diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java index 32e23d2d..c056b967 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/controller/AftersalesWarehouseOutController.java @@ -387,4 +387,16 @@ public class AftersalesWarehouseOutController extends BaseController return toAjax(warehouseOutOrderService.confirmReceivingGoodsById(outOrderId)); } + + /** + * 确认验收 + */ + @RequiresPermissions("aftersales:warehouseOutOrder:confirmCheckGoods") + @Log(title = "售后维护设备出库", businessType = BusinessType.UPDATE) + @GetMapping( "/confirmCheckGoods/{outOrderId}") + @ResponseBody + public AjaxResult confirmCheckGoods(@PathVariable("outOrderId") Long outOrderId){ + return toAjax(warehouseOutOrderService.confirmCheckGoodsById(outOrderId)); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java index 2851f1df..c68025a0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesWarehouseOutService.java @@ -145,4 +145,9 @@ public interface IAftersalesWarehouseOutService * 确认收货 */ int confirmReceivingGoodsById(Long outOrderId); + + /** + * 确认验收 + */ + int confirmCheckGoodsById(Long outOrderId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java index e3d2d7cf..cf8cdac4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesWarehouseOutServiceImpl.java @@ -426,6 +426,52 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); } + /** + * 确认验收 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int confirmCheckGoodsById(Long outOrderId) { + + String loginName = ShiroUtils.getLoginName(); + WarehouseOutOrder warehouseOutOrder = warehouseOutOrderMapper.selectWarehouseOutOrderById(outOrderId); + if (warehouseOutOrder == null){ + log.warn("出库单Id为空:{}",outOrderId); + } + String outOrderCode = warehouseOutOrder.getOutOrderCode(); + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + sysSalesShippingInform.setOutOrderCode(outOrderCode); + sysSalesShippingInform.setWarehouseOutStatus("12"); + sysSalesShippingInform.setUpdateTime(new Date()); + sysSalesShippingInform.setUpdateBy(loginName); + + int updateSalesShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + if (updateSalesShippingInformResult <= 0){ + throw new BusinessException("更新销售出库数据失败"); + } + + String salesOrderCode = warehouseOutOrder.getSalesOrderCode(); + if (StringUtils.isEmpty(salesOrderCode)){ + log.warn("销售订单号为空:{}",salesOrderCode); + } + SysSalesOrder sysSalesOrder = new SysSalesOrder(); + sysSalesOrder.setSalesOrderCode(salesOrderCode); + //设置为全部出货 + sysSalesOrder.setDeliveryStatus("8"); + sysSalesOrder.setUpdateTime(new Date()); + sysSalesOrder.setUpdateBy(loginName); + int updateSysSalesOrderResult = sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder); + if (updateSysSalesOrderResult <= 0){ + throw new BusinessException("更新销售订单数据失败"); + } + warehouseOutOrder.setUpdateTime(new Date()); + warehouseOutOrder.setUpdateBy(loginName); + //设置为全部验收 + warehouseOutOrder.setWarehouseOutStatus("12"); + return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + + } + /* * 售后第一次维护设备信息根据设备ID删除出货设备信息 * */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java index 82b00c35..66f82046 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java @@ -2,7 +2,9 @@ package com.ruoyi.system.controller; import java.util.List; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.system.domain.SysSalesOrder; +import com.ruoyi.system.domain.SysSalesShippingInformDetail; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -193,4 +195,41 @@ public class SysSalesShippingInformController extends BaseController return toAjax(sysSalesShippingInformService.updateCancelShipping(sysSalesShippingInform)); } + /** + * 客户验收 + */ + @GetMapping("/customerCheckGoods/{shippingInformId}") + public String customerCheckGoods(@PathVariable("shippingInformId") Long shippingInformId, ModelMap mmap) + { + SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformService.selectSysSalesShippingInformById(shippingInformId); + mmap.put("sysSalesShippingInform", sysSalesShippingInform); + return prefix + "/customerCheckGoods"; + } + + /** + * 修改保存客户验收 + */ + @RequiresPermissions("system:salesShippingInform:customerCheckGoods") + @Log(title = "销售取消发货", businessType = BusinessType.UPDATE) + @PostMapping("/customerCheckGoods") + @ResponseBody + public AjaxResult customerCheckGoodsSave(@RequestBody SysSalesShippingInform sysSalesShippingInform) + { + return toAjax(sysSalesShippingInformService.updateCustomerCheckGoods(sysSalesShippingInform)); + } + + + + /** + * 客户验收 物料信息信息 + */ + @PostMapping("/getMaterialListByOutOrderCode") + @ResponseBody + public TableDataInfo getMaterialListByOutOrderCode(SysSalesShippingInform sysSalesShippingInform) + { + startPage(); + List list = sysSalesShippingInformService.getMaterialListByOutOrderCode(sysSalesShippingInform); + return getDataTable(list); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java index a21abd31..7e1b9e7b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java @@ -146,6 +146,9 @@ public class SysSalesOrderChild extends BaseEntity { //已申请出货数 private Integer hasApplyShippingNum; + //已验收数 + private Integer hasCheckNum; + private String bomId; public Long getId() { @@ -469,6 +472,14 @@ public class SysSalesOrderChild extends BaseEntity { this.hasApplyShippingNum = hasApplyShippingNum; } + public Integer getHasCheckNum() { + return hasCheckNum; + } + + public void setHasCheckNum(Integer hasCheckNum) { + this.hasCheckNum = hasCheckNum; + } + @Override public String toString() { return Objects.toStringHelper(this) @@ -511,6 +522,7 @@ public class SysSalesOrderChild extends BaseEntity { .add("finishNum", finishNum) .add("applyShippingNum", applyShippingNum) .add("hasApplyShippingNum", hasApplyShippingNum) + .add("hasCheckNum", hasCheckNum) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java index 538865a8..6d7c74db 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java @@ -2,6 +2,8 @@ package com.ruoyi.system.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -112,6 +114,10 @@ public class SysSalesShippingInform extends BaseEntity @Excel(name = "送货日期", width = 30, dateFormat = "yyyy-MM-dd") private Date deliverTime; + /** 销售出库单详情*/ + private List shippingInformDetailList; + + public void setShippingInformId(Long shippingInformId) { this.shippingInformId = shippingInformId; @@ -320,6 +326,14 @@ public class SysSalesShippingInform extends BaseEntity return deliverTime; } + public List getShippingInformDetailList() { + return shippingInformDetailList; + } + + public void setShippingInformDetailList(List shippingInformDetailList) { + this.shippingInformDetailList = shippingInformDetailList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -351,6 +365,7 @@ public class SysSalesShippingInform extends BaseEntity .append("paymentCondition", getPaymentCondition()) .append("deliveryCondition", getDeliveryCondition()) .append("deliverTime", getDeliverTime()) + .append("shippingInformDetailList",getShippingInformDetailList()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java index 80900bad..0bdcba7e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java @@ -74,4 +74,9 @@ public interface SysSalesShippingInformDetailMapper * @return 结果 */ public int restoreSysSalesShippingInformDetailById(Long shippingInformDetailId); + + /* + * 根据出库单号查询销售出库详情 + * */ + List selectSysSalesShippingInformDetailByCode(String outOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java index b2a59311..01fb4f01 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesShippingInform; +import com.ruoyi.system.domain.SysSalesShippingInformDetail; /** * 销售出货通知Service接口 @@ -90,4 +91,14 @@ public interface ISysSalesShippingInformService * 修改保存取消发货 */ int updateCancelShipping(SysSalesShippingInform sysSalesShippingInform); + + /** + * 客户验收 + * */ + int updateCustomerCheckGoods(SysSalesShippingInform sysSalesShippingInform); + + /* + * 客户验收查询物料相关数据 + * */ + List getMaterialListByOutOrderCode(SysSalesShippingInform sysSalesShippingInform); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java index 73d963f2..a5a7eb57 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java @@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.*; +import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.mapper.SysSalesShippingInformDetailMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrder; @@ -48,6 +49,8 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor @Autowired private SysSalesShippingInformDetailMapper shippingInformDetailMapper; + @Autowired + private SysSalesOrderChildMapper salesOrderChildMapper; /** * 查询销售出货通知 * @@ -259,4 +262,80 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor return 1; } + + /** + * 客户验收 + */ + + @Transactional(rollbackFor = Exception.class) + @Override + public int updateCustomerCheckGoods(SysSalesShippingInform sysSalesShippingInform) { + + String loginName = ShiroUtils.getLoginName(); + + List shippingInformDetailList = sysSalesShippingInform.getShippingInformDetailList(); + + for (SysSalesShippingInformDetail shippingInformDetail : shippingInformDetailList) { + SysSalesOrderChild sysSalesOrderChild = new SysSalesOrderChild(); + sysSalesOrderChild.setMaterialCode(shippingInformDetail.getMaterialNo()); + sysSalesOrderChild.setQuoteId(sysSalesShippingInform.getSalesOrderCode()); + sysSalesOrderChild.setUpdateBy(loginName); + sysSalesOrderChild.setUpdateTime(new Date()); + sysSalesOrderChild.setHasCheckNum(shippingInformDetail.getThisCheckNum()); + int updateSysSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(sysSalesOrderChild); + if (updateSysSalesOrderChildResult <= 0){ + throw new BusinessException("更新销售订单子表数据失败"); + } + shippingInformDetail.setUpdateBy(loginName); + shippingInformDetail.setUpdateTime(new Date()); + shippingInformDetail.setHasCheckNum(shippingInformDetail.getThisCheckNum()); + int updateShippingInformDetailResult = shippingInformDetailMapper.updateSysSalesShippingInformDetail(shippingInformDetail); + if (updateShippingInformDetailResult <= 0){ + throw new BusinessException("更新销售出库详情数据失败"); + } + } + //设置出货状态为全部验收 + sysSalesShippingInform.setWarehouseOutStatus("11"); + + //更新出库状态 + WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder(); + warehouseOutOrder.setOutOrderCode(sysSalesShippingInform.getOutOrderCode()); + warehouseOutOrder.setUpdateTime(new Date()); + warehouseOutOrder.setUpdateBy(loginName); + //设置为全部验收 + warehouseOutOrder.setWarehouseOutStatus("12"); + int updateWarehouseOutOrdeResult = warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + if (updateWarehouseOutOrdeResult <= 0){ + throw new BusinessException("更新出库单数据失败"); + } + + //更新销售订单状态 + SysSalesOrder sysSalesOrder = new SysSalesOrder(); + sysSalesOrder.setSalesOrderCode(sysSalesShippingInform.getSalesOrderCode()); + //设置为全部验收 + sysSalesOrder.setDeliveryStatus("8"); + sysSalesOrder.setUpdateTime(new Date()); + sysSalesOrder.setUpdateBy(loginName); + int updateSysSalesOrderResult = sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder); + if (updateSysSalesOrderResult <= 0){ + throw new BusinessException("更新销售订单数据失败"); + } + + return sysSalesShippingInformMapper.updateSysSalesShippingInform(sysSalesShippingInform); + } + + /* + * 客户验收查询物料相关数据 + * */ + @Override + public List getMaterialListByOutOrderCode(SysSalesShippingInform sysSalesShippingInform) { + + String outOrderCode = sysSalesShippingInform.getOutOrderCode(); + if (StringUtils.isEmpty(outOrderCode)){ + log.warn("出库单号为空:{}",outOrderCode); + + } + List list = shippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode); + return list; + } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml index 616bc64a..718ef843 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml @@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -81,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + insert into sys_sales_shipping_inform_detail diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html index 36212e7d..ee6687e4 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html @@ -68,6 +68,7 @@ var maintenanceEquipmentTwoFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:maintenanceEquipmentTwo')}]]; var confirmReceivingGoodsFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:confirmReceivingGoods')}]]; + var confirmCheckGoodsFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:confirmCheckGoods')}]]; var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]]; @@ -186,6 +187,9 @@ if (row.warehouseOutStatus=="7"){ actions.push('确认收货 '); } + // if (row.warehouseOutStatus=="10"){ + // actions.push('确认验收 '); + // } return actions.join(''); } }] @@ -248,6 +252,43 @@ }); } + //确认验收 + function confirmCheckGoods(outOrderId) { + // 使用layer.confirm替代alert,以实现确认功能 + layer.confirm("确定要验收吗?", { + title: "系统提示", + btn: ['确定', '取消'], // 自定义按钮文本 + yes: function(index, layero) { + // 用户点击确定后的操作 + $.ajax({ + url: prefix + '/confirmCheckGoods/' + outOrderId, + type: 'GET', + dataType: 'json', + success: function(data) { + if (data.code == web_status.SUCCESS) { + // 成功后提示 + layer.close(index); // 关闭当前confirm对话框 + $.modal.alert("验收成功。"); + $('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格 + } else { + layer.close(index); // 关闭当前confirm对话框 + $.modal.alertError(data.msg); + } + }, + error: function(error) { + layer.close(index); // 关闭当前confirm对话框 + $.modal.alertError("验收失败。"); + } + }); + }, + cancel: function(index, layero) { + // 用户点击取消的操作,通常无需处理,直接关闭对话框即可 + layer.close(index); + } + }); + } + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/customerCheckGoods.html b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/customerCheckGoods.html new file mode 100644 index 00000000..cb14d662 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/customerCheckGoods.html @@ -0,0 +1,246 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html index 37119d4a..173fa6e4 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html @@ -226,6 +226,10 @@ if(row.warehouseOutStatus == '2'){ actions.push('确认发货 '); } + if(row.warehouseOutStatus == '10' || row.warehouseOutStatus == '11'){ + actions.push('确认验收 '); + } + return actions.join(''); } }] @@ -238,6 +242,12 @@ var url = prefix +'/confirmShipping/' + shippingInformId; $.modal.open("确认发货",url); } + + //客户验收 + function customerCheckGoods(shippingInformId){ + var url = prefix +'/customerCheckGoods/' + shippingInformId; + $.modal.open("客户验收",url); + } \ No newline at end of file