fix:质检不合格调试
This commit is contained in:
parent
1f3d53b8fd
commit
3e52e45424
@ -4554,9 +4554,9 @@ public class ToSAPServiceImpl {
|
||||
item.put("BWART", "311");
|
||||
|
||||
String insmk = "";
|
||||
if("NG".equals(pqcResult) ){
|
||||
insmk = "3";
|
||||
}
|
||||
// if("NG".equals(pqcResult) ){
|
||||
// insmk = "3";
|
||||
// }
|
||||
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||
item.put("INSMK", insmk);
|
||||
// //ZLLORDER 自定义领料单号
|
||||
@ -5247,22 +5247,23 @@ public class ToSAPServiceImpl {
|
||||
if("OK".equals(pqcResult)) {
|
||||
moveType = "321"; // TF质量到非限制
|
||||
}else if("NG".equals(pqcResult)) {
|
||||
moveType = "350"; // TR 冻结到质检
|
||||
}
|
||||
}else if(StringUtils.equals("NG", (String)mm.get("PACKINGGRADE"))){ //当前是冻结
|
||||
if("OK".equals(pqcResult)) {
|
||||
moveType = "343"; // TF冻结到非限制
|
||||
}else { //转成质检
|
||||
// 322:TR 质量到非限制
|
||||
moveType = "349";// 349:TF 冻结到质检
|
||||
}
|
||||
}else if(StringUtils.equals("OK", (String)mm.get("PACKINGGRADE"))){ //当前是非限制
|
||||
if("NG".equals(pqcResult)) {
|
||||
moveType = "344"; // TR 冻结到非限制
|
||||
}else { //转成质检
|
||||
moveType = "322"; // 322:TR 质量到非限制
|
||||
moveType = "321"; // TR 冻结到质检
|
||||
}
|
||||
}
|
||||
// else if(StringUtils.equals("NG", (String)mm.get("PACKINGGRADE"))){ //当前是冻结
|
||||
// if("OK".equals(pqcResult)) {
|
||||
// moveType = "343"; // TF冻结到非限制
|
||||
// }else { //转成质检
|
||||
// // 322:TR 质量到非限制
|
||||
// moveType = "349";// 349:TF 冻结到质检
|
||||
// }
|
||||
// }else if(StringUtils.equals("OK", (String)mm.get("PACKINGGRADE"))){ //当前是非限制
|
||||
// if("NG".equals(pqcResult)) {
|
||||
// moveType = "344"; // TR 冻结到非限制
|
||||
// }else { //转成质检
|
||||
// moveType = "322"; // 322:TR 质量到非限制
|
||||
// }
|
||||
// }
|
||||
|
||||
//UMWRK 收货工厂
|
||||
//LGORT 发货库存地点
|
||||
@ -5277,9 +5278,9 @@ public class ToSAPServiceImpl {
|
||||
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
||||
item.put("MEINS", mm.get("UNIT"));
|
||||
String insmk = "";
|
||||
if("NG".equals(pqcResult) ){
|
||||
insmk = "3";
|
||||
}
|
||||
// if("NG".equals(pqcResult) ){
|
||||
// insmk = "3";
|
||||
// }
|
||||
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||
item.put("INSMK", insmk);
|
||||
itemData.add(item);
|
||||
|
@ -367,11 +367,11 @@ public class QMSController {
|
||||
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
|
||||
|
||||
//只有待检转合格才sap过账,其余不sap质检过账
|
||||
String qqAresult = queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString();
|
||||
if ("PREOQA".equals(qqAresult) && "OK".equals(pqcResult)) {
|
||||
String qqAresults = queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString();
|
||||
if ("PREOQA".equals(qqAresults) && "OK".equals(pqcResult) || "PREOQA".equals(qqAresults) && "NG".equals(pqcResult)) {
|
||||
sapBoxList.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString());
|
||||
}
|
||||
bindMap.put("preOqaResult", qqAresult);
|
||||
bindMap.put("preOqaResult", qqAresults);
|
||||
success ++;
|
||||
}
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class QMSController {
|
||||
|
||||
//只有待检转合格才sap过账,其余不sap质检过账
|
||||
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());
|
||||
}
|
||||
bindMap.put("preOqaResult", qqAresults);
|
||||
@ -846,7 +846,7 @@ public class QMSController {
|
||||
pqcResult="OK";
|
||||
}else if ("0".equals(pqcResult)) {
|
||||
pqcResult = "NG";
|
||||
continue;//NG直接跳过
|
||||
// continue;//NG直接跳过
|
||||
}
|
||||
List<MaterialPackingKey> mpList = new ArrayList<> ();
|
||||
// 转货位
|
||||
@ -882,7 +882,7 @@ public class QMSController {
|
||||
hashMap3.put("preErpLocation", queryForList.get(0).get("ERPLOCATION"));
|
||||
hashMap3.put("PRELOCATIONNAME", queryForList.get(0).get("LOCATIONNAME") == null ? "" : queryForList.get(0).get("LOCATIONNAME"));
|
||||
// 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("未维护转库对应关系");
|
||||
continue;
|
||||
|
@ -628,9 +628,13 @@ public class SaleOutController {
|
||||
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(sqlK, LKbp);
|
||||
//更新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" +
|
||||
" 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<>();
|
||||
bpu.put("MQTY", minusQty);
|
||||
bpu.put("SHIPREQUESTNAME", shipRequestName);
|
||||
|
@ -329,14 +329,18 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
}
|
||||
//判断会有多少个仓库发货,不同仓库需要分开走账
|
||||
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 = "";
|
||||
str += "(";
|
||||
for (String materialPacking : materialPackingKeyList) {
|
||||
str += "'" + materialPacking + "',";
|
||||
}
|
||||
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 = "";
|
||||
switch (shipRequestType) {
|
||||
case "NLCC" : //STO调拨出库
|
||||
@ -370,6 +374,27 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
|
||||
//MES需要接收,则只抛送数据。 或如果是现场仓,先移到现场仓
|
||||
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);
|
||||
billCode="Y";
|
||||
String sqlZK=" SELECT\r\n" +
|
||||
|
@ -7,9 +7,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class CodeGenerator {
|
||||
@ -21,6 +19,70 @@ public class CodeGenerator {
|
||||
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 newPalletNo = null;
|
||||
boolean success = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user