作者 Your Name

更新产能管理

1 package command 1 package command
2 2
3 type SaveEmployeeProductRecordCmd struct { 3 type SaveEmployeeProductRecordCmd struct {
4 - EmployeeProductRecordId int `json:"id"`  
5 // 车间ID 4 // 车间ID
6 WorkshopId int `cname:"车间ID" json:"workshopId" valid:"Required"` 5 WorkshopId int `cname:"车间ID" json:"workshopId" valid:"Required"`
7 // 生产线ID 6 // 生产线ID
@@ -13,11 +12,13 @@ type SaveEmployeeProductRecordCmd struct { @@ -13,11 +12,13 @@ type SaveEmployeeProductRecordCmd struct {
13 //产量重量 12 //产量重量
14 Weigh float64 `cname:"重量" json:"weigh" valid:"Required" ` 13 Weigh float64 `cname:"重量" json:"weigh" valid:"Required" `
15 //产品编码 14 //产品编码
16 - ProductCode string `json:"productCode"` 15 + ProductPlanId int `json:"productCode"`
17 // 参与类型 1:正常 2:支援 16 // 参与类型 1:正常 2:支援
18 ParticipateType int `json:"participateType"` 17 ParticipateType int `json:"participateType"`
19 //日期 18 //日期
20 RecordDate string `json:"recordDate"` 19 RecordDate string `json:"recordDate"`
21 //上班班次 1:全天 2:白班 4:中班 8:夜班 20 //上班班次 1:全天 2:白班 4:中班 8:夜班
22 WorkOn int `json:"workOn"` 21 WorkOn int `json:"workOn"`
  22 + //保存并审核
  23 + SaveAndApprove bool `json:"saveAndApprove"`
23 } 24 }
@@ -2,34 +2,34 @@ package dto @@ -2,34 +2,34 @@ package dto
2 2
3 //产能管理-列表 3 //产能管理-列表
4 type ProductCapacitiesList struct { 4 type ProductCapacitiesList struct {
5 - EmployeeProductRecordId int `json:"employeeProductRecordId"`  
6 - WorkshopName string `json:"workshopName"` //车间名称  
7 - LineName string `json:"lineName"` //线别名称  
8 - SectionName string `json:"sectionName"` //工段  
9 - WorkerName string `json:"workerName"` // 用户姓名  
10 - EmployeeType int `json:"employeeType"` // 员工类型 1:固定 2:派遣 3.临时  
11 - ProductName string `json:"productName"` //品名  
12 - ParticipateType int `json:"participateType"` // 参与类型 1:正常 2:支援  
13 - ProductWeigh float64 `json:"productWeigh"` // 产能  
14 - CreatedAt string `json:"createdAt"` // 创建时间  
15 - ApproveStatus int `json:"approveStatus"` //0:未审核 1:已审核 2.自动审核 5 + ProductRecordId int `json:"productRecordId"`
  6 + WorkshopName string `json:"workshopName"` //车间名称
  7 + LineName string `json:"lineName"` //线别名称
  8 + SectionName string `json:"sectionName"` //工段
  9 + WorkerName string `json:"workerName"` // 用户姓名
  10 + EmployeeType int `json:"employeeType"` // 员工类型 1:固定 2:派遣 3.临时
  11 + ProductName string `json:"productName"` //品名
  12 + ParticipateType int `json:"participateType"` // 参与类型 1:正常 2:支援
  13 + ProductWeigh float64 `json:"productWeigh"` // 产能
  14 + CreatedAt string `json:"createdAt"` // 创建时间
  15 + ApproveStatus int `json:"approveStatus"` //0:未审核 1:已审核 2.自动审核
16 } 16 }
17 17
18 //产能管理-列表-详情 18 //产能管理-列表-详情
19 type ProductCapacitiesInfo struct { 19 type ProductCapacitiesInfo struct {
20 - EmployeeProductRecordId int `json:"id"`  
21 - WorkshopId int ` json:"workshopId" ` // 车间ID  
22 - WorkshopName string `json:"workshopName"` //  
23 - LineId int `json:"lineId"` // 生产线ID  
24 - LineName string `json:"lineName"` //  
25 - SectionId int `json:"sectionId" ` // 工段ID  
26 - SectionName string `json:"sectionName"` //  
27 - WorkerId int `json:"workerId" ` //员工  
28 - WorkerName string `json:"workerName"` //  
29 - Weigh float64 `json:"weigh"` //产量重量  
30 - ProductCode string `json:"productCode"` //产品编码  
31 - ProductName string `json:"productName"` //产品名称  
32 - ParticipateType int `json:"participateType"` //参与类型 1:正常 2:支援  
33 - RecordDate string `json:"recordDate"` //日期  
34 - WorkOn int `json:"workOn"` //上班班次 1:全天 2:白班 4:中班 8:夜班 20 + ProductRecordId int `json:"id"`
  21 + WorkshopId int `json:"workshopId" ` // 车间ID
  22 + WorkshopName string `json:"workshopName"` //
  23 + LineId int `json:"lineId"` // 生产线ID
  24 + LineName string `json:"lineName"` //
  25 + SectionId int `json:"sectionId" ` // 工段ID
  26 + SectionName string `json:"sectionName"` //
  27 + WorkerId int `json:"workerId" ` //员工
  28 + WorkerName string `json:"workerName"` //
  29 + Weigh float64 `json:"weigh"` //产量重量
  30 + ProductCode string `json:"productCode"` //产品编码
  31 + ProductName string `json:"productName"` //产品名称
  32 + ParticipateType int `json:"participateType"` //参与类型 1:正常 2:支援
  33 + RecordDate string `json:"recordDate"` //日期
  34 + WorkOn int `json:"workOn"` //上班班次 1:全天 2:白班 4:中班 8:夜班
35 } 35 }
@@ -4,13 +4,11 @@ import ( @@ -4,13 +4,11 @@ import (
4 "time" 4 "time"
5 5
6 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
7 - pgTransaction "github.com/linmadan/egglib-go/transaction/pg"  
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/command" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/command"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/dto" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/dto"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/query" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productRecord/query"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
13 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/dao"  
14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
15 ) 13 )
16 14
@@ -66,61 +64,56 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat @@ -66,61 +64,56 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat
66 return nil, application.ThrowError(application.ARG_ERROR, "获取车间工段数据失败"+err.Error()) 64 return nil, application.ThrowError(application.ARG_ERROR, "获取车间工段数据失败"+err.Error())
67 } 65 }
68 66
69 - //产品数据  
70 - productRepo, _ := factory.CreateProductRepository(map[string]interface{}{ 67 + //获取生产记录
  68 + productPlanRepo, _ := factory.CreateProductPlanRepository(map[string]interface{}{
71 "transactionContext": transactionContext, 69 "transactionContext": transactionContext,
72 }) 70 })
73 71
74 - //获取产品  
75 - productData, err := productRepo.FindOne(map[string]interface{}{  
76 - "companyId": operateInfo.CompanyId,  
77 - "orgId": operateInfo.OrgId,  
78 - "productCode": param.ProductCode, 72 + planData, err := productPlanRepo.FindOne(map[string]interface{}{
  73 + "productPlanId": param.ProductPlanId,
79 }) 74 })
  75 +
