代码更新

This commit is contained in:
2022-11-27 18:40:25 +08:00
parent 10cb9c8718
commit d8c7d47f31
10 changed files with 181 additions and 28 deletions

View File

@@ -43,6 +43,7 @@ public class StructivtServiceImpl implements StructivtService {
String material = MapUtil.getStr(whereJson, "material");
String struct = MapUtil.getStr(whereJson, "struct");
String region_id = MapUtil.getStr(whereJson, "region_id");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("region_id", region_id);
@@ -52,6 +53,9 @@ public class StructivtServiceImpl implements StructivtService {
if (StrUtil.isNotEmpty(struct)) {
map.put("struct", "%" + struct + "%");
}
if (StrUtil.isNotEmpty(pcsn)) {
map.put("pcsn", "%" + pcsn + "%");
}
JSONObject jsonObject = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.instorage_time desc");
return jsonObject;
}

View File

@@ -17,6 +17,7 @@
输入.struct TYPEAS s_string
输入.material TYPEAS s_string
输入.region_id TYPEAS f_string
输入.pcsn TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -75,6 +76,9 @@
mater.material_name like 输入.material
)
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.region_id <> ""
ivt.region_id = 输入.region_id

View File

@@ -194,4 +194,6 @@ public interface CheckOutBillService {
* @param whereJson /
*/
JSONArray queryBox(JSONObject whereJson);
JSONArray getOutBillTask2(Map whereJson);
}

View File

