merge:合并一期代码到当前分支

This commit is contained in:
zhouz
2025-11-27 16:10:34 +08:00
42 changed files with 845 additions and 302 deletions

View File

@@ -1,18 +1,15 @@
package org.nl.b_lms.pdm.info.dao;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
* 子卷下线记录表
@@ -166,6 +163,16 @@ public class PdmBiContainerinfo implements Serializable {
*/
private String standard_limit;
/**
* 客户需求抗拉上限
*/
private String demand_up;
/**
* 内控标准抗拉上限
*/
private String standard_up;
/**
* 生产实际抗拉值
*/

View File

@@ -230,8 +230,8 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
*/
StIvtIostorinv mstDao = this.getById(whereJson.getLongValue("iostorinv_id"));
/*// 如果是发货出库则判断运费和物流公司不能为空
if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("发货出库"))) {
// 如果是发货出库则判断运费和物流公司不能为空
/*if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("发货出库"))) {
if (ObjectUtil.isEmpty(mstDao.getTrans_code())) {
throw new BadRequestException("物流公司不能为空!");
@@ -329,8 +329,8 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
public void manualDiv(JSONObject whereJson) {
StIvtIostorinv mstDao = this.getById(whereJson.getJSONObject("row").getString("iostorinv_id"));
/*// 如果是发货出库则判断运费和物流公司不能为空
if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("发货出库"))) {
// 如果是发货出库则判断运费和物流公司不能为空
/*if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("发货出库"))) {
if (ObjectUtil.isEmpty(mstDao.getTrans_code())) {
throw new BadRequestException("物流公司不能为空!");

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.SneakyThrows;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
@@ -16,6 +17,7 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlServi
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.impl.StIvtIostorinvServiceImpl;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.TwoInBussManageService;
@@ -29,6 +31,8 @@ import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.service.HandMoveStorService;
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -37,6 +41,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@@ -99,6 +104,9 @@ public class OutBussManageServiceImpl implements OutBussManageService {
@Autowired
private TwoInBussManageService twoInBussManageService;
@Autowired
private RedissonClient redissonClient;
@Override
@Transactional
public void lockStruct(List<String> param, JSONObject json) {
@@ -175,7 +183,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
updateIvtList.addAll(likeBoxList);
// 添加生成分配明细
List<StIvtIostorinvdis> disDaoList= divDisParam(likeBoxList, dtlDao);
List<StIvtIostorinvdis> disDaoList = divDisParam(likeBoxList, dtlDao);
resultDisList.addAll(disDaoList);
}
@@ -206,7 +214,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
updateIvtList.addAll(likePcsnBoxList);
// 添加生成分配明细
List<StIvtIostorinvdis> disDaoList= divDisParam(likePcsnBoxList, dtlDao);
List<StIvtIostorinvdis> disDaoList = divDisParam(likePcsnBoxList, dtlDao);
resultDisList.addAll(disDaoList);
}
@@ -234,12 +242,12 @@ public class OutBussManageServiceImpl implements OutBussManageService {
.reduce(BigDecimal.ZERO, BigDecimal::add)
.doubleValue();
dtlDao.setAssign_qty(NumberUtil.add(dtlDao.getAssign_qty(),canuse_qty));
dtlDao.setAssign_qty(NumberUtil.add(dtlDao.getAssign_qty(), canuse_qty));
// 减未分配数量
dtlDao.setUnassign_qty(NumberUtil.sub(dtlDao.getUnassign_qty(), canuse_qty));
if (dtlDao.getUnassign_qty().doubleValue() <= 0 ) {
if (dtlDao.getUnassign_qty().doubleValue() <= 0) {
dtlDao.setUnassign_qty(BigDecimal.valueOf(0));
}
@@ -256,11 +264,12 @@ public class OutBussManageServiceImpl implements OutBussManageService {
/**
* 准备插入分配明细的参数
*
* @param likeBoxList 相同木箱的库存
* @param dtlDao 明细对象
* @param dtlDao 明细对象
* @return List<StIvtIostorinvdis> 分配明细对象集合
*/
private List<StIvtIostorinvdis> divDisParam(List<JSONObject> likeBoxList, StIvtIostorinvdtl dtlDao) {
private List<StIvtIostorinvdis> divDisParam(List<JSONObject> likeBoxList, StIvtIostorinvdtl dtlDao) {
List<StIvtIostorinvdis> resultDisList = new ArrayList<>();
@@ -436,7 +445,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
moveParam.put("height", height);
moveParam.put("vehicle_type", boxDao.getVehicle_type());
// 移库巷道
moveParam.put("move_block_num",json.getString("block_num"));
moveParam.put("move_block_num", json.getString("block_num"));
// TODO JSONObject jsonMove = inBussManageService.getOneStruct(moveParam);
JSONObject jsonMove = twoInBussManageService.getOneStruct(moveParam);
@@ -474,7 +483,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonVeExt = extTab.query("pcsn = '" + json.getString("storagevehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVeExt)) {
throw new BadRequestException("此木箱没有绑定托盘号!"+json.getString("storagevehicle_code"));
throw new BadRequestException("此木箱没有绑定托盘号!" + json.getString("storagevehicle_code"));
}
// 生成任务
@@ -503,35 +512,49 @@ public class OutBussManageServiceImpl implements OutBussManageService {
}
@Override
@SneakyThrows
public void createMove2(List<JSONObject> list) {
//子卷包装关系表
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
//物料表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
// 获取子卷包装集合
String vehilcle_in = list.stream()
.map(row -> row.getString("storagevehicle_code"))
.collect(Collectors.joining("','"));
RLock lock = redissonClient.getLock(StIvtIostorinvServiceImpl.class.getName());
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {
//子卷包装关系表
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
//物料表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
// 获取子卷包装集合
String vehilcle_in = list.stream()
.map(row -> row.getString("storagevehicle_code"))
.collect(Collectors.joining("','"));
List<JSONObject> subList = subTab.query("package_box_sn IN ('" + vehilcle_in + "')")
.getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询物料集合
String materialCode_in = subList.stream()
.map(row -> row.getString("product_name"))
.collect(Collectors.joining("','"));
List<JSONObject> materList = materTab.query("material_code IN ('" + materialCode_in + "')")
.getResultJSONArray(0).toJavaList(JSONObject.class);
OutBussManageService myService = SpringContextHolder.getBean(OutBussManageService.class);
for (int i = 0; i < list.size(); i++) {
JSONObject json = list.get(i);
myService.createForMove(json,subList,materList);
List<JSONObject> subList = subTab.query("package_box_sn IN ('" + vehilcle_in + "')")
.getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询物料集合
String materialCode_in = subList.stream()
.map(row -> row.getString("product_name"))
.collect(Collectors.joining("','"));
List<JSONObject> materList = materTab.query("material_code IN ('" + materialCode_in + "')")
.getResultJSONArray(0).toJavaList(JSONObject.class);
OutBussManageService myService = SpringContextHolder.getBean(OutBussManageService.class);
for (int i = 0; i < list.size(); i++) {
JSONObject json = list.get(i);
myService.createForMove(json, subList, materList);
}
} else {
throw new BadRequestException("有单据正在分配中,请稍后在试");
}
} finally {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
/**
* 移库事务处理
* @param json 移库仓位个体
* @param subList 子卷包装关系集合
*
* @param json 移库仓位个体
* @param subList 子卷包装关系集合
* @param materList 物料集合
*/
@Transactional
@@ -588,7 +611,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
moveParam.put("height", height);
moveParam.put("vehicle_type", boxDao.getVehicle_type());
// 移库巷道
moveParam.put("move_block_num",json.getString("block_num"));
moveParam.put("move_block_num", json.getString("block_num"));
// TODO JSONObject jsonMove = inBussManageService.getOneStruct(moveParam);
JSONObject jsonMove = twoInBussManageService.getOneStruct(moveParam);
@@ -626,7 +649,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonVeExt = extTab.query("pcsn = '" + json.getString("storagevehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVeExt)) {
throw new BadRequestException("此木箱没有绑定托盘号!"+json.getString("storagevehicle_code"));
throw new BadRequestException("此木箱没有绑定托盘号!" + json.getString("storagevehicle_code"));
}
// 生成任务
@@ -734,7 +757,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
moveParam.put("height", height);
moveParam.put("vehicle_type", boxDao.getVehicle_type());
// 移库巷道
moveParam.put("move_block_num",json.getString("block_num"));
moveParam.put("move_block_num", json.getString("block_num"));
// TODO JSONObject jsonMove = inBussManageService.getOneStruct(moveParam);
JSONObject jsonMove = twoInBussManageService.getOneStruct(moveParam);
@@ -772,7 +795,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonVeExt = extTab.query("pcsn = '" + json.getString("storagevehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVeExt)) {
throw new BadRequestException("此木箱没有绑定托盘号!"+json.getString("storagevehicle_code"));
throw new BadRequestException("此木箱没有绑定托盘号!" + json.getString("storagevehicle_code"));
}
// 生成任务
@@ -832,6 +855,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
/**
* 异常出库转库任务
*
* @param jsonObject {task_code : 任务编码}
* @return JSONObject 仓位对象
*/
@@ -858,7 +882,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonSub = subTab.query("package_box_sn = '" + taskDao.getVehicle_code() + "'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonSub.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料编码【"+jsonSub.getString("product_name")+"】信息不存在!");
throw new BadRequestException("物料编码【" + jsonSub.getString("product_name") + "】信息不存在!");
}
// 1.更新原仓位为满入异常锁
@@ -890,7 +914,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
.eq(BstIvtBoxinfo::getBox_no, taskDao.getVehicle_code())
);
if (ObjectUtil.isEmpty(boxDao)) {
throw new BadRequestException("木箱号为【"+taskDao.getVehicle_code()+"】的木箱信息不存在!");
throw new BadRequestException("木箱号为【" + taskDao.getVehicle_code() + "】的木箱信息不存在!");
}
String box_high = boxDao.getBox_high();
@@ -905,15 +929,15 @@ public class OutBussManageServiceImpl implements OutBussManageService {
moveParam.put("height", height);
moveParam.put("vehicle_type", boxDao.getVehicle_type());
// 移库巷道
moveParam.put("move_block_num",jsonPoint.getString("block_num"));
moveParam.put("move_block_num", jsonPoint.getString("block_num"));
// TODO JSONObject jsonMove = inBussManageService.getOneStruct(moveParam);
JSONObject jsonMove = twoInBussManageService.getOneStruct(moveParam);
if (ObjectUtil.isEmpty(jsonMove)) {
throw new BadRequestException("当前【"+jsonPoint.getString("block_num")+"】号巷道没有可用仓位!");
throw new BadRequestException("当前【" + jsonPoint.getString("block_num") + "】号巷道没有可用仓位!");
}
// 更新新仓位状态
jsonMove.put("lock_type",IOSEnum.LOCK_TYPE.code("出库异常锁"));
jsonMove.put("lock_type", IOSEnum.LOCK_TYPE.code("出库异常锁"));
jsonMove.put("inv_code", taskDao.getVehicle_code());
attrTab.update(jsonMove);
@@ -927,6 +951,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
/**
* 正常出库转库任务
*
* @param jsonObject {task_code : 任务编码}
* @return JSONObject 仓位对象
*/
@@ -959,14 +984,14 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonMoveMst = moveMstTab.query("moveinv_id = '" + jsonMoveDtl.getString("moveinv_id") + "' AND bill_status <> '99'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMoveMst)) {
throw new BadRequestException("未找到任务号为【"+taskDao.getTask_code()+"】的移库单,请检查数据!");
throw new BadRequestException("未找到任务号为【" + taskDao.getTask_code() + "】的移库单,请检查数据!");
}
// 查询物料信息
JSONObject jsonSub = subTab.query("package_box_sn = '" + taskDao.getVehicle_code() + "'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonSub.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料编码【"+jsonSub.getString("product_name")+"】信息不存在!");
throw new BadRequestException("物料编码【" + jsonSub.getString("product_name") + "】信息不存在!");
}
// 标记原货位为货位异常锁-并更新库存
@@ -1012,7 +1037,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
.eq(BstIvtBoxinfo::getBox_no, taskDao.getVehicle_code())
);
if (ObjectUtil.isEmpty(boxDao)) {
throw new BadRequestException("木箱号为【"+taskDao.getVehicle_code()+"】的木箱信息不存在!");
throw new BadRequestException("木箱号为【" + taskDao.getVehicle_code() + "】的木箱信息不存在!");
}
String box_high = boxDao.getBox_high();
@@ -1027,11 +1052,11 @@ public class OutBussManageServiceImpl implements OutBussManageService {
moveParam.put("height", height);
moveParam.put("vehicle_type", boxDao.getVehicle_type());
// 移库巷道
moveParam.put("move_block_num",jsonAttr.getString("block_num"));
moveParam.put("move_block_num", jsonAttr.getString("block_num"));
// TODO JSONObject jsonMove = inBussManageService.getOneStruct(moveParam);
JSONObject jsonMove = twoInBussManageService.getOneStruct(moveParam);
if (ObjectUtil.isEmpty(jsonMove)) {
throw new BadRequestException("当前【"+jsonAttr.getString("block_num")+"】号巷道没有可用仓位!");
throw new BadRequestException("当前【" + jsonAttr.getString("block_num") + "】号巷道没有可用仓位!");
}
// 更新新移入货位锁类型,更新库存
@@ -1045,7 +1070,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
jsonParam2.put("bill_code", jsonMoveMst.getString("bill_code"));
jsonParam2.put("bill_type_scode", jsonMoveMst.getString("bill_code"));
jsonParam2.put("qty_unit_id", jsonMoveDtl.getString("qty_unit_id"));
storPublicService.IOStor(jsonParam2, IOSEnum.IVT_CHANGE.code("加待入"));
storPublicService.IOStor(jsonParam2, IOSEnum.IVT_CHANGE.code("加待入"));
jsonMove.put("lock_type", IOSEnum.LOCK_TYPE.code("移入锁"));
attrTab.update(jsonMove);

View File

@@ -32,7 +32,7 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '1' and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
@@ -80,7 +80,7 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '1' and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
@@ -127,7 +127,7 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '1' and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
@@ -174,7 +174,7 @@ public class AutoRiKuServiceImpl implements AutoRiKuService {
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01','FTD01') and is_used = '1' and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");

View File

@@ -1,12 +1,11 @@
package org.nl.start;
import cn.hutool.core.date.DateUtil;
import org.nl.common.utils.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.IdUtil;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@@ -106,7 +105,7 @@ public class Init implements ApplicationRunner {
// 新增点位
JSONObject jsonPoint = new JSONObject();
jsonPoint.put("point_id",IdUtil.getLongId());
jsonPoint.put("point_id",IdUtil.getStringId());
jsonPoint.put("point_code", json.getString("struct_code"));
jsonPoint.put("point_name", json.getString("struct_name"));
jsonPoint.put("region_id", json.getString("sect_id"));
@@ -227,7 +226,7 @@ public class Init implements ApplicationRunner {
// 新增点位
JSONObject jsonPoint = new JSONObject();
jsonPoint.put("point_id",IdUtil.getLongId());
jsonPoint.put("point_id",IdUtil.getStringId());
jsonPoint.put("point_code", json.getString("struct_code"));
jsonPoint.put("point_name", json.getString("struct_name"));
jsonPoint.put("region_id", json.getString("sect_id"));
@@ -271,7 +270,7 @@ public class Init implements ApplicationRunner {
for (int i = 1; i <= 3000; i++) {
JSONObject json = new JSONObject();
json.put("struct_id", IdUtil.getLongId());
json.put("struct_id", IdUtil.getStringId());
if (i < 10) {
json.put("struct_code", "91-"+"000"+i+"-01");
@@ -315,7 +314,7 @@ public class Init implements ApplicationRunner {
// 新增点位
JSONObject jsonPoint = new JSONObject();
jsonPoint.put("point_id",IdUtil.getLongId());
jsonPoint.put("point_id",IdUtil.getStringId());
jsonPoint.put("point_code", json.getString("struct_code"));
jsonPoint.put("point_name", json.getString("struct_name"));
jsonPoint.put("region_id", json.getString("sect_id"));

View File

@@ -100,7 +100,9 @@
mater.material_code,
mater.material_name,
unit.unit_name,
region.region_name
region.region_name,
container.demand_up,
container.demand_limit
FROM
ST_IVT_StructIvt StructIvt
inner JOIN st_ivt_structattr attr ON StructIvt.struct_id = attr.struct_id
@@ -108,6 +110,7 @@
inner JOIN md_me_materialbase mater ON mater.material_id = StructIvt.material_id
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = StructIvt.qty_unit_id
LEFT JOIN SCH_BASE_Region region ON region.region_id = StructIvt.region_id
left join pdm_bi_containerinfo container on container.container_name = StructIvt.pcsn
WHERE 1 = 1
and attr.stor_id in 输入.in_stor_id
OPTION 输入.struct <> ""

View File

@@ -93,6 +93,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.swing.*;
import java.lang.reflect.Method;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@@ -970,7 +971,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject bake_jo = new JSONObject();
bake_jo.put("point_code", device_code);
bake_jo.put("option", "2");
new BakingServiceImpl().ovenInAndOut(bake_jo);
BakingServiceImpl bakingService = SpringContextHolder.getBean(BakingServiceImpl.class);
bakingService.ovenInAndOut(bake_jo);
}
} else {
throw new BadRequestException("请输入正确的任务类型!");
@@ -1351,8 +1353,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject jo = new JSONObject();
jo.put("task_type", "010606");
JSONObject tggw_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '4'").uniqueResult(0);
jo.put("task_id", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_code", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_id", IdUtil.getStringId());
jo.put("task_code", IdUtil.getStringId());
jo.put("point_code1", tggw_jo.getString("point_code"));
jo.put("point_code2", in_jo.getString("point_code"));
jo.put("product_area", product_area);

View File

@@ -154,6 +154,14 @@ public class LmsToMesController {
return new ResponseEntity<>(lmsToMesService.getInspectionResult(jo), HttpStatus.OK);
}
@PostMapping("/EditSheetApi")
@Log("LMS获取MES称重后子卷信息")
@SaIgnore
public ResponseEntity<Object> EditSheetApi(@RequestBody JSONObject jo) {
lmsToMesService.EditSheetApi(jo);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/GetChildWeightIsSamplePDA")
@Log("判断子卷是否是NG卷")
@SaIgnore

View File

@@ -187,5 +187,7 @@ public interface LmsToMesService {
JSONObject getInspectionResult(JSONObject jo);
void EditSheetApi(JSONObject jo);
JSONObject GetChildWeightIsSamplePDA(JSONObject jo);
}

View File

@@ -9,10 +9,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.nl.b_lms.pdm.info.dao.PdmBiContainerinfo;
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
import org.nl.b_lms.pdm.productSpec.service.impl.PdmProductSpecServiceImpl;
@@ -22,6 +20,7 @@ import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
import org.nl.common.enums.SpecEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
@@ -30,10 +29,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* LMS系统为客户端MES为服务端
@@ -1283,4 +1284,95 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
return result;
}
@Override
public void EditSheetApi(JSONObject jo) {
JSONObject feishu_json = new JSONObject();
feishu_json.put("app_token", "B6r1bVaHmak3xQsL8kMc9gM5nxf");
feishu_json.put("tableid", "tbluPCwWQcvOprcx");
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
String feishu_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_TIME").getValue();
LocalDateTime today8AM;
if (StrUtil.equals(feishu_time,"-")) {
// 1. 当天早上 8 点:将当前时间的时、分、秒、纳秒设为 8:00:00
today8AM = now.withHour(7)
.withMinute(59)
.withSecond(59)
.withNano(0);
} else {
String dateTimeStr = feishu_time + "T00:00:00";
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr);
today8AM =dateTime.withHour(7)
.withMinute(59)
.withSecond(59)
.withNano(0);
}
// 2. 前一天早上 8 点:当天 8 点减去 1 天
LocalDateTime yesterday8AM = today8AM.minus(1, ChronoUnit.DAYS).plusSeconds(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String begin_time = yesterday8AM.format(formatter);
String end_time = today8AM.format(formatter);
JSONArray rows = WQL.getWO("ST_IVT_INBILLQUERY").addParam("flag", "7")
.addParam("begin_time", begin_time)
.addParam("end_time", end_time)
.process().getResultJSONArray(0);
JSONArray fs_rows = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
JSONObject fs_row = new JSONObject();
fs_row.put("日期", row.getLongValue("日期"));
fs_row.put("班次", row.getString("班次"));
fs_row.put("销售订单", row.getLongValue("销售订单"));
fs_row.put("行号", row.getLongValue("行号"));
fs_row.put("业务类型", row.getString("业务类型"));
fs_row.put("客户编码", row.getLongValue("客户编码"));
fs_row.put("客户名称", row.getString("客户名称"));
fs_row.put("业务员", row.getString("业务员"));
fs_row.put("规格", row.getDoubleValue("规格"));
fs_row.put("尺寸(mm)(客户要求幅宽)", row.getDoubleValue("尺寸(mm)(客户要求幅宽)"));
fs_row.put("实际尺寸(mm)(实际幅宽)", row.getDoubleValue("实际尺寸(mm)(实际幅宽)"));
fs_row.put("木箱规格|尺寸", row.getString("木箱规格|尺寸"));
fs_row.put("毛重合计", row.getDoubleValue("毛重合计"));
fs_row.put("小卷号", row.getString("小卷号"));
fs_row.put("SAP批次号", row.getString("sap批次号"));
fs_row.put("净重(KG)", row.getDoubleValue("净重(kg)"));
fs_row.put("卷数", row.getIntValue("卷数"));
fs_row.put("品级", row.getString("品级"));
fs_row.put("箱号", row.getString("箱号"));
fs_row.put("销售订单及行号", row.getString("销售订单及行号"));
fs_row.put("母卷号", row.getString("母卷号"));
fs_row.put("基重(面密度)(g|m³)", row.getDoubleValue("基重(面密度)(g|m³)"));
fs_row.put("居中度(mm)", row.getString("居中度(mm)"));
fs_row.put("塌边(mm)", row.getString("塌边(mm)"));
fs_row.put("米数(长度)", row.getDoubleValue("米数(长度)"));
fs_row.put("管件类型", row.getString("管件类型"));
fs_row.put("管件编码", row.getLongValue("管件编码"));
fs_row.put("管件描述", row.getString("管件描述"));
fs_row.put("生产实际抗拉值", row.getDoubleValue("生产实际抗拉值"));
fs_row.put("内控标准抗拉下限", row.getDoubleValue("内控标准抗拉下限"));
fs_row.put("客户需求抗拉下限", row.getDoubleValue("客户需求抗拉下限"));
fs_row.put("生产日期", row.getLongValue("生产日期"));
fs_row.put("入库日期", row.getLongValue("入库日期"));
fs_row.put("生产区域", row.getString("生产区域"));
fs_rows.add(fs_row);
}
feishu_json.put("MsgList", fs_rows);
try {
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_INSTOR").getValue();
String api = "FeiShuNoticesWebApi/EditSheetApi";
String resultMsg = HttpRequest.post(url + api)
.body(String.valueOf(feishu_json))
.execute().body();
log.info("飞书输入参数为:-------------------" + feishu_json);
log.info("飞书输出参数为:-------------------" + resultMsg);
} catch (Exception e) {
log.info(e.getMessage());
}
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.mes.service.impl;
import cn.hutool.core.date.DateUtil;
import org.checkerframework.checker.units.qual.A;
import org.nl.common.utils.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -496,11 +497,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
mes_jo.put("iWarehouse", 2);
mes_jo.put("UserName", userName);
mes_jo.put("PassWord", passWord);
mes_jo.put("pointCode", container_jo.getString("full_point_code"));
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param);
new LmsToMesServiceImpl().momRollSemiFGInboundComplete(mes_jo);
}
//将该母卷的入冷却标识改为0
@@ -953,6 +955,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
}
String Status = param.getJSONObject(0).getString("Status");
String ResourceName = param.getJSONObject(0).getString("ResourceName");
String Attribute2 = param.getJSONObject(0).getString("Attribute2");
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("分切计划对应的分切机不存在:" + ResourceName);
@@ -1003,6 +1006,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
plan_jo.put("is_parent_ok", "1");
plan_jo.put("is_child_tz_ok", "1");
plan_jo.put("is_child_ps_ok", "1");
if (StrUtil.isNotEmpty(Attribute2)) {
plan_jo.put("foil_container_name", Attribute2);
}
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
}
} else {
@@ -1081,6 +1087,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
plan_jo.put("is_child_tz_ok", "1");
plan_jo.put("is_child_ps_ok", "1");
plan_jo.put("is_paper_ok", "2");
if (StrUtil.isNotEmpty(Attribute2)) {
plan_jo.put("foil_container_name", Attribute2);
}
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
}
}
@@ -1760,6 +1769,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject map = new JSONObject();
map.put("flag", "6");
map.put("product_area", device_jo.getString("product_area"));
map.put("point_type","1");
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
form.put("point_code4", jsonIvt.getString("empty_point_code"));
}
@@ -1852,7 +1862,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
// 插入生箔工序工单表
JSONObject json = new JSONObject();
json.put("workorder_id", IdUtil.getLongId());
json.put("foil_container_ame", FoilContainerName);
json.put("foil_container_name", FoilContainerName);
json.put("container_name", TRContainerName);
json.put("resource_name", ResourceName);
json.put("mfg_order_name", MfgOrderName);
@@ -2094,7 +2104,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
public JSONObject getRollInfo(JSONObject param) {
JSONObject result = new JSONObject();
String ContainerName = param.getString("ContainerName");
PdmBiSlittingproductionplan one = slittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, ContainerName));
PdmBiSlittingproductionplan one = slittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, ContainerName).eq(PdmBiSlittingproductionplan::getIs_delete,"0"));
if (ObjectUtil.isEmpty(one)) {
throw new BadRequestException("未查询到子卷号为[" + ContainerName + "]的分切计划!");
}
@@ -2262,6 +2272,10 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String TensileStrength = param.getString("TensileStrength");
//包装类型
String ReWorkName = param.getString("ReWorkName");
//客户需求抗拉上限
String SOTensileStrengthUpperLimit = param.getString("SOTensileStrengthUpperLimit");
//内控标准抗拉上限
String ETTensileStrengthUpperLimit = param.getString("ETTensileStrengthUpperLimit");
String sub_type = "";
if (ObjectUtil.isEmpty(ReWorkName)) {
@@ -2304,6 +2318,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
.create_time(DateUtil.now())
.width_standard(WidthPlan)
.sub_type(sub_type)
.demand_up(SOTensileStrengthUpperLimit)
.standard_up(ETTensileStrengthUpperLimit)
.thickness_request(ThicknessPlan).build();
containerinfoService.save(containerinfo);
} else {
@@ -2326,6 +2342,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
one.setActual_value(TensileStrength);
one.setSub_type(sub_type);
one.setWidth_standard(WidthPlan);
one.setDemand_up(SOTensileStrengthUpperLimit);
one.setStandard_up(ETTensileStrengthUpperLimit);
one.setThickness_request(ThicknessPlan);
containerinfoService.updateById(one);
}
@@ -2493,7 +2511,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
"HL11": null
}
*/
Long id = IdUtil.getSnowflake(1, 1).nextId();
Long id = IdUtil.getLongId();
//变更类型
String change_type = param.getString("ChangeType");
//子卷号
@@ -2593,7 +2611,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
.build();
orderbominfoService.save(bom_info);
} else {
orderbominfo.setProductName(product_name);
orderbominfo.setDescription(description);
orderbominfo.setCarrierName(carrier_name);
@@ -2616,6 +2633,21 @@ public class MesToLmsServiceImpl implements MesToLmsService {
orderbominfoService.updateById(orderbominfo);
}
//更新当前分切计划包含该订单的对应的管件信息
IPdmBiSlittingproductionplanService service = SpringContextHolder.getBean(IPdmBiSlittingproductionplanService.class);
LambdaUpdateWrapper<PdmBiSlittingproductionplan> updateWrapper = new LambdaUpdateWrapper<PdmBiSlittingproductionplan>()
.eq(PdmBiSlittingproductionplan::getMfg_order_name, mfg_order);
if (type.equals("RW2")) {
updateWrapper.set(PdmBiSlittingproductionplan::getFRP_material, carrier_name);
updateWrapper.set(PdmBiSlittingproductionplan::getFRP_description, carrier_description);
updateWrapper.set(PdmBiSlittingproductionplan::getFRP_model, carrier_description);
} else {
updateWrapper.set(PdmBiSlittingproductionplan::getPaper_tube_material, carrier_name);
updateWrapper.set(PdmBiSlittingproductionplan::getPaper_tube_description, carrier_description);
updateWrapper.set(PdmBiSlittingproductionplan::getPaper_tube_model, carrier_description);
}
service.update(updateWrapper);
resultParam.put("RTYPE", "S");
resultParam.put("RTMSG", "操作成功!");
resultParam.put("RTOAL", 1);

View File

@@ -498,9 +498,6 @@ public class FeedingServiceImpl implements FeedingService {
}
}
CoolCutTask coolCutTask = SpringContextHolder.getBean(CoolCutTask.class);
String task_id = coolCutTask.createTask(jo);
//查询该母卷号对应的生箔信息
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
@@ -512,6 +509,9 @@ public class FeedingServiceImpl implements FeedingService {
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!");
}
CoolCutTask coolCutTask = SpringContextHolder.getBean(CoolCutTask.class);
String task_id = coolCutTask.createTask(jo);
//生成半成品出库单据
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();

