This commit is contained in:
2023-01-12 09:50:35 +08:00
8 changed files with 297 additions and 144 deletions

View File

@@ -86,7 +86,7 @@
and #{query.endTime} >= sys_user.create_time
</if>
<if test="query.blurry != null">
and (email like #{query.blurry} or username like #{query.blurry} or person_name like #{query.blurry})
and (email like "%"#{query.blurry}"%" or username like "%"#{query.blurry}"%" or person_name like "%"#{query.blurry}"%")
</if>
</where>
</select>

View File

@@ -80,5 +80,15 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.process(jo), HttpStatus.OK);
}
@PostMapping("/initialize")
@Log("仓位初始化")
@ApiOperation("仓位初始化")
@SaIgnore
@SaCheckPermission("menu:list")
public ResponseEntity<Object> initialize(@RequestBody JSONObject json) {
acsToWmsService.initialize(json);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -69,4 +69,8 @@ public interface AcsToWmsService {
*/
JSONObject process(JSONObject whereJson);
/**
* 仓位初始化
*/
void initialize(JSONObject json);
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -548,4 +549,107 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("dtl_type", "1");
return result;
}
@Override
public void initialize(JSONObject param) {
{
{
int j_size = param.getInteger("j"); // 排
int k_size = param.getInteger("k"); // 列
String block = param.getString("layer"); // 块
JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0);
int max_no = 0;
if (ObjectUtil.isNotEmpty(max_jo)) {
max_no = max_jo.getIntValue("out_order_seq");
}
max_no++;
for (int i = 1; i < 4; i++) {
for (int j = 1; j < j_size; j++) {
for (int k = 1; k < k_size; k++) {
//排
String row = "";
if (j < 10) {
row = "0" + j;
} else {
row = j + "";
}
//列
String line = "";
if (k < 10) {
line = "0" + k;
} else {
line = k + "";
}
//块
String piece = i + block;
//层
String layer = "0" + i;
JSONObject jo = new JSONObject();
jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId());
jo.put("struct_code", piece + row + "-" + line + "-" + layer);
jo.put("struct_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("simple_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("sect_id", "1582991348217286656");
jo.put("sect_code", "ZC01");
jo.put("sect_name", "主存区");
jo.put("stor_id", "1582991156504039424");
jo.put("stor_code", "CP01");
jo.put("stor_name", "兰州仓库");
jo.put("stor_type", "03");
jo.put("is_tempstruct", "0");
jo.put("row_num", row);
jo.put("col_num", line);
jo.put("layer_num", layer);
jo.put("block_num", piece);
jo.put("in_order_seq", 0);
jo.put("out_order_seq", max_no);
jo.put("in_empty_seq", 0);
jo.put("out_empty_seq", 0);
jo.put("placement_type", "01");
jo.put("create_id", "1");
jo.put("create_name", "管理员");
jo.put("create_time", DateUtil.now());
jo.put("update_optid", "1");
jo.put("update_optname", "管理员");
jo.put("update_time", DateUtil.now());
jo.put("is_delete", "0");
jo.put("is_used", "1");
jo.put("lock_type", "1");
jo.put("material_height_type", "1");
WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo);
max_no++;
//插入点位
JSONObject structMap = new JSONObject();
structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId());
structMap.put("point_code", jo.getString("struct_code"));
structMap.put("point_name", jo.getString("struct_name"));
structMap.put("region_id", "1582991348217286656");
structMap.put("region_code", jo.getString("sect_code"));
structMap.put("region_name", jo.getString("sect_name"));
structMap.put("point_type", "2");
structMap.put("point_status", "1");
structMap.put("lock_type", jo.getString("lock_type"));
structMap.put("block_num", jo.getIntValue("block_num"));
structMap.put("row_num", jo.getIntValue("row_num"));
structMap.put("col_num", jo.getIntValue("col_num"));
structMap.put("layer_num", jo.getIntValue("layer_num"));
structMap.put("source_id", jo.getString("struct_id"));
structMap.put("create_id", "1");
structMap.put("create_name", "管理员");
structMap.put("create_time", DateUtil.now());
structMap.put("update_optid", "1");
structMap.put("update_optname", "管理员");
structMap.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").insert(structMap);
}
}
}
}
}
}
}

View File

