作者 yangfu

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

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