@@ -123,6 +123,12 @@ public class CheckOutBillController {
public ResponseEntity<Object> getOutBillTask(@RequestParam Map whereJson){
return new ResponseEntity<>(checkOutBillService.getOutBillTask(whereJson), HttpStatus.OK);
}
@PostMapping("/getOutBillTask2")
@Log("详情查询出库单分配任务2")
@ApiOperation("详情查询出库单分配任务2")
public ResponseEntity<Object> getOutBillTask2(@RequestBody Map whereJson){
return new ResponseEntity<>(checkOutBillService.getOutBillTask2(whereJson), HttpStatus.OK);
}
@GetMapping("/getStructIvt")
@Log("查询可分配库存")
@ApiOperation("查询可分配库存")

View File

@@ -88,6 +88,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("flag", "7");
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
map.put("canuse_qty", "0");
if (StrUtil.isNotEmpty(map.get("material_code"))) {
map.put("material_code", "%" + map.get("material_code") + "%");
@@ -203,18 +204,25 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
//明细另一种写法
//JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData"));
JSONArray rows = map.getJSONArray("tableData");
JSONArray array = map.getJSONArray("tableData");
JSONArray rows = new JSONArray();
// 过滤相同箱号的明细
HashSet<String> boxSet = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
boxSet.add(json.getString("box_no"));
for (int i = 0; i < array.size(); i++) {
JSONObject json = array.getJSONObject(i);
if (ObjectUtil.isNotEmpty(json.getString("box_no"))) {
boxSet.add(json.getString("box_no"));
} else {
rows.add(json);
}
}
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);
if (ObjectUtil.isNotEmpty(boxSet)) {
// 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");
@@ -265,6 +273,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
int num = rows.size(); // 明细数
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
// 校验计划数量不能为零
double plan_qty = row.getDoubleValue("plan_qty");
if (plan_qty == 0.0) {
throw new BadRequestException("数量不能为0");
}
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
jsonDtl.put("iostorinv_id", iostorinv_id);
@@ -301,7 +314,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
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);
@@ -317,6 +329,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonDtl2.put("assign_qty", "0");
jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
// 校验计划数量不能为零
double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty");
if (plan_qty2 == 0.0) {
throw new BadRequestException("数量不能为0");
}
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2);
qty += jsonDtl2.getDoubleValue("plan_qty");
@@ -388,6 +405,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
int num = rows.size(); // 明细数
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
// 校验计划数量不能为零
double plan_qty = row.getDoubleValue("plan_qty");
if (plan_qty == 0.0) {
throw new BadRequestException("数量不能为0");
}
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
jsonDtl.put("iostorinv_id", iostorinv_id);
@@ -440,6 +463,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonDtl2.put("assign_qty", "0");
jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
// 校验计划数量不能为零
double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty");
if (plan_qty2 == 0.0) {
throw new BadRequestException("数量不能为0");
}
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2);
qty += jsonDtl2.getDoubleValue("plan_qty");
@@ -502,6 +530,33 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
return jo;
}
@Override
public JSONArray getOutBillTask2(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "101");
JSONArray jo = new JSONArray();
if (map.containsKey("iostorinvdtl_id")) {
jo = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParamMap(map)
.process()
.getResultJSONArray(0);
}
for (int i = 0; i < jo.size(); i++) {
JSONObject json = jo.getJSONObject(i);
String task_status = json.getString("task_status");
if (ObjectUtil.isEmpty(task_status)) {
String work_status = json.getString("work_status");
if (StrUtil.equals(work_status, "01")) {
json.put("task_status","01");
}
if (StrUtil.equals(work_status, "99")) {
json.put("task_status","07");
}
}
}
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
@@ -522,24 +577,38 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String iostorinv_id = (String) whereJson.get("iostorinv_id");
wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'");
JSONArray rows = whereJson.getJSONArray("tableData");
JSONArray array = whereJson.getJSONArray("tableData");
JSONArray rows = new JSONArray();
// 过滤相同箱号的明细
HashSet<String> boxSet = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
boxSet.add(json.getString("box_no"));
for (int i = 0; i < array.size(); i++) {
JSONObject json = array.getJSONObject(i);
if (ObjectUtil.isNotEmpty(json.getString("box_no"))) {
boxSet.add(json.getString("box_no"));
} else {
rows.add(json);
}
}
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);
if (ObjectUtil.isNotEmpty(boxSet)) {
// 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);
// 校验计划数量不能为零
double plan_qty = row.getDoubleValue("plan_qty");
if (plan_qty == 0.0) {
throw new BadRequestException("数量不能为0");
}
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
jsonDtl.put("iostorinv_id", iostorinv_id);
@@ -576,7 +645,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
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);
@@ -592,6 +660,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jsonDtl2.put("assign_qty", "0");
jsonDtl2.put("unassign_qty", jsonIvt.get("canuse_qty"));
jsonDtl2.put("source_billdtl_id", jsonDtl.getString("iostorinvdtl_id"));
// 校验计划数量不能为零
double plan_qty2 = jsonDtl2.getDoubleValue("plan_qty");
if (plan_qty2 == 0.0) {
throw new BadRequestException("数量不能为0");
}
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl2);
qty += jsonDtl2.getDoubleValue("plan_qty");

View File

@@ -44,6 +44,7 @@
输入.deptIds TYPEAS f_string
输入.sale_order_name TYPEAS s_string
输入.box_no TYPEAS s_string
输入.canuse_qty TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -485,6 +486,10 @@
attr.storagevehicle_code = 输入.box_no
ENDOPTION
OPTION 输入.canuse_qty <> ""
ivt.canuse_qty > 输入.canuse_qty
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
@@ -572,6 +577,41 @@
ENDQUERY
ENDIF
IF 输入.flag = "101"
QUERY
SELECT
dis.*,
mater.material_code,
mater.material_name,
point.point_code AS next_point_code,
task.task_code,
task.task_type,
task.task_status
FROM
st_ivt_iostorinvdis dis
LEFT JOIN md_me_materialbase mater ON dis.material_id = mater.material_id
LEFT JOIN sch_base_point point ON dis.point_id = point.point_id
LEFT JOIN sch_base_task task ON dis.task_id = task.task_id
WHERE
1=1
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
OPTION 输入.iostorinv_id <> ""
dis.iostorinv_id = 输入.iostorinv_id
ENDOPTION
OPTION 输入.is_issued <> ""
dis.is_issued = 输入.is_issued
ENDOPTION
OPTION 输入.struct_id <> ""
dis.struct_id = 输入.struct_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "11"
QUERY
SELECT