80 if err != nil { 76 if err != nil {
81 - return nil, application.ThrowError(application.ARG_ERROR, "获取产品数据失败"+err.Error()) 77 + return nil, application.ThrowError(application.ARG_ERROR, "获取计划任务数据失败"+err.Error())
82 } 78 }
83 - nowTime := time.Now()  
84 79
85 //员工生产记录 80 //员工生产记录
86 - eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{ 81 + productRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
87 "transactionContext": transactionContext, 82 "transactionContext": transactionContext,
88 }) 83 })
89 -  
90 - var epRecord *domain.EmployeeProductRecord  
91 - if param.EmployeeProductRecordId != 0 {  
92 - epRecord, err = eProductRecordRepo.FindOne(map[string]interface{}{  
93 - "employeeProductRecordId": param.EmployeeProductRecordId,  
94 - })  
95 - if err != nil {  
96 - return nil, application.ThrowError(application.ARG_ERROR, "获取员工生产记录数据失败"+err.Error())  
97 - }  
98 - } else {  
99 - epRecord = &domain.EmployeeProductRecord{  
100 - CreatedAt: nowTime,  
101 - OrgId: operateInfo.OrgId,  
102 - CompanyId: operateInfo.CompanyId,  
103 - }  
104 - }  
105 - epRecord.UpdatedAt = time.Now()  
106 - epRecord.ParticipateType = param.ParticipateType //参与类型  
107 - epRecord.WorkStation = workstation //车间工段  
108 - epRecord.ProductWorker = worker //员工  
109 - epRecord.WorkOn = param.WorkOn //上班班次  
110 - epRecord.CreatedAt = recordDate //日期  
111 - epRecord.Ext = &domain.Ext{  
112 - Operator: user,  
113 - OrgName: org.OrgName,  
114 - }  
115 - epRecord.ProductWeigh = param.Weigh //重量  
116 - if epRecord.ProductRecordInfo == nil {  
117 - epRecord.ProductRecordInfo = &domain.ProductRecordStaticInfo{}  
118 - }  
119 - epRecord.ProductRecordInfo.OutputWeight = param.Weigh //重量  
120 - epRecord.ProductRecordInfo.PlanProductName = productData.ProductName //产品名称  
121 - epRecord.ProductRecordInfo.PlanProductCode = productData.ProductCode //产品编码  
122 - epRecord.ProductRecordInfo.OutputWeight = param.Weigh //重量  
123 - _, err = eProductRecordRepo.Save(epRecord) 84 + nowTime := time.Now()
  85 + epRecord := &domain.ProductRecord{
  86 + UpdatedAt: nowTime,
  87 + OrgId: operateInfo.OrgId,
  88 + CompanyId: operateInfo.CompanyId,
  89 + WorkStation: workstation,
  90 + ProductWorker: worker,
  91 + CreatedAt: recordDate,
  92 + Ext: &domain.Ext{
  93 + Operator: user,
  94 + OrgName: org.OrgName,
  95 + },
  96 + ProductRecordType: domain.RecordTypeReceiveMaterial,
  97 + ProductRecordInfo: &domain.ProductRecordInfo{
  98 + WorkOn: param.WorkOn,
  99 + ProductDate: param.RecordDate,
  100 + Weigh: param.Weigh,
  101 + WeighBefore: param.Weigh,
  102 + ApproveStatus: domain.ProductRecordNotApprove,
  103 + ApproveAt: 0,
  104 + ApproveUser: nil,
  105 + ProductPlanId: planData.ProductPlanId,
  106 + PlanProductName: planData.PlanProductName,
  107 + BatchNumber: planData.BatchNumber,
  108 + },
  109 + }
  110 + if param.SaveAndApprove {
  111 + epRecord.ProductRecordInfo.ApproveAt = nowTime.Unix()
  112 + epRecord.ProductRecordInfo.ApproveStatus = domain.ProductRecordApproved
  113 + epRecord.ProductRecordInfo.ApproveUser = user
  114 + }
  115 + // epRecord.ParticipateType = param.ParticipateType //参与类型
  116 + _, err = productRecordRepo.Save(epRecord)
