Merge branch 'master' into master_merge

This commit is contained in:
2024-07-10 13:58:56 +08:00
76 changed files with 3074 additions and 1183 deletions

View File

@@ -21,6 +21,7 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pda.st.service.ProductInstorService;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
@@ -31,6 +32,7 @@ import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -59,6 +61,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
private final WmsToAcsService wmsToAcsService;
private final LmsToMesService lmsToMesService;
@Override
public JSONObject boxQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
@@ -194,6 +198,25 @@ public class ProductInstorServiceImpl implements ProductInstorService {
throw new BadRequestException("二期仓库木箱,请进行虚拟入库!");
}
// 重量阈值系统参数
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
// 木箱系统重量
double box_weight = sub_jo.getDoubleValue("box_weight");
// 木箱实称重重量
double real_weight = sub_jo.getDoubleValue("real_weight");
if (ObjectUtil.isEmpty(sub_jo.getString("real_weight"))) {
throw new BadRequestException("请先进行木箱称重校验!");
}
// 判断木箱毛重是否超标
if (NumberUtil.sub(box_weight, weight_sys) <= real_weight && NumberUtil.add(box_weight, weight_sys) >= real_weight) {
} else {
// 将木箱重量告知飞书
notifyMes(sub_jo);
throw new BadRequestException("重量不合格!系统重量浮动超过"+weight_sys+"KG,当前木称重重量:"+real_weight);
}
//判断是该包装计划是否存在长宽高
Double box_length = sub_jo.getDoubleValue("box_length");
Double box_width = sub_jo.getDoubleValue("box_width");
@@ -292,6 +315,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
throw new BadRequestException("请扫描内包间入库点位!");
}
}
//创建二楼去一楼的任务
JSONObject form = new JSONObject();
form.put("point_code1", point_code);
@@ -574,19 +598,71 @@ public class ProductInstorServiceImpl implements ProductInstorService {
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
// 获取系统参数
// 获取系统参数1
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
// 获取系统参数2
double weight_sys_2 = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys_2").getValue());
// 查询子卷包装关系
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
double box_weight = jsonSub.getDoubleValue("box_weight");
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {
jo.put("message", "重量合格!当前称重重量:"+weight_now);
// 校验重量上下付浮动是否超过2
if (NumberUtil.sub(box_weight, weight_sys_2) <= weight_now && NumberUtil.add(box_weight, weight_sys_2) >= weight_now) {
jo.put("message", "重量合格!当前称重重量:"+weight_now);
} else {
jo.put("message", "重量警告!系统重量浮动超过"+weight_sys_2+"KG,当前称重重量:"+weight_now);
}
} else {
jo.put("message", "重量不合格当前称重重量"+weight_now);
}
jo.put("message", "重量不合格!系统重量浮动超过"+weight_sys+"KG,当前称重重量:"+weight_now);
}
// 更新当前木箱实际重量
JSONObject json = new JSONObject();
json.put("real_weight",weight_now);
subTab.update(json,"package_box_sn = '"+box_no+"'");
return jo;
}
/**
* 生成输送任务时通知木箱重量不合格
* @param sub_jo {子卷包装关系对象}
*/
private void notifyMes(JSONObject sub_jo) {
JSONObject param = new JSONObject();
// 飞书用户集合
JSONArray UserList = new JSONArray();
// 系统参数
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU_2").getValue();
String[] split = userList.split(",");
if (split.length > 0) {
for (String s : split) {
JSONObject jo = new JSONObject();
jo.put("User", s);
UserList.add(jo);
}
} else {
JSONObject jo = new JSONObject();
jo.put("User", "");
UserList.add(jo);
}
param.put("UserList", UserList);
// 标签code
param.put("Code", "ctp_AA65DNXr3svo");
// 组织标签内容
JSONObject content = new JSONObject();
double box_weight = NumberUtil.round(sub_jo.getDoubleValue("box_weight"), 2).doubleValue();
double real_weight = NumberUtil.round(sub_jo.getDoubleValue("real_weight"), 2).doubleValue();
content.put("title", "【LMS通知】木箱超重警告");
content.put("Message", "木箱号:"+sub_jo.getString("package_box_sn")+",系统木箱重量:"+box_weight+"KG,实际木箱重量:"+real_weight+"KG");
param.put("card", content);
// 调用mes接口
lmsToMesService.proudDayData(param);
}
}

View File

@@ -253,11 +253,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -364,11 +361,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -1483,11 +1478,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -1524,11 +1516,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();

View File

