From c852fdcc2c668ee3581701af134535f2261bc0f6 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 10 Jul 2024 08:48:10 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BF=9D=E5=AD=98=E5=90=8E=E7=AB=AF=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=94=80=E5=94=AE=E5=8D=95=E5=8F=B7=E5=92=8C=E7=89=A9?= =?UTF-8?q?=E6=96=99=E5=8F=B7=E6=9B=B4=E6=96=B0=E9=94=80=E5=94=AE=E5=8D=95?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E7=9A=84=E5=90=8C=E6=97=B6=20=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BB=93=E5=BA=93=E5=87=BA=E5=BA=93=E5=8D=95=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E9=94=80?= =?UTF-8?q?=E5=94=AE=E5=8F=91=E8=B4=A7=E7=9A=84=E5=90=8C=E6=97=B6=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BB=93=E5=BA=93=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E9=94=80=E5=94=AE=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E6=97=B6=E7=94=9F=E6=88=90=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysSalesOrderController.java | 43 +++- .../system/domain/SysSalesOrderChild.java | 34 +++ .../mapper/SysSalesOrderChildMapper.java | 10 + .../service/ISysSalesOrderChildService.java | 4 + .../system/service/ISysSalesOrderService.java | 5 + .../ISysSalesShippingInformService.java | 7 + .../impl/SysSalesOrderChildServiceImpl.java | 9 + .../impl/SysSalesOrderServiceImpl.java | 48 ++++ .../SysSalesShippingInformServiceImpl.java | 51 ++++ .../service/IWarehouseOutOrderService.java | 6 + .../impl/WarehouseOutOrderServiceImpl.java | 69 +++++- .../WarehouseStorageOrderServiceImpl.java | 19 ++ .../system/SysSalesOrderChildMapper.xml | 68 ++++++ .../system/salesOrder/salesDeliverGoods.html | 231 ++++++++++++++++++ 14 files changed, 597 insertions(+), 7 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java index 3caf45fe..45a0289d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java @@ -28,6 +28,8 @@ import com.ruoyi.system.domain.exportDto.SysSalesFinishDto; import com.ruoyi.system.domain.exportDto.SysSalesOrderDto; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.service.*; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.runtime.ProcessInstance; @@ -88,12 +90,11 @@ public class SysSalesOrderController extends BaseController @Autowired private ISysMakeOrderService sysMakeOrderService; - @Autowired - private SysSalesOrderMapper sysSalesOrderMapper; - @Autowired private IFinancialReceivablesService financialReceivablesService; + @Autowired + private ISysSalesOrderChildService sysSalesOrderChildService; @RequiresPermissions("system:salesOrder:view") @GetMapping() @@ -522,4 +523,40 @@ public class SysSalesOrderController extends BaseController List list = sysUserService.selectRoleToUserList("ywyRole,ywjlRole,ywzgRole,zozjRole,admin"); return getDataTable(list); } + + /** + * 发起出货 + */ + @GetMapping("/salesDeliverGoods/{salesOrderId}") + public String salesDeliverGoods(@PathVariable("salesOrderId") Long salesOrderId, ModelMap mmap) + { + SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(salesOrderId); + mmap.put("sysSalesOrder", sysSalesOrder); + return prefix + "/salesDeliverGoods"; + } + + /** + * 修改保存发起出货 + */ + @RequiresPermissions("system:salesOrder:salesDeliverGoods") + @Log(title = "销售出货通知", businessType = BusinessType.UPDATE) + @PostMapping("/salesDeliverGoods") + @ResponseBody + public AjaxResult salesDeliverGoodsSave(@RequestBody SysSalesOrder sysSalesOrder) + { + return toAjax(sysSalesOrderService.updateSalesDeliverGoods(sysSalesOrder)); + } + + + /** + * 发起出货 物料详情列表 + */ + @ResponseBody + @RequestMapping("/salesDeliverGoodsDetailList") + public TableDataInfo storageMakeDetailList(SysSalesOrder sysSalesOrder){ + startPage(); + String salesOrderCode = sysSalesOrder.getSalesOrderCode(); + List list = sysSalesOrderChildService.selectOrderChildListBySalesOrderCode(salesOrderCode); + return getDataTable(list) ; + } } \ No newline at end of file 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 67a69414..a21abd31 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 @@ -137,6 +137,15 @@ public class SysSalesOrderChild extends BaseEntity { @Excel(name = "未出库数量") private Integer unBoundQuantity; + //已完成数 + private Integer finishNum; + + //申请出货数 + private Integer applyShippingNum; + + //已申请出货数 + private Integer hasApplyShippingNum; + private String bomId; public Long getId() { @@ -436,7 +445,29 @@ public class SysSalesOrderChild extends BaseEntity { this.bomId = bomId; } + public Integer getFinishNum() { + return finishNum; + } + public void setFinishNum(Integer finishNum) { + this.finishNum = finishNum; + } + + public Integer getApplyShippingNum() { + return applyShippingNum; + } + + public void setApplyShippingNum(Integer applyShippingNum) { + this.applyShippingNum = applyShippingNum; + } + + public Integer getHasApplyShippingNum() { + return hasApplyShippingNum; + } + + public void setHasApplyShippingNum(Integer hasApplyShippingNum) { + this.hasApplyShippingNum = hasApplyShippingNum; + } @Override public String toString() { @@ -477,6 +508,9 @@ public class SysSalesOrderChild extends BaseEntity { .add("taxRate", taxRate) .add("outBoundQuantity", outBoundQuantity) .add("unBoundQuantity", unBoundQuantity) + .add("finishNum", finishNum) + .add("applyShippingNum", applyShippingNum) + .add("hasApplyShippingNum", hasApplyShippingNum) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java index 8cdb9959..b1db1139 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java @@ -27,4 +27,14 @@ public interface SysSalesOrderChildMapper { * 根据物料号和销售订单号查询销售订单子表数据 * */ SysSalesOrderChild selectSalesOrderChildByCodeAndNo(SysSalesOrderChild sysSalesOrderChild); + + /* + * 通过销售订单号查询销售订单子表 + * */ + List selectOrderChildListBySalesOrderCode(String salesOrderCode); + + /* + * 根据销售单号和物料号更新销售单子表数据 + * */ + int updateSysSalesOrderChildByCodeAndQuoteId(SysSalesOrderChild sysSalesOrderChild); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java index ff4fcaf0..f87f3d25 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java @@ -23,4 +23,8 @@ public interface ISysSalesOrderChildService { SysSalesOrderChild selectOneByQuoteIdAndMaterialCode(String quoteId,String materialCode); + /* + * 通过销售订单号查询销售订单子表 + * */ + List selectOrderChildListBySalesOrderCode(String salesOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java index 40877029..91657cc7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java @@ -87,4 +87,9 @@ public interface ISysSalesOrderService * 根据销售单号更新销售订单 * */ int updateSysSalesOrderBySalesOrderCode(SysSalesOrder sysSalesOrder); + + /** + * 修改保存发起出货 + */ + int updateSalesDeliverGoods(SysSalesOrder sysSalesOrder); } 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 3cd18bc3..2290f0b9 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 @@ -1,6 +1,8 @@ package com.ruoyi.system.service; import java.util.List; + +import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesShippingInform; /** @@ -72,4 +74,9 @@ public interface ISysSalesShippingInformService * @return */ int restoreSysSalesShippingInformById(Long shippingInformId); + + /** + * 通过销售发起出货生成销售出货通知单列表 + * */ + int generateShippingInformBySalesOrder(SysSalesOrder sysSalesOrder, String outOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java index 255ed536..6a693507 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java @@ -51,4 +51,13 @@ public class SysSalesOrderChildServiceImpl implements ISysSalesOrderChildService public SysSalesOrderChild selectOneByQuoteIdAndMaterialCode(String quoteId, String materialCode) { return sysCustomerQuoteChildMapper.selectOneByQuoteIdAndMaterialCode(quoteId,materialCode); } + + /* + * 通过销售订单号查询销售订单子表 + * */ + @Override + public List selectOrderChildListBySalesOrderCode(String salesOrderCode) { + + return sysCustomerQuoteChildMapper.selectOrderChildListBySalesOrderCode(salesOrderCode); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java index cbaa4013..60a24051 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; @@ -13,9 +14,11 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.system.domain.*; +import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.*; +import com.ruoyi.warehouse.service.IWarehouseOutOrderService; import org.activiti.engine.TaskService; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.runtime.ProcessInstance; @@ -70,6 +73,15 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService @Autowired private ISysSalesOrderChildService sysSalesOrderChildService; + @Autowired + private SysSalesOrderChildMapper salesOrderChildMapper; + + @Autowired + private ISysSalesShippingInformService sysSalesShippingInformService; + + @Autowired + private IWarehouseOutOrderService warehouseOutOrderService; + /** * 查询销售订单 * @@ -352,6 +364,42 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService return sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder); } + /** + * 修改保存发起出货 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateSalesDeliverGoods(SysSalesOrder sysSalesOrder) { + + String loginName = ShiroUtils.getLoginName(); + + sysSalesOrder.setUpdateBy(loginName); + sysSalesOrder.setUpdateTime(new Date()); + + for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrder.getSysSalesOrderChildList()) { + + sysSalesOrderChild.setUpdateTime(new Date()); + sysSalesOrderChild.setUpdateBy(loginName); + sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode()); + sysSalesOrderChild.setHasApplyShippingNum(sysSalesOrderChild.getApplyShippingNum()); + int updateSysSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(sysSalesOrderChild); + if (updateSysSalesOrderChildResult <= 0){ + throw new BusinessException("更新销售订单子表数据失败"); + } + } + + + //两个表生成同一个出库单号 + String outOrderCode = redisCache.generateBillNo("CK"); + //通过销售发起出货生成仓库出库单 + int insertWarehouseOutOrderResult = warehouseOutOrderService.generateWarehouseOutOrderBySalesOrder(sysSalesOrder,outOrderCode); + + //通过销售发起出货生成销售出货通知单列表 + int insertShippingInformResult = sysSalesShippingInformService.generateShippingInformBySalesOrder(sysSalesOrder,outOrderCode); + + return sysSalesOrderMapper.updateSysSalesOrderBySalesOrderCode(sysSalesOrder); + } + private ProcessInstance startProcessInstance(String applyTitle,String instanceType,SysSalesOrder sysSalesOrder, SysUser user) { Long nessKey = sysSalesOrder.getSalesOrderId(); 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 44056899..a8e5460b 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 @@ -1,8 +1,18 @@ package com.ruoyi.system.service.impl; +import java.math.BigDecimal; +import java.util.Date; import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; 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.SysSalesOrderVo; +import com.ruoyi.system.mapper.SysSalesOrderMapper; +import com.ruoyi.warehouse.domain.WarehouseOutOrder; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.SysSalesShippingInformMapper; @@ -16,12 +26,19 @@ import com.ruoyi.common.core.text.Convert; * @author 刘晓旭 * @date 2024-07-09 */ +@Slf4j @Service public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInformService { @Autowired private SysSalesShippingInformMapper sysSalesShippingInformMapper; + @Autowired + private SysSalesOrderMapper sysSalesOrderMapper; + + @Autowired + private RedisCache redisCache; + /** * 查询销售出货通知 * @@ -123,4 +140,38 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor { return sysSalesShippingInformMapper.restoreSysSalesShippingInformById(shippingInformId); } + + /** + * 通过销售发起出货生成销售出货通知单列表 + * */ + @Override + public int generateShippingInformBySalesOrder(SysSalesOrder sysSalesOrder,String outOrderCode) { + + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + String salesOrderCode = sysSalesOrder.getSalesOrderCode(); + if (StringUtils.isEmpty(salesOrderCode)){ + log.warn("销售订单编号为空:{}",salesOrderCode); + } + //从数据库查询的数据 + SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(salesOrderCode); + + sysSalesShippingInform.setOutOrderCode(outOrderCode); + //出库状态为 待仓库准备物料 + sysSalesShippingInform.setWarehouseOutStatus("0"); + sysSalesShippingInform.setSalesOrderCode(salesOrderCode); + //订单类型设置为 销售订单 + sysSalesShippingInform.setWarehouseOrderType("0"); + //出库类型设置为 销售出库 + sysSalesShippingInform.setWarehouseOutType("0"); + sysSalesShippingInform.setCustomerId(sysSalesOrderVo.getEnterpriseCode()); + sysSalesShippingInform.setCustomerName(sysSalesOrderVo.getEnterpriseName()); + sysSalesShippingInform.setDeliveryCondition(sysSalesOrderVo.getDeliveryConditions()); + sysSalesShippingInform.setCreateTime(new Date()); + sysSalesShippingInform.setCreateBy(ShiroUtils.getLoginName()); + sysSalesShippingInform.setAllPriceExcludingTaxDollar(BigDecimal.valueOf(sysSalesOrderVo.getNoUsdSum())); + sysSalesShippingInform.setAllPriceExcludingTaxRmb(BigDecimal.valueOf(sysSalesOrderVo.getNoRmbSum())); + sysSalesShippingInform.setAllPriceIncludesTax(BigDecimal.valueOf(sysSalesOrderVo.getRmbTaxSum())); + + return sysSalesShippingInformMapper.insertSysSalesShippingInform(sysSalesShippingInform); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java index 8aea63fe..38c02b65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java @@ -3,6 +3,7 @@ package com.ruoyi.warehouse.service; import java.util.List; import com.ruoyi.system.domain.SysMakeorderPickVo; +import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder; /** @@ -100,4 +101,9 @@ public interface IWarehouseOutOrderService * 生产单-出库 * */ int updateMakeOutWarehouse(WarehouseOutOrder warehouseOutOrder); + + /** + * 通过销售发起出货生成仓库出库单 + * */ + int generateWarehouseOutOrderBySalesOrder(SysSalesOrder sysSalesOrder, String outOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java index eb5431d5..e1a7d6ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java @@ -8,15 +8,13 @@ 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.SysMakeOrder; -import com.ruoyi.system.domain.SysMakeorderPickDetail; -import com.ruoyi.system.domain.SysMakeorderPickVo; -import com.ruoyi.system.domain.SysSalesOrder; +import com.ruoyi.system.domain.*; import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper; import com.ruoyi.system.mapper.SysMakeorderPickMapper; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; import lombok.extern.slf4j.Slf4j; @@ -513,4 +511,67 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService } return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); } + + /** + * 通过销售发起出货生成仓库出库单 + * */ + @Override + public int generateWarehouseOutOrderBySalesOrder(SysSalesOrder sysSalesOrder,String outOrderCode) { + + String salesOrderCode = sysSalesOrder.getSalesOrderCode(); + if (StringUtils.isEmpty(salesOrderCode)){ + log.warn("销售订单编号为空:{}",salesOrderCode); + } + //从数据库查询的数据 + SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(salesOrderCode); + + WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder(); + warehouseOutOrder.setOutOrderCode(outOrderCode); + //出库状态为 待仓库准备物料 + warehouseOutOrder.setWarehouseOutStatus("0"); + warehouseOutOrder.setRelatedOrderCode(salesOrderCode); + warehouseOutOrder.setSalesOrderCode(salesOrderCode); + //订单类型设置为 销售订单 + warehouseOutOrder.setWarehouseOrderType("0"); + //出库类型设置为 销售出库 + warehouseOutOrder.setWarehouseOutType("0"); + warehouseOutOrder.setBusinessName(sysSalesOrderVo.getBusinessMembers()); + warehouseOutOrder.setCustomerId(sysSalesOrderVo.getEnterpriseCode()); + warehouseOutOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName()); + warehouseOutOrder.setApplyName(sysSalesOrderVo.getApplyUserName()); + warehouseOutOrder.setDeliveryCondition(sysSalesOrderVo.getDeliveryConditions()); + warehouseOutOrder.setCreateTime(new Date()); + warehouseOutOrder.setCreateBy(ShiroUtils.getLoginName()); + //新增出库单明细 + CreateOutOrderDetailBySalesOrderChildList(sysSalesOrder, salesOrderCode, sysSalesOrderVo, outOrderCode); + + return warehouseOutOrderMapper.insertWarehouseOutOrder(warehouseOutOrder); + } + //新增出库单明细 + private void CreateOutOrderDetailBySalesOrderChildList(SysSalesOrder sysSalesOrder, String salesOrderCode, SysSalesOrderVo sysSalesOrderVo, String outOrderCode) { + List sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList(); + for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildList) { + WarehouseOutOrderDetail warehouseOutOrderDetail = new WarehouseOutOrderDetail(); + warehouseOutOrderDetail.setOutOrderCode(outOrderCode); + warehouseOutOrderDetail.setRelatedOrderCode(salesOrderCode); + warehouseOutOrderDetail.setMaterialNo(sysSalesOrderChild.getMaterialCode()); + warehouseOutOrderDetail.setMaterialName(sysSalesOrderChild.getMaterialName()); + warehouseOutOrderDetail.setMaterialType(sysSalesOrderChild.getMaterialType()); + warehouseOutOrderDetail.setMaterialBrand(sysSalesOrderChild.getBrand()); + warehouseOutOrderDetail.setMaterialUnit(sysSalesOrderChild.getUnit()); + warehouseOutOrderDetail.setMaterialDescribe(sysSalesOrderChild.getDescribe()); + warehouseOutOrderDetail.setMaterialProcessMethod(sysSalesOrderChild.getProcessMethod()); + warehouseOutOrderDetail.setMakeNum(sysSalesOrderChild.getMaterialNum()); + warehouseOutOrderDetail.setApplyOutOrderSum(sysSalesOrderChild.getApplyShippingNum()); + warehouseOutOrderDetail.setCustomerId(sysSalesOrderVo.getEnterpriseCode()); + warehouseOutOrderDetail.setCustomerName(sysSalesOrderVo.getEnterpriseName()); + warehouseOutOrderDetail.setDeliveryCondition(sysSalesOrderVo.getDeliveryConditions()); + warehouseOutOrderDetail.setCreateTime(new Date()); + warehouseOutOrderDetail.setCreateBy(ShiroUtils.getLoginName()); + int insertOutOrderDetailResult = outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail); + if (insertOutOrderDetailResult <= 0){ + throw new BusinessException("新增出库单明细数据失败"); + } + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 3e4b3320..9804fe0a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -20,7 +20,9 @@ import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; import com.ruoyi.quality.service.IQualityOrderService; import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysSalesOrder; +import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.mapper.SysMakeOrderMapper; +import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.service.ISysMakeOrderService; import com.ruoyi.system.service.ISysSalesOrderService; @@ -69,6 +71,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Autowired private SysMakeOrderMapper sysMakeOrderMapper; + @Autowired + private SysSalesOrderChildMapper salesOrderChildMapper; @Autowired private RedisCache redisCache; @@ -790,6 +794,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS throw new BusinessException("更新生产订单数据失败"); } + //更新销售订单数据 SysSalesOrder sysSalesOrder = salesOrderMapper.selectSysSalesOrderBySalesOrderCode(tempSysMakeOrder.getSaleNo()); //设置为全部完成 @@ -801,6 +806,20 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS throw new BusinessException("更新销售订单数据失败"); } + //更新销售订单子表的数据 + for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) { + SysSalesOrderChild sysSalesOrderChild = new SysSalesOrderChild(); + sysSalesOrderChild.setQuoteId(tempSysMakeOrder.getSaleNo()); + sysSalesOrderChild.setMaterialCode(warehouseStorageOrderDetail.getMaterialNo()); + sysSalesOrderChild.setFinishNum(warehouseStorageOrderDetail.getStorageNum()); + sysSalesOrderChild.setUpdateBy(loginName); + sysSalesOrderChild.setUpdateTime(new Date()); + int updateSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(sysSalesOrderChild); + if (updateSalesOrderChildResult <= 0){ + throw new BusinessException("更新销售订单子表数据失败"); + } + } + // //更新生产单数据 // int updateMakeOrderResult = sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrderDetailList); diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml index 862af4b3..616bc64a 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml @@ -32,6 +32,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -84,6 +87,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and materialCode = #{materialCode} + + insert into sys_sales_order_child @@ -115,6 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" expiry_day, out_bound_quantity, un_bound_quantity, + finish_num, + apply_shipping_num, + has_apply_shipping_num, create_by, create_time, remark, @@ -151,6 +164,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{expiryDay}, #{outBoundQuantity}, #{unBoundQuantity}, + #{finishNum}, + #{applyShippingNum} + #{hasApplyShippingNum}, #{createBy}, #{createTime}, #{remark}, @@ -191,6 +207,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" expiry_day = #{expiryDay}, out_bound_quantity = #{outBoundQuantity}, un_bound_quantity = #{unBoundQuantity}, + finish_num = #{finishNum}, + apply_shipping_num = #{applyShippingNum}, + has_apply_shipping_num = #{hasApplyShippingNum}, update_by = #{updateBy}, remark = #{remark}, audit_status = #{auditStatus}, @@ -202,6 +221,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + + update sys_sales_order_child + + quoteId = #{quoteId}, + materialId = #{materialId}, + materialCode = #{materialCode}, + materialName = #{materialName}, + materialType = #{materialType}, + processMethod = #{processMethod}, + brand = #{brand}, + photoUrl = #{photoUrl}, + unit = #{unit}, + `describe` = #{describe}, + warehouseDept = #{warehouseDept}, + countTax = #{countTax}, + usdTax = #{usdTax}, + materialNum = #{materialNum}, + materialSole = #{materialSole}, + materialRmb = #{materialRmb}, + materialNoRmb = #{materialNoRmb}, + materialNoUsd = #{materialNoUsd}, + materialUsd = #{materialUsd}, + materialUsdSum = #{materialUsdSum}, + materialNoUsdSum = #{materialNoUsdSum}, + materialNoRmbSum = #{materialNoRmbSum}, + materialRmbSum = #{materialRmbSum}, + delivery_time = #{deliveryTime}, + expiry_day = #{expiryDay}, + out_bound_quantity = #{outBoundQuantity}, + un_bound_quantity = #{unBoundQuantity}, + finish_num = #{finishNum}, + apply_shipping_num = #{applyShippingNum}, + has_apply_shipping_num = #{hasApplyShippingNum}, + update_by = #{updateBy}, + remark = #{remark}, + audit_status = #{auditStatus}, + use_status = #{useStatus}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + + where quoteId = #{quoteId} + and materialCode = #{materialCode} + + + + delete from sys_sales_order_child where id = #{id} diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html new file mode 100644 index 00000000..073fe82e --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html @@ -0,0 +1,231 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + + + + + + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file