|
|
|
@ -21,6 +21,7 @@ import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesNumberRuleRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
@ -57,7 +58,8 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustomerPartRepository mesCustomerPartRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesNumberRuleRepository numberRuleRepository;
|
|
|
|
|
@Override
|
|
|
|
|
public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule,StepResult stepResult, StationRequestBean reqBean,Boolean isStep) {
|
|
|
|
|
//获取客户零件号
|
|
|
|
@ -71,9 +73,9 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
}
|
|
|
|
|
//获取工厂名称
|
|
|
|
|
String organizeName = mesConfig.getCfgValue();
|
|
|
|
|
MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode);
|
|
|
|
|
if (!isStep){
|
|
|
|
|
//物料信息
|
|
|
|
|
MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode);
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
//----广乘 45位 GQXNY
|
|
|
|
|
//{custPartNo}{SPILTURE}{custCode}{spiltrure}{spiltrule}{year}{serialNo}{spilture}{spiltrule}
|
|
|
|
@ -131,6 +133,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
mesProduceSnPrintModel.getMesProduceSnList().add(produceSn);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
numberRule = getNumberRule(organizeCode, mesPart);
|
|
|
|
|
String sn = mesProduceSnPrintModel.getProductSn();
|
|
|
|
|
MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0);
|
|
|
|
|
//零件长度17位,拓展2位,供应商7位,扩展位3个0,产线1,年月日,流水号4位,扩展位4位,标识+
|
|
|
|
@ -164,6 +167,14 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
}
|
|
|
|
|
return mesCustomerPart;
|
|
|
|
|
}
|
|
|
|
|
private MesNumberRule getNumberRule(String organizeCode, MesPart part) {
|
|
|
|
|
if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo());
|
|
|
|
|
MesNumberRule numberRule = numberRuleRepository.getByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()});
|
|
|
|
|
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule());
|
|
|
|
|
return numberRule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String stringFormat(String data, Integer length) {
|
|
|
|
|
return stringFormat(data, length, true, "0");
|
|
|
|
|