From 620efce6509ccf978a32741b384b0fe6c5f8f43e Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Thu, 7 Nov 2024 17:35:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[feat]=20=E5=94=AE=E5=90=8E=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E7=AC=AC=E4=B8=80=E6=AC=A1=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BA=E5=BA=93=E5=8D=95=E5=8F=B7=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=9B=E6=8F=90=E4=BA=A4=E6=96=B9=E6=B3=95=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=9A=E5=BD=93=E5=89=8D=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=85=B3=E8=81=94=E7=9A=84=E5=87=BA=E8=B4=A7=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=8B=BE=E9=80=89=E7=9A=84=E6=95=B0=E6=8D=AE=E5=92=8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=9A=84=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9B=E8=A1=8C=E7=BB=93?= =?UTF-8?q?=E5=90=88=E4=BC=A0=E9=80=92=E7=BB=99=E5=90=8E=E7=AB=AF=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E5=89=8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5=B1=95=E7=A4=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E7=9A=84=E5=87=BA=E8=B4=A7?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E5=AE=9E=E7=8E=B0=EF=BC=9A?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E6=98=AF=E5=90=A6=E6=B7=BB=E5=8A=A0=E5=87=BA?= =?UTF-8?q?=E8=B4=A7=E8=AE=BE=E5=A4=87=E7=AD=89=E4=BA=8E1=E7=9A=84?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=AD=89=E4=BA=8E0=E4=B8=94?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=8D=95=E5=8F=B7=E7=AD=89=E4=BA=8E=E6=9C=AC?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=E7=9A=84=20=E4=BF=AE=E6=94=B9=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=E7=BB=B4=E6=8A=A4=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E7=9A=84addShippi?= =?UTF-8?q?ngDevicesOne=E6=96=B9=E6=B3=95=EF=BC=9A=E6=96=B0=E5=A2=9E=20out?= =?UTF-8?q?OrderCode=E4=BC=A0=E9=80=92=E7=BB=99=E5=90=8E=E7=AB=AF=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E6=97=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=96=B0=E5=A2=9E=20addShi?= =?UTF-8?q?ppingDeviceFlag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AftersalesOutOrderController.java | 24 ++- .../aftersales/domain/AftersalesOutOrder.java | 18 ++ .../domain/vo/SelectShippingDeviceVO.java | 2 + .../service/IAftersalesOutOrderService.java | 6 + .../impl/AftersalesOutOrderServiceImpl.java | 66 +++++- .../addShippingDevicesOne.html | 193 ++++++++---------- .../maintenanceEquipmentOne.html | 2 + 7 files changed, 179 insertions(+), 132 deletions(-) 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 2394d827..3c5ac6d0 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 @@ -229,12 +229,14 @@ public class AftersalesOutOrderController extends BaseController @RequestParam("salesOrderCode") String salesOrderCode, @RequestParam("makeNo") String makeNo, @RequestParam("relatedOrderCode") String relatedOrderCode, + @RequestParam("outOrderCode") String outOrderCode, ModelMap mmap) { AftersalesOutOrderDetail aftersalesOutOrderDetail = aftersalesOutOrderDetailService.selectAftersalesOutOrderDetailById(outOrderDetailId); mmap.put("salesOrderCode",salesOrderCode); mmap.put("makeNo",makeNo); mmap.put("relatedOrderCode",relatedOrderCode); + mmap.put("outOrderCode",outOrderCode); mmap.put("aftersalesOutOrderDetail", aftersalesOutOrderDetail); return prefix + "/addShippingDevicesOne"; } @@ -272,17 +274,17 @@ public class AftersalesOutOrderController extends BaseController -// -// /** -// * 修改保存售后第一次维护设备 添加出货设备信息 -// */ -// @ResponseBody -// @PostMapping("/addShippingDevicesOne") -// public AjaxResult addShippingDevicesOneSave(@RequestBody WarehouseOutOrderDetail warehouseOutOrderDetail) -// { -// -// return toAjax(outOrderDetailService.addShippingDevicesOne(warehouseOutOrderDetail)); -// } + + /** + * 修改保存售后第一次维护设备 添加出货设备信息 + */ + @ResponseBody + @PostMapping("/addShippingDevicesOne") + public AjaxResult addShippingDevicesOneSave(@RequestBody AftersalesOutOrder aftersalesOutOrder) + { + + return toAjax(aftersalesOutOrderService.addShippingDevicesOne(aftersalesOutOrder)); + } // // // diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOutOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOutOrder.java index 92adf0ca..3ed85986 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOutOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOutOrder.java @@ -1,7 +1,10 @@ package com.ruoyi.aftersales.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -132,6 +135,12 @@ public class AftersalesOutOrder extends BaseEntity @Excel(name = "收货电话") private String deliveryNumber; + + + /** 添加出货设备列表*/ + + private List selectShippingDeviceVOList; + public void setOutOrderId(Long outOrderId) { this.outOrderId = outOrderId; @@ -421,6 +430,14 @@ public class AftersalesOutOrder extends BaseEntity return deliveryNumber; } + public List getSelectShippingDeviceVOList() { + return selectShippingDeviceVOList; + } + + public void setSelectShippingDeviceVOList(List selectShippingDeviceVOList) { + this.selectShippingDeviceVOList = selectShippingDeviceVOList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -461,6 +478,7 @@ public class AftersalesOutOrder extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("selectShippingDeviceVOList",getSelectShippingDeviceVOList()) .toString(); } } 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 06eeee72..2faee83a 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 @@ -43,5 +43,7 @@ public class SelectShippingDeviceVO { /** 二次维修后部件质保时间 */ 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 633e2c53..f353f8e8 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 @@ -106,4 +106,10 @@ public interface IAftersalesOutOrderService * 售后第一次维护设备,添加出货设备信息,展示其他销售订单的出货设备信息 * */ List getOtherSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder); + + /** + * 售后第一次维护设备,添加出货设备信息 + * */ + int addShippingDevicesOne(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 6212f372..7120e650 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 @@ -11,6 +11,7 @@ import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper; import com.ruoyi.aftersales.mapper.AftersalesOutOrderDetailMapper; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; @@ -149,7 +150,44 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService */ @Override public int updateMaintenanceEquipmentOne(AftersalesOutOrder aftersalesOutOrder) { - return 0; + + String outOrderCode = aftersalesOutOrder.getOutOrderCode(); + int updateResult = 0; + List selectShippingDeviceVOList = aftersalesOutOrder.getSelectShippingDeviceVOList(); + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId()); + afterSalesShippingDevice.setAddShippingDeviceFlag("0"); + afterSalesShippingDevice.setOutOrderCode(outOrderCode); + updateResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice); + if (updateResult <= 0){ + throw new BusinessException("更新出货设备信息失败"); + } + } + + return updateResult; + } + + /** + * 售后第一次维护设备,添加出货设备信息 + * */ + @Override + public int addShippingDevicesOne(AftersalesOutOrder aftersalesOutOrder) { + String outOrderCode = aftersalesOutOrder.getOutOrderCode(); + int updateResult = 0; + List selectShippingDeviceVOList = aftersalesOutOrder.getSelectShippingDeviceVOList(); + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId()); + afterSalesShippingDevice.setAddShippingDeviceFlag("0"); + afterSalesShippingDevice.setOutOrderCode(outOrderCode); + updateResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice); + if (updateResult <= 0){ + throw new BusinessException("更新出货设备信息失败"); + } + } + + return updateResult; } /** @@ -214,18 +252,25 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService public List getOtherSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { List selectShippingDeviceVOS = new ArrayList<>(); - + String outOrderCode = aftersalesOutOrder.getOutOrderCode(); List thisSalesOrderShippingDevices = this.getThisSalesOrderShippingDevices(aftersalesOutOrder); - //查找到当前销售订单的出货设备id集合 - List collectShippingDeviceId = thisSalesOrderShippingDevices.stream().map(SelectShippingDeviceVO::getShippingDeviceId).collect(Collectors.toList()); + // 查找到当前销售订单的出货设备ID集合 + List currentShippingDeviceIds = thisSalesOrderShippingDevices.stream() + .map(SelectShippingDeviceVO::getShippingDeviceId) + .collect(Collectors.toList()); //查找到所有出货设备id集合 List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectAllShippingDevices(); - List allShippingDeviceIds = afterSalesShippingDevices.stream().map(AfterSalesShippingDevice::getShippingDeviceId).collect(Collectors.toList()); - //筛选出所有出货设备id集合中,不在当前销售订单的出货设备id集合中的数据 - List otherShippingDeviceIds = allShippingDeviceIds.stream().filter(item -> !collectShippingDeviceId.contains(item)).collect(Collectors.toList()); - List list = afterSalesShippingDeviceMapper.selectBatchShippingDeviceById(otherShippingDeviceIds); + + //保留是否添加出货设备等于1的,以及等于0且出库单号等于本单据的 + List filteredDevices = afterSalesShippingDevices.stream().filter(device -> "1".equals(device.getAddShippingDeviceFlag()) + || "0".equals(device.getAddShippingDeviceFlag()) && outOrderCode.equals(device.getOutOrderCode())).collect(Collectors.toList()); + + // 筛选出不在当前销售订单中的数据 + List otherDevices = filteredDevices.stream() + .filter(device -> !currentShippingDeviceIds.contains(device.getShippingDeviceId())) + .collect(Collectors.toList()); //转换成vo类 - this.convertToDeviceVOs(list, selectShippingDeviceVOS); + this.convertToDeviceVOs(otherDevices, selectShippingDeviceVOS); return selectShippingDeviceVOS; } @@ -238,7 +283,10 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService selectShippingDeviceVO.setDeviceModelCode(device.getDeviceModelCode()); selectShippingDeviceVO.setDeviceRunningNumber(device.getDeviceRunningNumber()); selectShippingDeviceVO.setMakePhotoUrl(device.getMakePhotourl()); + selectShippingDeviceVO.setAddShippingDeviceFlag(device.getAddShippingDeviceFlag()); selectShippingDeviceVOS.add(selectShippingDeviceVO); } } + + } diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html index 659db9f9..71b37b7c 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html @@ -109,6 +109,7 @@ var salesOrderCode = [[${salesOrderCode}]]; var makeNo = [[${makeNo}]]; var relatedOrderCode = [[${relatedOrderCode}]]; + var outOrderCode = [[${outOrderCode}]]; $("#form-addShippingDevicesOne-edit").validate({ focusCleanup: true @@ -126,23 +127,34 @@ // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 // var table = $('#table-shippingDevices').bootstrapTable('getData'); //获取选中复选框行的数据 - const selectedRows = $("#table-shippingDevices").bootstrapTable('getSelections'); + const selectedThisRows = $("#thisSalesOrderShippingDevice-table").bootstrapTable('getSelections'); + const selectedOtherRows = $("#otherSalesOrderShippingDevice-table").bootstrapTable('getSelections'); + + // 将 outOrderCode 添加到 shippingDevicesData 对象中 + shippingDevicesData.outOrderCode = outOrderCode; + // 检查表格数据是否为空 - if (selectedRows.length===0){ - $.modal.alertWarning("请至少选择一条出货设备信息后再保存!"); + if (selectedThisRows.length + selectedOtherRows.length === 0) { + $.modal.alertWarning("请至少选择一条出货设备后再保存!"); return; } - // 将表数据转换成与complaintNoticeData格式一致的数组 - var equipDetailDataList = selectedRows.map(function(item) { - // 根据实际字段名调整 - return { + // 将表数据转换成一致的数组 + const equipDetailDataList = [ + ...selectedThisRows.map(item => ({ + "shippingDeviceId": item.shippingDeviceId, + "deviceModelCode": item.deviceModelCode, + "deviceRunningNumber": item.deviceRunningNumber, + "makePhotoUrl": item.makePhotoUrl + // ...其他字段 + })), + ...selectedOtherRows.map(item => ({ "shippingDeviceId": item.shippingDeviceId, "deviceModelCode": item.deviceModelCode, "deviceRunningNumber": item.deviceRunningNumber, "makePhotoUrl": item.makePhotoUrl // ...其他字段 - }; - }); + })) + ]; // 合并表单数据和表格数据 const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList }); @@ -166,69 +178,6 @@ minView: "month", autoclose: true }); - // - // /*物料信息列表*/ - // $(function() { - // // 物料信息 - // $('#table-material').bootstrapTable('destroy'); - // var materialOptions = { - // id:"table-material", - // url: prefix + "/addShippingDevicesMaterial", - // modalName: "物料信息", - // showColumns: false, - // pagination: false, - // showToggle: false, - // showRefresh:false, - // showSearch:false, - // queryParams:queryParams, - // columns: [{ - // checkbox: true - // }, - // { title:'销售订单号', - // field:'quoteId', - // visible: false - // }, - // { - // title: '料号', - // field: 'materialCode', - // }, - // { - // title: '图片', - // field: 'photoUrl', - // }, - // { - // title: '物料名称', - // field: 'materialName', - // }, - // { - // title: '物料类型', - // field: 'materialType', - // }, - // { - // title: '单位', - // field: 'materialUnit', - // }, - // { - // title: '品牌', - // field: 'brand', - // }, - // { - // title: '描述', - // field: 'describe', - // }, - // ] - // }; - // $.table.init(materialOptions); - // - // }) - // function queryParams(params) { - // var curParams = { - // // 传递参数查询参数 - // quoteId: selectMaterialsVO.quoteId, - // materialCode: selectMaterialsVO.materialCode, - // }; - // return curParams; - // } //销售订单的出货设备 $(function(){ @@ -243,8 +192,15 @@ showColumns: false, queryParams:thisQueryParams, sidePagination: "client", - columns: [{ - checkbox: true + columns: [ { + checkbox : true, + formatter: function(value, row, index) { + if(row.addShippingDeviceFlag === "0"){//如果已经操作禁止选择 + return { disabled : true,} + }else{ + return { disabled : false,} + } + } }, { field: 'equipmentIndex', @@ -275,6 +231,12 @@ align: 'center', title: '生产图片', }, + { + field: 'addShippingDeviceFlag', + align: 'center', + title: '是否添加出货设备', + visible: false + }, ] }; @@ -288,7 +250,8 @@ materialNo: aftersalesOutOrderDetail.materialNo, salesOrderCode:salesOrderCode, makeNo:makeNo, - relatedOrderCode:relatedOrderCode + relatedOrderCode:relatedOrderCode, + outOrderCode:outOrderCode }; return curParams; } @@ -299,9 +262,7 @@ - //其他销售订单的出货设备 - $(function(){ - + $(function () { var options = { id: "otherSalesOrderShippingDevice-table", url: prefix + "/getOtherSalesOrderShippingDevices", @@ -310,46 +271,53 @@ showRefresh: false, showToggle: false, showColumns: false, - queryParams:otherQueryParams, + queryParams: otherQueryParams, sidePagination: "client", - columns: [{ - checkbox: true - }, + columns: [ { - field: 'equipmentIndex', - align: 'center', - title: "序号", - formatter: function (value, row, index) { - // 使用bootstrap-table的内置序号生成 - return index + 1; + checkbox : true, + formatter: function(value, row, index) { + if(row.addShippingDeviceFlag === "0"){//如果已经操作禁止选择 + return { disabled : true,} + }else{ + return { disabled : false,} + } } }, { - field: 'shippingDeviceId', - align: 'center', - title: '出货设备id', - }, - { - field: 'deviceModelCode', - align: 'center', - title: '设备型号', - }, - { - field: 'deviceRunningNumber', - align: 'center', - title: '追踪码', - }, - { - field: 'makePhotoUrl', - align: 'center', - title: '生产图片', - }, - - ] + field: 'equipmentIndex', + align: 'center', + title: "序号", + formatter: function (value, row, index) { + // 使用bootstrap-table的内置序号生成 + return index + 1; + } + }, { + field: 'shippingDeviceId', + align: 'center', + title: '出货设备id', + }, { + field: 'deviceModelCode', + align: 'center', + title: '设备型号', + }, { + field: 'deviceRunningNumber', + align: 'center', + title: '追踪码', + }, { + field: 'makePhotoUrl', + align: 'center', + title: '生产图片', + }, { + field: 'addShippingDeviceFlag', + align: 'center', + title: '是否添加出货设备', + visible: false + }] }; - $.table.init(options); - }) + $.table.init(options); + }); function otherQueryParams(params) { var curParams = { @@ -357,7 +325,8 @@ materialNo: aftersalesOutOrderDetail.materialNo, salesOrderCode:salesOrderCode, makeNo:makeNo, - relatedOrderCode:relatedOrderCode + relatedOrderCode:relatedOrderCode, + outOrderCode:outOrderCode }; return curParams; } 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 6966c957..2ca72924 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html @@ -450,12 +450,14 @@ function addShippingDevicesOne(outOrderDetailId) { var salesOrderCode = [[${aftersalesOutOrder.salesOrderCode}]]; var relatedOrderCode = [[${aftersalesOutOrder.relatedOrderCode}]]; + var outOrderCode = [[${aftersalesOutOrder.outOrderCode}]]; var makeNo = [[${aftersalesOutOrder.makeNo}]]; var queryParams = new URLSearchParams(); queryParams.append('outOrderDetailId', outOrderDetailId); queryParams.append('salesOrderCode', encodeURIComponent(salesOrderCode)); queryParams.append('makeNo',encodeURIComponent(makeNo)); queryParams.append('relatedOrderCode',encodeURIComponent(relatedOrderCode)); + queryParams.append('outOrderCode',encodeURIComponent(outOrderCode)); var url = prefix + '/addShippingDevicesOne?' + queryParams.toString(); $.modal.open("添加出货设备", url); } From dbaa61b01a5b6bd037159f174e1aa88df493c635 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 8 Nov 2024 15:21:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[feat]=20=E5=94=AE=E5=90=8E=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E4=BF=AE=E6=94=B9=E5=94=AE=E5=90=8E=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=BB=B4=E6=8A=A4=E8=AE=BE=E5=A4=87=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=87=BA=E8=B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5=87=BA=E8=B4=A7=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8=E6=96=B9=E6=B3=95?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20=E6=A0=B9=E6=8D=AE=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AftersalesOutOrderController.java | 98 +++++--- .../AfterSalesShippingDeviceMapper.java | 20 ++ .../service/IAftersalesOutOrderService.java | 9 + .../impl/AftersalesOutOrderServiceImpl.java | 175 ++++++++++++--- .../AfterSalesShippingDeviceMapper.xml | 24 ++ .../addShippingDevicesOne.html | 71 +++--- .../maintenanceEquipmentOne.html | 210 +++++++++++------- 7 files changed, 441 insertions(+), 166 deletions(-) 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 3c5ac6d0..3bb4f992 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 @@ -1,10 +1,13 @@ package com.ruoyi.aftersales.controller; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.List; import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.aftersales.service.IAftersalesOutOrderDetailService; +import lombok.SneakyThrows; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -221,25 +224,44 @@ public class AftersalesOutOrderController extends BaseController // // // - /** - * 售后第一次维护设备 成品添加出货设备信息 - */ - @GetMapping("/addShippingDevicesOne") - public String addShippingDevicesOne(@RequestParam("outOrderDetailId") Long outOrderDetailId, - @RequestParam("salesOrderCode") String salesOrderCode, - @RequestParam("makeNo") String makeNo, - @RequestParam("relatedOrderCode") String relatedOrderCode, - @RequestParam("outOrderCode") String outOrderCode, - ModelMap mmap) - { - AftersalesOutOrderDetail aftersalesOutOrderDetail = aftersalesOutOrderDetailService.selectAftersalesOutOrderDetailById(outOrderDetailId); - mmap.put("salesOrderCode",salesOrderCode); - mmap.put("makeNo",makeNo); - mmap.put("relatedOrderCode",relatedOrderCode); - mmap.put("outOrderCode",outOrderCode); - mmap.put("aftersalesOutOrderDetail", aftersalesOutOrderDetail); - return prefix + "/addShippingDevicesOne"; +@SneakyThrows +@GetMapping("/addShippingDevicesOne") +public String addShippingDevicesOne(@RequestParam("outOrderDetailId") Long outOrderDetailId, + @RequestParam(value = "salesOrderCode", required = false, defaultValue = "") String salesOrderCode, + @RequestParam(value = "makeNo", required = false, defaultValue = "") String makeNo, + @RequestParam(value = "relatedOrderCode", required = false, defaultValue = "") String relatedOrderCode, + @RequestParam(value = "outOrderCode", required = false, defaultValue = "") String outOrderCode, + ModelMap mmap) { + + AftersalesOutOrderDetail aftersalesOutOrderDetail = aftersalesOutOrderDetailService.selectAftersalesOutOrderDetailById(outOrderDetailId); + + + // 手动解码参数 + salesOrderCode = URLDecoder.decode(salesOrderCode, StandardCharsets.UTF_8.name()); + makeNo = URLDecoder.decode(makeNo, StandardCharsets.UTF_8.name()); + relatedOrderCode = URLDecoder.decode(relatedOrderCode, StandardCharsets.UTF_8.name()); + outOrderCode = URLDecoder.decode(outOrderCode, StandardCharsets.UTF_8.name()); + + // 非空检查并添加到 ModelMap + if (!"null".equalsIgnoreCase(salesOrderCode) && !salesOrderCode.isEmpty()) { + mmap.put("salesOrderCode", salesOrderCode); + } + if (!"null".equalsIgnoreCase(makeNo) && !makeNo.isEmpty()) { + mmap.put("makeNo", makeNo); + } + if (!"null".equalsIgnoreCase(relatedOrderCode) && !relatedOrderCode.isEmpty()) { + mmap.put("relatedOrderCode", relatedOrderCode); } + if (!"null".equalsIgnoreCase(outOrderCode) && !outOrderCode.isEmpty()) { + mmap.put("outOrderCode", outOrderCode); + } + + // 无论是否为空,都添加 aftersalesOutOrderDetail + mmap.put("aftersalesOutOrderDetail", aftersalesOutOrderDetail); + + return prefix + "/addShippingDevicesOne"; +} + @@ -285,6 +307,26 @@ public class AftersalesOutOrderController extends BaseController return toAjax(aftersalesOutOrderService.addShippingDevicesOne(aftersalesOutOrder)); } + + + + + /** + * 展示第一次维护设备出库,已经添加了的出货设备 + */ + @ResponseBody + @PostMapping("/showAddShippingDevicesOne") + public TableDataInfo showAddShippingDevicesOne(AftersalesOutOrder aftersalesOutOrder) + { + startPage(); + List list = aftersalesOutOrderService.showAddShippingDevicesOne(aftersalesOutOrder); + return getDataTable(list); + } + + + + + // // // @@ -303,16 +345,16 @@ public class AftersalesOutOrderController extends BaseController // // // -// /** -// * 第一次维护设备删除物料信息出货设备信息 -// */ -// @Log(title = "售后维护设备出库", businessType = BusinessType.DELETE) -// @PostMapping("/deleteRow") -// @ResponseBody -// public AjaxResult deleteRow(String shippingDeviceId) -// { -// return toAjax(aftersalesOutOrderService.deleteAftersalesShippingDeviceById(shippingDeviceId)); -// } + /** + * 第一次维护设备删除物料信息出货设备信息 + */ + @Log(title = "售后维护设备出库", businessType = BusinessType.DELETE) + @PostMapping("/deleteRow") + @ResponseBody + public AjaxResult deleteRow(String shippingDeviceId) + { + return toAjax(aftersalesOutOrderService.deleteAftersalesShippingDeviceById(shippingDeviceId)); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java index 65da4aa2..aeb0e7bd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java @@ -141,4 +141,24 @@ public interface AfterSalesShippingDeviceMapper * 根据设备id批量查询出货设备信息列表 * */ List selectBatchShippingDeviceById(List otherShippingDeviceIds); + + /* + * 根据出库单号查询第一次维护设备已经添加的出货设备信息列表 + * */ + List selectShippingDeviceByOutOrderCode(String outOrderCode); + + /* + * 根据销售单号和物料号查询出货设备信息列表 + * */ + List selectShippingDeviceByOrderCodeAndMaterialNo(AfterSalesShippingDevice afterSalesShippingDevice); + + /* + * 根据物料号和出库单号查询已经添加了的出货设备信息列表 + * */ + List selectHasAddShippingDevice(AfterSalesShippingDevice tempShippingDevice); + + /* + * 根据物料号查询出货设备信息列表 + * */ + List selectShippingDevicesByMaterialNo(String materialNo); } 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 f353f8e8..e5f18c68 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 @@ -112,4 +112,13 @@ public interface IAftersalesOutOrderService * */ int addShippingDevicesOne(AftersalesOutOrder aftersalesOutOrder); + /** + * 展示第一次维护设备出库,已经添加了的出货设备 + * */ + List showAddShippingDevicesOne(AftersalesOutOrder aftersalesOutOrder); + + /** + * 逻辑删除出货设备(也就是取消关联) + * */ + int deleteAftersalesShippingDeviceById(String shippingDeviceId); } 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 7120e650..3e42771e 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 @@ -1,9 +1,6 @@ package com.ruoyi.aftersales.service.impl; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; @@ -15,12 +12,18 @@ import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysSalesShippingInform; +import com.ruoyi.system.mapper.SysSalesShippingInformMapper; +import com.ruoyi.warehouse.domain.WarehouseOutOrder; +import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.aftersales.mapper.AftersalesOutOrderMapper; import com.ruoyi.aftersales.domain.AftersalesOutOrder; import com.ruoyi.aftersales.service.IAftersalesOutOrderService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 售后维护设备出库Service业务层处理 @@ -40,6 +43,12 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService @Autowired private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper; + @Autowired + private WarehouseOutOrderMapper warehouseOutOrderMapper; + + @Autowired + private SysSalesShippingInformMapper shippingInformMapper; + /** * 查询售后维护设备出库 * @@ -148,24 +157,87 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService * @param aftersalesOutOrder * @return */ + @Transactional(rollbackFor = Exception.class) @Override public int updateMaintenanceEquipmentOne(AftersalesOutOrder aftersalesOutOrder) { String outOrderCode = aftersalesOutOrder.getOutOrderCode(); - int updateResult = 0; - List selectShippingDeviceVOList = aftersalesOutOrder.getSelectShippingDeviceVOList(); - for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { - AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); - afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId()); - afterSalesShippingDevice.setAddShippingDeviceFlag("0"); - afterSalesShippingDevice.setOutOrderCode(outOrderCode); - updateResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice); - if (updateResult <= 0){ - throw new BusinessException("更新出货设备信息失败"); + + // 定义一个StringBuilder来收集所有缺少SN号的设备ID + StringBuilder missingSnIds = new StringBuilder(); + //物料信息主表的数据 + List needShippingDeviceMaterialsOne = this.getNeedShippingDeviceMaterialsOne(aftersalesOutOrder); + if (!CollectionUtils.isEmpty(needShippingDeviceMaterialsOne)){ + List selectShippingDeviceVOList = aftersalesOutOrder.getSelectShippingDeviceVOList(); + if (CollectionUtils.isEmpty(selectShippingDeviceVOList)){ + throw new BusinessException("请展开物料详情并添加要出货的设备"); + } + +// boolean anyNullSnCode = selectShippingDeviceVOList.stream().anyMatch(item -> item.getSnCode() == null); +// if (anyNullSnCode){ +// throw new BusinessException("请展开物料详情并填写每个设备的SN号"); +// } + + // 遍历 selectShippingDeviceVOList 列表 + selectShippingDeviceVOList.forEach(item -> { + // 检查 SnCode 是否为空 + if (item.getSnCode() == null) { + // 如果是第一次添加,不加前缀“、”,否则加上 + if (missingSnIds.length() > 0) { + missingSnIds.append("、"); + } + missingSnIds.append(item.getShippingDeviceId()); + } + }); + + // 检查是否有任何设备缺少SN号 + if (missingSnIds.length() > 0) { + throw new BusinessException(missingSnIds.toString() + " SN未维护,请维护"); } + + /* 缺少校验规则,后续补充 + * 2.1、已选出货设备,是否可用(状态:可用,即未被其他出库单添加或报损),若不可用,则弹窗提示“CHSB20240808004、CHSB20240808005.不可用,请重新添加 + * */ + + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + String shippingDeviceId = selectShippingDeviceVO.getShippingDeviceId(); + AfterSalesShippingDevice tempShippingDevice = new AfterSalesShippingDevice(); + tempShippingDevice.setShippingDeviceId(shippingDeviceId); + tempShippingDevice.setSnCode(selectShippingDeviceVO.getSnCode()); + + int updateShippingDeviceResult = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(tempShippingDevice); + if (updateShippingDeviceResult <= 0){ + throw new BusinessException("更新设备数据失败"); + } + } + + } + //更新出库单 + WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder(); + //更改状态未待确认发货 + warehouseOutOrder.setOutOrderCode(outOrderCode); + warehouseOutOrder.setWarehouseOutStatus("2"); + int updateWarehouseResult = warehouseOutOrderMapper.updateWarehouseOutOrderByCode(warehouseOutOrder); + if (updateWarehouseResult <= 0){ + throw new BusinessException("更新销售售后通知单数据失败"); } - return updateResult; + //更新销售出货通知单 + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + sysSalesShippingInform.setOutOrderCode(outOrderCode); + sysSalesShippingInform.setWarehouseOutStatus("2"); + int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + if (updateShippingInformResult <= 0){ + throw new BusinessException("更新销售出货通知单数据失败"); + } + + + //更新售后维护设备出库单 + aftersalesOutOrder.setWarehouseOutStatus("2"); + int result = aftersalesOutOrderMapper.updateAftersalesOutOrder(aftersalesOutOrder); + + return result; + } /** @@ -225,22 +297,41 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService * */ @Override public List getThisSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { + // 输入验证 + if (aftersalesOutOrder == null || StringUtils.isEmpty(aftersalesOutOrder.getRelatedOrderCode()) && + StringUtils.isEmpty(aftersalesOutOrder.getSalesOrderCode())) { + return Collections.emptyList(); + } List selectShippingDeviceVOS = new ArrayList<>(); + String materialNo = aftersalesOutOrder.getMaterialNo(); - String relatedOrderCode = aftersalesOutOrder.getRelatedOrderCode(); - String salesOrderCode = aftersalesOutOrder.getSalesOrderCode(); - //优先使用销售订单号关联 - if (StringUtils.isNotEmpty(salesOrderCode)){ - List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode); - convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); - }else { - // 关联订单号可能存在逗号分隔的情况 - String[] splitRelatedOrderCode = relatedOrderCode.split(","); - List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectBatchShippingDeviceBySalesOrderCode(splitRelatedOrderCode); + // 优先使用销售订单号关联 + if (StringUtils.isNotEmpty(aftersalesOutOrder.getSalesOrderCode())) { + AfterSalesShippingDevice tempAfterSalesShippingDevice = new AfterSalesShippingDevice(); + tempAfterSalesShippingDevice.setMaterialNo(materialNo); + tempAfterSalesShippingDevice.setSalesOrderCode(aftersalesOutOrder.getSalesOrderCode()); + + List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectShippingDeviceByOrderCodeAndMaterialNo(tempAfterSalesShippingDevice); convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); + + // 提前返回 + return selectShippingDeviceVOS; } + // 处理关联订单号 + String relatedOrderCode = aftersalesOutOrder.getRelatedOrderCode(); + Arrays.stream(relatedOrderCode.split(",")) + .map(String::trim) + .forEach(code -> { + AfterSalesShippingDevice tempAfterSalesShippingDevice = new AfterSalesShippingDevice(); + tempAfterSalesShippingDevice.setMaterialNo(materialNo); + tempAfterSalesShippingDevice.setSalesOrderCode(code); + + List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectShippingDeviceByOrderCodeAndMaterialNo(tempAfterSalesShippingDevice); + convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); + }); + return selectShippingDeviceVOS; } @@ -253,13 +344,14 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService List selectShippingDeviceVOS = new ArrayList<>(); String outOrderCode = aftersalesOutOrder.getOutOrderCode(); + String materialNo = aftersalesOutOrder.getMaterialNo(); List thisSalesOrderShippingDevices = this.getThisSalesOrderShippingDevices(aftersalesOutOrder); // 查找到当前销售订单的出货设备ID集合 List currentShippingDeviceIds = thisSalesOrderShippingDevices.stream() .map(SelectShippingDeviceVO::getShippingDeviceId) .collect(Collectors.toList()); //查找到所有出货设备id集合 - List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectAllShippingDevices(); + List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectShippingDevicesByMaterialNo(materialNo); //保留是否添加出货设备等于1的,以及等于0且出库单号等于本单据的 List filteredDevices = afterSalesShippingDevices.stream().filter(device -> "1".equals(device.getAddShippingDeviceFlag()) @@ -289,4 +381,35 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService } + /** + * 展示第一次维护设备出库,已经添加了的出货设备 + * */ + @Override + public List showAddShippingDevicesOne(AftersalesOutOrder aftersalesOutOrder) { + String outOrderCode = aftersalesOutOrder.getOutOrderCode(); + String materialNo = aftersalesOutOrder.getMaterialNo(); + List selectShippingDeviceVOS = new ArrayList<>(); + AfterSalesShippingDevice tempShippingDevice = new AfterSalesShippingDevice(); + tempShippingDevice.setMaterialNo(materialNo); + tempShippingDevice.setOutOrderCode(outOrderCode); + List afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectHasAddShippingDevice(tempShippingDevice); + convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); + + return selectShippingDeviceVOS; + } + + + /** + * 逻辑删除出货设备(也就是取消关联) + * */ + @Override + public int deleteAftersalesShippingDeviceById(String shippingDeviceId) { + + AfterSalesShippingDevice tempShippingDevice = new AfterSalesShippingDevice(); + tempShippingDevice.setAddShippingDeviceFlag("1"); + tempShippingDevice.setShippingDeviceId(shippingDeviceId); + tempShippingDevice.setOutOrderCode(""); + int updateAfterSalesShippingDevice = afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(tempShippingDevice); + return updateAfterSalesShippingDevice; + } } diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index 6ed26895..d3744d6e 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -154,6 +154,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + insert into aftersales_shipping_device diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html index 71b37b7c..7da460b2 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html @@ -124,46 +124,53 @@ obj[item.name] = item.value; return obj; }, {}); - // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 - // var table = $('#table-shippingDevices').bootstrapTable('getData'); //获取选中复选框行的数据 const selectedThisRows = $("#thisSalesOrderShippingDevice-table").bootstrapTable('getSelections'); const selectedOtherRows = $("#otherSalesOrderShippingDevice-table").bootstrapTable('getSelections'); - + //获取所有数据 + const allThisRows = $("#thisSalesOrderShippingDevice-table").bootstrapTable('getData'); + const allOtherRows = $("#otherSalesOrderShippingDevice-table").bootstrapTable('getData'); // 将 outOrderCode 添加到 shippingDevicesData 对象中 shippingDevicesData.outOrderCode = outOrderCode; - // 检查表格数据是否为空 - if (selectedThisRows.length + selectedOtherRows.length === 0) { - $.modal.alertWarning("请至少选择一条出货设备后再保存!"); + // 检查是否有数据可以提交 + if (allThisRows.length === 0 && allOtherRows.length === 0) { + $.modal.alertWarning("没有数据可以提交!"); return; } - // 将表数据转换成一致的数组 - const equipDetailDataList = [ - ...selectedThisRows.map(item => ({ - "shippingDeviceId": item.shippingDeviceId, - "deviceModelCode": item.deviceModelCode, - "deviceRunningNumber": item.deviceRunningNumber, - "makePhotoUrl": item.makePhotoUrl - // ...其他字段 - })), - ...selectedOtherRows.map(item => ({ - "shippingDeviceId": item.shippingDeviceId, - "deviceModelCode": item.deviceModelCode, - "deviceRunningNumber": item.deviceRunningNumber, - "makePhotoUrl": item.makePhotoUrl - // ...其他字段 - })) - ]; - - // 合并表单数据和表格数据 - const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList }); - - console.log(combinedData) - // 使用 JSON.stringify() 序列化数据 - const jsonData = JSON.stringify(combinedData); - // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/addShippingDevicesOne", jsonData); + // 检查表格数据是否为空 + if (selectedThisRows.length + selectedOtherRows.length === 0) { + $.modal.alertWarning("请至少选择一条出货设备后再保存!"); + return; + } + // 将表数据转换成一致的数组 + const equipDetailDataList = [ + ...selectedThisRows.map(item => ({ + "shippingDeviceId": item.shippingDeviceId, + "deviceModelCode": item.deviceModelCode, + "deviceRunningNumber": item.deviceRunningNumber, + "makePhotoUrl": item.makePhotoUrl + // ...其他字段 + })), + ...selectedOtherRows.map(item => ({ + "shippingDeviceId": item.shippingDeviceId, + "deviceModelCode": item.deviceModelCode, + "deviceRunningNumber": item.deviceRunningNumber, + "makePhotoUrl": item.makePhotoUrl + // ...其他字段 + })) + ]; + + + + // 合并表单数据和表格数据 + const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList }); + + console.log(combinedData) + // 使用 JSON.stringify() 序列化数据 + const jsonData = JSON.stringify(combinedData); + // 发送 AJAX 请求到后端接口 + $.operate.saveJson(prefix + "/addShippingDevicesOne", jsonData); } 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 2ca72924..d3702299 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html @@ -260,49 +260,76 @@ }) - // initChildTable = function(index, row, $detail) { - // var parentRow = row; - // var childTableId = 'child_table_'+index; - // $detail.html('
'); - // $('#'+childTableId).bootstrapTable({ - // url: prefix + "/showAftersalesShippingDeviceListOne", - // method: 'post', - // sidePagination: "server", - // contentType: "application/x-www-form-urlencoded", - // queryParams : { - // // salesOrderCode: aftersalesOutOrder.salesOrderCode, - // materialNo: parentRow.materialNo, - // salesOrderCode:aftersalesOutOrder.salesOrderCode, - // makeNo:aftersalesOutOrder.makeNo - // }, - // columns: [ - // { - // title: '出货设备ID', - // field: 'shippingDeviceId', - // }, - // { - // title: '设备型号', - // field: 'deviceModelCode', - // }, - // { - // title: '流水号', - // field: 'deviceRunningNumber', - // }, - // { - // title: '设备SN号', - // field: 'snCode', - // editable:true - // }, - // { - // title: '操作', - // align: 'center', - // formatter: function (value, row, index) { - // return '删除'; - // } - // } - // ], - // }); - // }; + initChildTable = function(index, row, $detail) { + var parentRow = row; + var childTableId = 'child_table_'+index; + $detail.html('
'); + $('#'+childTableId).bootstrapTable({ + url: prefix + "/showAddShippingDevicesOne", + method: 'post', + sidePagination: "server", + contentType: "application/x-www-form-urlencoded", + queryParams : { + outOrderCode: aftersalesOutOrder.outOrderCode, + materialNo: parentRow.materialNo, + // salesOrderCode:aftersalesOutOrder.salesOrderCode, + // makeNo:aftersalesOutOrder.makeNo + }, + columns: [ + { + title: '出货设备ID', + field: 'shippingDeviceId', + }, + { + title: '设备型号', + field: 'deviceModelCode', + }, + { + title: '追踪码', + field: 'deviceRunningNumber', + }, + { + title: '设备SN号', + field: 'snCode', + editable: { + validate: function(value) { + if ($.trim(value) === '') { + return '本次收货数不能为空'; + } + }, + }, + + + formatter: function (value, row) { + // 检查 snCode 是否存在 + if (row.snCode === undefined || row.snCode === null) { + return ""; + } + + // 根据 snCode 的值决定返回值 + if (row.snCode) { + return row.snCode; + } else { + return value; + } + } + + }, + + // { + // title: '售后图片', + // field: 'deviceRunningNumber', + // }, + { + title: '操作', + align: 'center', + formatter: function (value, row, index) { + return '删除'; + } + } + ], + }); + }; function queryParams(params) { @@ -393,51 +420,71 @@ - - // 获取所有子表数据的函数 // 获取所有子表数据的函数 function getAllSubTablesData() { var allSubData = []; - // 获取所有被展开的行 - var parentLength = $("#bootstrap-table").bootstrapTable("getData").length; - for (let i = 0; i < parentLength; i++) { - var sonData = $('#'+"child_table_" + i).bootstrapTable("getData"); - //循环获取子表中存在的行数据,每个行数据转换添加到allSubData数组中 - allSubData = allSubData.concat(sonData); + var parentData = $("#needShippingDevice-table").bootstrapTable("getData"); + var parentLength = parentData.length; + + if (parentLength !== 0) { + for (let i = 0; i < parentLength; i++) { + var sonData = $("#" + "child_table_" + i).bootstrapTable("getData"); + allSubData = allSubData.concat(sonData); + + // 获取主表的准备出库数 + var prepareOutOrderSum = parentData[i].prepareOutOrderSum; + var sonDataLength = sonData.length; + + // 比较主表的准备出库数和子表的长度 + if (sonDataLength < prepareOutOrderSum) { + + $.modal.alertWarning(`物料第 ${i + 1} 行的准备出库数为 ${prepareOutOrderSum},但已经添加出货设备为 ${sonDataLength},请添加出货设备`); + return; + }else if(sonDataLength > prepareOutOrderSum){ + $.modal.alertWarning(`物料第 ${i + 1} 行的准备出库数为 ${prepareOutOrderSum},但已经添加出货设备为 ${sonDataLength},请删除出货设备`); + return; + } + } } return allSubData; } - function deleteRow(shippingDeviceId) { + + function deleteRow(shippingDeviceId, index) { // 弹出确认框询问用户是否确定删除 - if (confirm("确定要删除这条记录吗?")) { - // 发送删除请求到服务器 - $.ajax({ - url: prefix + "/deleteRow", // 请根据实际API路径调整 - type: 'POST', - data: { - shippingDeviceId: shippingDeviceId, // 传递需要删除的记录的ID - }, - success: function(result) { - if (result.success) { // 假设result是一个对象,包含success属性来表示操作是否成功 - // 删除操作成功,从表格中移除这一行 - $('#child_table_' + index).bootstrapTable('remove', { - field: 'shippingDeviceId', - values: [shippingDeviceId] - }); - toastr.success("删除成功!"); // 显示成功提示信息,这里使用toastr作为示例,确保已引入相关库 - } else { - toastr.error("删除失败: " + result.message); // 显示失败原因,同样确保已引入toastr库 + $.modal.confirm("确定要删除这条记录吗?", function(confirmed) { + if (confirmed) { + // 发送删除请求到服务器 + $.ajax({ + url: prefix + "/deleteRow", // 请根据实际API路径调整 + type: 'POST', + data: { + shippingDeviceId: shippingDeviceId, // 传递需要删除的记录的ID + }, + success: function(result) { + handleDeleteResponse(result, shippingDeviceId, index); + }, + error: function(xhr, status, error) { + $.modal.msgError("发生错误,删除失败: " + xhr.responseText); } - }, - error: function() { - toastr.error("发生错误,删除失败!"); // 网络错误或后端错误处理 - } + }); + } + }); + } + + function handleDeleteResponse(result, shippingDeviceId, index) { + if (result.code === 0) { + // 删除操作成功,从表格中移除这一行 + $('#child_table_' + index).bootstrapTable('remove', { + field: 'shippingDeviceId', + values: [shippingDeviceId] }); + $.modal.msgSuccess("删除成功,请刷新表格"); + } else { + $.modal.msgError("删除失败: " + result.message); } - }; - + } /*添加出货设备*/ @@ -454,10 +501,13 @@ var makeNo = [[${aftersalesOutOrder.makeNo}]]; var queryParams = new URLSearchParams(); queryParams.append('outOrderDetailId', outOrderDetailId); - queryParams.append('salesOrderCode', encodeURIComponent(salesOrderCode)); - queryParams.append('makeNo',encodeURIComponent(makeNo)); - queryParams.append('relatedOrderCode',encodeURIComponent(relatedOrderCode)); - queryParams.append('outOrderCode',encodeURIComponent(outOrderCode)); + + // 仅对需要编码的部分进行编码 + queryParams.append('salesOrderCode', salesOrderCode); + queryParams.append('makeNo', makeNo); + queryParams.append('relatedOrderCode', relatedOrderCode); + queryParams.append('outOrderCode', outOrderCode); + var url = prefix + '/addShippingDevicesOne?' + queryParams.toString(); $.modal.open("添加出货设备", url); }