@@ -116,6 +116,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
String is_all = MapUtil.getStr(whereJson, "is_all");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
String thickness_request = MapUtil.getStr(whereJson, "thickness_request");
JSONObject map = new JSONObject();
@@ -132,6 +133,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
map.put("sale_order_name", sale_order_name);
map.put("classes", classes);
map.put("thickness_request", thickness_request);
map.put("sap_pcsn", sap_pcsn);
// 处理时间
if (ObjectUtil.isNotEmpty(begin_time) && ObjectUtil.isNotEmpty(end_time)) {
@@ -363,6 +365,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
String classes = MapUtil.getStr(map, "classes");
String sale_order_name = MapUtil.getStr(map, "sale_order_name");
String pcsn = MapUtil.getStr(map, "pcsn");
String sap_pcsn = MapUtil.getStr(map, "sap_pcsn");
String is_all = MapUtil.getStr(map, "is_all");
String thickness_request = MapUtil.getStr(map, "thickness_request");
@@ -380,6 +383,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
mapParam.put("is_virtual", is_virtual);
mapParam.put("classes", classes);
mapParam.put("thickness_request", thickness_request);
mapParam.put("sap_pcsn", sap_pcsn);
// 处理时间
if (ObjectUtil.isNotEmpty(begin_time) && ObjectUtil.isNotEmpty(end_time)) {
@@ -447,6 +451,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
}
mp.put("毛重合计", NumberUtil.round(StrUtil.isEmpty(json.getString("box_weight")) ? "0" : json.getString("box_weight"), 1));
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("quanlity_in_box"));
mp.put("品级", "A");

View File

@@ -2,6 +2,7 @@ package org.nl.wms.stat.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
@@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Liuxy
@@ -113,6 +115,29 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
}
JSONObject json = WQL.getWO("ST_IVT_OUTBILLQUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC,dis.box_no");
// 查询此子卷转单之前的销售订单号
List<JSONObject> content = json.getJSONArray("content").toJavaList(JSONObject.class);
String pcsn_in = content.stream()
.map(row -> row.getString("pcsn"))
.collect(Collectors.joining("','"));
List<JSONObject> subList = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord")
.query("container_name IN ('" + pcsn_in + "') AND io_type = '0' ORDER BY insert_time")
.getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询所有子卷最早的入库时间
for (JSONObject item : content) {
JSONObject jsonSub = subList.stream()
.filter(row -> row.getString("container_name").equals(item.getString("pcsn")))
.min(Comparator.comparing(row -> row.getString("insert_time")))
.orElse(null);
item.put("old_sale_order_name", ObjectUtil.isEmpty(jsonSub) ? item.getString("sale_order_name") : jsonSub.getString("sale_order_name"));
}
json.put("content", content);
return json;
}
@@ -279,6 +304,11 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
JSONObject json = resultJSONArray.getJSONObject(i);
Map<String, Object> mp = new LinkedHashMap<>();
// 查询第一次入库的源销售订单
JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord")
.query("container_name = '" + json.getString("pcsn") + "' AND io_type = '0' ORDER BY insert_time")
.uniqueResult(0);
mp.put("仓库", json.getString("stor_name"));
if (ObjectUtil.isNotEmpty(bill_type) && "1004".equals(bill_type)) {
mp.put("移入仓库", json.getString("in_stor_name"));
@@ -310,6 +340,15 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("行号", "");
}
// 原销售订单
try {
mp.put("原销售订单", jsonSub.getString("sale_order_name").substring(0, jsonSub.getString("sale_order_name").indexOf("-")));
mp.put("原行号", jsonSub.getString("sale_order_name").substring(jsonSub.getString("sale_order_name").indexOf("-") + 1, jsonSub.getString("sale_order_name").length()));
} catch (Exception e) {
mp.put("原销售订单", jsonSub.getString("sale_order_name"));
mp.put("原行号", "");
}
mp.put("业务员", json.getString("sales_owner"));
mp.put("出库日期", json.getString("input_time"));
mp.put("产品规格", String.format("%.0f", json.getDoubleValue("width")));

View File

@@ -24,6 +24,7 @@
输入.is_virtual TYPEAS s_string
输入.classes TYPEAS s_string
输入.thickness_request TYPEAS s_string
输入.sap_pcsn TYPEAS s_string
输入.areas TYPEAS f_string
@@ -791,6 +792,10 @@
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn = 输入.sap_pcsn
ENDOPTION
OPTION 输入.bill_type = "0007"
sub.sub_type = '2'
ENDOPTION