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 7b18ba4d..82b00c35 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 @@ -1,15 +1,13 @@ package com.ruoyi.system.controller; import java.util.List; + +import com.ruoyi.system.domain.SysSalesOrder; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.SysSalesShippingInform; @@ -147,5 +145,52 @@ public class SysSalesShippingInformController extends BaseController return toAjax(sysSalesShippingInformService.restoreSysSalesShippingInformById(id)); } + /** + * 确认发货 + */ + @GetMapping("/confirmShipping/{shippingInformId}") + public String confirmShipping(@PathVariable("shippingInformId") Long shippingInformId, ModelMap mmap) + { + SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformService.selectSysSalesShippingInformById(shippingInformId); + mmap.put("sysSalesShippingInform", sysSalesShippingInform); + return prefix + "/confirmShipping"; + } + + /** + * 修改保存确认发货 + */ + @RequiresPermissions("system:salesShippingInform:confirmShipping") + @Log(title = "销售确认发货", businessType = BusinessType.UPDATE) + @PostMapping("/confirmShipping") + @ResponseBody + public AjaxResult confirmShippingSave(SysSalesShippingInform sysSalesShippingInform) + { + return toAjax(sysSalesShippingInformService.updateConfirmShipping(sysSalesShippingInform)); + } + + + + /** + * 取消发货 + */ + @GetMapping("/cancelShipping/{shippingInformId}") + public String cancelShipping(@PathVariable("shippingInformId") Long shippingInformId, ModelMap mmap) + { + SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformService.selectSysSalesShippingInformById(shippingInformId); + mmap.put("sysSalesShippingInform", sysSalesShippingInform); + return prefix + "/cancelShipping"; + } + + /** + * 修改保存取消发货 + */ + @RequiresPermissions("system:salesShippingInform:cancelShipping") + @Log(title = "销售取消发货", businessType = BusinessType.UPDATE) + @PostMapping("/cancelShipping") + @ResponseBody + public AjaxResult cancelShippingSave(SysSalesShippingInform sysSalesShippingInform) + { + return toAjax(sysSalesShippingInformService.updateCancelShipping(sysSalesShippingInform)); + } } 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 2290f0b9..b2a59311 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 @@ -79,4 +79,15 @@ public interface ISysSalesShippingInformService * 通过销售发起出货生成销售出货通知单列表 * */ int generateShippingInformBySalesOrder(SysSalesOrder sysSalesOrder, String outOrderCode); + + + /** + * 修改保存确认发货 + */ + int updateConfirmShipping(SysSalesShippingInform sysSalesShippingInform); + + /** + * 修改保存取消发货 + */ + int updateCancelShipping(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 a8e5460b..96682a81 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 @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; @@ -12,6 +13,8 @@ import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesOrderVo; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrder; +import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; +import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +22,7 @@ import com.ruoyi.system.mapper.SysSalesShippingInformMapper; import com.ruoyi.system.domain.SysSalesShippingInform; import com.ruoyi.system.service.ISysSalesShippingInformService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 销售出货通知Service业务层处理 @@ -28,7 +32,7 @@ import com.ruoyi.common.core.text.Convert; */ @Slf4j @Service -public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInformService +public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInformService { @Autowired private SysSalesShippingInformMapper sysSalesShippingInformMapper; @@ -39,6 +43,9 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor @Autowired private RedisCache redisCache; + @Autowired + private WarehouseOutOrderMapper warehouseOutOrderMapper; + /** * 查询销售出货通知 * @@ -174,4 +181,43 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor return sysSalesShippingInformMapper.insertSysSalesShippingInform(sysSalesShippingInform); } + + /** + * 修改保存确认发货 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateConfirmShipping(SysSalesShippingInform sysSalesShippingInform) { + + String loginName = ShiroUtils.getLoginName(); + //设置出库状态为 待设备维护2 + sysSalesShippingInform.setWarehouseOutStatus("3"); + sysSalesShippingInform.setUpdateBy(loginName); + sysSalesShippingInform.setUpdateTime(new Date()); + + //更新出库单数据 + String outOrderCode = sysSalesShippingInform.getOutOrderCode(); + if (StringUtils.isEmpty(outOrderCode)){ + log.warn("出库单号为空:{}",outOrderCode); + } + WarehouseOutOrder warehouseOutOrder = warehouseOutOrderMapper.selectWarehouseOutOrderByCode(outOrderCode); + warehouseOutOrder.setWarehouseOutStatus("3"); + warehouseOutOrder.setUpdateBy(loginName); + warehouseOutOrder.setUpdateTime(new Date()); + + int updateWarehouseOutOrderResult = warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + if (updateWarehouseOutOrderResult <= 0){ + throw new BusinessException("更新出库单数据失败"); + } + return sysSalesShippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + } + + /** + * 修改保存取消发货 (后续完善) + */ + @Override + public int updateCancelShipping(SysSalesShippingInform sysSalesShippingInform) { + + return 1; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java index e505696e..99ed744c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java @@ -83,4 +83,9 @@ public interface WarehouseOutOrderMapper * @return 结果 */ public int restoreWarehouseOutOrderById(Long outOrderId); + + /* + * 根据出库单号查询出库单数据 + * */ + WarehouseOutOrder selectWarehouseOutOrderByCode(String outOrderCode); } diff --git a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml index 4371525f..728613f3 100644 --- a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml @@ -89,6 +89,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where out_order_id = #{outOrderId} + + + + + insert into warehouse_out_order diff --git a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/cancelShipping.html b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/cancelShipping.html new file mode 100644 index 00000000..03eee16b --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/cancelShipping.html @@ -0,0 +1,35 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/confirmShipping.html b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/confirmShipping.html new file mode 100644 index 00000000..47233d79 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/confirmShipping.html @@ -0,0 +1,49 @@ + + + + + + + +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+
+ + + + + \ 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 20a1664d..37119d4a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html @@ -70,6 +70,12 @@ var removeFlag = [[${@permission.hasPermi('system:salesShippingInform:remove')}]]; var cancelFlag = [[${@permission.hasPermi('system:salesShippingInform:cancel')}]]; var restoreFlag = [[${@permission.hasPermi('system:salesShippingInform:restore')}]]; + var confirmShippingFlag = [[${@permission.hasPermi('system:salesShippingInform:confirmShipping')}]]; + + + + + var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]]; var warehouseOutTypeDatas = [[${@dict.getType('warehouse_out_type')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]]; @@ -217,11 +223,8 @@ formatter: function(value, row, index) { var actions = []; actions.push('编辑 '); - actions.push('删除 '); - if(row.delFlag == '0'){ - actions.push('作废 '); - }else{ - actions.push('恢复 '); + if(row.warehouseOutStatus == '2'){ + actions.push('确认发货 '); } return actions.join(''); } @@ -229,6 +232,12 @@ }; $.table.init(options); }); + + //确认发货 + function confirmShipping(shippingInformId){ + var url = prefix +'/confirmShipping/' + shippingInformId; + $.modal.open("确认发货",url); + } \ No newline at end of file