This commit is contained in:
郭飞 2025-05-29 20:14:55 +08:00
commit 6a66846be6

View File

@ -1854,6 +1854,7 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
pr.setPrintRequestID(UUID.randomUUID().toString());
LabelParameterObject obj = new LabelParameterObject();
List<Map<String, Object>> queryForListProduct = new ArrayList<>();
if ("PET标签-电晕.btw".equals(labelAddress) || "PET标签-电晕-兴远泰.btw".equals(labelAddress) || "PET标签-涂布面.btw".equals(labelAddress) || "PET标签-涂布面-兴远泰.btw".equals(labelAddress)) {
params = new LabelPrintPET().creatLabelPET();
labelPath = "C:\\inetpub\\wwwroot\\BarTender\\wwwroot\\Templates\\WMS\\WHRePrint\\" + labelAddress;
@ -1868,7 +1869,7 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" LN.PRACTICALSPEC,\n" +
" LN.JUMBOROLLBATCH,\n" +
" LN.DEFINEITEM18,\n" +
" MS.OLDMATERIALSPECNAME AS MATERIALCODE,\n" +
" MP.MATERIALSPECNAME AS MATERIALCODE,\n" +
" LN.MAINQTY,\n" +
" LN.DEFINEITEM19,\n" +
" LN.PRODUCTDATE,\n" +
@ -1878,11 +1879,14 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" LN.MAINUOM,\n" +
" LN.DEFINEITEM9,\n" +
" MP.ERPLOCATION,\n" +
" MP.LOCATIONNAME" +
" CASE \n" +
" WHEN MP.LOCATIONNAME IS NULL OR TRIM(MP.LOCATIONNAME) = '' THEN MP.ERPLOCATION\n" +
" ELSE MP.LOCATIONNAME\n" +
" END AS LOCATIONNAME, " +
" LN.MATERIALSPECNAMENC" +
" FROM\n" +
" LABELPRINTINFO LN \n" +
" LEFT JOIN MATERIALPACKING MP ON LN.BARCODE = MP.MATERIALPACKINGNAME " +
" LEFT JOIN MATERIALSPEC MS ON LN.MATERIALCODE = MS.MATERIALSPECNAME\n" +
" WHERE\n" +
" LN.BARCODE =:MATERIALPACKINGNAME ";
}else {
@ -1905,10 +1909,15 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
"LN.MAINUOM,\n" +
"LN.DEFINEITEM9, " +
" MP.ERPLOCATION,\n" +
" MP.LOCATIONNAME" +
" CASE \n" +
" WHEN MP.LOCATIONNAME IS NULL OR TRIM(MP.LOCATIONNAME) = '' THEN MP.ERPLOCATION\n" +
" ELSE MP.LOCATIONNAME\n" +
" END AS LOCATIONNAME," +
"MS.OLDMATERIALSPECNAME " +
"FROM\n" +
"\tLABELPRINTINFO LN \n" +
" LEFT JOIN MATERIALPACKING MP ON LN.BARCODE = MP.MATERIALPACKINGNAME " +
" LEFT JOIN MATERIALSPEC MS ON LN.MATERIALCODE = MS.MATERIALSPECNAME\n" +
"WHERE\n" +
"\tLN.BARCODE =:MATERIALPACKINGNAME ";
}
@ -1950,7 +1959,8 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
//电晕
labelPrintPET.setCorona(queryForListProduct.get(0).get("DEFINEITEM19") == null ? "" : queryForListProduct.get(0).get("DEFINEITEM19").toString());
//分切日期
labelPrintPET.setProductDate(queryForListProduct.get(0).get("PRODUCTDATE") == null ? "" : queryForListProduct.get(0).get("PRODUCTDATE").toString());
String productDate = queryForListProduct.get(0).get("PRODUCTDATE") == null ? "" : queryForListProduct.get(0).get("PRODUCTDATE").toString();
labelPrintPET.setProductDate(formatDateStr(productDate));
//型号
String defineitem16 = queryForListProduct.get(0).get("DEFINEITEM16") == null ? "" : queryForListProduct.get(0).get("DEFINEITEM16").toString();
labelPrintPET.setSpecifications(defineitem16);
@ -1960,10 +1970,11 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
//单位
String mainUom = queryForListProduct.get(0).get("MAINUOM") == null ? "" : queryForListProduct.get(0).get("MAINUOM").toString();
labelPrintPET.setMainUom(mainUom);
//仓库编码+空格+货位编码
//NC料号编码+'-'+货位编码
String erpLocation = queryForListProduct.get(0).get("ERPLOCATION") == null ? "" : queryForListProduct.get(0).get("ERPLOCATION").toString();
String locationname = queryForListProduct.get(0).get("LOCATIONNAME") == null ? "" : queryForListProduct.get(0).get("LOCATIONNAME").toString();
labelPrintPET.setLocationcode(erpLocation + " " + locationname);
String materialSpecNameNc = queryForListProduct.get(0).get("MATERIALSPECNAMENC") == null ? "" : queryForListProduct.get(0).get("MATERIALSPECNAMENC").toString();
labelPrintPET.setLocationcode(materialSpecNameNc + "-" + locationname);
labelPrintPET.setWide("");
labelPrintPET.setLength("");
labelPrintPET.setLineSpeed("");
@ -1983,7 +1994,7 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
if (newMaterialSpecSwitch.equals("Y")){
qeuryLabelDatasql = " SELECT\n" +
" m.MATERIALPACKINGNAME barcode,m2.materialtype,\n" +
" m2.OLDMATERIALSPECNAME partNo,\n" +
" m.MATERIALSPECNAME partNo,\n" +
" m.PHASE state,\n" +
" ss.SPECNAME sdkSpec,\n" +
" m2.DESC_CN partName,m2.description,\n" +
@ -1994,7 +2005,12 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" m.CHARGE lotNo,NVL(m.suppliername,'') supplierNo,\n" +
" m.REMARK remark,TO_CHAR(m.RECEIVETIME,'YYYYMMDD') jumboRollBatch,\n" +
" TO_CHAR(MAKEDATE,'YYYYMMDD') makedate, TO_CHAR(EXPIRINGDATE,'YYYYMMDD') expdate ,m.RECEIVEUSER opreater," +
" m.ERPLOCATION,m.LOCATIONNAME \n" +
" m.ERPLOCATION,m.LOCATIONNAME," +
" CASE " +
" WHEN m.LOCATIONNAME IS NULL OR TRIM(m.LOCATIONNAME) = '' THEN m.ERPLOCATION " +
" ELSE m.LOCATIONNAME" +
" END AS LOCATIONNAME, " +
" m.ERPSTATE \n" +
" FROM\n" +
" MATERIALPACKING m\n" +
" LEFT JOIN SDK_SPEC ss ON\n" +
@ -2019,7 +2035,12 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" m.CHARGE lotNo,NVL(m.suppliername,'') supplierNo,\r\n" +
" m.REMARK remark,TO_CHAR(m.RECEIVETIME,'YYYYMMDD') jumboRollBatch,"
+ "TO_CHAR(MAKEDATE,'YYYYMMDD') makedate, TO_CHAR(EXPIRINGDATE,'YYYYMMDD') expdate ,m.RECEIVEUSER opreater," +
" m.ERPLOCATION,m.LOCATIONNAME\r\n" +
" m.ERPLOCATION," +
" CASE " +
" WHEN m.LOCATIONNAME IS NULL OR TRIM(m.LOCATIONNAME) = '' THEN m.ERPLOCATION " +
" ELSE m.LOCATIONNAME" +
" END AS LOCATIONNAME, " +
" m2.OLDMATERIALSPECNAME AS ERPSTATE\r\n" +
"FROM\r\n" +
" MATERIALPACKING m\r\n" +
"LEFT JOIN SDK_SPEC ss ON\r\n" +
@ -2062,7 +2083,8 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
obj.setOperater(queryForListProduct.get(0).get("operater") != null ? queryForListProduct.get(0).get("operater").toString() : "");
// private String operater;
// obj.setOpreater(queryForList.get(0).get("operater") != null ? queryForList.get(0).get("operater").toString() : "");
obj.setJumboRollBatch(queryForListProduct.get(0).get("jumboRollBatch") != null ? queryForListProduct.get(0).get("jumboRollBatch").toString() : "");
String jumboRollBatch = queryForListProduct.get(0).get("jumboRollBatch") != null ? queryForListProduct.get(0).get("jumboRollBatch").toString() : "";
obj.setJumboRollBatch(formatDateStr(jumboRollBatch));
obj.setSpecifications(queryForListProduct.get(0).get("specifications") != null ? queryForListProduct.get(0).get("specifications").toString() : "");
obj.setPracticalSpec(queryForListProduct.get(0).get("PracticalSpec") != null ? queryForListProduct.get(0).get("PracticalSpec").toString() : "");
obj.setCustomNo(queryForListProduct.get(0).get("customNo") != null ? queryForListProduct.get(0).get("customNo").toString() : "");
@ -2078,7 +2100,8 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
obj.setDescription(queryForListProduct.get(0).get("description") != null ? queryForListProduct.get(0).get("description").toString() : "");
String erpLocation = queryForListProduct.get(0).get("ERPLOCATION") == null ? "" : queryForListProduct.get(0).get("ERPLOCATION").toString();
String locationName = queryForListProduct.get(0).get("LOCATIONNAME") == null ? "" : queryForListProduct.get(0).get("LOCATIONNAME").toString();
obj.setLocationcode(erpLocation + " " + locationName);
String erpState = queryForListProduct.get(0).get("ERPSTATE") == null ? "" : queryForListProduct.get(0).get("ERPSTATE").toString();
obj.setLocationcode(erpState + "-" + locationName);
log.info("***************************PrintLabel Assign params is : " + params.toString());
//labelUrl = labelPrintRabbitMQ(obj, requestUrl, pr, params);
labelUrl = labelPrint(obj, requestUrl, pr, params);
@ -2089,7 +2112,7 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
if (newMaterialSpecSwitch.equals("Y")){
qeuryLabelDatasql = "SELECT\r\n" +
" m.MATERIALPACKINGNAME barcode,m2.materialtype,\r\n" +
" m2.OLDMATERIALSPECNAME partNo,\r\n" +
" m.MATERIALSPECNAME partNo,\r\n" +
" m.PHASE state,\r\n" +
" ss.SPECNAME sdkSpec,\r\n" +
" m2.DESC_CN partName,m2.description,\r\n" +
@ -2100,7 +2123,12 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" m.CHARGE lotNo,NVL(m.suppliername,'') supplierNo,\r\n" +
" m.REMARK remark,TO_CHAR(m.RECEIVETIME,'YYYYMMDD') jumboRollBatch,"
+ "TO_CHAR(MAKEDATE,'YYYYMMDD') makedate, TO_CHAR(EXPIRINGDATE,'YYYYMMDD') expdate ,m.RECEIVEUSER opreater," +
" m.ERPLOCATION,m.LOCATIONNAME\r\n" +
" m.ERPLOCATION," +
" CASE " +
" WHEN m.LOCATIONNAME IS NULL OR TRIM(m.LOCATIONNAME) = '' THEN m.ERPLOCATION " +
" ELSE m.LOCATIONNAME" +
" END AS LOCATIONNAME, " +
" m.ERPSTATE\r\n" +
"FROM\r\n" +
" MATERIALPACKING m\r\n" +
"LEFT JOIN SDK_SPEC ss ON\r\n" +
@ -2125,7 +2153,12 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
" m.CHARGE lotNo,NVL(m.suppliername,'') supplierNo,\r\n" +
" m.REMARK remark,TO_CHAR(m.RECEIVETIME,'YYYYMMDD') jumboRollBatch,"
+ "TO_CHAR(MAKEDATE,'YYYYMMDD') makedate, TO_CHAR(EXPIRINGDATE,'YYYYMMDD') expdate ,m.RECEIVEUSER opreater," +
" m.ERPLOCATION,m.LOCATIONNAME\r\n" +
" m.ERPLOCATION," +
" CASE " +
" WHEN m.LOCATIONNAME IS NULL OR TRIM(m.LOCATIONNAME) = '' THEN m.ERPLOCATION " +
" ELSE m.LOCATIONNAME" +
" END AS LOCATIONNAME, " +
" m2.OLDMATERIALSPECNAME AS ERPSTATE\r\n" +
"FROM\r\n" +
" MATERIALPACKING m\r\n" +
"LEFT JOIN SDK_SPEC ss ON\r\n" +
@ -2168,7 +2201,8 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
obj.setOperater(queryForListProduct.get(0).get("operater") != null ? queryForListProduct.get(0).get("operater").toString() : "");
// private String operater;
// obj.setOpreater(queryForList.get(0).get("operater") != null ? queryForList.get(0).get("operater").toString() : "");
obj.setJumboRollBatch(queryForListProduct.get(0).get("jumboRollBatch") != null ? queryForListProduct.get(0).get("jumboRollBatch").toString() : "");
String jumboRollBatch = queryForListProduct.get(0).get("jumboRollBatch") != null ? queryForListProduct.get(0).get("jumboRollBatch").toString() : "";
obj.setJumboRollBatch(formatDateStr(jumboRollBatch));
obj.setSpecifications(queryForListProduct.get(0).get("specifications") != null ? queryForListProduct.get(0).get("specifications").toString() : "");
obj.setPracticalSpec(queryForListProduct.get(0).get("PracticalSpec") != null ? queryForListProduct.get(0).get("PracticalSpec").toString() : "");
obj.setCustomNo(queryForListProduct.get(0).get("customNo") != null ? queryForListProduct.get(0).get("customNo").toString() : "");
@ -2184,7 +2218,8 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
obj.setDescription(queryForListProduct.get(0).get("description") != null ? queryForListProduct.get(0).get("description").toString() : "");
String erpLocation = queryForListProduct.get(0).get("ERPLOCATION") == null ? "" : queryForListProduct.get(0).get("ERPLOCATION").toString();
String locationName = queryForListProduct.get(0).get("LOCATIONNAME") == null ? "" : queryForListProduct.get(0).get("LOCATIONNAME").toString();
obj.setLocationcode(erpLocation + " " + locationName);
String erpState = queryForListProduct.get(0).get("ERPSTATE") == null ? "" : queryForListProduct.get(0).get("ERPSTATE").toString();
obj.setLocationcode(erpState + " " + locationName);
log.info("***************************PrintLabel Assign params is : " + params.toString());
//labelUrl = labelPrintRabbitMQ(obj, requestUrl, pr, params);
labelUrl = labelPrint(obj, requestUrl, pr, params);
@ -2359,4 +2394,19 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
return bodyinfo;
}
public String formatDateStr(String productDate){
// 定义原始日期格式
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyyMMdd");
// 定义目标日期格式
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy/MM/dd");
try {
java.util.Date date = originalFormat.parse(productDate);
// 格式化为新的字符串格式
productDate = targetFormat.format(date);
}catch (Exception e){
}
return productDate;
}
}