|
|
|
@ -62,7 +62,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule,StepResult stepResult, StationRequestBean reqBean,Boolean isStep) {
|
|
|
|
|
//获取客户零件号
|
|
|
|
|
String custPartNo = getMesCustomerPart(mesProduceSnPrintModel).getCustPartNo();
|
|
|
|
|
String format = DateUtil.BASE_FORMAT;
|
|
|
|
|
String format = "yyyy/MM/dd";
|
|
|
|
|
// 获取工厂名称
|
|
|
|
|
String organizeCode = mesProduceSnPrintModel.getOrganizeCode();
|
|
|
|
|
MesConfig mesConfig = configService.getMesConfigByCfgCode(MesPcnExtConstWords.ORGANIZE_NAME, organizeCode);
|
|
|
|
@ -78,10 +78,16 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
//----广乘 45位 GQXNY
|
|
|
|
|
//{custPartNo}{SPILTURE}{custCode}{spiltrure}{spiltrule}{year}{serialNo}{spilture}{spiltrule}
|
|
|
|
|
//客户零件号-扩展位-客户代码-预留位000-产线1-年月日-条码-扩展0000-追溯位+
|
|
|
|
|
//零件长号---17位,不足17位 右边补*
|
|
|
|
|
//零件长号---17位,不足17位 右边补-
|
|
|
|
|
genSerialNoModel.setRuleCode(numberRule.getRuleCode());
|
|
|
|
|
String custPartNoFormat = stringFormat(custPartNo, 17);
|
|
|
|
|
genSerialNoModel.setCustPartNo(custPartNoFormat);
|
|
|
|
|
/**
|
|
|
|
|
* 2024/7/24
|
|
|
|
|
* 按照广州现场条码修改,逻辑由文档中 格式化客户零件号,不满足17位 后边补充 横杠
|
|
|
|
|
* 改为
|
|
|
|
|
* 客户零件号 + 固定三位横杠
|
|
|
|
|
*/
|
|
|
|
|
//String custPartNoFormat = stringFormat(custPartNo, 17);
|
|
|
|
|
genSerialNoModel.setCustPartNo(custPartNo);
|
|
|
|
|
//拓展位 2位 00 包含0~9,A~Z 不使用时,补“0”填充 {SPILTRULE}
|
|
|
|
|
//供应商代码 7位 供应商代码 0~9,A~Z;不足7位 右测补*
|
|
|
|
|
MesConfig supplierConfig = configService.getMesConfigByCfgCodeKeyOrg(MesPcnExtConstWords.SUPPLIER_CODE, MesExtEnumUtil.MES_PRINT_TEMPLATE.GQXNY.getValue(), organizeCode);
|
|
|
|
@ -99,12 +105,18 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) {
|
|
|
|
|
ResultBean resultBean = syncFuncService.syncSerialNo(genSerialNoModel, mesProduceSnPrintModel.getUserName(), organizeCode, 1);
|
|
|
|
|
String sn = resultBean.getResultList().get(0).toString();
|
|
|
|
|
String snPrefix = sn.substring(0, sn.length() - 12);
|
|
|
|
|
String snSuffix = sn.substring(sn.length() - 5);
|
|
|
|
|
String serialNo = sn.substring(sn.length() - 12, sn.length() - 5);
|
|
|
|
|
String serialNo34 = toBase34(Integer.parseInt(serialNo));
|
|
|
|
|
serialNo34 = stringFormat(serialNo34, 4, false, "0");
|
|
|
|
|
sn = snPrefix + serialNo34 + snSuffix;
|
|
|
|
|
/**
|
|
|
|
|
* 2024/7/24
|
|
|
|
|
* 按照广州现场条码修改,逻辑由文档中 流水码需要转换位34进制
|
|
|
|
|
* 改为
|
|
|
|
|
* 保留十进制
|
|
|
|
|
*/
|
|
|
|
|
// String snPrefix = sn.substring(0, sn.length() - 9);
|
|
|
|
|
// String snSuffix = sn.substring(sn.length() - 5);
|
|
|
|
|
String serialNo = sn.substring(sn.length() - 9, sn.length() - 5);
|
|
|
|
|
// String serialNo34 = toBase34(Integer.parseInt(serialNo));
|
|
|
|
|
// serialNo34 = stringFormat(serialNo34, 4, false, "0");
|
|
|
|
|
// sn = snPrefix + serialNo34 + snSuffix;
|
|
|
|
|
//保存条码信息
|
|
|
|
|
MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format);
|
|
|
|
|
//封装打印信息
|
|
|
|
@ -154,7 +166,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String stringFormat(String data, Integer length) {
|
|
|
|
|
return stringFormat(data, length, true, "*");
|
|
|
|
|
return stringFormat(data, length, true, "-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String stringFormat(String data, Integer length, boolean left, String symbol) {
|
|
|
|
|