fix:出库顺序逻辑优化
This commit is contained in:
@@ -90,7 +90,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
private final IStIvtIostorinvdisService iStIvtIostorinvdisService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CheckOutBillService checkOutBillService;
|
||||
private CheckOutBillService checkOutBillService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -125,7 +125,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = vbeln.split(" ");
|
||||
String vbeln_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("vbeln_in", "('"+vbeln_in+"')");
|
||||
map.put("vbeln_in", "('" + vbeln_in + "')");
|
||||
map.put("vbeln", "");
|
||||
} else {
|
||||
map.put("vbeln", "%" + map.get("vbeln") + "%");
|
||||
@@ -143,7 +143,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = box_no.split(" ");
|
||||
String box_no_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("box_no_in", "('"+box_no_in+"')");
|
||||
map.put("box_no_in", "('" + box_no_in + "')");
|
||||
map.put("box_no", "");
|
||||
} else {
|
||||
map.put("box_no", "%" + map.get("box_no") + "%");
|
||||
@@ -167,7 +167,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = pcsn.split(" ");
|
||||
String pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("pcsn_in", "('"+pcsn_in+"')");
|
||||
map.put("pcsn_in", "('" + pcsn_in + "')");
|
||||
map.put("pcsn", "");
|
||||
} else {
|
||||
map.put("pcsn", "%" + map.get("pcsn") + "%");
|
||||
@@ -186,7 +186,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = sap_pcsn.split(" ");
|
||||
String sap_pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("sap_pcsn_in", "('"+sap_pcsn_in+"')");
|
||||
map.put("sap_pcsn_in", "('" + sap_pcsn_in + "')");
|
||||
map.put("sap_pcsn", "");
|
||||
} else {
|
||||
map.put("sap_pcsn", "%" + map.get("sap_pcsn") + "%");
|
||||
@@ -269,7 +269,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = pcsn.split(" ");
|
||||
String pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("pcsn_in", "('"+pcsn_in+"')");
|
||||
map.put("pcsn_in", "('" + pcsn_in + "')");
|
||||
map.put("pcsn", "");
|
||||
} else {
|
||||
map.put("pcsn", "%" + pcsn + "%");
|
||||
@@ -286,7 +286,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = sap_pcsn.split(" ");
|
||||
String sap_pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("sap_pcsn_in", "('"+sap_pcsn_in+"')");
|
||||
map.put("sap_pcsn_in", "('" + sap_pcsn_in + "')");
|
||||
map.put("sap_pcsn", "");
|
||||
} else {
|
||||
map.put("sap_pcsn", "%" + sap_pcsn + "%");
|
||||
@@ -303,7 +303,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = package_box_sn.split(" ");
|
||||
String package_box_sn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("box_no_in", "('"+package_box_sn_in+"')");
|
||||
map.put("box_no_in", "('" + package_box_sn_in + "')");
|
||||
map.put("box_no", "");
|
||||
} else {
|
||||
map.put("box_no", "%" + map.get("package_box_sn") + "%");
|
||||
@@ -427,9 +427,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insertDtl(JSONObject map) {
|
||||
if(MapUtil.getStr(map,"bill_type").equals("1011")) {
|
||||
String iostorinv_id = inserdtlPic(map);
|
||||
return iostorinv_id ;
|
||||
if (MapUtil.getStr(map, "bill_type").equals("1011")) {
|
||||
String iostorinv_id = inserdtlPic(map);
|
||||
return iostorinv_id;
|
||||
}
|
||||
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
@@ -591,6 +591,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
/**
|
||||
* 拣选出库新增
|
||||
*
|
||||
* @param map 、
|
||||
* @return 单据标识
|
||||
*/
|
||||
@@ -1032,7 +1033,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = vbeln.split(" ");
|
||||
String vbeln_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("vbeln_in", "('"+vbeln_in+"')");
|
||||
map.put("vbeln_in", "('" + vbeln_in + "')");
|
||||
map.put("vbeln", "");
|
||||
} else {
|
||||
map.put("vbeln", "%" + map.get("vbeln") + "%");
|
||||
@@ -1050,7 +1051,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = box_no.split(" ");
|
||||
String box_no_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("box_no_in", "('"+box_no_in+"')");
|
||||
map.put("box_no_in", "('" + box_no_in + "')");
|
||||
map.put("box_no", "");
|
||||
} else {
|
||||
map.put("box_no", "%" + map.get("box_no") + "%");
|
||||
@@ -1073,7 +1074,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = pcsn.split(" ");
|
||||
String pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("pcsn_in", "('"+pcsn_in+"')");
|
||||
map.put("pcsn_in", "('" + pcsn_in + "')");
|
||||
map.put("pcsn", "");
|
||||
} else {
|
||||
map.put("pcsn", "%" + map.get("pcsn") + "%");
|
||||
@@ -1091,7 +1092,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String[] s = sap_pcsn.split(" ");
|
||||
String sap_pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("sap_pcsn_in", "('"+sap_pcsn_in+"')");
|
||||
map.put("sap_pcsn_in", "('" + sap_pcsn_in + "')");
|
||||
map.put("sap_pcsn", "");
|
||||
} else {
|
||||
map.put("sap_pcsn", "%" + map.get("sap_pcsn") + "%");
|
||||
@@ -1219,7 +1220,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("overdue_qyt",overdue_qyt);
|
||||
result.put("overdue_qyt", overdue_qyt);
|
||||
result.put("mst", jsonMst);
|
||||
return result;
|
||||
}
|
||||
@@ -1287,7 +1288,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
String estimated_freight = list.get(5).toString();
|
||||
|
||||
// 更新主表
|
||||
jsonMst.put("trans_code", ObjectUtil.isNotEmpty(jsonTran) ? jsonTran.getString("cust_code") : "" );
|
||||
jsonMst.put("trans_code", ObjectUtil.isNotEmpty(jsonTran) ? jsonTran.getString("cust_code") : "");
|
||||
jsonMst.put("order_number", order_number);
|
||||
jsonMst.put("car_type", car_type);
|
||||
jsonMst.put("other_freight", other_freight);
|
||||
@@ -1320,18 +1321,18 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// 更新冻结库存
|
||||
JSONObject jsonIvt = ivtTab.query("pcsn = '" + json.getString("pcsn") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("库存不存在!"+json.getString("pcsn"));
|
||||
throw new BadRequestException("库存不存在!" + json.getString("pcsn"));
|
||||
}
|
||||
|
||||
jsonIvt.put("frozen_qty", json.getDoubleValue("plan_qty"));
|
||||
// 冻结库存不能超过库存数量
|
||||
if (jsonIvt.getDoubleValue("frozen_qty") > jsonIvt.getDoubleValue("ivt_qty")) {
|
||||
throw new BadRequestException("输入数量不能大于库存数量! 当前库存数为:"+jsonIvt.getString("ivt_qty"));
|
||||
throw new BadRequestException("输入数量不能大于库存数量! 当前库存数为:" + jsonIvt.getString("ivt_qty"));
|
||||
}
|
||||
|
||||
// 更新库存数
|
||||
double canuse_qty = NumberUtil.sub(jsonIvt.getDoubleValue("ivt_qty"), jsonIvt.getDoubleValue("frozen_qty"));
|
||||
jsonIvt.put("canuse_qty",canuse_qty);
|
||||
jsonIvt.put("canuse_qty", canuse_qty);
|
||||
|
||||
ivtTab.update(jsonIvt);
|
||||
|
||||
@@ -1497,6 +1498,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
/**
|
||||
* 分拣出库修改
|
||||
*
|
||||
* @param whereJson、
|
||||
*/
|
||||
private void updatePic(JSONObject whereJson) {
|
||||
@@ -1606,7 +1608,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
|
||||
}*/
|
||||
RedissonUtils.lock(a->{
|
||||
RedissonUtils.lock(a -> {
|
||||
//查询生成和未分配完的明细
|
||||
JSONArray dtls = WQL.getWO("QST_IVT_CHECKOUTBILL")
|
||||
.addParam("flag", "2")
|
||||
@@ -1743,7 +1745,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
throw new BadRequestException("库存不足");
|
||||
}
|
||||
|
||||
double canuse_qty ;
|
||||
double canuse_qty;
|
||||
if (StrUtil.equals(bill_type, "1011")) {
|
||||
canuse_qty = dtl.getDoubleValue("plan_qty");
|
||||
} else {
|
||||
@@ -1837,7 +1839,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},"all_divOne",whereJson);
|
||||
}, "all_divOne", whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2473,7 +2475,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
|
||||
RLock lock = redissonClient.getLock("all_cancelDivOne");
|
||||
boolean tryLock = lock.tryLock(0, 60,TimeUnit.SECONDS);
|
||||
boolean tryLock = lock.tryLock(0, 60, TimeUnit.SECONDS);
|
||||
|
||||
try {
|
||||
if (tryLock) {
|
||||
@@ -3150,7 +3152,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(structArr)) {
|
||||
JSONObject jsonObject = structArr.getJSONObject(0);
|
||||
throw new BadRequestException("当前排存在单据号为【"+jsonObject.getString("inv_code")+"】的仓位【"+jsonObject.getString("struct_code")+"】正在执行任务,请稍后在试!");
|
||||
throw new BadRequestException("当前排存在单据号为【" + jsonObject.getString("inv_code") + "】的仓位【" + jsonObject.getString("struct_code") + "】正在执行任务,请稍后在试!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3220,7 +3222,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
public void allSetPointByNoTran(JSONObject whereJson) {
|
||||
String point_code = whereJson.getString("point_code"); // 终点
|
||||
JSONObject jsonPoint2 = WQLObject.getWQLObject("SCH_BASE_Point").query("lock_type='1' and (vehicle_code='' or vehicle_code IS NULL) and point_code='" + whereJson.getString("point_code") + "'").uniqueResult(0);
|
||||
参数校验:{
|
||||
参数校验:
|
||||
{
|
||||
JSONObject jo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo_mst)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
@@ -3245,7 +3248,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONArray structArr = WQLObject.getWQLObject("ST_IVT_StructAttr").query("block_num = '" + jsonRow.getString("block_num")
|
||||
+ "' and row_num = '" + jsonRow.getString("row_num") + "' and is_used = '1' and is_delete = '0' and lock_type not in ('1','6','3')").getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(structArr)) {
|
||||
throw new BadRequestException("有其他任务正在执行中,对应单据号为【"+structArr.getJSONObject(0).getString("inv_code")+"】,请稍后在试!");
|
||||
throw new BadRequestException("有其他任务正在执行中,对应单据号为【" + structArr.getJSONObject(0).getString("inv_code") + "】,请稍后在试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3254,7 +3257,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
//同区同排排序:10302-04-01
|
||||
//口口回口回口口口1
|
||||
//口口回回口口口口2
|
||||
Map<String, List<StructAllsetDto>> collect = structSet.stream().distinct().collect(Collectors.groupingBy(struct -> struct.getRow_num()+"_"+struct.getBlock_num()));
|
||||
Map<String, List<StructAllsetDto>> collect = structSet.stream().distinct().collect(Collectors.groupingBy(struct -> struct.getRow_num() + "_" + struct.getBlock_num()));
|
||||
//批量校验单据锁定
|
||||
for (String orderBy : collect.keySet()) {
|
||||
List<StructAllsetDto> needStructs = collect.get(orderBy);
|
||||
@@ -3268,60 +3271,167 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
for (String orderBy : collect.keySet()) {
|
||||
List<StructAllsetDto> needStructs = collect.get(orderBy);
|
||||
//从左到右排序
|
||||
needStructs.sort(Comparator.comparingInt(a->Integer.valueOf(a.getOut_order_seq())));
|
||||
needStructs.sort(Comparator.comparingInt(a -> Integer.valueOf(a.getOut_order_seq())));
|
||||
StructAllsetDto left = needStructs.get(0);
|
||||
StructAllsetDto right = needStructs.get(needStructs.size()-1);
|
||||
StructAllsetDto right = needStructs.get(needStructs.size() - 1);
|
||||
//确认左/右出库并根据出库顺序获取货位集合
|
||||
List<JSONObject> structs = 左右出库确认(needStructs, left, right,whereJson.getString("iostorinv_id"));
|
||||
//attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code,storagevehicle_code
|
||||
JSONObject jsonObject = 左右出库确认(needStructs, left, right, whereJson.getString("iostorinv_id"));
|
||||
List<JSONObject> structs = (List<JSONObject>) jsonObject.get("struct_list");
|
||||
boolean is_all = jsonObject.getBoolean("is_all");
|
||||
List<String> needStructList = needStructs.stream().map(StructAllsetDto::getStruct_code).collect(Collectors.toList());
|
||||
/**
|
||||
* 1.判断当前仓位:是否有锁定,是否是分配的货位
|
||||
* 锁定:
|
||||
* 直接跳过
|
||||
* 没锁定:
|
||||
* 1.不是分配的货位则移库
|
||||
* 2.是分配的货位则出库:并更新单据
|
||||
*/
|
||||
String taskGroup = org.nl.common.utils.IdUtil.getStringId();
|
||||
for (int i = 0; i < structs.size(); i++) {
|
||||
JSONObject item = structs.get(i);
|
||||
item.put("task_group_id",taskGroup);
|
||||
item.put("iostorinv_id",whereJson.getString("iostorinv_id"));
|
||||
item.put("sort_seq",i);
|
||||
item.put("point_code",point_code);
|
||||
item.put("point_id",jsonPoint2.getString("point_id"));
|
||||
String structCode = item.getString("struct_code");
|
||||
if (CollectionUtils.isEmpty(needStructList)){
|
||||
break;
|
||||
}
|
||||
if (needStructList.contains(structCode)){
|
||||
//出库
|
||||
checkOutBillService.createOut(item);
|
||||
needStructList.remove(structCode);
|
||||
}else {
|
||||
//移库:如果当前存在业务锁定则说明存在相关任务,不需要移库,直接跳过
|
||||
if (!item.getString("lock_type").equals(IOSEnum.LOCK_TYPE.code("未锁定"))){
|
||||
continue;
|
||||
if (is_all) {
|
||||
List<String> all_struct = new ArrayList<>(structs.size());
|
||||
HashMap<String, JSONObject> struct_map = new HashMap<>(structs.size());
|
||||
structs.forEach(struct -> {
|
||||
all_struct.add(struct.getString("struct_code"));
|
||||
struct_map.put(struct.getString("struct_code"), struct);
|
||||
});
|
||||
List<String> move_list = moveBoxes(needStructList, all_struct);
|
||||
String taskGroup = org.nl.common.utils.IdUtil.getStringId();
|
||||
for (int i = 0; i < move_list.size(); i++) {
|
||||
String goal_struct = move_list.get(i);
|
||||
JSONObject item = struct_map.get(goal_struct);
|
||||
item.put("task_group_id", taskGroup);
|
||||
item.put("iostorinv_id", whereJson.getString("iostorinv_id"));
|
||||
item.put("sort_seq", i);
|
||||
item.put("point_code", point_code);
|
||||
item.put("point_id", jsonPoint2.getString("point_id"));
|
||||
String structCode = item.getString("struct_code");
|
||||
if (CollectionUtils.isEmpty(needStructList)) {
|
||||
break;
|
||||
}
|
||||
if (needStructList.contains(structCode)) {
|
||||
//出库
|
||||
checkOutBillService.createOut(item);
|
||||
needStructList.remove(structCode);
|
||||
} else {
|
||||
//移库:如果当前存在业务锁定则说明存在相关任务,不需要移库,直接跳过
|
||||
if (!item.getString("lock_type").equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
|
||||
continue;
|
||||
}
|
||||
checkOutBillService.createMove(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code,storagevehicle_code
|
||||
/**
|
||||
* 1.判断当前仓位:是否有锁定,是否是分配的货位
|
||||
* 锁定:
|
||||
* 直接跳过
|
||||
* 没锁定:
|
||||
* 1.不是分配的货位则移库
|
||||
* 2.是分配的货位则出库:并更新单据
|
||||
*/
|
||||
String taskGroup = org.nl.common.utils.IdUtil.getStringId();
|
||||
for (int i = 0; i < structs.size(); i++) {
|
||||
JSONObject item = structs.get(i);
|
||||
item.put("task_group_id", taskGroup);
|
||||
item.put("iostorinv_id", whereJson.getString("iostorinv_id"));
|
||||
item.put("sort_seq", i);
|
||||
item.put("point_code", point_code);
|
||||
item.put("point_id", jsonPoint2.getString("point_id"));
|
||||
String structCode = item.getString("struct_code");
|
||||
if (CollectionUtils.isEmpty(needStructList)) {
|
||||
break;
|
||||
}
|
||||
if (needStructList.contains(structCode)) {
|
||||
//出库
|
||||
checkOutBillService.createOut(item);
|
||||
needStructList.remove(structCode);
|
||||
} else {
|
||||
//移库:如果当前存在业务锁定则说明存在相关任务,不需要移库,直接跳过
|
||||
if (!item.getString("lock_type").equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
|
||||
continue;
|
||||
}
|
||||
checkOutBillService.createMove(item);
|
||||
}
|
||||
checkOutBillService.createMove(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
private void 锁单判断(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right,String invId) {
|
||||
HashMap param = MapOf.of("invId",invId,"flag", "51", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
|
||||
private void 锁单判断(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right, String invId) {
|
||||
HashMap param = MapOf.of("invId", invId, "flag", "51", "sect_id", left.getSect_id(), "block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONArray allLock = WQL.getWO("ST_OUTIVT04").addParamMap(param).process().getResultJSONArray(0);
|
||||
List<JSONObject> hasLock = this.isNumList(allLock);
|
||||
if (!ObjectUtil.isEmpty(hasLock)){
|
||||
if (!ObjectUtil.isEmpty(hasLock)) {
|
||||
String error = hasLock.stream()
|
||||
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code"))
|
||||
.collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private List<JSONObject> 左右出库确认(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right,String invId) {
|
||||
public static List<String> moveBoxes(List<String> toRemove, List<String> allBoxes) {
|
||||
// 边界检查:所有箱子列表不能为空
|
||||
if (allBoxes == null || allBoxes.isEmpty()) {
|
||||
throw new BadRequestException("所有箱子列表不能为空");
|
||||
}
|
||||
|
||||
// 处理需要搬出的箱子列表为null的情况(视为无需要搬出的箱子)
|
||||
List<String> safeToRemove = (toRemove == null) ? new ArrayList<>() : toRemove;
|
||||
|
||||
// 用HashSet存储需要搬出的箱子,提高查询效率(O(1)复杂度)
|
||||
Set<String> toRemoveSet = new HashSet<>(safeToRemove.size());
|
||||
toRemoveSet.addAll(safeToRemove);
|
||||
|
||||
int totalBoxes = allBoxes.size();
|
||||
int maxKeepLength = 0; // 最长连续保留序列的长度
|
||||
int bestKeepStart = 0; // 最长连续保留序列的起始索引
|
||||
int bestKeepEnd = -1; // 最长连续保留序列的结束索引
|
||||
int currentKeepStart = 0; // 当前连续保留序列的起始索引
|
||||
int currentKeepLength = 0; // 当前连续保留序列的长度
|
||||
|
||||
// 遍历所有箱子,寻找最长的连续保留序列
|
||||
for (int i = 0; i < totalBoxes; i++) {
|
||||
String currentBox = allBoxes.get(i);
|
||||
// 判断当前箱子是否需要保留(不在需要搬出的集合中)
|
||||
boolean needKeep = !toRemoveSet.contains(currentBox);
|
||||
|
||||
if (needKeep) {
|
||||
// 若当前是新的连续保留序列起点,记录起始索引
|
||||
if (currentKeepLength == 0) {
|
||||
currentKeepStart = i;
|
||||
}
|
||||
currentKeepLength++;
|
||||
} else {
|
||||
// 遇到需要搬出的箱子,检查当前连续保留序列是否为最长
|
||||
if (currentKeepLength > maxKeepLength) {
|
||||
maxKeepLength = currentKeepLength;
|
||||
bestKeepStart = currentKeepStart;
|
||||
bestKeepEnd = i - 1;
|
||||
}
|
||||
// 重置当前连续保留序列
|
||||
currentKeepLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查循环结束后是否有未处理的最长连续保留序列(可能在列表末尾)
|
||||
if (currentKeepLength > maxKeepLength) {
|
||||
maxKeepLength = currentKeepLength;
|
||||
bestKeepStart = currentKeepStart;
|
||||
bestKeepEnd = totalBoxes - 1;
|
||||
}
|
||||
|
||||
// 计算需要搬运的箱子数量并预分配集合容量
|
||||
int leftMoveCount = bestKeepStart; // 最长保留序列左侧需要搬运的数量
|
||||
int rightMoveCount = (totalBoxes - 1) - bestKeepEnd; // 右侧需要搬运的数量
|
||||
List<String> moveOrder = new ArrayList<>(leftMoveCount + rightMoveCount);
|
||||
|
||||
// 添加左侧需要搬运的箱子(按原有顺序)
|
||||
for (int i = 0; i < bestKeepStart; i++) {
|
||||
moveOrder.add(allBoxes.get(i));
|
||||
}
|
||||
|
||||
// 添加右侧需要搬运的箱子(从右向左,减少移动距离)
|
||||
for (int i = totalBoxes - 1; i > bestKeepEnd; i--) {
|
||||
moveOrder.add(allBoxes.get(i));
|
||||
}
|
||||
System.out.println("搬运顺序: " + moveOrder);
|
||||
return moveOrder;
|
||||
}
|
||||
|
||||
private JSONObject 左右出库确认(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right, String invId) {
|
||||
/**
|
||||
* 1.查询当前排被锁住的货位集合
|
||||
* 2.过滤仓位没有没有被其他单据锁定的货位
|
||||
@@ -3334,39 +3444,40 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
* 5.根据哪边出库查询当前排货位出库顺序
|
||||
*/
|
||||
String placementType = left.getPlacement_type();
|
||||
boolean is_all = false;
|
||||
//查询当前排
|
||||
//lock_type('2','3','6','7')
|
||||
// 查询仓位被锁住的货位
|
||||
HashMap param = MapOf.of("invId",invId,"flag", "51", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
HashMap param = MapOf.of("invId", invId, "flag", "51", "sect_id", left.getSect_id(), "block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONArray allLock = WQL.getWO("ST_OUTIVT04").addParamMap(param).process().getResultJSONArray(0);
|
||||
List<JSONObject> hasLock = this.isNumList(allLock);
|
||||
|
||||
String option;
|
||||
//如果货位有锁定则需要判断左右
|
||||
//口回口口回口*口口 <--->
|
||||
if (!ObjectUtil.isEmpty(hasLock)){
|
||||
if (!ObjectUtil.isEmpty(hasLock)) {
|
||||
List<String> rightLock = hasLock.stream().filter(item ->
|
||||
item.getInteger("out_order_seq") >= Integer.valueOf(left.getOut_order_seq()))
|
||||
.map(a->"仓位"+a.getString("struct_code")+"锁定单据"+a.getString("inv_code")).collect(Collectors.toList());
|
||||
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code")).collect(Collectors.toList());
|
||||
List<String> leftLock = hasLock.stream().filter(item ->
|
||||
item.getInteger("out_order_seq") < Integer.valueOf(right.getOut_order_seq()))
|
||||
.map(a->"仓位"+a.getString("struct_code")+"锁定单据"+a.getString("inv_code")).collect(Collectors.toList());
|
||||
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code")).collect(Collectors.toList());
|
||||
//如果锁定货位存在则判断左右通
|
||||
if (StringUtils.equals(placementType,"03")){
|
||||
if (StringUtils.equals(placementType, "03")) {
|
||||
//右通:获取最左边仓位对应锁定的仓位
|
||||
if (!ObjectUtil.isEmpty(rightLock)){
|
||||
if (!ObjectUtil.isEmpty(rightLock)) {
|
||||
String error = rightLock.stream().collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
}
|
||||
option = "03";
|
||||
}else if (StringUtils.equals(placementType,"02")){
|
||||
} else if (StringUtils.equals(placementType, "02")) {
|
||||
//左通:获取最右边仓位对应锁定的仓位
|
||||
if (!ObjectUtil.isEmpty(leftLock)){
|
||||
if (!ObjectUtil.isEmpty(leftLock)) {
|
||||
String error = leftLock.stream().collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
}
|
||||
option = "02";
|
||||
}else {
|
||||
} else {
|
||||
//双通
|
||||
String error = hasLock.stream()
|
||||
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code"))
|
||||
@@ -3382,31 +3493,35 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
// }
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//如果没有锁定这确认从左边出还是右边出库
|
||||
if (StringUtils.equals(placementType,"01")){
|
||||
if (StringUtils.equals(placementType, "01")) {
|
||||
//确认那边少出哪边-
|
||||
//查询当前排最大order
|
||||
//口回口口回口*口口
|
||||
HashMap maxParam = MapOf.of("flag", "52", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
is_all = true;
|
||||
HashMap maxParam = MapOf.of("flag", "52", "sect_id", left.getSect_id(), "block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONObject result = WQL.getWO("ST_OUTIVT04").addParamMap(maxParam).process().uniqueResult(0);
|
||||
Integer maxSeq = result.getInteger("maxseq");
|
||||
Integer minSeq = result.getInteger("minseq");
|
||||
int leftVe = Integer.valueOf(left.getOut_order_seq()) - minSeq;
|
||||
int rightVe = maxSeq - Integer.valueOf(right.getOut_order_seq());
|
||||
option = leftVe>rightVe?"02":"03";
|
||||
}else {
|
||||
option = leftVe > rightVe ? "02" : "03";
|
||||
} else {
|
||||
option = placementType;
|
||||
}
|
||||
}
|
||||
//option确认了左边出库还是右边出库03右边,02左边
|
||||
String orderBy = "order by out_order_seq "+(option.equals("03")?"asc":"desc");
|
||||
HashMap structParam = MapOf.of("flag", "53", "order_by",orderBy,"sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
return WQL.getWO("ST_OUTIVT04").addParamMap(structParam).process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
String orderBy = "order by out_order_seq " + (option.equals("03") ? "asc" : "desc");
|
||||
HashMap structParam = MapOf.of("flag", "53", "order_by", orderBy, "sect_id", left.getSect_id(), "block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("is_all", is_all);
|
||||
json.put("struct_list", WQL.getWO("ST_OUTIVT04").addParamMap(structParam).process().getResultJSONArray(0).toJavaList(JSONObject.class));
|
||||
return json;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void createMove(JSONObject struct){
|
||||
public void createMove(JSONObject struct) {
|
||||
//attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code
|
||||
JSONObject json = WQLObject.getWQLObject("st_ivt_structattr").query("struct_code = '" + struct.getString("struct_code") + "'").uniqueResult(0);
|
||||
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
|
||||
@@ -3471,7 +3586,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("material_id", form.getString("material_id"));
|
||||
json.put("task_group_id", form.getString("task_group_id"));
|
||||
json.put("sort_seq", form.getString("sort_seq")+1);
|
||||
json.put("sort_seq", form.getString("sort_seq") + 1);
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("handle_class", HandMoveStorAcsTask.class.getName());
|
||||
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
@@ -3487,11 +3602,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
handMoveStorService.insertDtl2(mapParam);
|
||||
moveStorAcsTask.immediateNotifyAcs(json.getString("task_id"));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void createOut(JSONObject struct){
|
||||
public void createOut(JSONObject struct) {
|
||||
List<StIvtIostorinvdis> list = iStIvtIostorinvdisService
|
||||
.list(new QueryWrapper<StIvtIostorinvdis>()
|
||||
.eq("iostorinv_id",struct.getString("iostorinv_id"))
|
||||
.eq("iostorinv_id", struct.getString("iostorinv_id"))
|
||||
.eq("box_no", struct.getString("storagevehicle_code")));
|
||||
StIvtIostorinvdis oneDis = list.get(0);
|
||||
// 创建任务
|
||||
@@ -3505,18 +3621,19 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
param.put("material_id", oneDis.getMaterial_id());
|
||||
// 更新出库任务:任务组和顺序号
|
||||
param.put("task_group_id", struct.getString("task_group_id")); // 任务组
|
||||
param.put("sort_seq", struct.getIntValue("sort_seq")+1); // 任务组顺序号
|
||||
param.put("sort_seq", struct.getIntValue("sort_seq") + 1); // 任务组顺序号
|
||||
String create_task_id = outTask.createTask(param);
|
||||
//批量更细分配明细
|
||||
List<Long> disIds = list.stream().map(StIvtIostorinvdis::getIostorinvdis_id).collect(Collectors.toList());
|
||||
iStIvtIostorinvdisService.update(new UpdateWrapper<StIvtIostorinvdis>()
|
||||
.set("work_status","01")
|
||||
.set("task_id",create_task_id)
|
||||
.set("point_id",struct.getString("id"))
|
||||
.eq("work_status","00")
|
||||
.in("iostorinvdis_id",disIds));
|
||||
.set("work_status", "01")
|
||||
.set("task_id", create_task_id)
|
||||
.set("point_id", struct.getString("id"))
|
||||
.eq("work_status", "00")
|
||||
.in("iostorinvdis_id", disIds));
|
||||
outTask.immediateNotifyAcs(create_task_id);
|
||||
}
|
||||
|
||||
public void formeth(Consumer<String> allTransactionConsumer, JSONArray allRowArr, String iostorinv_id, String point_code, boolean checked, String iostorinvdtl_id, JSONObject jsonPoint2) {
|
||||
for (int i = 0; i < allRowArr.size(); i++) {
|
||||
// 调用当前排处理方法
|
||||
@@ -3615,7 +3732,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -3649,7 +3766,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -3683,7 +3800,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -3720,7 +3837,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定请等待下发任务并等待任务完成");
|
||||
@@ -3754,7 +3871,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定请等待下发任务并等待任务完成");
|
||||
@@ -4075,7 +4192,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -4107,7 +4224,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -4139,7 +4256,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定且未下发任务,无法生成任务!");
|
||||
@@ -4173,7 +4290,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定请等待下发任务并等待任务完成");
|
||||
@@ -4204,7 +4321,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
for (int k = 0; k < numArr.size(); k++) {
|
||||
JSONObject json = numArr.getJSONObject(k);
|
||||
error += json.getString("struct_code") + ", 锁定单据号:"+json.getString("inv_code");
|
||||
error += json.getString("struct_code") + ", 锁定单据号:" + json.getString("inv_code");
|
||||
}
|
||||
|
||||
throw new BadRequestException("仓位:" + error + "被锁定请等待下发任务并等待任务完成!");
|
||||
@@ -4560,6 +4677,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<JSONObject> isNumList(JSONArray arr) {
|
||||
StringJoiner joiner = new StringJoiner(",", "(", ")");
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
@@ -5124,12 +5242,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (jo_mst.getString("bill_type").equals("1011")) {
|
||||
// 更新子卷包装净重
|
||||
double net_weight = NumberUtil.sub(jsonSub.getDoubleValue("net_weight"), plan_qty);
|
||||
jsonSub.put("net_weight",net_weight);
|
||||
jsonSub.put("net_weight", net_weight);
|
||||
|
||||
if (net_weight <= 0) {
|
||||
jsonSub.put("status","3");
|
||||
jsonSub.put("status", "3");
|
||||
} else {
|
||||
jsonSub.put("status","2");
|
||||
jsonSub.put("status", "2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5162,7 +5280,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (is_zero) {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
} else {
|
||||
from_start.put("bill_type","1011");
|
||||
from_start.put("bill_type", "1011");
|
||||
from_start.put("storagevehicle_code", jsonSub.getString("package_box_sn"));
|
||||
}
|
||||
}
|
||||
@@ -5271,7 +5389,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
//插入分配表
|
||||
dis_wql.insert(dis_row);
|
||||
|
||||
total_qty = NumberUtil.add(total_qty,dis_row.getDoubleValue("plan_qty"));
|
||||
total_qty = NumberUtil.add(total_qty, dis_row.getDoubleValue("plan_qty"));
|
||||
|
||||
//将包装关系中对应的记录状态改为包装
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
@@ -5756,12 +5874,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (jo_mst.getString("bill_type").equals("1011")) {
|
||||
// 更新子卷包装净重
|
||||
double net_weight = NumberUtil.sub(jsonSub.getDoubleValue("net_weight"), plan_qty);
|
||||
jsonSub.put("net_weight",net_weight);
|
||||
jsonSub.put("net_weight", net_weight);
|
||||
|
||||
if (net_weight <= 0) {
|
||||
jsonSub.put("status","3");
|
||||
jsonSub.put("status", "3");
|
||||
} else {
|
||||
jsonSub.put("status","2");
|
||||
jsonSub.put("status", "2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5794,7 +5912,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (is_zero) {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
} else {
|
||||
from_start.put("bill_type","1011");
|
||||
from_start.put("bill_type", "1011");
|
||||
from_start.put("storagevehicle_code", jsonSub.getString("package_box_sn"));
|
||||
}
|
||||
}
|
||||
@@ -5903,7 +6021,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
//插入分配表
|
||||
dis_wql.insert(dis_row);
|
||||
|
||||
total_qty = NumberUtil.add(total_qty,dis_row.getDoubleValue("plan_qty"));
|
||||
total_qty = NumberUtil.add(total_qty, dis_row.getDoubleValue("plan_qty"));
|
||||
|
||||
//将包装关系中对应的记录状态改为包装
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
@@ -6073,12 +6191,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (jo_mst.getString("bill_type").equals("1011")) {
|
||||
// 更新子卷包装净重
|
||||
double net_weight = NumberUtil.sub(jsonSub.getDoubleValue("net_weight"), plan_qty);
|
||||
jsonSub.put("net_weight",net_weight);
|
||||
jsonSub.put("net_weight", net_weight);
|
||||
|
||||
if (net_weight <= 0) {
|
||||
jsonSub.put("status","3");
|
||||
jsonSub.put("status", "3");
|
||||
} else {
|
||||
jsonSub.put("status","2");
|
||||
jsonSub.put("status", "2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6089,10 +6207,10 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
//如果为返检出库或者改切出库删除对应的包装关系
|
||||
JSONArray dis_rows = new JSONArray();
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0' and box_no = '"+jsonSub.getString("package_box_sn")+"'").getResultJSONArray(0);
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0' and box_no = '" + jsonSub.getString("package_box_sn") + "'").getResultJSONArray(0);
|
||||
} else {
|
||||
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and box_no = '"+jsonSub.getString("package_box_sn")+"'").getResultJSONArray(0);
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and box_no = '" + jsonSub.getString("package_box_sn") + "'").getResultJSONArray(0);
|
||||
}
|
||||
|
||||
for (int j = 0; j < dis_rows.size(); j++) {
|
||||
@@ -6142,7 +6260,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (is_zero) {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
} else {
|
||||
from_start.put("bill_type","1011");
|
||||
from_start.put("bill_type", "1011");
|
||||
from_start.put("storagevehicle_code", jsonSub.getString("package_box_sn"));
|
||||
}
|
||||
}
|
||||
@@ -6463,13 +6581,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
shd_dtl_num = jsonCust.getIntValue("shd_dtl_num");
|
||||
if (ObjectUtil.isEmpty(shd_dtl_num)) {
|
||||
throw new BadRequestException("客户编码:"+cust_code+",送货单明细数未配置,请先去配置!");
|
||||
throw new BadRequestException("客户编码:" + cust_code + ",送货单明细数未配置,请先去配置!");
|
||||
}
|
||||
//1.根据出入库主表中 收货单位 查询客户表中的模板路径
|
||||
code_template = jsonCust.getString("shd_print_no");
|
||||
|
||||
if (StrUtil.isEmpty(code_template)) {
|
||||
throw new BadRequestException("客户编码:"+cust_code+",送货单打印模板号未配置,请先去配置!");
|
||||
throw new BadRequestException("客户编码:" + cust_code + ",送货单打印模板号未配置,请先去配置!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6582,7 +6700,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
ExcelWriter workBook = EasyExcel.write(outputStream, null).withTemplate(code_template).build();
|
||||
|
||||
oneMap.put("all_qty", NumberUtil.round(all_qty, 1)); // 合计
|
||||
oneMap.put("all_real", NumberUtil.round(all_real,1)); // 总毛重
|
||||
oneMap.put("all_real", NumberUtil.round(all_real, 1)); // 总毛重
|
||||
workBook.fill(oneMap, sheet);
|
||||
workBook.fill(new FillWrapper("data", flData), sheet);
|
||||
workBook.finish();
|
||||
@@ -6646,7 +6764,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// 订单号
|
||||
ExcelWriter workBook = EasyExcel.write(outputStream, null).withTemplate(code_template).build();
|
||||
oneMap.put("all_qty", NumberUtil.round(all_qty, 1)); // 合计
|
||||
oneMap.put("all_real", NumberUtil.round(all_real,1)); // 总毛重
|
||||
oneMap.put("all_real", NumberUtil.round(all_real, 1)); // 总毛重
|
||||
WriteSheet sheet = EasyExcel.writerSheet(0).build();
|
||||
workBook.fill(oneMap, sheet);
|
||||
workBook.fill(new FillWrapper("data", flData), sheet);
|
||||
|
||||
Reference in New Issue
Block a user