From 33c31ae5648ca03e70ba04f4b8fb33b110a10b55 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 22 Nov 2023 18:03:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=A3=80=E3=80=81=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E3=80=81=E4=BF=9D=E5=85=BB=E9=80=BB=E8=BE=91=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E3=80=81=E7=94=9F=E6=88=90=E7=BC=96=E7=A0=81=E9=87=8D=E5=A4=8D?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/controller/EquOrderController.java | 2 +- .../device/mapper/EquOrderDetailMapper.java | 6 ++++ .../com/op/device/mapper/EquOrderMapper.java | 6 ++++ .../device/mapper/EquOrderPersonMapper.java | 6 ++++ .../device/mapper/EquOrderStandardMapper.java | 6 ++++ .../op/device/mapper/EquSpareApplyMapper.java | 8 ++++- .../device/mapper/SparePartsLedgerMapper.java | 6 ++++ .../op/device/service/IEquOrderService.java | 2 +- .../service/impl/DevicePDAServiceImpl.java | 2 +- .../service/impl/DeviceTaskServiceImpl.java | 4 +-- .../service/impl/EquOrderServiceImpl.java | 32 +++++++++++++++++-- .../impl/EquUpkeepOrderServiceImpl.java | 2 +- .../impl/InspectionWorkServiceImpl.java | 2 +- .../device/EquCheckItemDetailMapper.xml | 2 +- .../mapper/device/EquCheckItemMapper.xml | 2 +- .../mapper/device/EquFaultTypeMapper.xml | 2 +- .../mapper/device/EquItemEquipmentMapper.xml | 2 +- .../mapper/device/EquOrderDetailMapper.xml | 9 ++++++ .../mapper/device/EquOrderMapper.xml | 11 +++++-- .../mapper/device/EquOrderPersonMapper.xml | 11 +++++++ .../mapper/device/EquOrderStandardMapper.xml | 10 ++++++ .../resources/mapper/device/EquPlanMapper.xml | 2 +- .../mapper/device/EquSpareApplyMapper.xml | 15 +++++++-- .../mapper/device/SparePartsLedgerMapper.xml | 5 +++ 24 files changed, 134 insertions(+), 21 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquOrderController.java index 424ec857..6ad25fff 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquOrderController.java @@ -93,6 +93,6 @@ public class EquOrderController extends BaseController { @Log(title = "计划工单", businessType = BusinessType.DELETE) @DeleteMapping("/{orderIds}") public AjaxResult remove(@PathVariable String[] orderIds) { - return toAjax(equOrderService.deleteEquOrderByOrderIds(orderIds)); + return equOrderService.deleteEquOrderByOrderIds(orderIds); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java index 37e62743..6b289b43 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java @@ -78,4 +78,10 @@ public interface EquOrderDetailMapper { List selectEquOrderDetailByOrderCode(String orderCode); int insertEquOrderDetails(@Param("list") List details); + + /** + * 通过orderIds逻辑删除检查项信息 + * @param orderIds + */ + void delEquOrderDetailByorderIds(String[] orderIds); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java index 7e42afbf..23a437fe 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java @@ -155,4 +155,10 @@ public interface EquOrderMapper { * @return */ List selectCheckListByRepairCode(EquOrder equOrder); + + /** + * 逻辑删除工单信息 + * @param orderIds + */ + void delEquOrderByOrderIds(String[] orderIds); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java index 7bb544a8..fd36f55f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java @@ -69,4 +69,10 @@ public interface EquOrderPersonMapper { List selectEquOrderPersonByOrderCode(String orderCode); int insertEquOrderPersons(@Param("list") List persons); + + /** + * 通过工单ids逻辑删除人员信息 + * @param orderIds + */ + void delEquOrderPersonByorderIds(String[] orderIds); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java index e1f82f44..a05d2f8a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java @@ -96,4 +96,10 @@ public interface EquOrderStandardMapper { * 更新维修后标准 */ void updateStandardAfterRepair(EquOrderStandard equOrderStandard); + + /** + * 通过orderIds逻辑删除标准信息 + * @param orderIds + */ + void delEquOrderStandardByorderIds(String[] orderIds); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java index 6cb379bc..e6924a08 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java @@ -74,5 +74,11 @@ public interface EquSpareApplyMapper { * @param orderCode * @return */ - List selectEquSpareApplyListByParentCode(String orderCode); + List selectEquSpareApplyListByWorkCode(String orderCode); + + /** + * 通过保养工单ids逻辑删除备件申领表信息 + * @param orderIds + */ + void delEquSpareApplyByorderIds(String[] orderIds); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java index 2714af72..e46cdd5b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java @@ -73,4 +73,10 @@ public interface SparePartsLedgerMapper { * @param apply */ void updateSpareNumReduce(EquSpareApply apply); + + /** + * 删除工单然后返还备件数量 + * @param apply + */ + void updateSpareNumAdd(EquSpareApply apply); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquOrderService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquOrderService.java index da19e7c7..f6d05174 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquOrderService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquOrderService.java @@ -50,7 +50,7 @@ public interface IEquOrderService { * @param orderIds 需要删除的计划工单主键集合 * @return 结果 */ - public int deleteEquOrderByOrderIds(String[] orderIds); + public AjaxResult deleteEquOrderByOrderIds(String[] orderIds); /** * 删除计划工单信息 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 89c93961..93bc62b7 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -143,7 +143,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { } // 备件 - List spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); + List spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode()); if (spareList != null) { order.setSpareList(spareList); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index dd2b695f..933ed86b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -288,7 +288,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { apply.setSpareQuantity(spare.getApplyNum()); apply.setFactoryCode(factory); apply.setApplyPeople("job"); - apply.setParentCode(orderCode); + apply.setWorkCode(orderCode); apply.setCreateBy("job"); apply.setCreateTime(nowtime); apply.setSpareUseEquipment(plan.getEquipmentCode()); @@ -296,7 +296,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { // 插入备件信息 equSpareApplyMapper.insertEquSpareApply(apply); - // TODO 减少备件仓库中备件数量 + // 减少备件仓库中备件数量 sparePartsLedgerMapper.updateSpareNumReduce(apply); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java index 70837bb8..b56c698f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java @@ -55,6 +55,8 @@ public class EquOrderServiceImpl implements IEquOrderService { private EquPlanMapper equPlanMapper; @Autowired private EquSpareApplyMapper equSpareApplyMapper; + @Autowired + private SparePartsLedgerMapper sparePartsLedgerMapper; /** * 查询计划工单 @@ -91,7 +93,7 @@ public class EquOrderServiceImpl implements IEquOrderService { order.setDetailList(detailList); // 备件 - List spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); + List spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode()); if (spareList.size() > 0) { order.setSpareList(spareList); } @@ -361,8 +363,32 @@ public class EquOrderServiceImpl implements IEquOrderService { */ @Override @DS("#header.poolName") - public int deleteEquOrderByOrderIds(String[] orderIds) { - return equOrderMapper.deleteEquOrderByOrderIds(orderIds); + public AjaxResult deleteEquOrderByOrderIds(String[] orderIds) { + // 保养-备件逻辑 + for (String orderId : orderIds) { + EquOrder order = equOrderMapper.selectEquOrderByOrderId(orderId); + if (!order.getOrderStatus().equals("0")) { + return error(500,"工单已进行修改!不可删除!"); + } + if (order.getPlanType().equals("maintenance")) { + List applyList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getWorkCode()); + for (EquSpareApply apply : applyList) { + // 返回备件数量 + sparePartsLedgerMapper.updateSpareNumAdd(apply); + } + } + } + // 逻辑删除工单 + equOrderMapper.delEquOrderByOrderIds(orderIds); + // 逻辑删除获取人员 + equOrderPersonMapper.delEquOrderPersonByorderIds(orderIds); + // 逻辑删除标准信息 + equOrderStandardMapper.delEquOrderStandardByorderIds(orderIds); + // 逻辑删除检查项信息 + equOrderDetailMapper.delEquOrderDetailByorderIds(orderIds); + // 逻辑删除备件信息 + equSpareApplyMapper.delEquSpareApplyByorderIds(orderIds); + return success(); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java index 23a3a7f5..10e37555 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java @@ -130,7 +130,7 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { apply.setSpareQuantity(spare.getApplyNum()); apply.setFactoryCode(factory); apply.setApplyPeople(SecurityContextHolder.getUserName()); - apply.setParentCode(equOrder.getOrderCode()); + apply.setWorkCode(equOrder.getOrderCode()); apply.setCreateBy(SecurityContextHolder.getUserName()); apply.setCreateTime(DateUtils.getNowDate()); apply.setSpareUseEquipment(equOrder.getEquipmentCode()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java index 3e04ee70..7203edc3 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java @@ -68,7 +68,7 @@ public class InspectionWorkServiceImpl implements IInspectionWorkService { } // 查询备件信息 - List spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); + List spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode()); // 替换循环周期 order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType())); diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml index 03432131..437a399a 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -60,7 +60,7 @@ SELECT COUNT(item_id)+1 AS serialNum FROM equ_check_item - WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' + WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) SELECT COUNT(fault_id)+1 AS serialNum FROM equ_fault_type - WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' + WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquItemEquipmentMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquItemEquipmentMapper.xml index e58ca399..fb8bc284 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquItemEquipmentMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquItemEquipmentMapper.xml @@ -50,7 +50,7 @@ SELECT COUNT(order_id)+1 AS serialNum FROM equ_order - WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' + WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) select eo.order_id, diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderPersonMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderPersonMapper.xml index 870e0dc0..51a5b701 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderPersonMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderPersonMapper.xml @@ -127,4 +127,15 @@ #{id} + + + update equ_order_person + set del_flag = '1' + where del_flag = '0' and order_code in ( + select order_code from equ_order where del_flag = '0' and order_id in + + #{id} + + ) + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml index 466095ba..cb2aa019 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml @@ -259,6 +259,16 @@ delete from base_file where source_id = #{sourceId} + + update equ_order_standard set del_flag = '1' + where del_flag = '0' and order_code in ( + select order_code from equ_order where del_flag = '0' and order_id in + + #{id} + + ) + + SELECT COUNT(plan_id)+1 AS serialNum FROM equ_plan - WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' + WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) @@ -179,12 +188,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - where parent_code = #{orderCode} and del_flag = '0' + where work_code = #{orderCode} and del_flag = '0' \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml index 0ceedf67..f1eb13d4 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml @@ -285,6 +285,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" set amount = ( amount - #{spareQuantity} ) where material_code = #{spareCode} + + update wms_ods_mate_storage_news + set amount = ( amount + #{spareQuantity} ) where material_code = #{spareCode} + + delete from wms_ods_mate_storage_news where storage_id = #{storageId}