|
|
@ -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) |
|
|
|