代码更新

This commit is contained in:
2022-11-27 11:27:27 +08:00
parent cce8d4eb53
commit 17eae55192
9 changed files with 199 additions and 54 deletions

View File

@@ -182,4 +182,10 @@ public interface CheckOutBillService {
* @param whereJson /
*/
JSONObject getDisNum(Map whereJson);
/**
* 新增物料库存条件过滤
* @param whereJson /
*/
JSONArray queryBox(JSONObject whereJson);
}

View File

@@ -218,4 +218,11 @@ public class CheckOutBillController {
public ResponseEntity<Object> getDisNum(@RequestBody Map whereJson) {
return new ResponseEntity<>(checkOutBillService.getDisNum(whereJson),HttpStatus.OK);
}
@PostMapping("/queryBox")
@Log("新增物料库存条件过滤")
@ApiOperation("新增物料库存条件过滤")
public ResponseEntity<Object> queryBox(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(checkOutBillService.queryBox(whereJson),HttpStatus.OK);
}
}

View File

@@ -95,7 +95,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (StrUtil.isNotEmpty(map.get("pcsn"))) {
map.put("pcsn", "%" + map.get("pcsn") + "%");
}
JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.struct_code ASC");
return jo;
}
@@ -204,6 +204,19 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
//明细另一种写法
//JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData"));
JSONArray rows = map.getJSONArray("tableData");
// 过滤相同箱号的明细
HashSet<String> boxSet = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
boxSet.add(json.getString("box_no"));
}
rows.clear();
// 遍历
for (String box_no : boxSet) {
JSONObject jsonObject = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().uniqueResult(0);
rows.add(jsonObject);
}
map.remove("tableData");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -300,7 +313,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonDtl2.put("qty_unit_id", jsonIvt.get("qty_unit_id"));
jsonDtl2.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
jsonDtl2.put("plan_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("remark", "通过明细创建");
jsonDtl2.put("remark", "");
jsonDtl2.put("assign_qty", "0");
jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
@@ -379,11 +392,29 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo = WQLObject.getWQLObject("ST_IVT_IOStorInv");
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
wo.update(whereJson);
//先删除该单据下的所有明细
String iostorinv_id = (String) whereJson.get("iostorinv_id");
wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'");
JSONArray rows = whereJson.getJSONArray("tableData");
// 过滤相同箱号的明细
HashSet<String> boxSet = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
boxSet.add(json.getString("box_no"));
}
rows.clear();
// 遍历
for (String box_no : boxSet) {
JSONObject jsonObject = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().uniqueResult(0);
rows.add(jsonObject);
}
double qty = 0.0; // 主表重量
int num = rows.size(); // 明细数
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
@@ -399,9 +430,54 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonDtl.put("qty_unit_name", row.getString("qty_unit_name"));
jsonDtl.put("plan_qty", row.get("plan_qty"));
jsonDtl.put("remark", row.getString("remark"));
jsonDtl.put("source_bill_code", row.getString("source_bill_code"));
jsonDtl.put("assign_qty", "0");
jsonDtl.put("unassign_qty", row.get("plan_qty"));
jsonDtl.put("vbeln", row.getString("vbeln"));
jsonDtl.put("posnr", row.getString("posnr"));
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
qty += jsonDtl.getDoubleValue("plan_qty");
// 判断此明细子卷是否存在,存在则将此木箱下的子卷全部生成明细
String pcsn = row.getString("pcsn");
if (ObjectUtil.isNotEmpty(pcsn)) {
JSONObject json = ivtTab.query("pcsn = '" + pcsn + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) continue;
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("pcsn", pcsn);
jsonMap.put("struct_id", json.getString("struct_id"));
JSONArray ivtArr = WQL.getWO("ST_OUTIVT02").addParamMap(jsonMap).process().getResultJSONArray(0);
for (int j = 0; j < ivtArr.size(); j++) {
JSONObject jsonIvt = ivtArr.getJSONObject(j);
JSONObject jsonDtl2 = new JSONObject();
jsonDtl2.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
jsonDtl2.put("iostorinv_id", iostorinv_id);
jsonDtl2.put("seq_no", i + 2 + j);
jsonDtl2.put("material_id", jsonIvt.getString("material_id"));
jsonDtl2.put("pcsn", jsonIvt.getString("pcsn"));
jsonDtl2.put("box_no", jsonIvt.getString("box_no"));
jsonDtl2.put("quality_scode", "01");
jsonDtl2.put("bill_status", "10");
jsonDtl2.put("qty_unit_id", jsonIvt.get("qty_unit_id"));
jsonDtl2.put("qty_unit_name", jsonIvt.getString("qty_unit_name"));
jsonDtl2.put("plan_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("remark", "");
jsonDtl2.put("assign_qty", "0");
jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2);
qty += jsonDtl2.getDoubleValue("plan_qty");
}
num += ivtArr.size();
}
whereJson.put("total_qty", qty);
whereJson.put("detail_count", num);
wo.update(whereJson);
}
}
@@ -2290,6 +2366,26 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
return json;
}
@Override
public JSONArray queryBox(JSONObject whereJson) {
JSONArray data = whereJson.getJSONArray("data");
// 先过滤相同的箱号
HashSet<String> boxSet = new HashSet<>();
for (int i = 0; i < data.size(); i++) {
JSONObject json = data.getJSONObject(i);
boxSet.add(json.getString("box_no"));
}
JSONArray array = new JSONArray();
// 遍历
for (String box_no : boxSet) {
JSONArray boxArr = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "7").addParam("box_no", box_no).process().getResultJSONArray(0);
array.addAll(boxArr);
}
return array;
}
/**
* 更新主表状态
*

View File

@@ -43,6 +43,7 @@
输入.task_status TYPEAS s_string
输入.deptIds TYPEAS f_string
输入.sale_order_name TYPEAS s_string
输入.box_no TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -479,6 +480,11 @@
OPTION 输入.end_time <> ""
ivt.instorage_time <= 输入.end_time
ENDOPTION
OPTION 输入.box_no <> ""
attr.storagevehicle_code = 输入.box_no
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF