Browse Source

opt:移库单表、设备状态表代码替换更新

master
zds 3 weeks ago
parent
commit
974df28680
  1. 59
      lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/OutBussManageServiceImpl.java
  2. 4
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java
  3. 14
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml
  4. 55
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  5. 29
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCleanIos.java
  6. 19
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java
  7. 19
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java
  8. 24
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java
  9. 42
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java
  10. 39
      lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java
  11. 24
      lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java

59
lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/OutBussManageServiceImpl.java

@ -37,6 +37,10 @@ import org.nl.wms.basedata.st.structattr.service.dao.mapper.StructattrMapper;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.movestor.service.HandMoveStorService;
import org.nl.wms.st.instor.movestor.service.dao.MoveStor;
import org.nl.wms.st.instor.movestor.service.dao.MoveStorDtl;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorDtlMapper;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorMapper;
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -71,6 +75,10 @@ public class OutBussManageServiceImpl implements OutBussManageService {
private StructattrMapper structattrMapper;
@Autowired
private StructattrService structattrService;
@Autowired
private MoveStorMapper moveStorMapper;
@Autowired
private MoveStorDtlMapper moveStorDtlMapper;
/**
* 出入库明细服务
*/
@ -794,10 +802,6 @@ public class OutBussManageServiceImpl implements OutBussManageService {
* 3.更新单据相关数据
* 4.更新任务终点
*/
// 移库单明细
WQLObject moveDtlTab = WQLObject.getWQLObject("st_ivt_moveinvdtl");
// 移库单主表
WQLObject moveMstTab = WQLObject.getWQLObject("st_ivt_moveinv");
// 子卷包装关系
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
// 物料信息
@ -810,9 +814,16 @@ public class OutBussManageServiceImpl implements OutBussManageService {
);
// 查询对应单据
JSONObject jsonMoveDtl = moveDtlTab.query("task_id = '" + taskDao.getTask_id() + "'").uniqueResult(0);
JSONObject jsonMoveMst = moveMstTab.query("moveinv_id = '" + jsonMoveDtl.getString("moveinv_id") + "' AND bill_status <> '99'")
.uniqueResult(0);
List<MoveStorDtl> ja = moveStorDtlMapper.selectList(new LambdaQueryWrapper<MoveStorDtl>()
.eq(MoveStorDtl::getTask_id, taskDao.getTask_id()));
if(ja.size() == 0){
throw new BadRequestException("未找到任务号为【"+taskDao.getTask_code()+"】的移库单明细,请检查数据!");
}
MoveStorDtl jsonMoveDtl = ja.get(0);
MoveStor jsonMoveMst = moveStorMapper.selectOne(new LambdaQueryWrapper<MoveStor>()
.eq(MoveStor::getMoveinv_id, jsonMoveDtl.getMoveinv_id())
.eq(MoveStor::getIs_delete,"0")
.ne(MoveStor::getBill_status,"99"));
if (ObjectUtil.isEmpty(jsonMoveMst)) {
throw new BadRequestException("未找到任务号为【"+taskDao.getTask_code()+"】的移库单,请检查数据!");
}
@ -832,11 +843,11 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonParam = new JSONObject();
jsonParam.put("struct_id", jsonAttr.getStruct_id());
jsonParam.put("material_id", jsonMater.getString("material_id"));
jsonParam.put("pcsn", jsonMoveDtl.getString("pcsn"));
jsonParam.put("change_qty", jsonMoveDtl.getString("qty"));
jsonParam.put("inv_id", jsonMoveMst.getString("moveinv_id"));
jsonParam.put("bill_code", jsonMoveMst.getString("bill_code"));
jsonParam.put("quality_scode", jsonMoveDtl.getString("quality_scode"));
jsonParam.put("pcsn", jsonMoveDtl.getPcsn());
jsonParam.put("change_qty", jsonMoveDtl.getQty());
jsonParam.put("inv_id", jsonMoveMst.getMoveinv_id());
jsonParam.put("bill_code", jsonMoveMst.getBill_code());
jsonParam.put("quality_scode", jsonMoveDtl.getQuality_scode());
storPublicService.IOStor(jsonParam, IOSEnum.IVT_CHANGE.code("减待入"));
jsonAttr.setLock_type(IOSEnum.LOCK_TYPE.code("货位异常锁"));
@ -850,7 +861,7 @@ public class OutBussManageServiceImpl implements OutBussManageService {
// 2.重新分配货位
// 组织查询移入仓位数据
JSONObject moveParam = new JSONObject();
moveParam.put("stor_id", jsonMoveMst.getString("stor_id"));
moveParam.put("stor_id", jsonMoveMst.getStor_id());
moveParam.put("sect_id", RegionTypeEnum.TWO_BZC01.getId());
moveParam.put("box_no", taskDao.getVehicle_code());
moveParam.put("material_id", jsonMater.getString("material_id"));
@ -891,23 +902,23 @@ public class OutBussManageServiceImpl implements OutBussManageService {
JSONObject jsonParam2 = new JSONObject();
jsonParam2.put("struct_id", jsonMove.getStruct_id());
jsonParam2.put("material_id", jsonMater.getString("material_id"));
jsonParam2.put("pcsn", jsonMoveDtl.getString("pcsn"));
jsonParam2.put("change_qty", jsonMoveDtl.getString("qty"));
jsonParam2.put("quality_scode", jsonMoveDtl.getString("quality_scode"));
jsonParam2.put("inv_id", jsonMoveMst.getString("moveinv_id"));
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"));
jsonParam2.put("pcsn", jsonMoveDtl.getPcsn());
jsonParam2.put("change_qty", jsonMoveDtl.getQty());
jsonParam2.put("quality_scode", jsonMoveDtl.getQuality_scode());
jsonParam2.put("inv_id", jsonMoveMst.getMoveinv_id());
jsonParam2.put("bill_code", jsonMoveMst.getBill_code());
jsonParam2.put("bill_type_scode", jsonMoveMst.getBill_type());
jsonParam2.put("qty_unit_id", jsonMoveDtl.getQty_unit_id());
storPublicService.IOStor(jsonParam2, IOSEnum.IVT_CHANGE.code("加待入"));
jsonMove.setLock_type(IOSEnum.LOCK_TYPE.code("移入锁"));
structattrMapper.updateById(jsonMove);
// 3.更新单据相关数据
jsonMoveDtl.put("turnin_struct_id", jsonMove.getStruct_id());
jsonMoveDtl.put("turnin_struct_code", jsonMove.getStruct_code());
jsonMoveDtl.put("turnin_struct_name", jsonMove.getStruct_name());
moveDtlTab.update(jsonMoveDtl);
jsonMoveDtl.setTurnin_struct_id(String.valueOf(jsonMove.getStruct_id()));
jsonMoveDtl.setTurnin_struct_code(jsonMove.getStruct_code());
jsonMoveDtl.setTurnin_struct_name(jsonMove.getStruct_name());
moveStorDtlMapper.updateById(jsonMoveDtl);
// 4.更新任务终点
taskDao.setPoint_code2(jsonMove.getStruct_code());

4
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
import java.util.List;
/**
* @author: zds
* @date: 2024-09-27
@ -11,4 +13,6 @@ import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
*/
public interface DeviceStatusMapper extends BaseMapper<DeviceStatus> {
List<DeviceStatus> queryAllByResend_time(String resend_time);
}

14
lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml

@ -1,5 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper">
<select id="queryAllByResend_time" resultType="org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus">
SELECT
ds.*
FROM
em_bi_devicestatus ds
WHERE 1=1
and error > '0'
AND is_upload = '1'
AND upload_flag = '1'
<if test="resend_time != null">
and TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > resend_time
</if>
</select>
</mapper>

55
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -46,6 +46,8 @@ import org.nl.system.service.notice.ISysNoticeService;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
import org.nl.wms.basedata.master.storagevehicleinfo.service.StoragevehicleinfoService;
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleex;
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo;
@ -94,6 +96,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
private StructattrMapper structattrMapper;
@Autowired
private DeviceStatusMapper deviceStatusMapper;
@Autowired
private ISysParamService sysParamService;
@ -1177,7 +1181,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject sendDeviceStatus(JSONObject whereJson) {
log.info("sendDeviceStatus--------------输入为:" + whereJson.toString());
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
String device_code = whereJson.getString("device_code");
String device_name = whereJson.getString("device_name");
String product_area = whereJson.getString("product_area");
@ -1189,41 +1192,47 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("message", "反馈成功!");
return result;
} else {
JSONObject device = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,device_code);
List<DeviceStatus> rows = deviceStatusMapper.selectList(lam);
DeviceStatus device = null;
if(rows.size()>0){
device = rows.get(0);
}
if (ObjectUtil.isEmpty(device)) {
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("device_name", device_name);
jo.put("product_area", product_area);
jo.put("device_type", device_type);
jo.put("plan", "1");
jo.put("upload_flag", "1");
DeviceStatus jo = new DeviceStatus();
jo.setDevice_code(device_code);
jo.setDevice_name(device_name);
jo.setProduct_area(product_area);
jo.setDevice_type(device_type);
jo.setPlan("1");
jo.setUpload_flag("1");
if (whereJson.containsKey("mode")) {
jo.put("mode", whereJson.getString("mode"));
jo.put("mode_update_time", DateUtil.now());
jo.setMode(whereJson.getString("mode"));
jo.setMode_update_time(DateUtil.now());
}
if (whereJson.containsKey("error")) {
jo.put("error", whereJson.getString("error"));
jo.put("error_msg", whereJson.getString("error_msg"));
jo.put("error_update_time", DateUtil.now());
jo.setError(whereJson.getString("error"));
jo.setError_msg(whereJson.getString("error_msg"));
jo.setError_update_time(DateUtil.now());
}
wo.insert(jo);
deviceStatusMapper.insert(jo);
} else {
HashMap<String, String> map = new HashMap<>();
if (whereJson.containsKey("mode")) {
map.put("mode", whereJson.getString("mode"));
map.put("mode_update_time", DateUtil.now());
device.setMode(whereJson.getString("mode"));
device.setMode_update_time(DateUtil.now());
}
if (whereJson.containsKey("error")) {
map.put("error", whereJson.getString("error"));
map.put("error_msg", whereJson.getString("error_msg"));
map.put("error_update_time", DateUtil.now());
device.setError(whereJson.getString("error"));
device.setError_msg(whereJson.getString("error_msg"));
device.setError_update_time(DateUtil.now());
if ("0".equals(whereJson.getString("error"))) {
map.put("is_upload", "0");
map.put("upload_time", DateUtil.now());
device.setIs_upload("0");
device.setUpload_time(DateUtil.now());
}
}
wo.update(map, "device_code = '" + device_code + "'");
deviceStatusMapper.updateById(device);
}
}
JSONObject result = new JSONObject();

29
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCleanIos.java

@ -2,12 +2,18 @@ package org.nl.wms.sch.manage;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.st.instor.movestor.service.dao.MoveStor;
import org.nl.wms.st.instor.movestor.service.dao.MoveStorDtl;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorDtlMapper;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@ -20,7 +26,10 @@ import java.util.stream.Collectors;
public class AutoCleanIos {
private final RedissonClient redissonClient;
@Autowired
private MoveStorMapper moveStorMapper;
@Autowired
private MoveStorDtlMapper moveStorDtlMapper;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
@ -77,21 +86,25 @@ public class AutoCleanIos {
private void cleanIosMove() {
// 移库单主表
WQLObject mst = WQLObject.getWQLObject("st_ivt_moveinv");
// 移库单明细表
WQLObject dtl = WQLObject.getWQLObject("st_ivt_moveinvdtl");
// 需删除的主表集合
List<JSONObject> mstArr = mst.query("(TO_DAYS(NOW()) - TO_DAYS(input_time))>365")
.getResultJSONArray(0).toJavaList(JSONObject.class);
String moveinv_id_in = mstArr.stream()
List<String> moveinv_id_in = mstArr.stream()
.map(row -> row.getString("moveinv_id"))
.collect(Collectors.joining("','"));
.collect(Collectors.toList());
// 删除主表
mst.delete("moveinv_id IN ('"+moveinv_id_in+"')");
LambdaQueryWrapper<MoveStor> wrapper = new LambdaQueryWrapper();
wrapper.in(MoveStor::getMoveinv_id,moveinv_id_in);
moveStorMapper.delete(wrapper);
// 删除明细表
dtl.delete("moveinv_id IN ('"+moveinv_id_in+"')");
log.info("仓储【移库单据】相关表清除成功!删除单据为:"+moveinv_id_in);
LambdaQueryWrapper<MoveStorDtl> wrapperdtl = new LambdaQueryWrapper();
wrapperdtl.in(MoveStorDtl::getMoveinv_id,moveinv_id_in);
moveStorDtlMapper.delete(wrapperdtl);
log.info("仓储【移库单据】相关表清除成功!删除单据为:"+moveinv_id_in.toString());
}
}

19
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java

@ -6,16 +6,21 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
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.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@ -24,7 +29,8 @@ import java.util.concurrent.TimeUnit;
public class AutoQueryBillInfo {
private final RedissonClient redissonClient;
@Autowired
private DeviceStatusMapper deviceStatusMapper;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
@ -53,13 +59,16 @@ public class AutoQueryBillInfo {
}
void sendInfo(JSONArray send_rows) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
String device_code = "BILL_INFO";
JSONObject device_jo = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(device_jo.getString("upload_user"))) {
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,device_code);
List<DeviceStatus> rows = deviceStatusMapper.selectList(lam);
DeviceStatus device_jo = rows.get(0);
if (ObjectUtil.isEmpty(device_jo.getUpload_user())) {
return;
}
String upload_user = device_jo.getString("upload_user");
String upload_user = device_jo.getUpload_user();
String[] split = upload_user.split(",");
JSONArray UserList = new JSONArray();
if (split.length > 0) {

19
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java

@ -5,16 +5,21 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
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.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@ -22,7 +27,8 @@ import java.util.concurrent.TimeUnit;
@RequiredArgsConstructor
public class AutoQueryConRem {
private final RedissonClient redissonClient;
@Autowired
private DeviceStatusMapper deviceStatusMapper;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
@ -63,15 +69,18 @@ public class AutoQueryConRem {
}
void sendInfo(JSONArray send_rows) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
for (int i = 0; i < send_rows.size(); i++) {
JSONObject row = send_rows.getJSONObject(i);
String device_code = row.getString("device_code");
JSONObject device_jo = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(device_jo) || ObjectUtil.isEmpty(device_jo.getString("upload_user"))) {
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,device_code);
DeviceStatus device_jo = deviceStatusMapper.selectOne(lam);
if (ObjectUtil.isEmpty(device_jo) || ObjectUtil.isEmpty(device_jo.getUpload_user())) {
return;
}
String upload_user = device_jo.getString("upload_user");
String upload_user = device_jo.getUpload_user();
String[] split = upload_user.split(",");
JSONArray UserList = new JSONArray();
if (split.length > 0) {

24
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java

@ -6,14 +6,18 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
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.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@ -25,7 +29,8 @@ import java.util.concurrent.TimeUnit;
public class AutoQueryUpload {
private final RedissonClient redissonClient;
@Autowired
private DeviceStatusMapper deviceStatusMapper;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
@ -46,13 +51,15 @@ public class AutoQueryUpload {
}
void sendInfo(JSONArray send_rows) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
String device_code = "UPLOAD_INFO";
JSONObject device_jo = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(device_jo.getString("upload_user"))) {
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,device_code);
DeviceStatus device_jo = deviceStatusMapper.selectOne(lam);
if (ObjectUtil.isEmpty(device_jo.getUpload_user())) {
return;
}
String upload_user = device_jo.getString("upload_user");
String upload_user = device_jo.getUpload_user();
String[] split = upload_user.split(",");
JSONArray UserList = new JSONArray();
if (split.length > 0) {
@ -85,10 +92,9 @@ public class AutoQueryUpload {
.execute().body();
log.info(" " + jo);
log.info("飞书输出参数为:-------------------" + resultMsg);
HashMap<String, String> map = new HashMap<>();
map.put("is_upload", "1");
map.put("upload_time", DateUtil.now());
wo.update(map, "device_code = '" + device_code + "'");
device_jo.setIs_upload("1");
device_jo.setUpload_time(DateUtil.now());
deviceStatusMapper.updateById(device_jo);
} catch (Exception e) {
log.info(e.getMessage());
}

42
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java

@ -5,17 +5,23 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest;
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 lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
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.master.devicestatus.service.dao.DeviceStatus;
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@ -24,21 +30,28 @@ import java.util.concurrent.TimeUnit;
public class AutoSendFeiShu {
private final RedissonClient redissonClient;
@Autowired
private DeviceStatusMapper deviceStatusMapper;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
//查询故障了还未发送的
JSONArray send_rows = wo.query("error > '0' AND IFNULL(is_upload,'0') = '0' AND upload_flag = '1'").getResultJSONArray(0);
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getUpload_flag,"1")
.and(la->la.isNull(DeviceStatus::getIs_upload)
.or()
.eq(DeviceStatus::getIs_upload,"0"))
.gt(DeviceStatus::getError,"0");
List<DeviceStatus> send_rows = deviceStatusMapper.selectList(lam);
this.sendInfo(send_rows);
//查询已经发送了但是还是故障中的
String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("RESEND_TIME").getValue();
JSONArray resend_rows = wo.query("error > '0' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0);
List<DeviceStatus> resend_rows =deviceStatusMapper.queryAllByResend_time(resend_time);
this.sendInfo(resend_rows);
}
} finally {
@ -48,15 +61,14 @@ public class AutoSendFeiShu {
}
}
void sendInfo(JSONArray device_rows) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
void sendInfo(List<DeviceStatus> device_rows) {
for (int i = 0; i < device_rows.size(); i++) {
JSONObject row = device_rows.getJSONObject(i);
String device_code = row.getString("device_code");
String device_name = row.getString("device_name");
String product_area = row.getString("product_area");
String error_msg = row.getString("error_msg");
String upload_user = row.getString("upload_user");
DeviceStatus row = device_rows.get(i);
String device_code = row.getDevice_code();
String device_name = row.getDevice_name();
String product_area = row.getProduct_area();
String error_msg = row.getError_msg();
String upload_user = row.getUpload_user();
String[] split = upload_user.split(",");
JSONArray UserList = new JSONArray();
if (split.length > 0) {
@ -90,7 +102,11 @@ public class AutoSendFeiShu {
HashMap<String, String> map = new HashMap<>();
map.put("is_upload", "1");
map.put("upload_time", DateUtil.now());
wo.update(map, "device_code = '" + device_code + "'");
LambdaUpdateWrapper<DeviceStatus> lam = new LambdaUpdateWrapper<DeviceStatus>();
lam.eq(DeviceStatus::getDevice_code,device_code);
lam.set(DeviceStatus::getIs_upload,"1");
lam.set(DeviceStatus::getUpload_time,DateUtil.now());
deviceStatusMapper.update(null,lam);
} catch (Exception e) {
log.info(e.getMessage());
}

39
lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java

@ -5,15 +5,19 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
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 lombok.RequiredArgsConstructor;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.st.instor.movestor.service.impl.HandMoveStorServiceImpl;
import org.nl.wms.st.instor.movestor.service.HandMoveStorService;
import org.nl.wms.st.instor.movestor.service.dao.MoveStorDtl;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorDtlMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -25,7 +29,10 @@ import java.util.List;
@RequiredArgsConstructor
public class HandMoveStorAcsTask extends AbstractAcsTask {
private final String THIS_CLASS = HandMoveStorAcsTask.class.getName();
@Autowired
private MoveStorDtlMapper moveStorDtlMapper;
@Autowired
private HandMoveStorService handMoveStorService;
@Override
public List<AcsTaskDto> addTask() {
/*
@ -79,8 +86,6 @@ public class HandMoveStorAcsTask extends AbstractAcsTask {
public void updateTaskStatus(JSONObject taskObj, String status) {
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
//出库分配表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
HashMap<String, String> map = new HashMap<>();
String currentUserId = SecurityUtils.getCurrentUserId();
@ -95,19 +100,20 @@ public class HandMoveStorAcsTask extends AbstractAcsTask {
throw new BadRequestException("查询不到操作的任务记录!");
}
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
/*map.put("work_status", "02");
wo_dtl.update(map, "task_id='" + task_id + "'");*/
map.put("task_status", TaskStatusEnum.EXECUTING.getCode());
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
map.put("update_time", now);
wo_Task.update(map, "task_id='" + task_id + "'");
} else if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
HandMoveStorServiceImpl handMoveStorServiceImpl = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
handMoveStorServiceImpl.finishTask(task);
handMoveStorService.finishTask(task);
} else if ("0".equals(status)) {
map.put("work_status", "01");
wo_dtl.update(map, "task_id='" + task_id + "'");
LambdaUpdateWrapper<MoveStorDtl> wrapper = new LambdaUpdateWrapper();
wrapper.set(MoveStorDtl::getWork_status,"01");
wrapper.eq(MoveStorDtl::getTask_id,task_id);
moveStorDtlMapper.update(null,wrapper);
map.put("is_delete", "1");
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
@ -158,8 +164,6 @@ public class HandMoveStorAcsTask extends AbstractAcsTask {
@Override
@Transactional(rollbackFor = Exception.class)
public void forceFinish(String taskdtl_id) {
//出库明细表
WQLObject wo_dtl = WQLObject.getWQLObject("st_ivt_moveinvdtl");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject task = wo_Task.query("task_status<>'99' and task_id='" + taskdtl_id + "'").uniqueResult(0);
@ -168,10 +172,15 @@ public class HandMoveStorAcsTask extends AbstractAcsTask {
}
String task_id = task.getString("task_id");
JSONObject dtl = wo_dtl.query("task_id='" + task_id + "'").uniqueResult(0);
HandMoveStorServiceImpl handMoveStorService = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
task.put("moveinv_id", dtl.getString("moveinv_id"));
List<MoveStorDtl> ja = moveStorDtlMapper.selectList(new LambdaQueryWrapper<MoveStorDtl>()
.eq(MoveStorDtl::getTask_id, task_id));
if (ja.size()==0) {
throw new BadRequestException("查询不到操作的移库明细记录!");
}
task.put("moveinv_id", ja.get(0).getMoveinv_id());
handMoveStorService.finishTask(task);
}

24
lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java

@ -44,6 +44,10 @@ import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.instor.movestor.service.HandMoveStorService;
import org.nl.wms.st.instor.movestor.service.dao.MoveStor;
import org.nl.wms.st.instor.movestor.service.dao.MoveStorDtl;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorDtlMapper;
import org.nl.wms.st.instor.movestor.service.dao.mapper.MoveStorMapper;
import org.nl.wms.st.instor.movestor.service.impl.HandMoveStorServiceImpl;
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
import org.nl.wms.st.outbill.util.ThreadManage;
@ -80,6 +84,10 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
private final HandMoveStorAcsTask moveStorAcsTask;
private final InAndOutReturnService inAndOutReturnService;
@Autowired
private MoveStorMapper moveStorMapper;
@Autowired
private MoveStorDtlMapper moveStorDtlMapper;
@Autowired
private SectattrMapper sectattrMapper;
@Autowired
private CustomerbaseMapper customerbaseMapper;
@ -2363,10 +2371,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
//移库单明细表
WQLObject move_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
//移库单主表
WQLObject move_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
@ -2453,14 +2457,16 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
for (int j = 0; j < moveArrTask.size(); j++) {
JSONObject jsonMoveTask = moveArrTask.getJSONObject(j);
// 调用删除移库单
JSONObject jsonMoveDtl = move_dtl.query("task_id = '" + jsonMoveTask.getString("task_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonMoveDtl)) {
JSONObject jsonMoveMst = move_mst.query("moveinv_id = '" + jsonMoveDtl.getString("moveinv_id") + "' and is_delete = '0'").uniqueResult(0);
List<MoveStorDtl> jsonMoveDtl = moveStorDtlMapper.selectList(new LambdaQueryWrapper<MoveStorDtl>()
.eq(MoveStorDtl::getTask_id, jsonMoveTask.getString("task_id")));
if (jsonMoveDtl.size()>0) {
MoveStor jsonMoveMst = moveStorMapper.selectOne(new LambdaQueryWrapper<MoveStor>()
.eq(MoveStor::getMoveinv_id, jsonMoveDtl.get(0).getMoveinv_id())
.eq(MoveStor::getIs_delete,"0"));
if (ObjectUtil.isNotEmpty(jsonMoveMst)) {
HandMoveStorServiceImpl bean = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
bean.deleteById(jsonMoveMst.getString("moveinv_id"));
bean.deleteById(jsonMoveMst.getMoveinv_id());
}
}

Loading…
Cancel
Save