代码合并

This commit is contained in:
zhouz
2024-06-27 15:23:15 +08:00
110 changed files with 4905 additions and 1381 deletions

View File

@@ -118,7 +118,6 @@ public class TwoSendOutTask extends AbstractAcsTask {
}
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
// 更改任务状态为完成
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());

View File

@@ -139,6 +139,7 @@ public class InBussManageServiceImpl implements InBussManageService {
"AND height = '" + jsonObject.getString("height") + "'" +
"AND sect_id = '" + jsonObject.getString("sect_id") + "' AND block_num = '"+block_num+"'")
.getResultJSONArray(0);
}

View File

@@ -301,7 +301,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
.qty_unit_id(jsonUnit.getLongValue("measure_unit_id"))
.qty_unit_name(jsonUnit.getString("unit_name"))
.plan_qty(jsonIvt.getBigDecimal("canuse_qty"))
.real_qty(jsonIvt.getBigDecimal("real_qty"))
.real_qty(jsonIvt.getBigDecimal("canuse_qty"))
.work_status(work_status)
.box_no(jsonSub.getString("package_box_sn"))
.build();

View File

@@ -422,7 +422,6 @@ public class SendOutManageServiceImpl implements SendOutManageService {
if (ObjectUtil.isNotEmpty(isBlock2)) {
continue;
} else {
JSONObject jsonNewRow = JSONObject.parseObject(JSON.toJSONString(json));
point_code4 = jsonNewRow.getString("point_code");
@@ -453,7 +452,6 @@ public class SendOutManageServiceImpl implements SendOutManageService {
taskJson.put("point_code2", point_code4);
taskJson.put("point_code4", "");
taskTab.update(taskJson);
// 返回点位
return point_code4;

View File

@@ -689,6 +689,180 @@ public class StructattrServiceImpl implements StructattrService {
@Override
@Transactional(rollbackFor = Exception.class)
public void oneCreate(JSONObject whereJson) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
// 库区表
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
// 点位表
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
// 仓库表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
// 判断库区是否是虚拟区
JSONObject jsonSect = sectTab.query("sect_id = '" + whereJson.getString("sect_id") + "'").uniqueResult(0);
if (!jsonSect.getString("sect_type_attr").equals("09")) {
throw new BadRequestException("所选库区必须是虚拟区!");
}
/*
* 判断此库区是否已经生成仓位
*/
JSONObject jsonAttr = attrTab.query("sect_id = '" + whereJson.getString("sect_id") + "' order by struct_code DESC").uniqueResult(0);
// 生成数量
int createNum = whereJson.getIntValue("num");
// 开始生成数
int createNum_start = 1;
// 前缀
String prefix = "";
if (ObjectUtil.isNotEmpty(jsonAttr)) {
String struct_code = jsonAttr.getString("struct_code");
// 第一个-的位置
int firstIndex = struct_code.indexOf("-");
// 第二个-的位置
int secondIndex = struct_code.substring(firstIndex + 1).indexOf("-") + firstIndex;
// 最大的仓位数
String result = struct_code.substring(firstIndex + 1, secondIndex +1);
createNum += Integer.parseInt(result);
createNum_start += Integer.parseInt(result);
prefix = struct_code.substring(0, firstIndex);
} else {
// 截取第一个 - 之前的数据集合
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
.getResultJSONArray(0).toJavaList(JSONObject.class);
List<String> subStringList = attrList.stream()
.filter(row -> row.getString("struct_code").contains("-"))
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
.distinct()
.sorted()
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
.collect(Collectors.toList());
prefix = String.valueOf(Integer.parseInt(subStringList.get(subStringList.size() - 1)) + 1);
}
/*
* 生成货位
*/
String now = DateUtil.now();
for (int i = createNum_start; i <= createNum; i++) {
JSONObject json = new JSONObject();
json.put("struct_id", IdUtil.getSnowflake(1,1).nextId());
if (i < 10) {
json.put("struct_code", prefix + "-"+"000"+i+"-01");
json.put("struct_name", prefix + "排-"+"000"+i+"列-01层");
}else if (i >= 10 && i < 100) {
json.put("struct_code", prefix + "-"+"00"+i+"-01");
json.put("struct_name", prefix + "排-"+"00"+i+"列-01层");
}else if (i >= 100 && i < 1000) {
json.put("struct_code", prefix + "-"+"0"+i+"-01");
json.put("struct_name", prefix + "排-"+"0"+i+"列-01层");
} else {
json.put("struct_code", prefix + "-"+i+"-01");
json.put("struct_name", prefix + "排-"+i+"列-01层");
}
JSONObject jsonObject = storTab.query("stor_id = '"+whereJson.getString("stor_id")+"'").uniqueResult(0);
JSONObject jsonObjec2 = sectTab.query("stor_id = '"+whereJson.getString("stor_id")+"' and sect_id = '"+whereJson.getString("sect_id")+"'").uniqueResult(0);
// 新增仓位
json.put("simple_name", json.getString("struct_name"));
json.put("sect_id", jsonObjec2.getString("sect_id"));
json.put("sect_code", jsonObjec2.getString("sect_code"));
json.put("sect_name", jsonObjec2.getString("sect_name"));
json.put("stor_id", jsonObject.getString("stor_id"));
json.put("stor_code", jsonObject.getString("stor_code"));
json.put("stor_name", jsonObject.getString("stor_name"));
json.put("lock_type", "1");
json.put("row_num", 1);
json.put("col_num", i);
json.put("layer_num", 1);
json.put("block_num", 1);
json.put("in_order_seq", i);
json.put("out_order_seq", i);
json.put("in_empty_seq", i);
json.put("out_empty_seq", i);
json.put("create_id", "1");
json.put("create_name", "管理员");
json.put("create_time", now);
json.put("material_height_type", 1);
attrTab.insert(json);
// 新增点位
JSONObject jsonPoint = new JSONObject();
jsonPoint.put("point_id",IdUtil.getSnowflake(1,1).nextId());
jsonPoint.put("point_code", json.getString("struct_code"));
jsonPoint.put("point_name", json.getString("struct_name"));
jsonPoint.put("region_id", json.getString("sect_id"));
jsonPoint.put("region_code", json.getString("sect_code"));
jsonPoint.put("region_name", json.getString("sect_name"));
jsonPoint.put("point_type", "2");
jsonPoint.put("point_status", "1");
jsonPoint.put("lock_type", "1");
jsonPoint.put("vehicle_max_qty", 0);
jsonPoint.put("vehicle_qty", 0);
jsonPoint.put("block_num", 1);
jsonPoint.put("row_num", 1);
jsonPoint.put("col_num", 1);
jsonPoint.put("layer_num", 1);
jsonPoint.put("in_order_seq", 0);
jsonPoint.put("out_order_seq", 0);
jsonPoint.put("in_empty_seq", 0);
jsonPoint.put("out_empty_seq", 0);
jsonPoint.put("is_have_workder", "0");
jsonPoint.put("is_used", "1");
jsonPoint.put("source_id", json.get("struct_id"));
jsonPoint.put("is_delete", "0");
jsonPoint.put("create_id", "1");
jsonPoint.put("create_name", "管理员");
jsonPoint.put("create_time", now);
pointTab.insert(jsonPoint);
}
}
@Override
public void blurQuery(JSONObject whereJson) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
/*
* 判断前缀是否存在
*/
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
.getResultJSONArray(0).toJavaList(JSONObject.class);
// 截取第一个 - 之前的数据集合
List<String> subStringList = attrList.stream()
.filter(row -> row.getString("struct_code").contains("-"))
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
.distinct()
.sorted()
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
.collect(Collectors.toList());
// 判断是否有相同的前缀
boolean is_like = subStringList.stream()
.anyMatch(row -> row.equals(whereJson.getString("prefix")));
if (is_like) {
throw new BadRequestException("此前缀已存在,请更换!");
}
}
@Override
public void tunConfirm(JSONObject json) {
WQLObject tab = WQLObject.getWQLObject("st_ivt_structattr");

View File

@@ -296,7 +296,7 @@ public class StructivtServiceImpl implements StructivtService {
mp.put("客户名称", json.getString("customer_description"));
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("业务员", json.getString("sales_owner"));
mp.put("入库日期", json.getString("instorage_time"));
mp.put("入库日期", json.getString("confirm_time"));
mp.put("生产日期", json.getString("date_of_production"));
if ("1".equals(json.getString("sub_type"))) {
mp.put("子卷状态", "正常");
@@ -312,6 +312,7 @@ public class StructivtServiceImpl implements StructivtService {
mp.put("净重", json.getString("net_weight"));
mp.put("毛重", json.getString("box_weight"));
mp.put("长度", json.getString("length"));
mp.put("接头数", json.getString("joint_type"));
mp.put("计划外分切的子卷", json.getString("is_un_plan_production"));
mp.put("子卷的物性值1", json.getString("un_plan_product_property1"));
mp.put("子卷的物性值2", json.getString("un_plan_product_property2"));

View File

@@ -90,7 +90,9 @@
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
END
END AS sub_type,
DATEDIFF( NOW(), sub.date_of_production ) AS stock_age
DATEDIFF( NOW(), sub.date_of_production ) AS stock_age,
sub.joint_type,
dis.confirm_time
FROM
ST_IVT_StructIvt ivt
@@ -114,6 +116,20 @@
WHERE
plan1.is_delete = '0'
GROUP BY container_name) plan ON plan.container_name = sub.container_name
LEFT JOIN (
SELECT
MIN( mst.confirm_time ) AS confirm_time,
dis.pcsn
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
WHERE
mst.io_type = '0'
AND mst.bill_type = '0001'
AND mst.is_delete = '0'
GROUP BY
dis.pcsn
) dis ON dis.pcsn = ivt.pcsn
WHERE
1 = 1
@@ -243,7 +259,9 @@
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
END AS sub_type,
DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age
DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age,
sub.joint_type,
dis.confirm_time
FROM
ST_IVT_StructIvt ivt
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
@@ -267,6 +285,20 @@
WHERE
plan1.is_delete = '0'
GROUP BY container_name) plan ON plan.container_name = sub.container_name
LEFT JOIN (
SELECT
MIN( mst.confirm_time ) AS confirm_time,
dis.pcsn
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
WHERE
mst.io_type = '0'
AND mst.bill_type = '0001'
AND mst.is_delete = '0'
GROUP BY
dis.pcsn
) dis ON dis.pcsn = ivt.pcsn
WHERE
1 = 1
and attr.stor_id in 输入.in_stor_id

View File

@@ -140,5 +140,9 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmsToAcsService.getTubeMsg(jo), HttpStatus.OK);
}
@PostMapping("/queryBoxWeigh")
@Log(value = "查询木箱毛重", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
public ResponseEntity<Object> querydeviceOne(@RequestBody JSONObject jo) {
return new ResponseEntity<>(wmsToAcsService.queryBoxWeigh(jo), HttpStatus.OK);
}
}

View File

@@ -147,6 +147,10 @@ public interface WmsToAcsService {
JSONObject getTubeMsg(JSONObject jo);
/**
* 查询木箱重量
* @param jo 、
* @return JSONObject
*/
JSONObject queryBoxWeigh(JSONObject jo);
}

View File

@@ -474,4 +474,47 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
arr.add(whereJson);
return AcsUtil.notifyAcs(api, arr);
}
@Override
public JSONObject queryBoxWeigh(JSONObject jo) {
String api = "api/wms/querydevice";
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
JSONObject result = new JSONObject();
if (StrUtil.equals("0", isConnect)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "查询失败未连接ACS!");
result.put("data", new JSONArray());
return result;
}
String product_area = "LK";
String acs_url = URLEnum.find(product_area);
if (StrUtil.isEmpty(acs_url)) {
log.info(product_area);
throw new BadRequestException("未查询到区域对应的acs地址");
}
String url = acs_url + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(jo.getJSONArray("data")))
.execute().body();
result = JSONObject.parseObject(resultMsg);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
result.put("status", HttpStatus.BAD_REQUEST);
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONArray());
}
//acs抛异常这里
if (!StrUtil.equals(result.getString("status"), "200")) {
throw new BadRequestException("操作失败:" + result.getString("message"));
}
return result;
}
}