124 if err != nil { 117 if err != nil {
125 return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error()) 118 return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error())
126 } 119 }
@@ -128,7 +121,7 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat @@ -128,7 +121,7 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat
128 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 121 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
129 } 122 }
130 return map[string]interface{}{ 123 return map[string]interface{}{
131 - "employeeProductRecordId": epRecord.EmployeeProductRecordId, 124 + "productRecordId": epRecord.ProductRecordId,
132 }, nil 125 }, nil
133 } 126 }
134 127
@@ -144,7 +137,11 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI @@ -144,7 +137,11 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI
144 defer func() { 137 defer func() {
145 transactionContext.RollbackTransaction() 138 transactionContext.RollbackTransaction()
146 }() 139 }()
147 - productRecordRepository, _ := dao.NewEmployeeProductRecordDao(transactionContext.(*pgTransaction.TransactionContext)) 140 +
  141 + productRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
  142 + "transactionContext": transactionContext,
  143 + })
  144 +
148 productBeginTime, _ := time.ParseInLocation("2006-01-02", param.ProductBeginTime, time.Local) 145 productBeginTime, _ := time.ParseInLocation("2006-01-02", param.ProductBeginTime, time.Local)
149 productEndTime, _ := time.ParseInLocation("2006-01-02", param.ProductEndTime, time.Local) 146 productEndTime, _ := time.ParseInLocation("2006-01-02", param.ProductEndTime, time.Local)
150 condition := map[string]interface{}{ 147 condition := map[string]interface{}{
@@ -166,7 +163,7 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI @@ -166,7 +163,7 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI
166 if offset >= 0 { 163 if offset >= 0 {
167 condition["offset"] = limit 164 condition["offset"] = limit
168 } 165 }
169 - count, productRecords, err := productRecordRepository.SearchEmployeeProductRecord(condition) 166 + count, productRecords, err := productRecordRepo.Find(condition)
170 if err != nil { 167 if err != nil {
171 return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 168 return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
172 } 169 }
@@ -177,17 +174,17 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI @@ -177,17 +174,17 @@ func (productRecordService *ProductRecordService) ListProductCapacities(operateI
177 var result = make([]dto.ProductCapacitiesList, 0) 174 var result = make([]dto.ProductCapacitiesList, 0)
178 for _, v := range productRecords { 175 for _, v := range productRecords {
179 item := dto.ProductCapacitiesList{ 176 item := dto.ProductCapacitiesList{
180 - EmployeeProductRecordId: v.EmployeeProductRecordId,  
181 - WorkshopName: v.WorkStation.WorkshopName,  
182 - LineName: v.WorkStation.LineName,  
183 - SectionName: v.WorkStation.SectionName,  
184 - WorkerName: v.ProductWorker.UserName,  
185 - EmployeeType: v.ProductWorker.EmployeeType,  
186 - ProductName: v.ProductRecordInfo.PlanProductName,  
187 - ParticipateType: v.ParticipateType,  
188 - ProductWeigh: v.ProductRecordInfo.OutputWeight,  
189 - CreatedAt: v.CreatedAt.Format("2006-01-02"),  
190 - ApproveStatus: v.ApproveStatus, 177 + ProductRecordId: v.ProductRecordId,
  178 + WorkshopName: v.WorkStation.WorkshopName,
  179 + LineName: v.WorkStation.LineName,
  180 + SectionName: v.WorkStation.SectionName,
  181 + WorkerName: v.ProductWorker.UserName,
  182 + EmployeeType: v.ProductWorker.EmployeeType,
  183 + ProductName: v.ProductRecordInfo.PlanProductName,
  184 + // ParticipateType: v.ParticipateType,
  185 + ProductWeigh: v.ProductRecordInfo.Weigh,
  186 + CreatedAt: v.CreatedAt.Format("2006-01-02"),
  187 + ApproveStatus: v.ProductRecordInfo.ApproveStatus,
191 } 188 }
192 result = append(result, item) 189 result = append(result, item)
193 } 190 }
@@ -207,12 +204,12 @@ func (productRecordService *ProductRecordService) GetProductCapacities(operateIn @@ -207,12 +204,12 @@ func (productRecordService *ProductRecordService) GetProductCapacities(operateIn
207 transactionContext.RollbackTransaction() 204 transactionContext.RollbackTransaction()
208 }() 205 }()
209 206
210 - eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{ 207 + productRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
211 "transactionContext": transactionContext, 208 "transactionContext": transactionContext,
212 }) 209 })
213 210
214 - recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{  
215 - "employeeProductRecordId": id, 211 + recordData, err := productRecordRepo.FindOne(map[string]interface{}{
  212 + "productRecordId": id,
216 }) 213 })
217 if err != nil { 214 if err != nil {
218 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 215 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -223,21 +220,21 @@ func (productRecordService *ProductRecordService) GetProductCapacities(operateIn @@ -223,21 +220,21 @@ func (productRecordService *ProductRecordService) GetProductCapacities(operateIn
223 } 220 }
224 221
225 var result = dto.ProductCapacitiesInfo{ 222 var result = dto.ProductCapacitiesInfo{
226 - EmployeeProductRecordId: recordData.EmployeeProductRecordId,  
227 - WorkshopId: recordData.WorkStation.WorkshopId,  
228 - WorkshopName: recordData.WorkStation.WorkshopName,  
229 - LineId: recordData.WorkStation.LineId,  
230 - LineName: recordData.WorkStation.LineName,  
231 - SectionId: recordData.WorkStation.SectionId,  
232 - SectionName: recordData.WorkStation.SectionName,  
233 - WorkerId: recordData.ProductWorker.UserId,  
234 - WorkerName: recordData.ProductWorker.UserName,  
235 - Weigh: recordData.ProductRecordInfo.OutputWeight,  
236 - ProductCode: recordData.ProductRecordInfo.PlanProductCode,  
237 - ProductName: recordData.ProductRecordInfo.PlanProductName,  
238 - ParticipateType: recordData.ParticipateType,  
239 - RecordDate: recordData.CreatedAt.Format("2006-01-02"),  
240 - WorkOn: recordData.WorkOn, 223 + ProductRecordId: recordData.ProductRecordId,
  224 + WorkshopId: recordData.WorkStation.WorkshopId,
  225 + WorkshopName: recordData.WorkStation.WorkshopName,
  226 + LineId: recordData.WorkStation.LineId,
  227 + LineName: recordData.WorkStation.LineName,
  228 + SectionId: recordData.WorkStation.SectionId,
  229 + SectionName: recordData.WorkStation.SectionName,
  230 + WorkerId: recordData.ProductWorker.UserId,
  231 + WorkerName: recordData.ProductWorker.UserName,
  232 + Weigh: recordData.ProductRecordInfo.Weigh,
  233 + ProductCode: recordData.ProductRecordInfo.BatchNumber,
  234 + ProductName: recordData.ProductRecordInfo.PlanProductName,
  235 + // ParticipateType: recordData.ParticipateType,
  236 + RecordDate: recordData.CreatedAt.Format("2006-01-02"),
  237 + WorkOn: recordData.ProductRecordInfo.WorkOn,
241 } 238 }
242 239
243 return &result, nil 240 return &result, nil
@@ -256,12 +253,12 @@ func (productRecordService *ProductRecordService) DeleteProductCapacities(operat @@ -256,12 +253,12 @@ func (productRecordService *ProductRecordService) DeleteProductCapacities(operat
256 transactionContext.RollbackTransaction() 253 transactionContext.RollbackTransaction()
257 }() 254 }()
258 255
259 - eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{ 256 + eProductRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
260 "transactionContext": transactionContext, 257 "transactionContext": transactionContext,
261 }) 258 })
262 259
263 recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{ 260 recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{
264 - "employeeProductRecordId": id, 261 + "productRecordId": id,
265 }) 262 })
266 if err != nil { 263 if err != nil {
267 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 264 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -275,7 +272,7 @@ func (productRecordService *ProductRecordService) DeleteProductCapacities(operat @@ -275,7 +272,7 @@ func (productRecordService *ProductRecordService) DeleteProductCapacities(operat
275 } 272 }
276 273
277 return map[string]interface{}{ 274 return map[string]interface{}{
278 - "employeeProductRecordId": recordData.EmployeeProductRecordId, 275 + "productRecordId": recordData.ProductRecordId,
279 }, nil 276 }, nil
280 } 277 }
281 278
@@ -292,12 +289,12 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera @@ -292,12 +289,12 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera
292 transactionContext.RollbackTransaction() 289 transactionContext.RollbackTransaction()
293 }() 290 }()
294 291
295 - eProductRecordRepo, _ := factory.CreateEmployeeProductRecordRepository(map[string]interface{}{ 292 + productRecordRepo, _ := factory.CreateProductRecordRepository(map[string]interface{}{
296 "transactionContext": transactionContext, 293 "transactionContext": transactionContext,
297 }) 294 })
298 295
299 - recordData, err := eProductRecordRepo.FindOne(map[string]interface{}{  
300 - "employeeProductRecordId": id, 296 + recordData, err := productRecordRepo.FindOne(map[string]interface{}{
  297 + "productRecordId": id,
301 }) 298 })
302 if err != nil { 299 if err != nil {
303 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 300 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -310,12 +307,11 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera @@ -310,12 +307,11 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera
310 if err != nil { 307 if err != nil {
311 return nil, application.ThrowError(application.ARG_ERROR, "获取操作人错误,"+err.Error()) 308 return nil, application.ThrowError(application.ARG_ERROR, "获取操作人错误,"+err.Error())
312 } 309 }
313 -  
314 - nowTime := time.Now()  
315 - recordData.ApproveAt = &nowTime  
316 - recordData.ApproveStatus = 1  
317 - recordData.ApproveUser = user  
318 - _, err = eProductRecordRepo.Save(recordData) 310 + err = recordData.Approve(user, recordData.ProductRecordInfo.Weigh, time.Now(), domain.ProductRecordApproved)
  311 + if err != nil {
  312 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  313 + }
  314 + _, err = productRecordRepo.Save(recordData)
319 if err != nil { 315 if err != nil {
320 return nil, application.ThrowError(application.ARG_ERROR, "保存数据错误,"+err.Error()) 316 return nil, application.ThrowError(application.ARG_ERROR, "保存数据错误,"+err.Error())
321 } 317 }
@@ -323,6 +319,6 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera @@ -323,6 +319,6 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera
323 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 319 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
324 } 320 }
325 return map[string]interface{}{ 321 return map[string]interface{}{
326 - "employeeProductRecordId": recordData.EmployeeProductRecordId, 322 + "productRecordId": recordData.ProductRecordId,
327 }, nil 323 }, nil
328 } 324 }