This commit is contained in:
zds
2022-12-20 11:13:53 +08:00
parent e7162a67b1
commit bb74c562a6
2 changed files with 79 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
输入.material_code TYPEAS s_string
输入.material_id TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.quality_scode TYPEAS s_string
[临时表]
@@ -156,6 +157,9 @@
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn = 输入.pcsn
ENDOPTION
OPTION 输入.quality_scode <> ""
ivt.quality_scode = 输入.quality_scode
ENDOPTION
group by ivt.material_id,ivt.pcsn
ENDSELECT

View File

@@ -234,6 +234,8 @@ public class InbillServiceImpl {
WQLObject reDtlTab = WQLObject.getWQLObject("PCS_RC_ReceiveDtl"); //到货通知单明细表
WQLObject procTab = WQLObject.getWQLObject("PCS_IF_PurchaseOrderProc"); //采购订单接口处理表
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetDtl"); //质检单明细表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); //库存表
WQLObject redTab = WQLObject.getWQLObject("MD_PB_BucketRecord"); //桶记录表
String iostorinv_id = from.getString("iostorinv_id");
Long currentUserId = SecurityUtils.getCurrentUserId();
@@ -311,6 +313,79 @@ public class InbillServiceImpl {
JSONObject dtl = dtlTab.query("bill_status='99' and material_id='"+material_id+"' and pcsn='"+pcsn+"' and result='01'").uniqueResult(0);
if(dtl!=null){
flag = true;
//更新库存品质类型
//判断当前库存是否有冻结数或者待入数
JSONObject ivt_now = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
.addParam("flag", "5")
.addParam("material_id", jo.getString("material_id"))
.addParam("quality_scode", "00")
.addParam("pcsn", jo.getString("pcsn"))
.process().uniqueResult(0);
if(ivt_now != null){
double frozen_qty = ivt_now.getDouble("frozen_qty");
double warehousing_qty = ivt_now.getDouble("warehousing_qty");
if(frozen_qty!=0 || warehousing_qty != 0){
}else{
JSONArray IvtArr = ivtTab.query("quality_scode='00' and material_id = '" + jo.getString("material_id") + "' and pcsn = '" + jo.getString("pcsn") + "'").getResultJSONArray(0);
if(IvtArr.size()!=0){
for (int m = 0; m < IvtArr.size(); m++) {
JSONObject jsonIvt = IvtArr.getJSONObject(m);
// 判断库存的可用数和库存数是否一致,不可以确认
if (jsonIvt.getDoubleValue("canuse_qty") != jsonIvt.getDoubleValue("ivt_qty")) {
throw new BadRequestException("此批次物料有未完成的单据");
}
JSONObject prarm = new JSONObject();
String change_type_scode = "";
prarm.put("struct_id", jsonIvt.getString("struct_id"));
prarm.put("material_id", jsonIvt.getString("material_id"));
prarm.put("quality_scode", jsonIvt.getString("quality_scode"));
prarm.put("pcsn", jsonIvt.getString("pcsn"));
prarm.put("ivt_level", jsonIvt.getString("ivt_level"));
prarm.put("is_active", jsonIvt.getString("is_active"));
prarm.put("change_qty", jsonIvt.getString("ivt_qty"));
prarm.put("bill_type_scode", dtl.getString("inspectiondtl_id"));
prarm.put("inv_id", dtl.getString("inspectiondtl_id"));
prarm.put("bill_code", dtl.getString("inspectiondtl_id"));
prarm.put("qty_unit_id", jsonIvt.getString("qty_unit_id"));
prarm.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
change_type_scode = "24";
storPublicService.IOStor(prarm, change_type_scode);
prarm.put("quality_scode", dtl.getString("result"));
prarm.put("ivt_level", dtl.getString("grade"));
change_type_scode = "23";
storPublicService.IOStor(prarm, change_type_scode);
}
}
/*
* 更新桶记录表
*/
JSONArray redArr = redTab.query("quality_scode='00' and material_id = '" + jo.getString("material_id") + "' and pcsn = '" + jo.getString("pcsn") + "' and status = '03'").getResultJSONArray(0);
for (int k = 0; k < redArr.size(); k++) {
JSONObject json = redArr.getJSONObject(k);
String result_qty = json.getString("storage_qty"); // 原结存数量
json.put("quality_scode", dtl.getString("result"));
json.put("ivt_level", dtl.getString("grade"));
redTab.update(json);
// 合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRedFow.put("bucket_code", json.get("bucketunique"));
jsonRedFow.put("material_id", json.get("material_id"));
jsonRedFow.put("pcsn", json.getString("pcsn"));
jsonRedFow.put("ivt_level", dtl.getString("grade"));
jsonRedFow.put("is_active", json.getString("is_active"));
jsonRedFow.put("quality_scode", dtl.getString("result"));
jsonRedFow.put("change_type_scode", "01");
jsonRedFow.put("change_time", now);
jsonRedFow.put("rec_person", currentUserId);
jsonRedFow.put("change_qty", result_qty);
jsonRedFow.put("result_qty", result_qty);
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
}
}
}
}
}
if(flag){
@@ -384,7 +459,6 @@ public class InbillServiceImpl {
}
}
}
//更新主表状态为99
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
}