diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java index 3bb4f992..55713336 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesOutOrderController.java @@ -359,4 +359,29 @@ public String addShippingDevicesOne(@RequestParam("outOrderDetailId") Long outOr + /** + * 售后第二次维护设备 + */ + @GetMapping("/maintenanceEquipmentTwo/{outOrderId}") + public String maintenanceEquipmentTwo(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap) + { + AftersalesOutOrder aftersalesOutOrder = aftersalesOutOrderService.selectAftersalesOutOrderById(outOrderId); + mmap.put("aftersalesOutOrder", aftersalesOutOrder); + return prefix + "/maintenanceEquipmentTwo"; + } + + /** + * 修改保存售后第二次维护设备 + */ + @RequiresPermissions("aftersales:aftersalesOutOrder:maintenanceEquipmentTwo") + @Log(title = "售后维护设备出库", businessType = BusinessType.UPDATE) + @PostMapping("/maintenanceEquipmentTwo") + @ResponseBody + public AjaxResult maintenanceEquipmentTwoSave(@RequestBody AftersalesOutOrder aftersalesOutOrder) + { + return toAjax(aftersalesOutOrderService.updateMaintenanceEquipmentTwo(aftersalesOutOrder)); + } + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java index 2faee83a..dacdb514 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java @@ -26,24 +26,29 @@ public class SelectShippingDeviceVO { private String snCode; /** 出厂日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") private Date factoryDate; /** 保修期 */ private String guaranteePeriod; /** 锁机时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") private Date lockDate; /** 是否有锁机时间 */ private String lockDateFlag; /** 损耗品到期时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") private Date wastageExpireDate; /** 二次维修后部件质保时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") private Date componentGuaranteeDate; /** 是否添加出货设备(0代表是 1代表否)*/ + private String addShippingDeviceFlag; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java index e5f18c68..5aed959c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOutOrderService.java @@ -121,4 +121,11 @@ public interface IAftersalesOutOrderService * 逻辑删除出货设备(也就是取消关联) * */ int deleteAftersalesShippingDeviceById(String shippingDeviceId); + + /** + * 修改保存售后第二次维护设备出库 + * @param aftersalesOutOrder + * @return + */ + int updateMaintenanceEquipmentTwo(AftersalesOutOrder aftersalesOutOrder); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java index 3e42771e..8014dcd3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOutOrderServiceImpl.java @@ -162,7 +162,7 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService public int updateMaintenanceEquipmentOne(AftersalesOutOrder aftersalesOutOrder) { String outOrderCode = aftersalesOutOrder.getOutOrderCode(); - + String loginName = ShiroUtils.getLoginName(); // 定义一个StringBuilder来收集所有缺少SN号的设备ID StringBuilder missingSnIds = new StringBuilder(); //物料信息主表的数据 @@ -204,7 +204,8 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService AfterSalesShippingDevice tempShippingDevice = new AfterSalesShippingDevice(); tempShippingDevice.setShippingDeviceId(shippingDeviceId); tempShippingDevice.setSnCode(selectShippingDeviceVO.getSnCode()); - + tempShippingDevice.setUpdateBy(loginName); + tempShippingDevice.setUpdateTime(new Date()); int updateShippingDeviceResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(tempShippingDevice); if (updateShippingDeviceResult <= 0){ throw new BusinessException("更新设备数据失败"); @@ -217,6 +218,8 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService //更改状态未待确认发货 warehouseOutOrder.setOutOrderCode(outOrderCode); warehouseOutOrder.setWarehouseOutStatus("2"); + warehouseOutOrder.setUpdateBy(loginName); + warehouseOutOrder.setUpdateTime(new Date()); int updateWarehouseResult = warehouseOutOrderMapper.updateWarehouseOutOrderByCode(warehouseOutOrder); if (updateWarehouseResult <= 0){ throw new BusinessException("更新销售售后通知单数据失败"); @@ -226,6 +229,8 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); sysSalesShippingInform.setOutOrderCode(outOrderCode); sysSalesShippingInform.setWarehouseOutStatus("2"); + sysSalesShippingInform.setUpdateBy(loginName); + sysSalesShippingInform.setUpdateTime(new Date()); int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); if (updateShippingInformResult <= 0){ throw new BusinessException("更新销售出货通知单数据失败"); @@ -234,6 +239,8 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService //更新售后维护设备出库单 aftersalesOutOrder.setWarehouseOutStatus("2"); + aftersalesOutOrder.setUpdateBy(loginName); + aftersalesOutOrder.setUpdateTime(new Date()); int result = aftersalesOutOrderMapper.updateAftersalesOutOrder(aftersalesOutOrder); return result; @@ -412,4 +419,109 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService int updateAfterSalesShippingDevice = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(tempShippingDevice); return updateAfterSalesShippingDevice; } + + + /** + * 修改保存售后第二次维护设备出库 + * @param aftersalesOutOrder + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateMaintenanceEquipmentTwo(AftersalesOutOrder aftersalesOutOrder) { + + String outOrderCode = aftersalesOutOrder.getOutOrderCode(); + String loginName = ShiroUtils.getLoginName(); + //物料信息主表的数据 + List needShippingDeviceMaterialsOne = this.getNeedShippingDeviceMaterialsOne(aftersalesOutOrder); + if (!CollectionUtils.isEmpty(needShippingDeviceMaterialsOne)){ + List selectShippingDeviceVOList = aftersalesOutOrder.getSelectShippingDeviceVOList(); + if (CollectionUtils.isEmpty(selectShippingDeviceVOList)){ + throw new BusinessException("请展开物料详情并维护要出货的设备"); + } + + boolean anyNullFactoryDate = selectShippingDeviceVOList.stream().anyMatch(item -> item.getFactoryDate() == null); + if (anyNullFactoryDate){ + throw new BusinessException("请展开物料详情并填写每个设备的出库日期"); + } + + boolean anyNullGuaranteePeriod = selectShippingDeviceVOList.stream().anyMatch(item -> item.getGuaranteePeriod() == null); + if (anyNullGuaranteePeriod){ + throw new BusinessException("请展开物料详情并填写每个设备的保修期"); + } + + boolean anyNullLockDateFlag = selectShippingDeviceVOList.stream().anyMatch(item -> item.getLockDateFlag() == null); + if (anyNullLockDateFlag){ + throw new BusinessException("请展开物料详情并填写每个设备的是否有锁机时间"); + } + + boolean anyNullWastageExpireDate = selectShippingDeviceVOList.stream().anyMatch(item -> item.getWastageExpireDate() == null); + if (anyNullWastageExpireDate){ + throw new BusinessException("请展开物料详情并填写每个设备的是否有损耗品到期时间"); + } + + boolean anyNullComponentGuaranteeDate = selectShippingDeviceVOList.stream().anyMatch(item -> item.getComponentGuaranteeDate() == null); + if (anyNullComponentGuaranteeDate){ + throw new BusinessException("请展开物料详情并填写每个设备的是否有二次维护部件质保时间"); + } + + /* 缺少校验规则,后续补充 + * 2.1、已选出货设备,是否可用(状态:可用,即未被其他出库单添加或报损),若不可用,则弹窗提示“CHSB20240808004、CHSB20240808005.不可用,请重新添加 + * */ + + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + String shippingDeviceId = selectShippingDeviceVO.getShippingDeviceId(); + AfterSalesShippingDevice tempShippingDevice = new AfterSalesShippingDevice(); + tempShippingDevice.setShippingDeviceId(shippingDeviceId); + tempShippingDevice.setSnCode(selectShippingDeviceVO.getSnCode()); + tempShippingDevice.setFactoryDate(selectShippingDeviceVO.getFactoryDate()); + tempShippingDevice.setGuaranteePeriod(selectShippingDeviceVO.getGuaranteePeriod()); + tempShippingDevice.setLockDateFlag(selectShippingDeviceVO.getLockDateFlag()); + if ("0".equals(selectShippingDeviceVO.getLockDateFlag())){ + tempShippingDevice.setLockDate(selectShippingDeviceVO.getLockDate()); + } + tempShippingDevice.setWastageExpireDate(selectShippingDeviceVO.getWastageExpireDate()); + tempShippingDevice.setComponentGuaranteeDate(selectShippingDeviceVO.getComponentGuaranteeDate()); + tempShippingDevice.setUpdateBy(loginName); + tempShippingDevice.setUpdateTime(new Date()); + int updateShippingDeviceResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(tempShippingDevice); + if (updateShippingDeviceResult <= 0){ + throw new BusinessException("更新设备数据失败"); + } + } + + } + //更新出库单 + WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder(); + //更改状态未待确认发货 + warehouseOutOrder.setOutOrderCode(outOrderCode); + warehouseOutOrder.setWarehouseOutStatus("4");//为待出库 + warehouseOutOrder.setUpdateBy(loginName); + warehouseOutOrder.setUpdateTime(new Date()); + int updateWarehouseResult = warehouseOutOrderMapper.updateWarehouseOutOrderByCode(warehouseOutOrder); + if (updateWarehouseResult <= 0){ + throw new BusinessException("更新销售售后通知单数据失败"); + } + + //更新销售出货通知单 + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + sysSalesShippingInform.setOutOrderCode(outOrderCode); + sysSalesShippingInform.setWarehouseOutStatus("4");//为待出库 + sysSalesShippingInform.setUpdateTime(new Date()); + sysSalesShippingInform.setUpdateBy(loginName); + int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + if (updateShippingInformResult <= 0){ + throw new BusinessException("更新销售出货通知单数据失败"); + } + + + //更新售后维护设备出库单 为待出库 + aftersalesOutOrder.setWarehouseOutStatus("4"); + aftersalesOutOrder.setUpdateBy(loginName); + aftersalesOutOrder.setUpdateTime(new Date()); + int result = aftersalesOutOrderMapper.updateAftersalesOutOrder(aftersalesOutOrder); + + return result; + + } } diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html index 80bf0888..4d5ad8a5 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/aftersalesOutOrder.html @@ -219,6 +219,14 @@ $.modal.open("售后第一次维护设备",url); } + + /*售后第二次维护设备*/ + function maintenanceEquipmentTwo(outOrderId) { + var url = ctx + 'aftersales/aftersalesOutOrder/maintenanceEquipmentTwo/'+outOrderId; + $.modal.open("售后第二次维护设备",url); + } + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html index d3702299..9a048b3a 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html @@ -294,7 +294,7 @@ editable: { validate: function(value) { if ($.trim(value) === '') { - return '本次收货数不能为空'; + return '设备SN号不能为空'; } }, }, diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentTwo.html b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentTwo.html new file mode 100644 index 00000000..0302b451 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentTwo.html @@ -0,0 +1,486 @@ + + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+

需要维护出货设备信息

+
+
+
+
+
+
+
+ + +
+
+

无需维护出货设备信息

+
+
+
+
+
+
+
+ + + +
+
+ + + + + + + \ No newline at end of file