fix:报废出库审核对没有库存的卷跳过处理
This commit is contained in:
@@ -213,7 +213,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
WQLObject mst = WQLObject.getWQLObject("ST_IVT_ProductScrapMst");
|
||||
WQLObject dtl = WQLObject.getWQLObject("ST_IVT_ProductScrapDtl");
|
||||
WQLObject ivt = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
|
||||
|
||||
try {
|
||||
// 查询所有明细
|
||||
JSONArray dtlArr = dtl.query("scrap_id = '" + whereJson.getString("scrap_id") + "'").getResultJSONArray(0);
|
||||
@@ -227,7 +227,11 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
List<JSONObject> ivtList = ivt.query("pcsn in ('" + pcsnJoining + "') and canuse_qty > 0")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
if (dtlArr.size() != ivtList.size()) {
|
||||
Set<String> ivtSet = ivtList.stream().map(row -> row.getString("pcsn")).collect(Collectors.toSet());
|
||||
|
||||
String havePcsn = ivtSet.stream().collect(Collectors.joining("','"));
|
||||
|
||||
/*if (dtlArr.size() != ivtList.size()) {
|
||||
throw new BadRequestException("库存异常请检查!");
|
||||
}
|
||||
|
||||
@@ -237,7 +241,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
|
||||
if (!is_pass) {
|
||||
throw new BadRequestException("库存异常请检查!");
|
||||
}
|
||||
}*/
|
||||
|
||||
// 生成出库单
|
||||
JSONObject jsonOutMst = new JSONObject();
|
||||
@@ -256,6 +260,9 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
JSONArray tableData = new JSONArray();
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
if (!ivtSet.contains(json.getString("pcsn"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("pcsn", json.getString("pcsn"));
|
||||
@@ -274,7 +281,11 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
||||
// 变更为手动分配
|
||||
// checkOutBillService.allDiv(jsonObject);
|
||||
|
||||
if (StrUtil.isNotEmpty(havePcsn)) {
|
||||
HashMap dtlMap = new HashMap();
|
||||
dtlMap.put("is_audit", "1");
|
||||
dtl.update(dtlMap, "scrap_id = '" + whereJson.getString("scrap_id") + "' AND pcsn in ('" + havePcsn + "')");
|
||||
}
|
||||
// 更新主表为完成
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("bill_status", "99");
|
||||
@@ -284,8 +295,8 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
mst.update(param, "scrap_id = '" + whereJson.getString("scrap_id") + "'");
|
||||
} catch (Exception e) {
|
||||
JSONObject msg = new JSONObject();
|
||||
msg.put("remark", "单据异常:"+e.getMessage());
|
||||
mst.update(msg,"scrap_id = '" + whereJson.getString("scrap_id") + "'");
|
||||
msg.put("remark", "单据异常:" + e.getMessage());
|
||||
mst.update(msg, "scrap_id = '" + whereJson.getString("scrap_id") + "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -478,7 +489,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
|
||||
List<JSONObject> ivtList = WQL.getWO("QST_IVT_HANDMOVESTOR")
|
||||
.addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id",in_stor_id)
|
||||
.addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id", in_stor_id)
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 查询不合格品来源字典
|
||||
@@ -536,7 +547,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
String finalValue = value;
|
||||
boxList.forEach(row -> {
|
||||
row.put("fail_source", finalValue);
|
||||
row.put("remark",remark);
|
||||
row.put("remark", remark);
|
||||
});
|
||||
|
||||
resultList.addAll(boxList);
|
||||
@@ -609,6 +620,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
mp.put("不合格品来源", "客户投诉");
|
||||
}
|
||||
mp.put("不合格品缺陷描述", object.getString("remark"));
|
||||
mp.put("是否出库", object.getString("is_audit").equals("1") ? "是" : "否");
|
||||
list.add(mp);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
||||
Reference in New Issue
Block a user