作者 Your Name

更新导入逻辑

@@ -19,7 +19,7 @@ func (srv ExcelDataService) ImportProductRecord(importDataCommand *command.Impor @@ -19,7 +19,7 @@ func (srv ExcelDataService) ImportProductRecord(importDataCommand *command.Impor
19 {EnName: "lineName", CnName: "线别"}, 19 {EnName: "lineName", CnName: "线别"},
20 {EnName: "sectionName", CnName: "工段"}, 20 {EnName: "sectionName", CnName: "工段"},
21 {EnName: "workerName", CnName: "姓名"}, 21 {EnName: "workerName", CnName: "姓名"},
22 - {EnName: "productGroupName", CnName: "班组"}, 22 + {EnName: "batchNumber", CnName: "批次号"},
23 {EnName: "weigh", CnName: "二级品重量"}, 23 {EnName: "weigh", CnName: "二级品重量"},
24 } 24 }
25 excelData, err := converter.OpenImportFileFromIoReader(excelImport, importDataCommand.Reader, importDataCommand.FileExt) //excelImport.OpenExcelFromIoReader(importDataCommand.Reader) 25 excelData, err := converter.OpenImportFileFromIoReader(excelImport, importDataCommand.Reader, importDataCommand.FileExt) //excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
@@ -36,7 +36,6 @@ func (srv ExcelDataService) ImportProductRecord(importDataCommand *command.Impor @@ -36,7 +36,6 @@ func (srv ExcelDataService) ImportProductRecord(importDataCommand *command.Impor
36 SectionName: v["sectionName"], 36 SectionName: v["sectionName"],
37 WorkerName: v["workerName"], 37 WorkerName: v["workerName"],
38 BatchNumber: v["batchNumber"], 38 BatchNumber: v["batchNumber"],
39 - ProductGroupName: v["productGroupName"],  
40 Weigh: v["weigh"], 39 Weigh: v["weigh"],
41 FailReason: "", 40 FailReason: "",
42 } 41 }
@@ -10,7 +10,6 @@ type BatchAddProductRecordCommand struct { @@ -10,7 +10,6 @@ type BatchAddProductRecordCommand struct {
10 SectionName string `json:"sectionName"` // 工段 10 SectionName string `json:"sectionName"` // 工段
11 WorkerName string `json:"workerName"` // 工人名称 11 WorkerName string `json:"workerName"` // 工人名称
12 BatchNumber string `json:"batchNumber"` // 批次 12 BatchNumber string `json:"batchNumber"` // 批次
13 - ProductGroupName string `json:"productGroupName"` // 班组名称  
14 Weigh string `json:"weigh"` // 重量 13 Weigh string `json:"weigh"` // 重量
15 FailReason string `json:"failReason"` // 数据检查失败的原因 14 FailReason string `json:"failReason"` // 数据检查失败的原因
16 } 15 }
@@ -32,10 +31,7 @@ func (cmd *BatchAddProductRecordCommand) ValidField() error { @@ -32,10 +31,7 @@ func (cmd *BatchAddProductRecordCommand) ValidField() error {
32 return errors.New("姓名未填写") 31 return errors.New("姓名未填写")
33 } 32 }
34 if len(cmd.BatchNumber) == 0 { 33 if len(cmd.BatchNumber) == 0 {
35 - return errors.New("批次未填写")  
36 - }  
37 - if len(cmd.ProductGroupName) == 0 {  
38 - return errors.New("班组名称未填写") 34 + return errors.New("批次号未填写")
39 } 35 }
40 if len(cmd.Weigh) == 0 { 36 if len(cmd.Weigh) == 0 {
41 return errors.New("重量未填写") 37 return errors.New("重量未填写")
@@ -550,15 +550,15 @@ func (productRecordService *ProductRecordService) BatchAddProductRecord(operate @@ -550,15 +550,15 @@ func (productRecordService *ProductRecordService) BatchAddProductRecord(operate
550 failRows = append(failRows, param[i]) 550 failRows = append(failRows, param[i])
551 continue 551 continue
552 } 552 }
553 - //获取生产班组  
554 - var productGroup *domain.ProductGroup  
555 - if v, ok := productGroupMap[param[i].ProductGroupName]; ok {  
556 - productGroup = v  
557 - } else {  
558 - param[i].FailReason = "班组不存在"  
559 - failRows = append(failRows, param[i])  
560 - continue  
561 - } 553 + // //获取生产班组
  554 + // var productGroup *domain.ProductGroup
  555 + // if v, ok := productGroupMap[param[i].ProductGroupName]; ok {
  556 + // productGroup = v
  557 + // } else {
  558 + // param[i].FailReason = "班组不存在"
  559 + // failRows = append(failRows, param[i])
  560 + // continue
  561 + // }
562 //检查员工姓名 562 //检查员工姓名
563 var worker *domain.User 563 var worker *domain.User
564 workKey := param[i].WorkshopName + "/" + param[i].WorkerName 564 workKey := param[i].WorkshopName + "/" + param[i].WorkerName
@@ -615,8 +615,8 @@ func (productRecordService *ProductRecordService) BatchAddProductRecord(operate @@ -615,8 +615,8 @@ func (productRecordService *ProductRecordService) BatchAddProductRecord(operate
615 ProductPlanId: productPlanData.ProductPlanId, 615 ProductPlanId: productPlanData.ProductPlanId,
616 PlanProductName: productPlanData.PlanProductName, 616 PlanProductName: productPlanData.PlanProductName,
617 BatchNumber: productPlanData.BatchNumber, 617 BatchNumber: productPlanData.BatchNumber,
618 - ProductGroupId: productGroup.ProductGroupId,  
619 - WorkOn: productGroup.WorkOn, 618 + ProductGroupId: 0,
  619 + WorkOn: productPlanData.WorkOn,
620 }, 620 },
621 Ext: &domain.Ext{ 621 Ext: &domain.Ext{
622 Operator: operateUser, 622 Operator: operateUser,