View File

@@ -319,6 +319,7 @@ public class HandleBakingServiceImpl implements HandleBakingService {
param.put("iWarehouse", 2);
param.put("UserName", userName);
param.put("PassWord", passWord);
param.put("pointCode", cool_ivt.getString("full_point_code"));
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0);

View File

@@ -1,7 +1,7 @@
package org.nl.wms.pda.mps.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import org.nl.common.utils.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
@@ -296,7 +296,7 @@ public class PaperTubeServiceImpl implements PaperTubeService {
// 没根轴有多少管芯
for (int j = 0; j < paperNum; j++) {
PdmBiSlittingproductionplan plan = new PdmBiSlittingproductionplan();
plan.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
plan.setWorkorder_id(IdUtil.getStringId());
// 公共部分插入
plan.setOrder_type("1");
plan.setContainer_name(area + "Z虚拟" + i + TaskUtils.getDateTime("yyMMddHHmmss") + j);
@@ -683,8 +683,8 @@ public class PaperTubeServiceImpl implements PaperTubeService {
// 获取点位
JSONObject jo = new JSONObject();
jo.put("task_type", "010606");
jo.put("task_id", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_code", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_id", IdUtil.getStringId());
jo.put("task_code", IdUtil.getStringId());
jo.put("point_code1", area + "_RG_RGV");
jo.put("point_code2", in_jo.getString("point_code"));
jo.put("product_area", area);

View File

@@ -12,9 +12,12 @@ import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.pda.mps.service.ShippingService;
import org.nl.wms.sch.AcsUtil;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.sch.tasks.PaperTrussTask;
@@ -127,6 +130,20 @@ public class ShippingServiceImpl implements ShippingService {
throw new BadRequestException("最多选择两个分切计划进行操作!");
}
String request_area = whereJson.getString("point_code").substring(0, 2);
//调用ACS扫码器获取载具码
String sm_area = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("sm_area").getValue();
if (sm_area.contains(request_area)) {
JSONObject sm_json = new JSONObject();
sm_json.put("device_code", whereJson.getString("point_code"));
sm_json.put("product_area", request_area);
JSONObject jsonObject = AcsUtil.notifyAcsObject("api/wms/getBarcode", sm_json);
if (ObjectUtil.isNotEmpty(jsonObject) && !jsonObject.getString("device_code").equals(vehicle_code)) {
throw new BadRequestException("扫码器返回的托盘码【" + jsonObject.getString("device_code") + "】与手持扫码不一致!");
}
}
String split_group = "";
String resource_name = "";
String order_type = "";
@@ -380,6 +397,21 @@ public class ShippingServiceImpl implements ShippingService {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("载具码不能为空!");
}
String request_area = point_code.substring(0, 2);
//调用ACS扫码器获取载具码
String sm_area = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("sm_area").getValue();
if (sm_area.contains(request_area)) {
JSONObject sm_json = new JSONObject();
sm_json.put("device_code", whereJson.getString("point_code"));
sm_json.put("product_area", request_area);
JSONObject jsonObject = AcsUtil.notifyAcsObject("api/wms/getBarcode", sm_json);
if (ObjectUtil.isNotEmpty(jsonObject) && !jsonObject.getString("vehicle_code").equals(vehicle_code)) {
throw new BadRequestException("扫码器返回的托盘码【" + jsonObject.getString("vehicle_code") + "】与手持扫码不一致!");
}
}
JSONObject vehicle_task = WQLObject.getWQLObject("sch_base_task").query("vehicle_code2 = '" + vehicle_code + "' AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(vehicle_task)) {
if (vehicle_task.getString("point_code2").contains("OUT")) {

View File

@@ -19,7 +19,7 @@
输入.point_code TYPEAS s_string
输入.container_name TYPEAS s_string
输入.product_area TYPEAS s_string
输入.point_type TYPEAS s_string
输入.point_type TYPEAS s_string
输入.in_area_id TYPEAS f_string
@@ -327,6 +327,10 @@ IF 输入.flag = "6"
ivt.point_location = 输入.point_location
ENDOPTION
OPTION 输入.point_type <> ""
ivt.point_type = 输入.point_type
ENDOPTION
order by ivt.point_code ASC
ENDSELECT

View File

@@ -701,6 +701,9 @@ public class ProductInstorServiceImpl implements ProductInstorService {
// 查询子卷包装关系
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSub)) {
throw new BadRequestException("未查询到木箱【"+box_no+"】对应的包装关系!");
}
double box_weight = jsonSub.getDoubleValue("box_weight");
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {

View File

@@ -97,7 +97,7 @@ public class VirtualOutServiceImpl implements VirtualOutService {
if (ObjectUtil.isNotEmpty(whereJson.getString("box_no"))) {
JSONObject jsonSub = WQL.getWO("PDA_VIRTUALOUT").addParam("flag", "4").addParam("box_no", whereJson.getString("box_no")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSub)){
if (ObjectUtil.isEmpty(jsonSub) || ObjectUtil.isEmpty(jsonSub.getString("net_weight_num"))){
throw new BadRequestException("未查询到设木箱号为["+whereJson.getString("box_no")+"]的子卷包装关系信息!");
}

View File

@@ -1,7 +1,7 @@
package org.nl.wms.pdm.ivt.deliverycache.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import org.nl.common.utils.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -55,7 +55,7 @@ public class DeliverycachepointivtServiceImpl extends ServiceImpl<Deliverycachep
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
entity.setIvt_id(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setIvt_id(IdUtil.getStringId());
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);

View File

@@ -222,6 +222,7 @@ public class CoolPointIvtServiceImpl implements CoolPointIvtService {
param.put("iWarehouse", 2);
param.put("UserName", userName);
param.put("PassWord", passWord);
param.put("pointCode", form.getString("full_point_code"));
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0);

View File

@@ -0,0 +1,27 @@
package org.nl.wms.sch.manage;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class AutoSendInStorFeiShuInfo {
@Autowired
private LmsToMesService lmsToMesService;
@SneakyThrows
public void run() {
this.sendInfo();
}
void sendInfo() {
lmsToMesService.EditSheetApi(new JSONObject());
}
}

View File

@@ -1,7 +1,7 @@
package org.nl.wms.sch.tasks;
import cn.hutool.core.date.DateUtil;
import org.nl.common.utils.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@@ -17,6 +17,7 @@ import org.nl.b_lms.sch.point.service.IstIvtShaftivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
@@ -32,6 +33,7 @@ import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.renovation.service.ReNbjService;
import org.nl.wms.sch.tasks.renovation.util.RenUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

View File

@@ -154,6 +154,7 @@ public class InCoolIvtTask extends AbstractAcsTask {
param.put("iWarehouse", 2);
param.put("UserName", userName);
param.put("PassWord", passWord);
param.put("pointCode", point_code2);
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollSemiFGInboundComplete'").uniqueResult(0);

View File

@@ -37,6 +37,7 @@ public class InbillServiceImpl {
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
String end_point = form.getString("end_point");
String sect_code = form.getString("sect_code");
HashMap<String, String> map = new HashMap<>();
//operate:0生成、1完成、2单据确认
switch (operate) {
@@ -74,7 +75,11 @@ public class InbillServiceImpl {
struct_map.put("inv_type", "");
struct_map.put("inv_id", "");
struct_map.put("inv_code", "");
struct_table.update(struct_map, "struct_code = '" + end_point + "'");
if (StrUtil.isNotEmpty(sect_code)) {
struct_table.update(struct_map, "struct_code = '" + end_point + "' AND sect_code = '" + sect_code + "'");
}else {
struct_table.update(struct_map, "struct_code = '" + end_point + "'");
}
break;
default:
break;
@@ -163,6 +168,7 @@ public class InbillServiceImpl {
JSONObject dis_row = dis_rows.getJSONObject(i);
JSONObject point_form = new JSONObject();
point_form.put("end_point", dis_row.getString("struct_code"));
point_form.put("sect_code", dis_row.getString("sect_code"));
point_form.put("vehicle_code", dis_row.getString("box_no"));
//更新目的点位
this.operatePoint("2", point_form);

View File

@@ -748,6 +748,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
public void allDivStruct(JSONObject form) {
String iostorinv_id = form.getString("iostorinv_id");
String sect_id = form.getString("sect_id");
String stor_id = form.getString("stor_id");
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id = '" + sect_id + "'").uniqueResult(0);
if (!"09".equals(sect_jo.getString("sect_type_attr"))) {
@@ -780,6 +781,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
Map<String, Object> dis_map = new HashMap<>();
dis_map.put("tableMater", list);
dis_map.put("sect_id", sect_id);
dis_map.put("stor_id", stor_id);
dis_map.put("checked", true);
this.divStruct(dis_map);
}
@@ -1043,7 +1045,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
} else {
// 优先入1层
row_map.put("in_layer_num", "('1')");
in_layer_num = "('1')";
rowArr2 = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(rowArr2)) {
@@ -1868,16 +1870,19 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
if (ObjectUtil.isEmpty(struct_jo)) {
// 主存区类型更改成中转区类型:找一排主存区的更改中转区、把一排中转区的更改成主存区(只允许调用一次)
String result = HttpUtil.get("http://127.0.0.1:8011/api/in/rawAssist/updateStructSect?layer_num=" + col_num);
/*String result = HttpUtil.get("http://127.0.0.1:8011/api/in/rawAssist/updateStructSect?layer_num=" + col_num);
if (StringUtils.isEmpty(result)){
throw new BadRequestException("扩容异常");
}
JSONObject toJSON = JSONObject.parseObject(result);
if (!toJSON.getString("status").equals("200")){
throw new BadRequestException(toJSON.getString("message"));
}
// SpringContextHolder.getBean(RawAssistIStorServiceImpl.class).updateStructSect(col_num);
}*/
SpringContextHolder.getBean(RawAssistIStorServiceImpl.class).updateStructSect(col_num);
struct_jo = autoDisMove2(whereJson);
if (ObjectUtil.isEmpty(struct_jo)){
throw new BadRequestException("扩容失败,当前没有可用的仓位用来移库,请稍后再试!");
}
}
return struct_jo;
}
@@ -2909,6 +2914,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
jsonParam.put("region_code", "ZZ01");
jsonParam.put("region_name", RegionTypeEnum.ZZ01.getName());
point.update(jsonParam,"region_code = 'ZC01' AND block_num = '"+block_num+"' AND row_num = '"+row_num+"' AND layer_num = '"+layer_num+"'");
log.info("变更库区成功,变更的库存为:"+block_num+","+row_num+","+layer_num);
}
/**

View File

@@ -213,7 +213,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
WQLObject mst = WQLObject.getWQLObject("ST_IVT_ProductScrapMst");
WQLObject dtl = WQLObject.getWQLObject("ST_IVT_ProductScrapDtl");
WQLObject ivt = WQLObject.getWQLObject("st_ivt_structivt");
try {
// 查询所有明细
JSONArray dtlArr = dtl.query("scrap_id = '" + whereJson.getString("scrap_id") + "'").getResultJSONArray(0);
@@ -227,7 +227,11 @@ public class ProductScrapServiceImpl implements ProductScrapService {
List<JSONObject> ivtList = ivt.query("pcsn in ('" + pcsnJoining + "') and canuse_qty > 0")
.getResultJSONArray(0).toJavaList(JSONObject.class);
if (dtlArr.size() != ivtList.size()) {
Set<String> ivtSet = ivtList.stream().map(row -> row.getString("pcsn")).collect(Collectors.toSet());
String havePcsn = ivtSet.stream().collect(Collectors.joining("','"));
/*if (dtlArr.size() != ivtList.size()) {
throw new BadRequestException("库存异常请检查!");
}
@@ -237,7 +241,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
if (!is_pass) {
throw new BadRequestException("库存异常请检查!");
}
}*/
// 生成出库单
JSONObject jsonOutMst = new JSONObject();
@@ -256,6 +260,9 @@ public class ProductScrapServiceImpl implements ProductScrapService {
JSONArray tableData = new JSONArray();
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i);
if (!ivtSet.contains(json.getString("pcsn"))) {
continue;
}
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("pcsn", json.getString("pcsn"));
@@ -274,7 +281,11 @@ public class ProductScrapServiceImpl implements ProductScrapService {
jsonObject.put("iostorinv_id", iostorinv_id);
// 变更为手动分配
// checkOutBillService.allDiv(jsonObject);
if (StrUtil.isNotEmpty(havePcsn)) {
HashMap dtlMap = new HashMap();
dtlMap.put("is_audit", "1");
dtl.update(dtlMap, "scrap_id = '" + whereJson.getString("scrap_id") + "' AND pcsn in ('" + havePcsn + "')");
}
// 更新主表为完成
JSONObject param = new JSONObject();
param.put("bill_status", "99");
@@ -284,8 +295,8 @@ public class ProductScrapServiceImpl implements ProductScrapService {
mst.update(param, "scrap_id = '" + whereJson.getString("scrap_id") + "'");
} catch (Exception e) {
JSONObject msg = new JSONObject();
msg.put("remark", "单据异常:"+e.getMessage());
mst.update(msg,"scrap_id = '" + whereJson.getString("scrap_id") + "'");
msg.put("remark", "单据异常:" + e.getMessage());
mst.update(msg, "scrap_id = '" + whereJson.getString("scrap_id") + "'");
}
@@ -478,7 +489,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
String in_stor_id = userStorService.getInStor();
List<JSONObject> ivtList = WQL.getWO("QST_IVT_HANDMOVESTOR")
.addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id",in_stor_id)
.addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id", in_stor_id)
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询不合格品来源字典
@@ -536,7 +547,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
String finalValue = value;
boxList.forEach(row -> {
row.put("fail_source", finalValue);
row.put("remark",remark);
row.put("remark", remark);
});
resultList.addAll(boxList);
@@ -609,6 +620,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
mp.put("不合格品来源", "客户投诉");
}
mp.put("不合格品缺陷描述", object.getString("remark"));
mp.put("是否出库", object.getString("is_audit").equals("1") ? "" : "");
list.add(mp);
}
FileUtil.downloadExcel(list, response);

View File

@@ -3,6 +3,7 @@ package org.nl.wms.st.outbill.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
@@ -12,9 +13,12 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussMana
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.LashManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
import org.nl.common.utils.RedissonUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -26,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@RestController
@RequiredArgsConstructor
@@ -52,6 +57,9 @@ public class CheckOutBillController {
private final OutBoxManageService outBoxManageService;
@Autowired
private RedissonClient redissonClient;
@GetMapping
@Log("查询出库单")
@@ -114,12 +122,25 @@ public class CheckOutBillController {
@PostMapping("/allDiv")
@Log("出库单全部分配")
@SneakyThrows
public ResponseEntity<Object> allDiv(@RequestBody JSONObject whereJson) {
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
iStIvtIostorinvOutService.allDiv(whereJson);
} else {
checkOutBillService.allDiv(whereJson);
String iostorinv_id = whereJson.getString("iostorinv_id");
RLock lock = redissonClient.getLock("allDiv----"+iostorinv_id);
boolean tryLock = lock.tryLock(0, 60, TimeUnit.SECONDS);
try {
if (tryLock) {
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
iStIvtIostorinvOutService.allDiv(whereJson);
} else {
checkOutBillService.allDiv(whereJson);
}
} else {
throw new BadRequestException("当前出库单当前正在分配库存中,请勿重复操作!");
}
} finally {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -211,13 +232,13 @@ public class CheckOutBillController {
@Log("一键设置")
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
RedissonUtils.lock(c->{
RedissonUtils.lock(c -> {
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
iStIvtIostorinvOutService.allSetPoint2(whereJson);
} else {
checkOutBillService.allSetPointByNoTran(whereJson);
}
},"出库一键设置",1,120,null);
}, "出库一键设置", 1, 120, null);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -375,7 +396,7 @@ public class CheckOutBillController {
@PostMapping("/updataIsOverdue")
@Log("更新是否超期")
public ResponseEntity<Object> updataIsOverdue(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson),HttpStatus.OK);
return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson), HttpStatus.OK);
}
@PostMapping("/importExcel")

View File

@@ -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) {
@@ -1594,7 +1596,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
// 如果是发货出库则判断运费和物流公司不能为空
String bill_type = jo_mst.getString("bill_type");
if (StrUtil.equals(bill_type, "1001")) {
/*if (StrUtil.equals(bill_type, "1001")) {
String trans_code = jo_mst.getString("trans_code");
String estimated_freight = jo_mst.getString("estimated_freight");
@@ -1605,8 +1607,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
throw new BadRequestException("预估运费不能为空");
}
}
RedissonUtils.lock(a->{
}*/
RedissonUtils.lock(a -> {
//查询生成和未分配完的明细
JSONArray dtls = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "2")
@@ -1686,7 +1688,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
storPublicService.IOStor(ivt2, "11");
//生成分配明细
dtl.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
dtl.put("iostorinvdis_id", IdUtil.getLongId());
dtl.put("sect_id", ivt2.getString("sect_id"));
dtl.put("sect_code", ivt2.getString("sect_code"));
dtl.put("sect_name", ivt2.getString("sect_name"));
@@ -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 {
@@ -1754,37 +1756,37 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
unassign_qty = 0;
assign_qty = NumberUtil.add(assign_qty, canuse_qty);
//更新库存
jsonIvt.put("bill_type_scode", jo_mst.getString("bill_type"));
jsonIvt.put("inv_id", dtl.getString("iostorinv_id"));
jsonIvt.put("bill_code", jo_mst.getString("bill_code"));
jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
storPublicService.IOStor(jsonIvt, "11");
//生成分配明细
dtl.put("iostorinvdis_id", IdUtil.getLongId());
dtl.put("sect_id", jsonIvt.getString("sect_id"));
dtl.put("sect_code", jsonIvt.getString("sect_code"));
dtl.put("sect_name", jsonIvt.getString("sect_name"));
dtl.put("struct_id", jsonIvt.getString("struct_id"));
dtl.put("struct_code", jsonIvt.getString("struct_code"));
dtl.put("struct_name", jsonIvt.getString("struct_name"));
dtl.put("pcsn", jsonIvt.getString("pcsn"));
dtl.put("box_no", jsonIvt.getString("storagevehicle_code"));
dtl.put("storagevehicle_id", jsonIvt.getString("storagevehicle_id"));
dtl.put("storagevehicle_code", jsonIvt.getString("storagevehicle_code"));
dtl.put("storagevehicle_type", jsonIvt.getString("storagevehicle_type"));
dtl.put("is_issued", "0");
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("is_overdue", jsonIvt.getString("is_overdue"));
dtl.put("instorage_time", jsonIvt.getString("instorage_time"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
}
//更新库存
jsonIvt.put("bill_type_scode", jo_mst.getString("bill_type"));
jsonIvt.put("inv_id", dtl.getString("iostorinv_id"));
jsonIvt.put("bill_code", jo_mst.getString("bill_code"));
jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
storPublicService.IOStor(jsonIvt, "11");
//生成分配明细
dtl.put("iostorinvdis_id", IdUtil.getLongId());
dtl.put("sect_id", jsonIvt.getString("sect_id"));
dtl.put("sect_code", jsonIvt.getString("sect_code"));
dtl.put("sect_name", jsonIvt.getString("sect_name"));
dtl.put("struct_id", jsonIvt.getString("struct_id"));
dtl.put("struct_code", jsonIvt.getString("struct_code"));
dtl.put("struct_name", jsonIvt.getString("struct_name"));
dtl.put("pcsn", jsonIvt.getString("pcsn"));
dtl.put("box_no", jsonIvt.getString("storagevehicle_code"));
dtl.put("storagevehicle_id", jsonIvt.getString("storagevehicle_id"));
dtl.put("storagevehicle_code", jsonIvt.getString("storagevehicle_code"));
dtl.put("storagevehicle_type", jsonIvt.getString("storagevehicle_type"));
dtl.put("is_issued", "0");
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("is_overdue", jsonIvt.getString("is_overdue"));
dtl.put("instorage_time", jsonIvt.getString("instorage_time"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
}
// 判断是否超期
if (jo_mst.getString("is_overdue").equals("1")) {
@@ -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("有其他任务正在执行中,请稍后在试!");
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();// 生成移库单传入参数
@@ -3462,8 +3577,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
form.put("point_code2", jsonMove.getString("struct_code"));
form.put("task_group_id", struct.getLongValue("task_group_id")); // 任务组
form.put("sort_seq", struct.getIntValue("sort_seq") + 1); // 任务组顺序号
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_id", IdUtil.getLongId());
json.put("task_code", IdUtil.getLongId());
json.put("task_type", form.getString("task_type"));
json.put("vehicle_code", form.getString("vehicle_code"));
json.put("task_name", form.getString("task_name"));
@@ -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);

View File

@@ -19,6 +19,7 @@
输入.block_num TYPEAS s_string
输入.sect_id TYPEAS s_string
输入.invId TYPEAS s_string
输入.out_order_seq TYPEAS s_string
输入.row_num TYPEAS s_string
输入.order_by TYPEAS f_string
输入.iostorinvdis_id TYPEAS s_string
@@ -286,7 +287,6 @@
attr.lock_type in ('2','3','6','7')
AND attr.block_num = 输入.block_num
AND attr.row_num = 输入.row_num
AND attr.sect_id = 输入.sect_id
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
OPTION 输入.invId <> ""
attr.inv_id <> 输入.invId
@@ -303,7 +303,6 @@
WHERE
attr.block_num = 输入.block_num
AND attr.row_num = 输入.row_num
AND attr.sect_id = 输入.sect_id
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
ENDSELECT
ENDQUERY
@@ -317,7 +316,6 @@
WHERE
attr.block_num = 输入.block_num
AND attr.row_num = 输入.row_num
AND attr.sect_id = 输入.sect_id
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
OPTION 输入.order_by <> ""
1=1 输入.order_by

View File

@@ -491,6 +491,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
mp.put("小卷号", json.getString("pcsn"));
mp.put("sap批次号", json.getString("sap_pcsn"));
mp.put("净重KG", NumberUtil.round(StrUtil.isEmpty(json.getString("net_weight")) ? "0" : json.getString("net_weight"), 1));
mp.put("生箔母卷", json.getString("foil_container_name"));
mp.put("卷数", json.getString("quanlity_in_box"));
mp.put("品级", "A");
mp.put("箱号", json.getString("box_no"));

View File

@@ -659,6 +659,7 @@
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
plan.foil_container_name,
sub.thickness,
sub.box_weight,
sub.length,
@@ -756,7 +757,8 @@
MAX(parent_container_name) AS parent_container_name,
MAX(restruct_container_name) AS restruct_container_name,
MAX(FRP_description) AS FRP_description,
MAX(FRP_model) AS FRP_model
MAX(FRP_model) AS FRP_model,
MAX(foil_container_name) AS foil_container_name
FROM
pdm_bi_slittingproductionplan plan1
WHERE
@@ -996,6 +998,7 @@
sub.length,
sub.thickness_request,
sub.width_standard,
plan.foil_container_name,
sub.mass_per_unit_area,
sub.demand_limit,
sub.standard_limit,
@@ -1088,7 +1091,8 @@
MAX(parent_container_name) AS parent_container_name,
MAX(restruct_container_name) AS restruct_container_name,
MAX(FRP_description) AS FRP_description,
MAX(FRP_model) AS FRP_model
MAX(FRP_model) AS FRP_model,
MAX(foil_container_name) AS foil_container_name
FROM
pdm_bi_slittingproductionplan plan1
WHERE
@@ -1292,3 +1296,126 @@
ENDQUERY
ENDIF
IF 输入.flag = "7"
QUERY
SELECT
FLOOR(UNIX_TIMESTAMP(DATE_FORMAT(DATE_SUB(输入.end_time, INTERVAL 1 DAY), '%Y-%m-%d 08:00:00')) * 1000) AS '日期',
CASE
WHEN DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '08:00:00'
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '19:59:59' THEN '白班'
WHEN DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '20:00:00'
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '23:59:59' OR
DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '00:00:00'
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '07:59:59' THEN '晚班'
END AS '班次',
SUBSTRING_INDEX(sub.sale_order_name, '-', '1') AS '销售订单',
SUBSTRING_INDEX(sub.sale_order_name, '-', '-1') AS '行号',
'生产入库' AS '业务类型',
cust.cust_code AS '客户编码',
sub.customer_description AS '客户名称',
cust.sales_owner AS '业务员',
sub.thickness_request AS '规格',
sub.width_standard AS '尺寸(mm)(客户要求幅宽)',
sub.width AS '实际尺寸(mm)(实际幅宽)',
CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(mb.material_name, '|', 3), '|', -1), '*',
SUBSTRING_INDEX(SUBSTRING_INDEX(mb.material_name, '|', 4), '|', -1)) AS '木箱规格|尺寸',
sub.box_weight AS '毛重合计',
sub.container_name AS '小卷号',
sub.sap_pcsn AS 'SAP批次号',
sub.net_weight AS '净重(KG)',
sub.quanlity_in_box AS '卷数',
'A' AS '品级',
sub.package_box_sn AS '箱号',
sub.sale_order_name AS '销售订单及行号',
CASE
WHEN plan.parent_container_name <> '' THEN
plan.parent_container_name
ELSE plan.restruct_container_name
END AS '母卷号',
sub.mass_per_unit_area AS '基重(面密度)(g|m³)',
'±1' AS '居中度(mm)',
'≤10' AS '塌边(mm)',
sub.length AS '米数(长度)',
CASE
WHEN plan.paper_tube_or_FRP = '1' THEN
'纸管'
WHEN plan.paper_tube_or_FRP = '2' THEN
'FRP管'
END AS '管件类型',
CASE
WHEN plan.paper_tube_or_FRP = '1' THEN
plan.paper_tube_material
WHEN plan.paper_tube_or_FRP = '2' THEN
plan.FRP_material
END AS '管件编码',
CASE
WHEN plan.paper_tube_or_FRP = '1' THEN
plan.paper_tube_description
WHEN plan.paper_tube_or_FRP = '2' THEN
plan.FRP_description
END AS '管件描述',
sub.actual_value AS '生产实际抗拉值',
sub.standard_limit AS '内控标准抗拉下限',
sub.demand_limit AS '客户需求抗拉下限',
FLOOR(UNIX_TIMESTAMP(sub.date_of_production) * 1000) AS '生产日期',
FLOOR(UNIX_TIMESTAMP(mst.confirm_time) * 1000) AS '入库日期',
substr(sub.container_name, 1, 2) AS '生产区域'
FROM (SELECT MIN(a.iostorinvdis_id) AS iostorinvdis_id
FROM st_ivt_iostorinvdis a
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
WHERE b.io_type = '0'
AND b.bill_type = '0001'
AND b.confirm_time >= 输入.begin_time
AND b.confirm_time <= 输入.end_time
AND b.bill_status = '99'
GROUP BY pcsn
UNION
SELECT MIN(a.iostorinvdis_id) AS iostorinvdis_id
FROM st_ivt_iostorinvdis a
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
WHERE b.io_type = '0'
AND b.bill_type = '0007'
AND b.confirm_time >= 输入.begin_time
AND b.confirm_time <= 输入.end_time
AND b.bill_status = '99'
GROUP BY pcsn) c
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn
AND sub.package_box_sn = dis.box_no
AND sub.bill_id = dis.iostorinv_id
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
LEFT JOIN (SELECT container_name,
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
MAX(paper_tube_material) AS paper_tube_material,
MAX(paper_tube_description) AS paper_tube_description,
MAX(paper_tube_model) AS paper_tube_model,
MAX(FRP_material) AS FRP_material,
MAX(parent_container_name) AS parent_container_name,
MAX(restruct_container_name) AS restruct_container_name,
MAX(FRP_description) AS FRP_description,
MAX(FRP_model) AS FRP_model,
MAX(foil_container_name) AS foil_container_name
FROM pdm_bi_slittingproductionplan plan1
WHERE plan1.is_delete = '0'
GROUP BY container_name) plan ON plan.container_name = sub.container_name
LEFT JOIN md_me_materialbase mb ON mb.material_code = sub.box_type
WHERE mst.io_type = '0'
AND mst.is_delete = '0'
AND mst.bill_status = '99'
AND IFNULL(sub.sub_type, '') = ''
AND mst.confirm_time >= 输入.begin_time
AND mst.confirm_time <= 输入.end_time
ORDER BY mst.confirm_time DESC,
dis.box_no
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -274,6 +274,7 @@
c.pcsn,
sub.sap_pcsn,
sub.net_weight,
sub.boxin_num,
sub.customer_name,
sub.customer_description,
sub.sale_order_name,
@@ -334,6 +335,7 @@
max(record.customer_name) as customer_name,
max(record.customer_description) as customer_description,
max(record.width) as width,
max(record.quanlity_in_box) boxin_num,
max(record.thickness) as thickness,
max(record.mass_per_unit_area) as mass_per_unit_area,
max(record.net_weight) as net_weight,