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 7a990d22..2394d827 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 @@ -3,6 +3,7 @@ package com.ruoyi.aftersales.controller; import java.util.List; import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.aftersales.service.IAftersalesOutOrderDetailService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -227,14 +228,50 @@ public class AftersalesOutOrderController extends BaseController public String addShippingDevicesOne(@RequestParam("outOrderDetailId") Long outOrderDetailId, @RequestParam("salesOrderCode") String salesOrderCode, @RequestParam("makeNo") String makeNo, + @RequestParam("relatedOrderCode") String relatedOrderCode, ModelMap mmap) { AftersalesOutOrderDetail aftersalesOutOrderDetail = aftersalesOutOrderDetailService.selectAftersalesOutOrderDetailById(outOrderDetailId); mmap.put("salesOrderCode",salesOrderCode); mmap.put("makeNo",makeNo); + mmap.put("relatedOrderCode",relatedOrderCode); mmap.put("aftersalesOutOrderDetail", aftersalesOutOrderDetail); return prefix + "/addShippingDevicesOne"; } + + + + + /** + * 售后第一次维护设备,添加出货设备信息,展示销售订单的出货设备信息 + * */ + + @ResponseBody + @PostMapping("/getThisSalesOrderShippingDevices") + public TableDataInfo getThisSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) + { + startPage(); + List list = aftersalesOutOrderService.getThisSalesOrderShippingDevices(aftersalesOutOrder); + return getDataTable(list); + } + + + + /** + * 售后第一次维护设备,添加出货设备信息,展示其他销售订单的出货设备信息 + * */ + + @ResponseBody + @PostMapping("/getOtherSalesOrderShippingDevices") + public TableDataInfo getOtherSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) + { + startPage(); + List list = aftersalesOutOrderService.getOtherSalesOrderShippingDevices(aftersalesOutOrder); + return getDataTable(list); + } + + + // // /** // * 修改保存售后第一次维护设备 添加出货设备信息 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 a8a7b048..65da4aa2 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 @@ -125,4 +125,20 @@ public interface AfterSalesShippingDeviceMapper * 根据sn号查询出货设备信息列表 * */ List selectShippingDeviceListBySnCodeAndMaterialNo(String[] snCode); + + /* + * 根据销售单号批量查询出货设备信息列表 + * */ + List selectBatchShippingDeviceBySalesOrderCode(String[] splitRelatedOrderCode); + + /* + * 查询所有出货设备信息列表 + * */ + List selectAllShippingDevices(); + + + /* + * 根据设备id批量查询出货设备信息列表 + * */ + List selectBatchShippingDeviceById(List otherShippingDeviceIds); } 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 afb4f4c2..633e2c53 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 @@ -3,6 +3,7 @@ package com.ruoyi.aftersales.service; import java.util.List; import com.ruoyi.aftersales.domain.AftersalesOutOrder; import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; /** * 售后维护设备出库Service接口 @@ -95,4 +96,14 @@ public interface IAftersalesOutOrderService * @return */ List getNoShippingDeviceMaterialsOne(AftersalesOutOrder aftersalesOutOrder); + + /** + * 售后第一次维护设备,添加出货设备信息,展示销售订单的出货设备信息 + * */ + List getThisSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder); + + /** + * 售后第一次维护设备,添加出货设备信息,展示其他销售订单的出货设备信息 + * */ + List getOtherSalesOrderShippingDevices(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 1a777275..6212f372 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,12 +1,19 @@ 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.stream.Collectors; +import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; 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.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.aftersales.mapper.AftersalesOutOrderMapper; @@ -29,6 +36,9 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService @Autowired private AftersalesOutOrderDetailMapper aftersalesOutOrderDetailMapper; + @Autowired + private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper; + /** * 查询售后维护设备出库 * @@ -171,4 +181,64 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService return filterList; } + + /** + * 售后第一次维护设备,添加出货设备信息,展示销售订单的出货设备信息 + * */ + @Override + public List getThisSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { + + List selectShippingDeviceVOS = new ArrayList<>(); + + 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); + convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); + } + + return selectShippingDeviceVOS; + } + + + /** + * 售后第一次维护设备,添加出货设备信息,展示其他销售订单的出货设备信息 + * */ + @Override + public List getOtherSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { + + List selectShippingDeviceVOS = new ArrayList<>(); + + List thisSalesOrderShippingDevices = this.getThisSalesOrderShippingDevices(aftersalesOutOrder); + //查找到当前销售订单的出货设备id集合 + List collectShippingDeviceId = 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); + //转换成vo类 + this.convertToDeviceVOs(list, selectShippingDeviceVOS); + return selectShippingDeviceVOS; + } + + + //转换成vo类 + private void convertToDeviceVOs(List afterSalesShippingDevices, List selectShippingDeviceVOS) { + for (AfterSalesShippingDevice device : afterSalesShippingDevices) { + SelectShippingDeviceVO selectShippingDeviceVO = new SelectShippingDeviceVO(); + selectShippingDeviceVO.setShippingDeviceId(device.getShippingDeviceId()); + selectShippingDeviceVO.setDeviceModelCode(device.getDeviceModelCode()); + selectShippingDeviceVO.setDeviceRunningNumber(device.getDeviceRunningNumber()); + selectShippingDeviceVO.setMakePhotoUrl(device.getMakePhotourl()); + selectShippingDeviceVOS.add(selectShippingDeviceVO); + } + } } diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index cee723ea..96118079 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -134,6 +134,27 @@ 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 6f32290d..659db9f9 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/addShippingDevicesOne.html @@ -104,10 +104,11 @@ // var addFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:addShippingDevice')}]]; // var addFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:addShippingDevice')}]]; - var prefix = ctx + "aftersales/warehouseOutOrder"; + var prefix = ctx + "aftersales/aftersalesOutOrder"; var aftersalesOutOrderDetail = [[${aftersalesOutOrderDetail}]]; var salesOrderCode = [[${salesOrderCode}]]; var makeNo = [[${makeNo}]]; + var relatedOrderCode = [[${relatedOrderCode}]]; $("#form-addShippingDevicesOne-edit").validate({ focusCleanup: true @@ -234,13 +235,13 @@ var options = { id: "thisSalesOrderShippingDevice-table", - url: prefix + "/getAllMaterialShippingDevices", + url: prefix + "/getThisSalesOrderShippingDevices", pagination: false, showSearch: false, showRefresh: false, showToggle: false, showColumns: false, - queryParams:queryParams, + queryParams:thisQueryParams, sidePagination: "client", columns: [{ checkbox: true @@ -281,12 +282,13 @@ }) - function queryParams(params) { + function thisQueryParams(params) { var curParams = { // 传递参数查询参数 materialNo: aftersalesOutOrderDetail.materialNo, salesOrderCode:salesOrderCode, - makeNo:makeNo + makeNo:makeNo, + relatedOrderCode:relatedOrderCode }; return curParams; } @@ -302,13 +304,13 @@ var options = { id: "otherSalesOrderShippingDevice-table", - url: prefix + "/getAllMaterialShippingDevices", + url: prefix + "/getOtherSalesOrderShippingDevices", pagination: false, showSearch: false, showRefresh: false, showToggle: false, showColumns: false, - queryParams:queryParams, + queryParams:otherQueryParams, sidePagination: "client", columns: [{ checkbox: true @@ -349,12 +351,13 @@ }) - function queryParams(params) { + function otherQueryParams(params) { var curParams = { // 传递参数查询参数 materialNo: aftersalesOutOrderDetail.materialNo, salesOrderCode:salesOrderCode, - makeNo:makeNo + makeNo:makeNo, + relatedOrderCode:relatedOrderCode }; 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 b1a5152c..6966c957 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOutOrder/maintenanceEquipmentOne.html @@ -327,10 +327,7 @@ showRefresh:false, showSearch:false, queryParams:queryParams, - columns: [{ - checkbox: true - }, - + columns: [ { title:'销售订单号', field:'quoteId', visible: false @@ -389,15 +386,6 @@ title: '准备出库数', field: 'prepareOutOrderSum', }, - { - title: '操作', - align: 'center', - formatter: function(value, row, index) { - var actions = []; - actions.push('添加出货设备'); - return actions.join(''); - } - } ] }; $.table.init(options); @@ -461,11 +449,13 @@ function addShippingDevicesOne(outOrderDetailId) { var salesOrderCode = [[${aftersalesOutOrder.salesOrderCode}]]; + var relatedOrderCode = [[${aftersalesOutOrder.relatedOrderCode}]]; 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)); var url = prefix + '/addShippingDevicesOne?' + queryParams.toString(); $.modal.open("添加出货设备", url); }