From 974df286802d4b854916662a2603aed5d271c4ef Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Thu, 31 Oct 2024 13:48:57 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E7=A7=BB=E5=BA=93=E5=8D=95=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E8=A1=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9B=BF=E6=8D=A2=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../util/impl/OutBussManageServiceImpl.java | 59 +++++++++++-------- .../dao/mapper/DeviceStatusMapper.java | 4 ++ .../service/dao/mapper/DeviceStatusMapper.xml | 14 ++++- .../acs/service/impl/AcsToWmsServiceImpl.java | 55 +++++++++-------- .../org/nl/wms/sch/manage/AutoCleanIos.java | 29 ++++++--- .../nl/wms/sch/manage/AutoQueryBillInfo.java | 19 ++++-- .../nl/wms/sch/manage/AutoQueryConRem.java | 19 ++++-- .../nl/wms/sch/manage/AutoQueryUpload.java | 24 +++++--- .../org/nl/wms/sch/manage/AutoSendFeiShu.java | 42 +++++++++---- .../st/instor/task/HandMoveStorAcsTask.java | 39 +++++++----- .../service/impl/CheckOutBillServiceImpl.java | 24 +++++--- 11 files changed, 216 insertions(+), 112 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/OutBussManageServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/OutBussManageServiceImpl.java index 609c5c7..942a267 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/OutBussManageServiceImpl.java +++ b/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 ja = moveStorDtlMapper.selectList(new LambdaQueryWrapper() + .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() + .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()); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java index 94d21e4..3dff9fc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java +++ b/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 { + List queryAllByResend_time(String resend_time); + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml index 6e6b2d5..a97cc69 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml @@ -1,5 +1,17 @@ - + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index a8935bc..077c469 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/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 lam = new LambdaQueryWrapper(); + lam.eq(DeviceStatus::getDevice_code,device_code); + List 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 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(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCleanIos.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCleanIos.java index 1da4747..d9a7652 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCleanIos.java +++ b/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 mstArr = mst.query("(TO_DAYS(NOW()) - TO_DAYS(input_time))>365") .getResultJSONArray(0).toJavaList(JSONObject.class); - String moveinv_id_in = mstArr.stream() + List 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 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 wrapperdtl = new LambdaQueryWrapper(); + wrapperdtl.in(MoveStorDtl::getMoveinv_id,moveinv_id_in); + moveStorDtlMapper.delete(wrapperdtl); + + log.info("仓储【移库单据】相关表清除成功!删除单据为:"+moveinv_id_in.toString()); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java index 4fe51c9..b5067e8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryBillInfo.java +++ b/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 lam = new LambdaQueryWrapper(); + lam.eq(DeviceStatus::getDevice_code,device_code); + + List 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) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java index ecd9e5a..9c17557 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryConRem.java +++ b/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 lam = new LambdaQueryWrapper(); + 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) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java index e9aa53b..32b14cb 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryUpload.java +++ b/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 lam = new LambdaQueryWrapper(); + 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 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()); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java index 13ffe76..a18c412 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSendFeiShu.java +++ b/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 lam = new LambdaQueryWrapper(); + lam.eq(DeviceStatus::getUpload_flag,"1") + .and(la->la.isNull(DeviceStatus::getIs_upload) + .or() + .eq(DeviceStatus::getIs_upload,"0")) + .gt(DeviceStatus::getError,"0"); + + List 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 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 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 map = new HashMap<>(); map.put("is_upload", "1"); map.put("upload_time", DateUtil.now()); - wo.update(map, "device_code = '" + device_code + "'"); + LambdaUpdateWrapper lam = new LambdaUpdateWrapper(); + 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()); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java index bcf4f94..7f46c78 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/task/HandMoveStorAcsTask.java +++ b/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 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 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 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 ja = moveStorDtlMapper.selectList(new LambdaQueryWrapper() + .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); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index 49571d3..34fdcee 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/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 jsonMoveDtl = moveStorDtlMapper.selectList(new LambdaQueryWrapper() + .eq(MoveStorDtl::getTask_id, jsonMoveTask.getString("task_id"))); + if (jsonMoveDtl.size()>0) { + MoveStor jsonMoveMst = moveStorMapper.selectOne(new LambdaQueryWrapper() + .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()); } }