diff --git a/services/om/SerialOrder.service.go b/services/om/SerialOrder.service.go index 1bde81f..39d9c66 100644 --- a/services/om/SerialOrder.service.go +++ b/services/om/SerialOrder.service.go @@ -513,7 +513,7 @@ type SerialOrderService interface { PrintRuleInfo(user *global.User, session *xorm.Session, serialOrderStep *model.SerialOrderStepLst, rule *baseModel.PrintBasicRuleInfo, printTemplate *baseModel.LabelTemplateHead, article *baseModel.Article, bkFlag bool, planDate string) error ExtractArtId(bomHead *meModel.BomHead) map[string]int ExtractEOL(session *xorm.Session, user *global.User, serialOrder *model.SerialOrder) (status bool, remark string, recordT time.Time, err error) - CreateBatchSerialOrder(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int) error + CreateBatchSerialOrder(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int, planDate string) error TraceSubArticleBatch(user *global.User, barcode string, paging *grmi.Paging) (grmi.PagingResult, error) ExportTraceSubArticleBatch(user *global.User, barcode string) (string, error) CancelMultiSerialOrder(user *global.User, serialOrderIdLi []string) error diff --git a/services/om/implments/SerialOrder.service.impl.go b/services/om/implments/SerialOrder.service.impl.go index 727ef2c..5acce64 100644 --- a/services/om/implments/SerialOrder.service.impl.go +++ b/services/om/implments/SerialOrder.service.impl.go @@ -18,6 +18,7 @@ import ( eolModel "LAPP_ACURA_MOM_BACKEND/models/eol" meModel "LAPP_ACURA_MOM_BACKEND/models/me" model "LAPP_ACURA_MOM_BACKEND/models/om" + "LAPP_ACURA_MOM_BACKEND/utils" "github.com/go-xorm/xorm" "strconv" "strings" @@ -3876,10 +3877,14 @@ func (impl *SerialOrderServiceImplement) GetSerialOrderDetailTrace(user *global. * @Reference LAPP_ACURA_MOM_BACKEND/services/om/SerialOrderService.CreateBatchSerialOrder * ******************************************************************************/ -func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int) error { +func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int, planDate string) error { engine := db.Eloquent.Master() session := engine.NewSession() defer session.Close() + planDateT, err := time.ParseInLocation(grmi.DateOutFormat, planDate, utils.TimezoneLocation) + if err != nil { + return grmi.NewBusinessError("计划日期格式错误") + } productDao := meDal.NewProductDAO(session, user.PlantNr, user.UserId) serialOrderDao := dal.NewSerialOrderDAO(session, user.PlantNr, user.UserId) serialOrderStatusDao := dal.NewSerialOrderStatusDAO(session, user.PlantNr, user.UserId) @@ -3925,9 +3930,8 @@ func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.Use return grmi.NewBusinessError("开启事务失败, 错误:" + err.Error()) } if priority != 0 { - now := time.Now() for i := 1; i <= qty; i++ { - serialNumber, err := snrDao.GetNextSnr(project.INTSerialOrderSnr) + serialNumber, err := snrDao.GetNextSnrWithTime(project.INTSerialOrderSnr, planDateT) if err != nil { _ = session.Rollback() return grmi.NewBusinessError("生成工单流水号失败, error:" + err.Error()) @@ -3945,10 +3949,10 @@ func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.Use PlanResourceId: workLineId, UsedResourceId: workLineId, PlanQty: 1, - PlanStartDate: grmi.Date(now), - PlanEndDate: grmi.Date(now), - PlanStartTime: grmi.DateTime(now), - PlanEndTime: grmi.DateTime(now), + PlanStartDate: grmi.Date(planDateT), + PlanEndDate: grmi.Date(planDateT), + PlanStartTime: grmi.DateTime(planDateT), + PlanEndTime: grmi.DateTime(planDateT), PickingFlag: product.PickingFlag, } err = serialOrderDao.InsertOne(&insertOrder) @@ -3990,7 +3994,6 @@ func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.Use _ = session.Rollback() return grmi.NewBusinessError("生成的排序Key已存在工单") } - now := time.Now() for i := 1; i <= qty; i++ { serialNumber, err := snrDao.GetNextSnr(project.INTSerialOrderSnr) if err != nil { @@ -4013,10 +4016,10 @@ func (impl *SerialOrderServiceImplement) CreateBatchSerialOrder(user *global.Use PlanResourceId: workLineId, UsedResourceId: workLineId, PlanQty: 1, - PlanStartDate: grmi.Date(now), - PlanEndDate: grmi.Date(now), - PlanStartTime: grmi.DateTime(now), - PlanEndTime: grmi.DateTime(now), + PlanStartDate: grmi.Date(planDateT), + PlanEndDate: grmi.Date(planDateT), + PlanStartTime: grmi.DateTime(planDateT), + PlanEndTime: grmi.DateTime(planDateT), PickingFlag: product.PickingFlag, } err = serialOrderDao.InsertOne(&insertOrder) diff --git a/web/controllers/om/SerialOrder.rest.go b/web/controllers/om/SerialOrder.rest.go index c5e8291..c198be2 100644 --- a/web/controllers/om/SerialOrder.rest.go +++ b/web/controllers/om/SerialOrder.rest.go @@ -1130,7 +1130,7 @@ func RegisterDisplaySerialOrderTrace(party router.Party, path string, method fun * @Date : 2022-01-11 * ******************************************************************************/ -func RegisterCreateBatchSerialOrder(party router.Party, path string, method func(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int) error) { +func RegisterCreateBatchSerialOrder(party router.Party, path string, method func(user *global.User, productId string, projectId string, workLineId string, qty int, preSchKey int, priority int, planDate string) error) { party.Post(path, func(ctx iris.Context) { user, ok := jwts.ParseToken(ctx) @@ -1144,13 +1144,14 @@ func RegisterCreateBatchSerialOrder(party router.Party, path string, method func Qty int `json:"OM_SerialOrder-Qty"` PreSchedKey int `json:"OM_SerialOrder-PreSchedKey"` Priority int `json:"OM_SerialOrder-Priority"` + PlanDate string `json:"OM_SerialOrder-PlanDate"` } var data Req if err := ctx.ReadJSON(&data); err != nil { supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) return } - err := method(user, data.ProductId, data.ProjectId, data.WorkLineId, data.Qty, data.PreSchedKey, data.Priority) + err := method(user, data.ProductId, data.ProjectId, data.WorkLineId, data.Qty, data.PreSchedKey, data.Priority, data.PlanDate) if err != nil { supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) return