2
3
dubch преди 4 години
родител
ревизия
35ea507467

+ 61 - 59
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -134,7 +134,7 @@ func (this *OilContractController) GetEntityList() {
 	}
 
 	if ImportUnitName != "" {
-		where = where + " and SecondUnitName like '%" + ImportUnitName + "%'"
+		where = where + " and ImportSecondUnit like '%" + ImportUnitName + "%'"
 	}
 
 	if Status != "" {
@@ -524,64 +524,66 @@ func (this *OilContractController) ImportExcel() {
 			var con1 contract.OilContract
 			lineNo := strconv.Itoa(i + 1)
 			fmt.Println(lineNo)
-			svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
-			if con1.Id > 0 {
-				con1.ContractName = sheet.Rows[i].Cells[1].String()
-				con1.Amount = sheet.Rows[i].Cells[2].String()
-				if con1.Amount == "" {
-					con1.Amount = "0"
+			if sheet.Rows[i].Cells[0].String() != "" {
+				svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
+				if con1.Id > 0 {
+					con1.ContractName = sheet.Rows[i].Cells[1].String()
+					con1.Amount = sheet.Rows[i].Cells[2].String()
+					if con1.Amount == "" {
+						con1.Amount = "0"
+					}
+					con1.ClassName = sheet.Rows[i].Cells[3].String()
+					con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
+					con1.SmallClass = sheet.Rows[i].Cells[5].String()
+					con1.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
+					con1.Number = sheet.Rows[i].Cells[10].String()
+					con1.ChooseWay = sheet.Rows[i].Cells[11].String()
+					con1.ContractMark = sheet.Rows[i].Cells[14].String()
+					con1.Currency = sheet.Rows[i].Cells[15].String()
+					con1.BudgetAmount = sheet.Rows[i].Cells[16].String()
+					if con.BudgetAmount == "" {
+						con.BudgetAmount = "0"
+					}
+					con1.PerformAmount = sheet.Rows[i].Cells[17].String()
+					if con1.PerformAmount == "" {
+						con1.PerformAmount = "0"
+					}
+					con1.IsYearMoney = con1.PerformAmount
+					con1.IsInternal = 0
+					if sheet.Rows[i].Cells[18].String() == "是" {
+						con1.IsInternal = 1
+					}
+					con1.IsForeign = 0
+					if sheet.Rows[i].Cells[19].String() == "是" {
+						con1.IsForeign = 1
+					}
+					con1.IsDeal = 0
+					if sheet.Rows[i].Cells[20].String() == "是" {
+						con1.IsDeal = 1
+					}
+					con1.MoneyFlows = sheet.Rows[i].Cells[21].String()
+					con1.MoneyChannel = sheet.Rows[i].Cells[22].String()
+					con1.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
+					con1.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
+					con1.SingUnit = sheet.Rows[i].Cells[25].String()
+					con1.Place = sheet.Rows[i].Cells[28].String()
+
+					con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
+					con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
+					con1.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
+					con1.DisputeResolution = sheet.Rows[i].Cells[31].String()
+
+					con1.Remark = sheet.Rows[i].Cells[32].String()
+					if con1.ProjectOwner != sheet.Rows[i].Cells[33].String() {
+						con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[33].String()
+					}
+					con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
+					con1.SealName = sheet.Rows[i].Cells[42].String()
+					//con1.PoNumber = sheet.Rows[i].Cells[31].String()
+					//con1.ImportStatus = 0
+					svc.UpdateEntityById(con1.Id, &con1)
+					continue
 				}
-				con1.ClassName = sheet.Rows[i].Cells[3].String()
-				con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
-				con1.SmallClass = sheet.Rows[i].Cells[5].String()
-				con1.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
-				con1.Number = sheet.Rows[i].Cells[10].String()
-				con1.ChooseWay = sheet.Rows[i].Cells[11].String()
-				con1.ContractMark = sheet.Rows[i].Cells[14].String()
-				con1.Currency = sheet.Rows[i].Cells[15].String()
-				con1.BudgetAmount = sheet.Rows[i].Cells[16].String()
-				if con.BudgetAmount == "" {
-					con.BudgetAmount = "0"
-				}
-				con1.PerformAmount = sheet.Rows[i].Cells[17].String()
-				if con1.PerformAmount == "" {
-					con1.PerformAmount = "0"
-				}
-				con1.IsYearMoney = con1.PerformAmount
-				con1.IsInternal = 0
-				if sheet.Rows[i].Cells[18].String() == "是" {
-					con1.IsInternal = 1
-				}
-				con1.IsForeign = 0
-				if sheet.Rows[i].Cells[19].String() == "是" {
-					con1.IsForeign = 1
-				}
-				con1.IsDeal = 0
-				if sheet.Rows[i].Cells[20].String() == "是" {
-					con1.IsDeal = 1
-				}
-				con1.MoneyFlows = sheet.Rows[i].Cells[21].String()
-				con1.MoneyChannel = sheet.Rows[i].Cells[22].String()
-				con1.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
-				con1.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
-				con1.SingUnit = sheet.Rows[i].Cells[25].String()
-				con1.Place = sheet.Rows[i].Cells[28].String()
-
-				con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
-				con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
-				con1.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
-				con1.DisputeResolution = sheet.Rows[i].Cells[31].String()
-
-				con1.Remark = sheet.Rows[i].Cells[32].String()
-				if con1.ProjectOwner != sheet.Rows[i].Cells[33].String() {
-					con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[33].String()
-				}
-				con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
-				con1.SealName = sheet.Rows[i].Cells[42].String()
-				//con1.PoNumber = sheet.Rows[i].Cells[31].String()
-				//con1.ImportStatus = 0
-				svc.UpdateEntityById(con1.Id, &con1)
-				continue
 			}
 			con.ContractNo = sheet.Rows[i].Cells[0].String()
 			con.ContractName = sheet.Rows[i].Cells[1].String()
@@ -708,7 +710,7 @@ func (this *OilContractController) DocExport() {
 // @router /importbatchsave [post]
 func (this *OilContractController) ImportBatchSave() {
 
-	sql := "update OilContract set ImportStatus = 1 where SupplierId != 0 and ContractClass != '' and SecondUnit != 0"
+	sql := "update OilContract set ImportStatus = 1 where SupplierId != 0 and ContractClass != '' and SecondUnit != 0 and ContractNo != ''"
 	_, err := utils.DBE.Query(sql)
 	var errinfo ErrorInfo
 	if err == nil {

+ 8 - 1
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -333,6 +333,14 @@
               <el-button size="mini" type="primary" @click="allUpdate(scope.row.ContractClass,scope.row.ClassName,'ContractClass', 0, scope.row.SupplierId)">全部修改</el-button>
             </template>
           </el-table-column>
+          <el-table-column  prop="ContractNo"  min-width="200" label="合同编号" align="center" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.ContractNo'" :rules="rules.ContractNo">
+                <el-input v-if="scope.row.ContractNo == ''" size="mini" v-model="scope.row.ContractNo" style="width:100%" placeholder="请输入"></el-input>
+                <el-input v-else size="mini" v-model="scope.row.ContractNo" style="width:100%" placeholder="请输入" readonly></el-input>
+              </el-form-item>
+            </template>
+          </el-table-column>
           <el-table-column  prop="ImportSupplierName"  min-width="250" label="企业名称" align="center" show-overflow-tooltip></el-table-column>
           <el-table-column  prop="SupplierName"  width="220" label="确认企业名称" align="center" show-overflow-tooltip >
              <template slot-scope="scope">
@@ -378,7 +386,6 @@
               <el-button size="mini" type="primary" @click="allUpdate(scope.row.SecondUnit,scope.row.ImportSecondUnit,'SecondUnit',0,scope.row.SupplierId)">全部修改</el-button>
             </template>
           </el-table-column>
-           <el-table-column  prop="ContractNo"  min-width="110" label="合同编号" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractName"  min-width="110" label="合同名称" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractSonClass"  min-width="110" label="合同子类" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="SmallClass"  min-width="110" label="相应小类" align="center" show-overflow-tooltip></el-table-column>