@@ -75,7 +75,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
*
* @param moveinv_id
*/
void deleteById(String moveinv_id) {
public void deleteById(String moveinv_id) {
//明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
//主表

View File

@@ -34,6 +34,7 @@ import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.service.HandMoveStorService;
import org.nl.wms.st.instor.service.impl.HandMoveStorServiceImpl;
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -1235,6 +1236,10 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
//移库单明细表
WQLObject move_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
//移库单主表
WQLObject move_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
@@ -1313,9 +1318,32 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (flag.size() == 0) {//仓位载具冻结数为0
//任务号不为空
if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) {
// 判断是否有移库的任务:有就取消掉
JSONObject jsonTask = wo_Task.query("task_id = '" + dis.getString("task_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTask)) {
JSONArray moveArrTask = wo_Task.query("task_group_id = '" + jsonTask.getString("task_group_id") + "' and task_type = '010505'").getResultJSONArray(0);
for (int j = 0; j < moveArrTask.size(); j++) {
JSONObject jsonMoveTask = moveArrTask.getJSONObject(j);
// 调用删除移库单
JSONObject jsonMoveDtl = move_dtl.query("task_id = '" + jsonMoveTask.getString("task_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonMoveDtl)) {
JSONObject jsonMoveMst = move_mst.query("moveinv_id = '" + jsonMoveDtl.getString("moveinv_id") + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonMoveMst)) {
HandMoveStorServiceImpl bean = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
bean.deleteById(jsonMoveMst.getString("moveinv_id"));
}
}
}
}
//更新对应任务为删除
map.put("is_delete", "1");
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'");
}
//解锁起点仓位点位
JSONObject from_start = new JSONObject();
@@ -2524,43 +2552,149 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONArray disRowArrNew = new JSONArray();
String option = ""; // 1.左 2.右
String placement_type = jsonRow.getString("placement_type"); // 单通或双通
// 双通
if (StrUtil.equals(placement_type, "01")) {
// String placement_type = jsonRow.getString("placement_type"); // 单通或双通
// 取右边第一个
JSONObject jsonDisRight = disRowArr.getJSONObject(0);
// 取左边第一个
JSONObject jsonDisLeft = disRowArr.getJSONObject(disRowArr.size() - 1);
for (int p = 0; p < disRowArr.size(); p++) {
JSONObject jsonObject4 = disRowArr.getJSONObject(p);
String placement_type = jsonObject4.getString("placement_type");
// 双通
if (StrUtil.equals(placement_type, "01")) {
/*
* 判断左边被挡住的个数多还是右边被挡住的个数多
*/
// 判断右边边被挡住的个数
JSONObject isNumMap = new JSONObject();
isNumMap.put("flag", "3");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray numArrFirst = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
// 取右边第一个
JSONObject jsonDisRight = disRowArr.getJSONObject(0);
// 取左边第一个
JSONObject jsonDisLeft = disRowArr.getJSONObject(disRowArr.size() - 1);
// 调用共用方法计算被挡个数
JSONArray rightNumArr = this.isNum(numArrFirst);
// 判断左边被挡住的个数
isNumMap.put("flag", "4");
isNumMap.put("block_num", jsonDisLeft.getString("block_num"));
isNumMap.put("row_num", jsonDisLeft.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisLeft.getString("out_order_seq"));
JSONArray numArrLast = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
// 调用共用方法计算被挡个数
JSONArray leftNumArr = this.isNum(numArrLast);
// 判断哪边少
if (rightNumArr.size() > leftNumArr.size()) {
/*
* 左边开始
* 判断左边被挡住的个数多还是右边被挡住的个数多
*/
// 判断右边边被挡住的个数
JSONObject isNumMap = new JSONObject();
isNumMap.put("flag", "3");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray numArrFirst = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
// 调用共用方法计算被挡个数
JSONArray rightNumArr = this.isNum(numArrFirst);
// 判断左边被挡住的个数
isNumMap.put("flag", "4");
isNumMap.put("block_num", jsonDisLeft.getString("block_num"));
isNumMap.put("row_num", jsonDisLeft.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisLeft.getString("out_order_seq"));
JSONArray numArrLast = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
// 调用共用方法计算被挡个数
JSONArray leftNumArr = this.isNum(numArrLast);
// 判断哪边少
if (rightNumArr.size() > leftNumArr.size()) {
/*
* 左边开始
*/
// 查询仓位被锁住的货位
isNumMap.put("flag", "5");
isNumMap.put("block_num", jsonDisLeft.getString("block_num"));
isNumMap.put("row_num", jsonDisLeft.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisLeft.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "22")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "1";
} else if (rightNumArr.size() < leftNumArr.size()) {
/*
* 右边开始
*/
// 查询仓位被锁住的货位
isNumMap.put("flag", "6");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "2")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "2";
} else {
/*
* 相等默认右边开始
*/
// 查询仓位被锁住的货位
isNumMap.put("flag", "6");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "2")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "2";
}
} else if (StrUtil.equals(placement_type, "02")) {
// 左通
JSONObject jsonDisLeft = disRowArr.getJSONObject(disRowArr.size() - 1);
JSONObject isNumMap = new JSONObject();
// 查询仓位被锁住的货位
isNumMap.put("flag", "5");
isNumMap.put("block_num", jsonDisLeft.getString("block_num"));
@@ -2578,7 +2712,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
@@ -2590,10 +2724,10 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
option = "1";
} else if (rightNumArr.size() < leftNumArr.size()) {
/*
* 右边开始
*/
} else if (StrUtil.equals(placement_type, "03")) {
// 右通
JSONObject jsonDisRight = disRowArr.getJSONObject(0);
JSONObject isNumMap = new JSONObject();
// 查询仓位被锁住的货位
isNumMap.put("flag", "6");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
@@ -2611,40 +2745,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "2")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "2";
} else {
/*
* 相等默认右边开始
*/
// 查询仓位被锁住的货位
isNumMap.put("flag", "6");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务");
}
// 重新按照排序查询
@@ -2657,78 +2758,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
option = "2";
}
} else if (StrUtil.equals(placement_type, "02")) {
// 左通
JSONObject jsonDisLeft = disRowArr.getJSONObject(disRowArr.size() - 1);
JSONObject isNumMap = new JSONObject();
// 查询仓位被锁住的货位
isNumMap.put("flag", "5");
isNumMap.put("block_num", jsonDisLeft.getString("block_num"));
isNumMap.put("row_num", jsonDisLeft.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisLeft.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "22")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "1";
} else if (StrUtil.equals(placement_type, "03")) {
// 右通
JSONObject jsonDisRight = disRowArr.getJSONObject(0);
JSONObject isNumMap = new JSONObject();
// 查询仓位被锁住的货位
isNumMap.put("flag", "6");
isNumMap.put("block_num", jsonDisRight.getString("block_num"));
isNumMap.put("row_num", jsonDisRight.getString("row_num"));
isNumMap.put("out_order_seq", jsonDisRight.getString("out_order_seq"));
JSONArray isLockArr = WQL.getWO("ST_OUTIVT04").addParamMap(isNumMap).process().getResultJSONArray(0);
JSONArray numArr = this.isNum(isLockArr);
// 不为空则返回报错
if (ObjectUtil.isNotEmpty(numArr)) {
String error = "";
for (int k = 0; k < numArr.size(); k++) {
JSONObject json = numArr.getJSONObject(k);
error += json.getString("struct_code") + ",";
}
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务");
}
// 重新按照排序查询
disRowArrNew = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "2")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.addParam("block_num", jsonRow.getString("block_num"))
.addParam("row_num", jsonRow.getString("row_num"))
.process().getResultJSONArray(0);
option = "2";
break;
}
/*
* 循环生成任务
* 生成任务
*/
boolean canOut = false;
int j = 0;

View File

@@ -88,7 +88,8 @@
max(dis.point_id) AS point_id,
max(attr.out_order_seq) AS out_order_seq,
max(attr.block_num) AS block_num,
max(attr.row_num) AS row_num
max(attr.row_num) AS row_num,
max(attr.placement_type) AS placement_type
FROM
ST_IVT_IOStorInvDis dis
LEFT JOIN st_ivt_structattr attr ON dis.struct_id = attr.struct_id

View File

@@ -63,7 +63,7 @@
PAGEQUERY
SELECT DISTINCT
mst.*,
dtl.source_bill_type,
IFNULL( dtl.source_bill_type, '' ) AS source_bill_type,
IFNULL(dtl.vbeln,'') AS vbeln,
user.person_name AS upload_name
FROM