作者 yangfu

fix: 车间生产记录初始化修改

@@ -70,7 +70,7 @@ func AutoInitWorkshopProductRecord(ctx context.Context) error { @@ -70,7 +70,7 @@ func AutoInitWorkshopProductRecord(ctx context.Context) error {
70 var workshopProductRecord *domain.WorkshopProductRecord 70 var workshopProductRecord *domain.WorkshopProductRecord
71 workshopProductRecord, err = workshopProductRecordDao.WorkshopProductRecord(cid, oid, workstation.WorkStationId, plan.ProductPlanId, time.Now()) 71 workshopProductRecord, err = workshopProductRecordDao.WorkshopProductRecord(cid, oid, workstation.WorkStationId, plan.ProductPlanId, time.Now())
72 if err == domain.ErrorNotFound { 72 if err == domain.ErrorNotFound {
73 - workshopProductRecord = domainService.NewWorkshopProductRecord(&domain.ProductRecord{ 73 + productRecord := &domain.ProductRecord{
74 CompanyId: constant.MANUFACTURE_DEFAULT_COMPANYID, 74 CompanyId: constant.MANUFACTURE_DEFAULT_COMPANYID,
75 OrgId: constant.MANUFACTURE_DEFAULT_ORGID, 75 OrgId: constant.MANUFACTURE_DEFAULT_ORGID,
76 WorkStation: workstation, 76 WorkStation: workstation,
@@ -80,7 +80,9 @@ func AutoInitWorkshopProductRecord(ctx context.Context) error { @@ -80,7 +80,9 @@ func AutoInitWorkshopProductRecord(ctx context.Context) error {
80 PlanProductName: plan.PlanProductName, 80 PlanProductName: plan.PlanProductName,
81 BatchNumber: plan.BatchNumber, 81 BatchNumber: plan.BatchNumber,
82 }, 82 },
83 - }, plan) 83 + }
  84 + workshopProductRecord = domainService.NewWorkshopProductRecord(productRecord, plan)
  85 + workshopProductRecord.UpdateProductWeigh(productRecord)
84 if workshopProductRecord, err = workshopProductRecordRepository.Save(workshopProductRecord); err != nil { 86 if workshopProductRecord, err = workshopProductRecordRepository.Save(workshopProductRecord); err != nil {
85 return err 87 return err
86 } 88 }