View File

@@ -701,6 +701,76 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
@Override
public JSONObject sendSalesIvtMsg(String file_name) {
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功,但未连接飞书!");
result.put("data", new JSONObject());
return result;
}
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/UploadImage";
url = url + api +"?fileName="+file_name;
log.info("sendSalesIvtMsg接口输入参数为-------------------" + url.toString());
try {
String resultMsg = HttpRequest.post(url)
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("sendSalesIvtMsg接口输出参数为-------------------" + result.toString());
String RTYPE = result.getString("RTYPE");
if ("E".equals(RTYPE)) {
throw new BadRequestException(result.getString("RTMSG"));
}
} catch (Exception e) {
throw new BadRequestException("飞书提示错误:" + e.getMessage());
}
return result;
}
@Override
public JSONObject sendSalesIvtMsgParam(JSONObject param) {
log.info("sendSalesIvtMsgParam接口输入参数为-------------------" + param.toString());
JSONObject result = new JSONObject();
if (StrUtil.equals("0", is_connect_mes)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功,但未连接飞书!");
result.put("data", new JSONObject());
return result;
}
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/SendCard";
url = url + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("sendSalesIvtMsgParam接口输出参数为-------------------" + result.toString());
String RTYPE = result.getString("RTYPE");
if ("E".equals(RTYPE)) {
throw new BadRequestException(result.getString("RTMSG"));
}
} catch (Exception e) {
throw new BadRequestException("飞书提示错误:" + e.getMessage());
}
return result;
}
@Override
public JSONObject momAutoTransterMoveIn(JSONObject param) {
String from_area = param.getString("from_area");

View File

@@ -33,6 +33,12 @@ public class ProductInstorController {
return new ResponseEntity<>(productInstorService.boxQuery(whereJson), HttpStatus.OK);
}
@PostMapping("/weighCheck")
@Log("称重校验")
public ResponseEntity<Object> weighCheck(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(productInstorService.weighCheck(whereJson), HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("手持生产入库确认")

View File

@@ -22,4 +22,6 @@ public interface ProductInstorService {
JSONObject bale(JSONObject whereJson);
JSONObject abnormalOut(JSONObject whereJson);
JSONObject weighCheck(JSONObject whereJson);
}

View File

@@ -153,7 +153,7 @@ public class PrintServiceImpl implements PrintService {
+ box_jo.getString("customer_description") + ","
+ box_jo.getString("thickness") + ","
+ box_jo.getString("mass_per_unit_area") + ","
+ box_jo.getString("length") + ","
+ NumberUtil.round(box_jo.getString("length"), 2) + ","
+ box_jo.getString("box_type") + ","
+ box_jo.getString("sap_pcsn") + ","
+ box_jo.getString("box_length") + ","
@@ -295,7 +295,7 @@ public class PrintServiceImpl implements PrintService {
+ box_jo.getString("customer_description") + ","
+ box_jo.getString("thickness") + ","
+ box_jo.getString("mass_per_unit_area") + ","
+ box_jo.getString("length") + ","
+ NumberUtil.round(box_jo.getString("length"), 2) + ","
+ box_jo.getString("box_type") + ","
+ box_jo.getString("sap_pcsn") + ","
+ box_jo.getString("box_length") + ","

View File

@@ -3,6 +3,7 @@ package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -17,6 +18,7 @@ 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.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.pda.st.service.ProductInstorService;
@@ -55,6 +57,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
private final RedissonClient redissonClient;
private final WmsToAcsService wmsToAcsService;
@Override
public JSONObject boxQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
@@ -540,4 +544,49 @@ public class ProductInstorServiceImpl implements ProductInstorService {
return jo;
}
@Override
public JSONObject weighCheck(JSONObject whereJson) {
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
JSONObject jo = new JSONObject();
String point_code = whereJson.getString("point_code");
String box_no = whereJson.getString("box_no");
if (ObjectUtil.isEmpty(point_code)) {
throw new BadRequestException("点位不能为空!");
}
if (ObjectUtil.isEmpty(box_no)) {
throw new BadRequestException("木箱号不能为空!");
}
// 组织数据
JSONArray paramArr = new JSONArray();
JSONObject paramJson = new JSONObject();
paramJson.put("device_code", point_code);
paramArr.add(paramJson);
// 调用接口
whereJson.put("data", paramArr);
JSONObject jsonObject = wmsToAcsService.queryBoxWeigh(whereJson);
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
// 获取系统参数
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").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);
} else {
jo.put("message", "重量不合格!当前称重重量:"+weight_now);
}
return jo;
}
}

View File

@@ -77,6 +77,7 @@ public class CutConveyorTask extends AbstractAcsTask {
public void updateTaskStatus(JSONObject taskObj, String status) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -111,6 +112,15 @@ public class CutConveyorTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
if ("010507".equals(jsonTask.getString("task_type"))) {
double weight = taskObj.getDoubleValue("weight");
// 更新子卷包装实际重量
JSONObject param = new JSONObject();
param.put("real_weight",weight);
subTab.update(param,"package_box_sn ='"+jsonTask.getString("vehicle_code")+"'");
}
//只有输送入的时候才调用MES
if ("010402".equals(jsonTask.getString("task_type"))) {
//调用MES接口通知MES运输中

View File

@@ -5683,9 +5683,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'").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 + "'").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++) {

View File

@@ -175,3 +175,4 @@
ENDSELECT
ENDQUERY
ENDIF