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 4abf6cf3..32e23d2d 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 @@ -376,4 +376,15 @@ public class AftersalesWarehouseOutController extends BaseController } + /** + * 确认收货 + */ + @RequiresPermissions("aftersales:warehouseOutOrder:confirmReceivingGoods") + @Log(title = "售后维护设备出库", businessType = BusinessType.UPDATE) + @GetMapping( "/confirmReceivingGoods/{outOrderId}") + @ResponseBody + public AjaxResult confirmReceivingGoods(@PathVariable("outOrderId") Long outOrderId){ + return toAjax(warehouseOutOrderService.confirmReceivingGoodsById(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 5a16ff02..2851f1df 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 @@ -140,4 +140,9 @@ public interface IAftersalesWarehouseOutService * 修改保存售后第二次维护设备 */ int updateMaintenanceEquipmentTwo(WarehouseOutOrder warehouseOutOrder); + + /** + * 确认收货 + */ + int confirmReceivingGoodsById(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 ec33f164..e3d2d7cf 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 @@ -13,9 +13,11 @@ 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.SysSalesOrder; import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.domain.SysSalesShippingInform; import com.ruoyi.system.mapper.SysSalesOrderChildMapper; +import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.mapper.SysSalesShippingInformMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; @@ -53,6 +55,9 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu @Autowired private SysSalesShippingInformMapper shippingInformMapper; + @Autowired + private SysSalesOrderMapper sysSalesOrderMapper; + /** * 查询出库单 * @@ -376,6 +381,51 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu } + /** + * 确认收货 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int confirmReceivingGoodsById(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("10"); + 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("6"); + 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("10"); + return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + } + /* * 售后第一次维护设备信息根据设备ID删除出货设备信息 * */ 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 998b0854..36212e7d 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/warehouseOutOrder.html @@ -67,6 +67,7 @@ var maintenanceEquipmentOneFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:maintenanceEquipmentOne')}]]; var maintenanceEquipmentTwoFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:maintenanceEquipmentTwo')}]]; + var confirmReceivingGoodsFlag = [[${@permission.hasPermi('aftersales:warehouseOutOrder:confirmReceivingGoods')}]]; var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]]; @@ -182,6 +183,9 @@ if (row.warehouseOutStatus== "3"){ actions.push('维护设备 '); } + if (row.warehouseOutStatus=="7"){ + actions.push('确认收货 '); + } return actions.join(''); } }] @@ -208,6 +212,42 @@ $.modal.open("售后第二次维护设备",url); } + //确认收货 + function confirmReceivingGoods(outOrderId) { + // 使用layer.confirm替代alert,以实现确认功能 + layer.confirm("确定要收货吗?", { + title: "系统提示", + btn: ['确定', '取消'], // 自定义按钮文本 + yes: function(index, layero) { + // 用户点击确定后的操作 + $.ajax({ + url: prefix + '/confirmReceivingGoods/' + 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