fix:质检不合格调试

This commit is contained in:
郭飞 2025-04-22 17:31:59 +08:00
parent 1f3d53b8fd
commit 3e52e45424
5 changed files with 127 additions and 35 deletions

View File

@ -4554,9 +4554,9 @@ public class ToSAPServiceImpl {
item.put("BWART", "311"); item.put("BWART", "311");
String insmk = ""; String insmk = "";
if("NG".equals(pqcResult) ){ // if("NG".equals(pqcResult) ){
insmk = "3"; // insmk = "3";
} // }
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X"; // String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
item.put("INSMK", insmk); item.put("INSMK", insmk);
// //ZLLORDER 自定义领料单号 // //ZLLORDER 自定义领料单号
@ -5247,22 +5247,23 @@ public class ToSAPServiceImpl {
if("OK".equals(pqcResult)) { if("OK".equals(pqcResult)) {
moveType = "321"; // TF质量到非限制 moveType = "321"; // TF质量到非限制
}else if("NG".equals(pqcResult)) { }else if("NG".equals(pqcResult)) {
moveType = "350"; // TR 冻结到质检 moveType = "321"; // TR 冻结到质检
}
}else if(StringUtils.equals("NG", (String)mm.get("PACKINGGRADE"))){ //当前是冻结
if("OK".equals(pqcResult)) {
moveType = "343"; // TF冻结到非限制
}else { //转成质检
// 322TR 质量到非限制
moveType = "349";// 349TF 冻结到质检
}
}else if(StringUtils.equals("OK", (String)mm.get("PACKINGGRADE"))){ //当前是非限制
if("NG".equals(pqcResult)) {
moveType = "344"; // TR 冻结到非限制
}else { //转成质检
moveType = "322"; // 322TR 质量到非限制
} }
} }
// else if(StringUtils.equals("NG", (String)mm.get("PACKINGGRADE"))){ //当前是冻结
// if("OK".equals(pqcResult)) {
// moveType = "343"; // TF冻结到非限制
// }else { //转成质检
// // 322TR 质量到非限制
// moveType = "349";// 349TF 冻结到质检
// }
// }else if(StringUtils.equals("OK", (String)mm.get("PACKINGGRADE"))){ //当前是非限制
// if("NG".equals(pqcResult)) {
// moveType = "344"; // TR 冻结到非限制
// }else { //转成质检
// moveType = "322"; // 322TR 质量到非限制
// }
// }
//UMWRK 收货工厂 //UMWRK 收货工厂
//LGORT 发货库存地点 //LGORT 发货库存地点
@ -5277,9 +5278,9 @@ public class ToSAPServiceImpl {
item.put("MENGE", mm.get("MATERIALQUANTITY")); item.put("MENGE", mm.get("MATERIALQUANTITY"));
item.put("MEINS", mm.get("UNIT")); item.put("MEINS", mm.get("UNIT"));
String insmk = ""; String insmk = "";
if("NG".equals(pqcResult) ){ // if("NG".equals(pqcResult) ){
insmk = "3"; // insmk = "3";
} // }
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X"; // String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
item.put("INSMK", insmk); item.put("INSMK", insmk);
itemData.add(item); itemData.add(item);

View File

@ -367,11 +367,11 @@ public class QMSController {
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo); // queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
//只有待检转合格才sap过账其余不sap质检过账 //只有待检转合格才sap过账其余不sap质检过账
String qqAresult = queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString(); String qqAresults = queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString();
if ("PREOQA".equals(qqAresult) && "OK".equals(pqcResult)) { if ("PREOQA".equals(qqAresults) && "OK".equals(pqcResult) || "PREOQA".equals(qqAresults) && "NG".equals(pqcResult)) {
sapBoxList.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString()); sapBoxList.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString());
} }
bindMap.put("preOqaResult", qqAresult); bindMap.put("preOqaResult", qqAresults);
success ++; success ++;
} }
} }
@ -393,7 +393,7 @@ public class QMSController {
//只有待检转合格才sap过账其余不sap质检过账 //只有待检转合格才sap过账其余不sap质检过账
String qqAresults = queryForList.get(j).get("OQARESULT") == null ? "PREOQA" : queryForList.get(j).get("OQARESULT").toString(); String qqAresults = queryForList.get(j).get("OQARESULT") == null ? "PREOQA" : queryForList.get(j).get("OQARESULT").toString();
if ("PREOQA".equals(qqAresults) && "OK".equals(pqcResult)) { if ("PREOQA".equals(qqAresults) && "OK".equals(pqcResult) || "PREOQA".equals(qqAresults) && "NG".equals(pqcResult)) {
sapBoxList.add(queryForList.get(j).get("MATERIALPACKINGNAME").toString()); sapBoxList.add(queryForList.get(j).get("MATERIALPACKINGNAME").toString());
} }
bindMap.put("preOqaResult", qqAresults); bindMap.put("preOqaResult", qqAresults);
@ -846,7 +846,7 @@ public class QMSController {
pqcResult="OK"; pqcResult="OK";
}else if ("0".equals(pqcResult)) { }else if ("0".equals(pqcResult)) {
pqcResult = "NG"; pqcResult = "NG";
continue;//NG直接跳过 // continue;//NG直接跳过
} }
List<MaterialPackingKey> mpList = new ArrayList<> (); List<MaterialPackingKey> mpList = new ArrayList<> ();
// 转货位 // 转货位
@ -882,7 +882,7 @@ public class QMSController {
hashMap3.put("preErpLocation", queryForList.get(0).get("ERPLOCATION")); hashMap3.put("preErpLocation", queryForList.get(0).get("ERPLOCATION"));
hashMap3.put("PRELOCATIONNAME", queryForList.get(0).get("LOCATIONNAME") == null ? "" : queryForList.get(0).get("LOCATIONNAME")); hashMap3.put("PRELOCATIONNAME", queryForList.get(0).get("LOCATIONNAME") == null ? "" : queryForList.get(0).get("LOCATIONNAME"));
// if ("OK".equals(pqcResult)) { // if ("OK".equals(pqcResult)) {
if(OKERPLOCATION.length()==0 || ("PREOQA".equals(PREOQARESULT) && pqcResult == "OK") || PREOQARESULT.equals(pqcResult)) if(OKERPLOCATION.isEmpty() || ("PREOQA".equals(PREOQARESULT) && "OK".equals(pqcResult)) || PREOQARESULT.equals(pqcResult))
{ {
log.info("未维护转库对应关系"); log.info("未维护转库对应关系");
continue; continue;

View File

@ -628,9 +628,13 @@ public class SaleOutController {
IDMFrameServiceProxy.getSqlTemplate().update(sqlK, LKbp); IDMFrameServiceProxy.getSqlTemplate().update(sqlK, LKbp);
//更新MaterialShipRequestDetail表ASSIGNEDQUANTITY //更新MaterialShipRequestDetail表ASSIGNEDQUANTITY
// String sqlu="UPDATE MATERIALSHIPREQUESTDETAIL m SET m.ASSIGNEDQUANTITY=m.ASSIGNEDQUANTITY - :MQTY\r\n" +
// " WHERE m.SHIPREQUESTNAME =:SHIPREQUESTNAME AND m.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" +
// " AND m.ASSIGNEDQUANTITY >0 AND (:SDK_ID IS NULL OR m.SDK_ID = :SDK_ID) AND (:PHASE IS NULL OR m.PHASE = :PHASE)";
String sqlu="UPDATE MATERIALSHIPREQUESTDETAIL m SET m.ASSIGNEDQUANTITY=m.ASSIGNEDQUANTITY - :MQTY\r\n" + String sqlu="UPDATE MATERIALSHIPREQUESTDETAIL m SET m.ASSIGNEDQUANTITY=m.ASSIGNEDQUANTITY - :MQTY\r\n" +
" WHERE m.SHIPREQUESTNAME =:SHIPREQUESTNAME AND m.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" + " WHERE m.SHIPREQUESTNAME =:SHIPREQUESTNAME AND m.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" +
" AND m.ASSIGNEDQUANTITY >0 AND (:SDK_ID IS NULL OR m.SDK_ID = :SDK_ID) AND (:PHASE IS NULL OR m.PHASE = :PHASE)"; " AND m.ASSIGNEDQUANTITY >0 AND (:PHASE IS NULL OR m.PHASE = :PHASE)";
Map<String,Object> bpu=new HashMap<>(); Map<String,Object> bpu=new HashMap<>();
bpu.put("MQTY", minusQty); bpu.put("MQTY", minusQty);
bpu.put("SHIPREQUESTNAME", shipRequestName); bpu.put("SHIPREQUESTNAME", shipRequestName);

View File

@ -329,14 +329,18 @@ public class InvoiceServiceImpl implements InvoiceService {
} }
//判断会有多少个仓库发货不同仓库需要分开走账 //判断会有多少个仓库发货不同仓库需要分开走账
StringBuffer cklx = new StringBuffer(); StringBuffer cklx = new StringBuffer();
cklx.append("SELECT DISTINCT m.ERPLOCATION FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN "); // cklx.append("SELECT DISTINCT m.ERPLOCATION FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
cklx.append("SELECT m.MATERIALQUANTITY,m.MATERIALQUANTITY2,m.MATERIALPACKINGNAME,m.CHARGE FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
String str = ""; String str = "";
str += "("; str += "(";
for (String materialPacking : materialPackingKeyList) { for (String materialPacking : materialPackingKeyList) {
str += "'" + materialPacking + "',"; str += "'" + materialPacking + "',";
} }
str += "'')"; str += "'')";
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap); // List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
// 查询MATERIALQUANTITY MATERIALQUANTITY2是否相等如果相等则未修改数量不相等则修改数量
List<Map<String, Object>> qtyQueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
String billCode = ""; String billCode = "";
switch (shipRequestType) { switch (shipRequestType) {
case "NLCC" : //STO调拨出库 case "NLCC" : //STO调拨出库
@ -370,6 +374,27 @@ public class InvoiceServiceImpl implements InvoiceService {
//MES需要接收则只抛送数据 或如果是现场仓,先移到现场仓 //MES需要接收则只抛送数据 或如果是现场仓,先移到现场仓
if(src.size()>0 || !ERPRECEIVELOCATION.isEmpty()) { if(src.size()>0 || !ERPRECEIVELOCATION.isEmpty()) {
// 查询MATERIALQUANTITY MATERIALQUANTITY2是否相等如果相等则未修改数量不相等则修改数量
// 如果已修改数量则进行拆单
for (int z = 0; z < qtyQueryForList.size(); z++) {
String qty = qtyQueryForList.get(z).get("MATERIALQUANTITY").toString();
String qty2 = qtyQueryForList.get(z).get("MATERIALQUANTITY2") == null ? "0" : qtyQueryForList.get(z).get("MATERIALQUANTITY2").toString();
BigDecimal bigQty = new BigDecimal(qty);
// 已拆数量
BigDecimal bigQty2 = new BigDecimal(qty2);
if(bigQty.compareTo(bigQty2) != 0) {
// 剩余数量
BigDecimal restQty = bigQty.subtract(bigQty2);
}
}
//new MESServiceImpl().NeedReceiveMaterialInfoSend_NEW(shipRequestName, "SDK", materialPackingKeyList); //new MESServiceImpl().NeedReceiveMaterialInfoSend_NEW(shipRequestName, "SDK", materialPackingKeyList);
billCode="Y"; billCode="Y";
String sqlZK=" SELECT\r\n" + String sqlZK=" SELECT\r\n" +

View File

@ -7,9 +7,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.Map;
@Component @Component
public class CodeGenerator { public class CodeGenerator {
@ -21,6 +19,70 @@ public class CodeGenerator {
public static String generateCode() throws CustomException { public static String generateCode() throws CustomException {
String currentDateStr = new SimpleDateFormat(DATE_FORMAT).format(new Date());
String newPalletNo = null;
boolean success = false;
while (!success) {
String maxSeqNoQuery = "SELECT NVL(MAX(TO_NUMBER(SUBSTR(PALLETNO, " +
"(LENGTH('" + PREFIX + "') + LENGTH(:dateStr) + 1), 3))), 0) + 1 AS new_seq " +
"FROM MATERIALPACKINGPALLET " +
"WHERE SUBSTR(PALLETNO, 1, LENGTH('" + PREFIX + "') + LENGTH(:dateStr)) = '" + PREFIX + "' || :dateStr";
try {
log.info("maxSeqNoQuery: " + maxSeqNoQuery);
Map<String, String> bindMap = new HashMap<String, String>();
bindMap.put("dateStr", currentDateStr);
Map<String, Object> maxSeqNoResult = IDMFrameServiceProxy.getSqlTemplate().queryForMap(maxSeqNoQuery,bindMap);
int newSeqNo = 0;
if (maxSeqNoResult != null && maxSeqNoResult.containsKey("new_seq")) {
newSeqNo = Integer.parseInt(maxSeqNoResult.get("new_seq").toString());
}
// 确保流水码不超过999
if (newSeqNo > 999) {
throw new CustomException("流水码超过了数字999");
}
String newSeqNoStr = String.format("%03d", newSeqNo);
newPalletNo = PREFIX + currentDateStr + newSeqNoStr;
success = true;
}catch (Exception e) {
log.error("Failed to generate pallet number: " + e.getMessage());
throw new CustomException("生成流水码错误: " + e.getMessage());
}
}
return newPalletNo;
}
// 修改数量条码里批次拆分获取流水码
public static String packingGenerateCode(String materialpackingname) throws CustomException {
// 3. 遍历结果集生成新条码并更新数据库
List<Integer> idsToUpdate = new ArrayList<Integer>();
List<String> newNames = new ArrayList<String>();
int sequence = 1; // 假设从1开始计数实际中可能需要从数据库获取当前最大值或使用其他逻辑
String[] parts = materialpackingname.split("\\|");
if (parts.length < 7) {
throw new IllegalArgumentException("Invalid barcode format: " + materialpackingname);
}
// 构建新的条码部分假设在第五部分索引4因为索引从0开始后添加流水码
StringBuilder newBasePart = new StringBuilder();
for (int i = 0; i < parts.length - 2; i++) { // 不包括最后两个部分
newBasePart.append(parts[i]).append("|");
}
newBasePart.append(parts[4]).append("-").append(sequence++); // 在第五部分后添加流水码
for (int i = 6; i < parts.length; i++) { // 添加最后两个部分
newBasePart.append("|").append(parts[i]);
}
// idsToUpdate.add(id);
// newNames.add(newBasePart.toString());
String currentDateStr = new SimpleDateFormat(DATE_FORMAT).format(new Date()); String currentDateStr = new SimpleDateFormat(DATE_FORMAT).format(new Date());
String newPalletNo = null; String newPalletNo = null;
boolean success = false; boolean success = false;