|
|
@ -12,6 +12,7 @@ import ( |
|
|
|
|
|
|
|
//medal "LAPP_GAAS_GFrame_BACKEND/dao/me"
|
|
|
|
dal "LAPP_GAAS_GFrame_BACKEND/dao/log" |
|
|
|
qmdal "LAPP_GAAS_GFrame_BACKEND/dao/qm" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/db" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/grmi" |
|
|
|
bmeta "LAPP_GAAS_GFrame_BACKEND/meta/base" |
|
|
@ -705,6 +706,44 @@ func (self *PackOrderServiceImplement) IsCreatePackOrder(user *models.Usertab, o |
|
|
|
if len(dataList) > 0 { |
|
|
|
return nil, grmi.NewBusinessError("该条码已经扫描过!") |
|
|
|
} |
|
|
|
|
|
|
|
//条件判断
|
|
|
|
slaves := db.Eloquent.Slaves() |
|
|
|
slavesession := slaves[0].NewSession() |
|
|
|
defer slavesession.Close() |
|
|
|
apiDao := api.NewACCUNITSTATUSDAO(slavesession, user.Userid) |
|
|
|
|
|
|
|
//根据唯一码查询信息
|
|
|
|
mesData, err := apiDao.SelectInfo(orderId) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if mesData == nil { |
|
|
|
return nil, grmi.NewBusinessError("该唯一码不存在!") |
|
|
|
} |
|
|
|
if mesData.LINE == "LaserWelding" { |
|
|
|
//校验
|
|
|
|
if mesData.OP != "017" { |
|
|
|
return nil, grmi.NewBusinessError("OP状态值不是017!") |
|
|
|
} |
|
|
|
//if mesData.STATUS != "2" {
|
|
|
|
// return nil, grmi.NewBusinessError("该唯一码状态不为2!")
|
|
|
|
//}
|
|
|
|
} else if mesData.LINE == "G-Frame Assy" { |
|
|
|
//查询目检
|
|
|
|
//判断该条码是否是合格产品
|
|
|
|
sdao := qmdal.NewSerialOrderRutingDAO(session, user.Pid, user.Userid) |
|
|
|
OrderInfo, err := sdao.SelectOne(orderId) |
|
|
|
if err != nil { |
|
|
|
return nil, grmi.NewBusinessError("序列订单查询错误!") |
|
|
|
} |
|
|
|
if OrderInfo == nil || OrderInfo.Status != bmodel.CHECK_STATUS_CLOSED { |
|
|
|
return nil, grmi.NewBusinessError("该序列订单已经检测!") |
|
|
|
} |
|
|
|
} else { |
|
|
|
return nil, grmi.NewBusinessError("产线信息有误!") |
|
|
|
} |
|
|
|
|
|
|
|
/********************************* |
|
|
|
* 1.判断是否已经有激活的包装 |
|
|
|
*********************************/ |
|
|
@ -772,7 +811,7 @@ func (self *PackOrderServiceImplement) IsCreatePackOrder(user *models.Usertab, o |
|
|
|
err = packOrderDAO.InsertOne(&model.PackOrder{ |
|
|
|
PlantNr: packTemplate.PlantNr, |
|
|
|
PackOrderId: packOrderId, |
|
|
|
Status: 26, |
|
|
|
Status: bmodel.PACK_STATUS_RELEASED, |
|
|
|
PackTemplateId: packTemplate.PackTemplateId, |
|
|
|
PackTypeId: packTemplate.PackTypeId, |
|
|
|
MaterialId: packTemplate.MaterialId, |
|
|
@ -793,7 +832,7 @@ func (self *PackOrderServiceImplement) IsCreatePackOrder(user *models.Usertab, o |
|
|
|
MaterialId: packTemplateItem.MaterialId, |
|
|
|
PlanQty: float64(packTemplateItem.PlanQty), |
|
|
|
ActQty: 0, |
|
|
|
Status: 26, |
|
|
|
Status: bmodel.PACK_STATUS_RELEASED, |
|
|
|
Seq: packTemplateItem.Seq, |
|
|
|
}) |
|
|
|
} |
|
|
@ -807,7 +846,7 @@ func (self *PackOrderServiceImplement) IsCreatePackOrder(user *models.Usertab, o |
|
|
|
} |
|
|
|
//查询该零件对应的包装项位置
|
|
|
|
dao := dal.NewPackOrderItemlstDAO(packsession, user.Pid, user.Userid) |
|
|
|
infoPos, err := dao.SelectOnePos(packOrderId,artId) |
|
|
|
infoPos, err := dao.SelectOnePos(packOrderId, artId) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -1004,7 +1043,7 @@ func (self *PackOrderServiceImplement) CreatePackOrderByTemplate(user *models.Us |
|
|
|
err = packOrderDAO.InsertOne(&model.PackOrder{ |
|
|
|
PlantNr: packTemplate.PlantNr, |
|
|
|
PackOrderId: packOrderId, |
|
|
|
Status: 26, |
|
|
|
Status: bmodel.PACK_STATUS_RELEASED, |
|
|
|
PackTemplateId: packTemplate.PackTemplateId, |
|
|
|
PackTypeId: packTemplate.PackTypeId, |
|
|
|
MaterialId: packTemplate.MaterialId, |
|
|
@ -1024,7 +1063,7 @@ func (self *PackOrderServiceImplement) CreatePackOrderByTemplate(user *models.Us |
|
|
|
MaterialId: packTemplateItem.MaterialId, |
|
|
|
PlanQty: float64(packTemplateItem.PlanQty), |
|
|
|
ActQty: 0, |
|
|
|
Status: 26, |
|
|
|
Status: bmodel.PACK_STATUS_RELEASED, |
|
|
|
Seq: packTemplateItem.Seq, |
|
|
|
}) |
|
|
|
} |
|
|
@ -1090,28 +1129,35 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab, |
|
|
|
apiDao := api.NewACCUNITSTATUSDAO(slavesession, user.Userid) |
|
|
|
|
|
|
|
//根据唯一码查询信息
|
|
|
|
mesData,err := apiDao.SelectInfo(orderId) |
|
|
|
mesData, err := apiDao.SelectInfo(orderId) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
if mesData == nil{ |
|
|
|
return "",grmi.NewBusinessError("该唯一码不存在!") |
|
|
|
if mesData == nil { |
|
|
|
return "", grmi.NewBusinessError("该唯一码不存在!") |
|
|
|
} |
|
|
|
if mesData.LINE == "G-Frame Assy"{ |
|
|
|
if mesData.LINE == "LaserWelding" { |
|
|
|
//校验
|
|
|
|
if mesData.OP != "017"{ |
|
|
|
return "",grmi.NewBusinessError("OP状态值不是017!") |
|
|
|
if mesData.OP != "017" { |
|
|
|
return "", grmi.NewBusinessError("OP状态值不是017!") |
|
|
|
} |
|
|
|
if mesData.STATUS != "2"{ |
|
|
|
return "",grmi.NewBusinessError("该唯一码状态不为2!") |
|
|
|
if mesData.STATUS != "2" { |
|
|
|
return "", grmi.NewBusinessError("该唯一码状态不为2!") |
|
|
|
} |
|
|
|
}else if mesData.LINE == "LaserWelding"{ |
|
|
|
} else if mesData.LINE == "G-Frame Assy" { |
|
|
|
//查询目检
|
|
|
|
}else { |
|
|
|
return "",grmi.NewBusinessError("产线信息有误!") |
|
|
|
//判断该条码是否是合格产品
|
|
|
|
sdao := qmdal.NewSerialOrderRutingDAO(session, user.Pid, user.Userid) |
|
|
|
OrderInfo, err := sdao.SelectOne(orderId) |
|
|
|
if err != nil { |
|
|
|
return "", grmi.NewBusinessError("序列订单查询错误!") |
|
|
|
} |
|
|
|
if OrderInfo == nil || OrderInfo.Status != bmodel.CHECK_STATUS_CLOSED { |
|
|
|
return "", grmi.NewBusinessError("该序列订单已经检测!") |
|
|
|
} |
|
|
|
} else { |
|
|
|
return "", grmi.NewBusinessError("产线信息有误!") |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
articleDAO := base.NewArticleDAO(session, user.Pid, user.Userid) |
|
|
|
article, err := articleDAO.SelectOne(artId) |
|
|
|
if err != nil { |
|
|
@ -1133,6 +1179,7 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab, |
|
|
|
if len(dataLens) == 0 { |
|
|
|
return "", grmi.NewBusinessError("该条码不符合该包装规则!") |
|
|
|
} |
|
|
|
|
|
|
|
//判断条码是否已经生成过包装
|
|
|
|
dataList, err := itemlstDAO.Select([]grmi.Predicate{ |
|
|
|
meta.PackOrderItemlst_SerialOrderId.NewPredicate(grmi.Equal, orderId), |
|
|
@ -1152,7 +1199,7 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab, |
|
|
|
} |
|
|
|
//查询待检测包装位置
|
|
|
|
dao := dal.NewPackOrderItemlstDAO(packsession, user.Pid, user.Userid) |
|
|
|
infoPos, err := dao.SelectOnePos(packOrderId,artId) |
|
|
|
infoPos, err := dao.SelectOnePos(packOrderId, artId) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|