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 1/4] =?UTF-8?q?[feat]=20=E9=94=80=E5=94=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=96=B0=E5=A2=9E=20=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=8F=91=E8=B4=A7=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98=E5=90=8E=E7=AB=AF=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=8F=B7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=94=80=E5=94=AE=E5=8D=95=E5=8F=B7=E5=92=8C?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=8F=B7=E6=9B=B4=E6=96=B0=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=8D=95=E5=AD=90=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=90=8E=E7=AB=AF?= =?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=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?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=8F=91=E8=B4=A7=E7=9A=84=E5=90=8C=E6=97=B6?= =?UTF-8?q?=20=E7=94=9F=E6=88=90=E4=BB=93=E5=BA=93=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E6=98=8E=E7=BB=86=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=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 From 80bcbc538b17e913bea91b092abf172cdb4c12d4 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 10 Jul 2024 11:06:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[feat]=20=E5=94=AE=E5=90=8E=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=AE=A1=E7=90=86=20=E6=96=B0=E5=A2=9E=20=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=E7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=9E=E7=89=A9=E6=96=99=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=96=9D=E7=94=B3=E8=AF=B7=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E6=95=B0=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E4=BF=9D=E5=AD=98=E9=94=80=E5=94=AE=E5=8D=95-?= =?UTF-8?q?=E5=87=86=E5=A4=87=E7=89=A9=E6=96=99=20=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=97=B6=E6=9B=B4=E6=96=B0=20=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=BA=20=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AftersalesWarehouseOutController.java | 36 +++ .../AfterSalesShippingDeviceMapper.java | 5 + .../IAftersalesWarehouseOutService.java | 5 + .../AftersalesWarehouseOutServiceImpl.java | 27 ++ .../controller/SysMakeOrderController.java | 1 + .../impl/WarehouseOutOrderServiceImpl.java | 15 +- .../AfterSalesShippingDeviceMapper.xml | 7 + .../warehouseOutOrder/addShippingDevices.html | 186 ------------ .../addShippingDevicesOne.html | 273 ++++++++++++++++++ .../maintenanceEquipmentOne.html | 39 ++- .../system/makeorder/addEquipmentResume.html | 3 +- .../warehouseOutOrder/prepareMaterial.html | 12 +- 12 files changed, 412 insertions(+), 197 deletions(-) delete mode 100644 ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevices.html create mode 100644 ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html 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 96723c52..163c8516 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 @@ -263,6 +263,7 @@ public class AftersalesWarehouseOutController extends BaseController List list = warehouseOutOrderService.selectOutOrderDetailListByCode(warehouseOutOrder); return getDataTable(list); } + /** * 展示售后第一次维护设备料号相关出货设备信息 */ @@ -276,6 +277,41 @@ public class AftersalesWarehouseOutController extends BaseController return getDataTable(list); } + + + + /** + * 售后第一次维护设备 添加出货设备信息 + */ + @GetMapping("/addShippingDevicesOne/{outOrderDetailId}") + public String addShippingDevicesOne(@PathVariable("outOrderDetailId") Long outOrderDetailId, ModelMap mmap) + { + WarehouseOutOrderDetail warehouseOutOrderDetail = outOrderDetailService.selectWarehouseOutOrderDetailById(outOrderDetailId); + mmap.put("warehouseOutOrderDetail", warehouseOutOrderDetail); + return prefix + "/addShippingDevicesOne"; + } + + + + + + /** + * 展示售后第一次维护设备添加出货设备料号相关出货设备信息 + */ + @PostMapping("/getEquipMaterialDetailByMaterialNo") + @ResponseBody + public TableDataInfo showAftersalesShippingDevicelist(WarehouseOutOrderDetail warehouseOutOrderDetail) + { + + startPage(); + List list = warehouseOutOrderService.selectAftersalesShippingDeviceListByMaterialNo(warehouseOutOrderDetail); + 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 2e1a3a3b..2fd79a99 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 @@ -102,4 +102,9 @@ public interface AfterSalesShippingDeviceMapper * 根据生产单号和关联销售单号查询出货设备履历信息 * */ List selectAfterSalesShippingDeviceByNoAndCode(AfterSalesShippingDevice afterSalesShippingDevice); + + /* + * 根据物料号查询出货设备信息列表 + * */ + List selectShippingDeviceListByMaterialNo(AfterSalesShippingDevice afterSalesShippingDevice); } 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 77a7c7d0..2e95ce8b 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 @@ -114,4 +114,9 @@ public interface IAftersalesWarehouseOutService * 展示售后第一次维护设备物料相关信息 * */ List selectOutOrderDetailListByCode(WarehouseOutOrder warehouseOutOrder); + + /** + * 展示售后第一次维护设备 添加出货设备 料号相关出货设备信息 + * */ + List selectAftersalesShippingDeviceListByMaterialNo(WarehouseOutOrderDetail warehouseOutOrderDetail); } 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 5b4614a2..1291ad81 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 @@ -184,6 +184,33 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu return warehouseOutOrderDetails; } + /** + * 展示售后第一次维护设备 添加出货设备 料号相关出货设备信息 + * */ + @Override + public List selectAftersalesShippingDeviceListByMaterialNo(WarehouseOutOrderDetail warehouseOutOrderDetail) { + + List selectShippingDeviceVOs = new ArrayList<>(); + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setMaterialNo(warehouseOutOrderDetail.getMaterialNo()); + List afterSalesShippingDevices = shippingDeviceMapper.selectShippingDeviceListByMaterialNo(afterSalesShippingDevice); + if (!StringUtils.isNotEmpty(afterSalesShippingDevices)) { + // 记录日志 + log.warn("未查找到与物料号关联的出库设备数据, 物料号: {}",warehouseOutOrderDetail.getMaterialNo()); + } + + for (AfterSalesShippingDevice tempAfterSalesShippingDevice : afterSalesShippingDevices) { + SelectShippingDeviceVO shippingDeviceVO = new SelectShippingDeviceVO(); + shippingDeviceVO.setShippingDeviceId(tempAfterSalesShippingDevice.getShippingDeviceId()); + shippingDeviceVO.setDeviceModelCode(tempAfterSalesShippingDevice.getDeviceModelCode()); + shippingDeviceVO.setDeviceRunningNumber(tempAfterSalesShippingDevice.getDeviceRunningNumber()); + shippingDeviceVO.setMakePhotoUrl(tempAfterSalesShippingDevice.getMakePhotourl()); + shippingDeviceVO.setQuoteId(tempAfterSalesShippingDevice.getSalesOrderCode()); + selectShippingDeviceVOs.add(shippingDeviceVO); + } + return selectShippingDeviceVOs; + } + /* * 售后第一次维护设备信息根据设备ID删除出货设备信息 * */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java index e227446b..444e367f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java @@ -257,6 +257,7 @@ public class SysMakeOrderController extends BaseController AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); afterSalesShippingDevice.setMakeNo(makeNo); afterSalesShippingDevice.setSalesOrderCode(salesOrderCode); + afterSalesShippingDevice.setMaterialNo(equipMaterialDto.getMaterialCode()); List equipDetailDtos = salesShippingDeviceService.selectAfterSalesShippingDeviceByNoAndCode(afterSalesShippingDevice); return getDataTable(equipDetailDtos); } 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 e1a7d6ba..f554a845 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 @@ -170,20 +170,27 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService String loginName = ShiroUtils.getLoginName(); warehouseOutOrder.setUpdateBy(loginName); warehouseOutOrder.setUpdateTime(new Date()); - warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + + //更改出库状态为 第一次维护设备信息 + warehouseOutOrder.setWarehouseOutStatus("1"); List warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList(); if (StringUtils.isEmpty(warehouseOutOrderDetailList)){ log.warn("保存销售单-准备物料,物料列表信息为空:{}",warehouseOutOrder); } - int updateRows = 0; for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) { warehouseOutOrderDetail.setUpdateBy(loginName); warehouseOutOrderDetail.setUpdateTime(new Date()); warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark()); //更新数据库记录 - updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail); + int updateOutOrderDetail = outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail); + if (updateOutOrderDetail <= 0){ + throw new BusinessException("更新出库单详情数据失败"); + } } - return updateRows; + //出库单点击准备物料后生成售后单 + + int updateWarehouseOutOrderResult = warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + return updateWarehouseOutOrderResult; } diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index 33997e27..d5a9f599 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -98,6 +98,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where make_no = #{makeNo} and sales_order_code = #{salesOrderCode} + and material_no = #{materialNo} + + + + diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevices.html b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevices.html deleted file mode 100644 index 316a5184..00000000 --- a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevices.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - -
-
- - -
-

物料信息

-
-
-
-

出货设备

-
-
-
-
- - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html new file mode 100644 index 00000000..af49b115 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/addShippingDevicesOne.html @@ -0,0 +1,273 @@ + + + + + + + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + +
+ +
+ +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + + + + + +
+
+ +
+ +
+

出货设备

+
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html index d35431fa..304c596e 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html @@ -124,13 +124,20 @@ columns: [{ checkbox: true }, + { title:'销售订单号', field:'quoteId', visible: false }, + { + title:'出库单详情Id', + field:'outOrderDetailId', + visible: false + + }, { title: '料号', - field: 'materialCode', + field: 'materialNo', }, { title: '图片', @@ -156,12 +163,28 @@ title: '描述', field: 'describe', }, + { + title: '订单数量', + field: 'makeNum', + }, + { + title: '已出库数', + field: 'hasOutOrderSum', + }, + { + title: '申请出库数', + field: 'applyOutOrderSum', + }, + { + title: '准备出库数', + field: 'prepareOutOrderSum', + }, { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; - actions.push('添加出货设备'); + actions.push('添加出货设备'); return actions.join(''); } } @@ -255,12 +278,18 @@ /*添加出货设备*/ - function addShippingDevices(quoteId, materialCode) { - // 确保URL编码,特别是如果materialCode中可能含有特殊字符 - var url = ctx + 'aftersales/warehouseOutOrder/addShippingDevices/' + encodeURIComponent(quoteId) + '/' + encodeURIComponent(materialCode); + // function addShippingDevicesOne(quoteId, materialCode) { + // // 确保URL编码,特别是如果materialCode中可能含有特殊字符 + // var url = ctx + 'aftersales/warehouseOutOrder/addShippingDevicesOne/' + encodeURIComponent(quoteId) + '/' + encodeURIComponent(materialCode); + // $.modal.open("添加出货设备", url); + // } + + function addShippingDevicesOne(outOrderDetailId) { + var url = prefix + '/addShippingDevicesOne/' + outOrderDetailId $.modal.open("添加出货设备", url); } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html index 6756d2b3..b00778cf 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html @@ -207,7 +207,8 @@ var curParams = { // 传递参数查询参数 makeNo: equipMaterial.makeNo, - quoteId: equipMaterial.quoteId + quoteId: equipMaterial.quoteId, + materialCode: equipMaterial.materialCode }; return curParams; } diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html index 5b0bc67b..367571f2 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/prepareMaterial.html @@ -117,7 +117,17 @@ "outOrderDetailId":item.outOrderDetailId, "outOrderCode":item.outOrderCode, "materialNo": item.materialNo, // 假设id对应materialId - "prepareOutOrderSum":item.prepareOutOrderSum, + "materialName": item.materialName, + "materialType": item.materialType, + "materialPhotourl": item.materialPhotourl, + "materialDescribe": item.materialDescribe, + "materialBrand": item.materialBrand, + "materialUnit": item.materialUnit, + "materialProcessMethod": item.materialProcessMethod, + "makeNum": item.makeNum, + "hasOutOrderSum": item.hasOutOrderSum, + "applyOutOrderSum": item.applyOutOrderSum, + "prepareOutOrderSum": item.prepareOutOrderSum, // ...其他字段 }; }); From 5bc948d15298c0ad387e04d32b0fd759cf425e65 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 10 Jul 2024 14:46:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[feat]=20=E5=94=AE=E5=90=8E=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=94=AE=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AE=BE=E5=A4=87=20=E5=9B=BE=E7=89=87=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=B8=8D=E5=AF=B9=E9=97=AE=E9=A2=98=20=E4=BF=AE?= =?UTF-8?q?=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=BB=E5=8A=A0=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E7=9A=84?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=87=BA=E8=B4=A7=E8=AE=BE=E5=A4=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=87=BA=E5=BA=93=E5=8D=95=E8=AF=A6=E6=83=85=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20=E6=B7=BB=E5=8A=A0=E5=87=BA=E8=B4=A7=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=88=97=E8=A1=A8=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AftersalesWarehouseOutController.java | 27 +++++---- .../domain/AfterSalesShippingDevice.java | 12 +++- .../IAftersalesWarehouseOutService.java | 6 ++ .../AftersalesWarehouseOutServiceImpl.java | 29 ++++++++++ .../domain/WarehouseOutOrderDetail.java | 16 ++++++ .../IWarehouseOutOrderDetailService.java | 5 ++ .../WarehouseOutOrderDetailServiceImpl.java | 24 ++++++++ .../AfterSalesShippingDeviceMapper.xml | 7 ++- .../addShippingDevicesOne.html | 55 +++++++++++++++---- .../maintenanceEquipmentOne.html | 4 +- 10 files changed, 160 insertions(+), 25 deletions(-) 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 163c8516..f083025a 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 @@ -11,11 +11,7 @@ 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.aftersales.service.IAftersalesWarehouseOutService; @@ -265,15 +261,15 @@ public class AftersalesWarehouseOutController extends BaseController } /** - * 展示售后第一次维护设备料号相关出货设备信息 + * 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息 */ - @PostMapping("/showAftersalesShippingDevicelist") + @PostMapping("/showAftersalesShippingDeviceList") @ResponseBody - public TableDataInfo showAftersalesShippingDevicelist(WarehouseOutOrder warehouseOutOrder) + public TableDataInfo showAftersalesShippingDeviceList(@RequestParam("materialNo") String materialNo) { startPage(); - List list = warehouseOutOrderService.selectAftersalesShippingDevicelistByCodeAndNo(warehouseOutOrder); + List list = warehouseOutOrderService.showAftersalesShippingDeviceList(materialNo); return getDataTable(list); } @@ -293,6 +289,17 @@ public class AftersalesWarehouseOutController extends BaseController + /** + * 修改保存售后第一次维护设备 添加出货设备信息 + */ + @ResponseBody + @PostMapping("/addShippingDevicesOne") + public AjaxResult addShippingDevicesOne(@RequestBody WarehouseOutOrderDetail warehouseOutOrderDetail) + { + + return toAjax(outOrderDetailService.addShippingDevicesOne(warehouseOutOrderDetail)); + } + /** @@ -310,8 +317,6 @@ public class AftersalesWarehouseOutController extends BaseController - - /** * 第一次维护设备删除物料信息出货设备信息 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java index 1bdffb92..6bf4cece 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AfterSalesShippingDevice.java @@ -158,7 +158,8 @@ public class AfterSalesShippingDevice extends BaseEntity @Excel(name = "维修时间", width = 30, dateFormat = "yyyy-MM-dd") private Date maintainTime; - + /** 是否添加出货设备(0代表是 1代表否) */ + private String addShippingDeviceFlag; public void setShippingDeviceCode(Long shippingDeviceCode) { this.shippingDeviceCode = shippingDeviceCode; @@ -464,6 +465,14 @@ public class AfterSalesShippingDevice extends BaseEntity this.maintainTime = maintainTime; } + public String getAddShippingDeviceFlag() { + return addShippingDeviceFlag; + } + + public void setAddShippingDeviceFlag(String addShippingDeviceFlag) { + this.addShippingDeviceFlag = addShippingDeviceFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -505,6 +514,7 @@ public class AfterSalesShippingDevice extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("addShippingDeviceFlag",getAddShippingDeviceFlag()) .toString(); } } 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 2e95ce8b..1420df74 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 @@ -119,4 +119,10 @@ public interface IAftersalesWarehouseOutService * 展示售后第一次维护设备 添加出货设备 料号相关出货设备信息 * */ List selectAftersalesShippingDeviceListByMaterialNo(WarehouseOutOrderDetail warehouseOutOrderDetail); + + /** + * 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息 + * */ + List showAftersalesShippingDeviceList(String materialNo); + } 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 1291ad81..d4859b94 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 @@ -2,6 +2,7 @@ package com.ruoyi.aftersales.service.impl; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; import com.ruoyi.aftersales.domain.vo.SelectMaterialsVO; @@ -211,6 +212,34 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu return selectShippingDeviceVOs; } + /** + * 展示售后第一次维护设备料号已选择添加出货设备的相关出货设备信息 + * */ + @Override + public List showAftersalesShippingDeviceList(String materialNo) { + + List selectShippingDeviceVOs = new ArrayList<>(); + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setMaterialNo(materialNo); + List afterSalesShippingDevices = shippingDeviceMapper.selectShippingDeviceListByMaterialNo(afterSalesShippingDevice); + List filterAfterSalesShippingDevices = afterSalesShippingDevices.stream().filter(shippingDevice -> "0".equals(shippingDevice.getAddShippingDeviceFlag())).collect(Collectors.toList()); + if (!StringUtils.isNotEmpty(filterAfterSalesShippingDevices)) { + // 记录日志 + log.warn("未查找到与物料号关联的出库设备数据, 物料号: {}",materialNo); + } + + for (AfterSalesShippingDevice tempAfterSalesShippingDevice : filterAfterSalesShippingDevices) { + SelectShippingDeviceVO shippingDeviceVO = new SelectShippingDeviceVO(); + shippingDeviceVO.setShippingDeviceId(tempAfterSalesShippingDevice.getShippingDeviceId()); + shippingDeviceVO.setDeviceModelCode(tempAfterSalesShippingDevice.getDeviceModelCode()); + shippingDeviceVO.setDeviceRunningNumber(tempAfterSalesShippingDevice.getDeviceRunningNumber()); + shippingDeviceVO.setMakePhotoUrl(tempAfterSalesShippingDevice.getMakePhotourl()); + shippingDeviceVO.setQuoteId(tempAfterSalesShippingDevice.getSalesOrderCode()); + selectShippingDeviceVOs.add(shippingDeviceVO); + } + return selectShippingDeviceVOs; + } + /* * 售后第一次维护设备信息根据设备ID删除出货设备信息 * */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java index 777e0796..57f887ad 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrderDetail.java @@ -1,7 +1,10 @@ package com.ruoyi.warehouse.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -199,6 +202,10 @@ public class WarehouseOutOrderDetail extends BaseEntity @Excel(name = "收货电话") private String deliveryNumber; + /** 添加出货设备列表*/ + private List SelectShippingDeviceVOList; + + public void setOutOrderDetailId(Long outOrderDetailId) { this.outOrderDetailId = outOrderDetailId; @@ -605,6 +612,14 @@ public class WarehouseOutOrderDetail extends BaseEntity return deliveryNumber; } + public List getSelectShippingDeviceVOList() { + return SelectShippingDeviceVOList; + } + + public void setSelectShippingDeviceVOList(List selectShippingDeviceVOList) { + SelectShippingDeviceVOList = selectShippingDeviceVOList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -658,6 +673,7 @@ public class WarehouseOutOrderDetail extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("selectShippingDeviceVOList",getSelectShippingDeviceVOList()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java index 0739d3d2..ed3624bb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderDetailService.java @@ -91,4 +91,9 @@ public interface IWarehouseOutOrderDetailService * 退换货-出库 供应商物料详情列表 */ List selectWarehouseOutOrderDetailListByCode(String outOrderCode); + + /** + * 修改保存售后第一次维护设备 添加出货设备信息 + */ + int addShippingDevicesOne(WarehouseOutOrderDetail warehouseOutOrderDetail); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java index 9b70eca2..c4dcb061 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderDetailServiceImpl.java @@ -3,7 +3,9 @@ package com.ruoyi.warehouse.service.impl; import java.util.List; import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; @@ -16,6 +18,7 @@ import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.service.IWarehouseOutOrderDetailService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 出库单详情Service业务层处理 @@ -165,4 +168,25 @@ public class WarehouseOutOrderDetailServiceImpl implements IWarehouseOutOrderDet return warehouseOutOrderDetailMapper.selectOutOrderDetailListByCode(outOrderCode); } + + /** + * 修改保存售后第一次维护设备 添加出货设备信息 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int addShippingDevicesOne(WarehouseOutOrderDetail warehouseOutOrderDetail) { + List selectShippingDeviceVOList = warehouseOutOrderDetail.getSelectShippingDeviceVOList(); + int updateShippingDeviceResult = 0; + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId()); + //设置为已经添加出货设备 + afterSalesShippingDevice.setAddShippingDeviceFlag("0"); + updateShippingDeviceResult += afterSalesShippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice); + if (updateShippingDeviceResult <= 0){ + throw new BusinessException("更新出货设备信息失败"); + } + } + return updateShippingDeviceResult; + } } diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index d5a9f599..c93078fa 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -43,10 +43,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select shipping_device_code, shipping_device_id, make_no,sales_order_code, material_no, material_photoUrl, material_name, material_type, material_class, material_model_code, material_unit, material_brand, material_describe, device_model_code, device_running_number, make_photoUrl, sn_code, aftersales_photoUrl, factory_date, guarantee_period, guarantee_period_flag, lock_date, lock_date_flag, wastage_expire_date, wastage_expire_flag, component_guarantee_date, component_guarantee_flag, engineer_name, salesman_name, make_name,customer_id, customer_name, maintain_order_code, maintain_time, create_by, create_time, update_by, update_time from aftersales_shipping_device + select shipping_device_code, shipping_device_id, make_no,sales_order_code, material_no, material_photoUrl, material_name, material_type, material_class, material_model_code, material_unit, material_brand, material_describe, device_model_code, device_running_number, make_photoUrl, sn_code, aftersales_photoUrl, factory_date, guarantee_period, guarantee_period_flag, lock_date, lock_date_flag, wastage_expire_date, wastage_expire_flag, component_guarantee_date, component_guarantee_flag, engineer_name, salesman_name, make_name,customer_id, customer_name, maintain_order_code, maintain_time, create_by, create_time, update_by, update_time, add_shipping_device_flag from aftersales_shipping_device + @@ -111,12 +111,47 @@ focusCleanup: true }); + /* + * 提交设备履历信息 + * */ function submitHandler() { - if ($.validate.form()) { - $.operate.save(prefix + "/edit", $('#form-addShippingDevicesOne-edit').serialize()); + // 获取表单数据 + const shippingDevicesData = $("#form-addShippingDevicesOne-edit").serializeArray().reduce((obj, item) => { + obj[item.name] = item.value; + return obj; + }, {}); + // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 + // var table = $('#table-shippingDevices').bootstrapTable('getData'); + //获取选中复选框行的数据 + const selectedRows = $("#table-shippingDevices").bootstrapTable('getSelections'); + // 检查表格数据是否为空 + if (selectedRows.length===0){ + $.modal.alertWarning("请至少选择一条出货设备信息后再保存!"); + return; } + // 将表数据转换成与complaintNoticeData格式一致的数组 + var equipDetailDataList = selectedRows.map(function(item) { + // 根据实际字段名调整 + return { + "shippingDeviceId": item.shippingDeviceId, + "deviceModelCode": item.deviceModelCode, + "deviceRunningNumber": item.deviceRunningNumber, + "makePhotoUrl": item.makePhotoUrl + // ...其他字段 + }; + }); + + // 合并表单数据和表格数据 + const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList }); + + console.log(combinedData) + // 使用 JSON.stringify() 序列化数据 + const jsonData = JSON.stringify(combinedData); + // 发送 AJAX 请求到后端接口 + $.operate.saveJson(prefix + "/addShippingDevicesOne", jsonData); } + $("input[name='outOrderTime']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -195,7 +230,7 @@ $(function(){ var options = { - id: "form-equipMaterialDetail-add", + id: "table-shippingDevices", url: prefix + "/getEquipMaterialDetailByMaterialNo", pagination: false, showSearch: false, @@ -217,22 +252,22 @@ } }, { - field: 'equipmentId', + field: 'shippingDeviceId', align: 'center', title: '出货设备id', }, { - field: 'equipmentModel', + field: 'deviceModelCode', align: 'center', title: '设备型号', }, { - field: 'serialNo', + field: 'deviceRunningNumber', align: 'center', title: '流水号', }, { - field: 'producePic', + field: 'makePhotoUrl', align: 'center', title: '生产图片', }, @@ -259,10 +294,10 @@ } function removeRow(index) { - var data = $('#form-equipMaterialDetail-add').bootstrapTable('getData'); + var data = $('#table-shippingDevices').bootstrapTable('getData'); var row = data[index]; // 获取要删除的行数据 if (row) { - $('#form-equipMaterialDetail-add').bootstrapTable('remove', { + $('#table-shippingDevices').bootstrapTable('remove', { field: 'equipmentIndex', values: [row.equipmentIndex] }); diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html index 304c596e..3adb18d3 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/warehouseOutOrder/maintenanceEquipmentOne.html @@ -200,12 +200,12 @@ var childTableId = 'child_table_'+index; $detail.html('
'); $('#'+childTableId).bootstrapTable({ - url: prefix + "/showAftersalesShippingDevicelist", + url: prefix + "/showAftersalesShippingDeviceList", method: 'post', sidePagination: "server", contentType: "application/x-www-form-urlencoded", queryParams : { - salesOrderCode: warehouseOutOrder.salesOrderCode, + // salesOrderCode: warehouseOutOrder.salesOrderCode, materialNo: parentRow.materialNo }, columns: [ From 03bf21d5463806d7cef8237d4c002ff8e064c9de Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 10 Jul 2024 20:07:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[feat]=20=E5=94=AE=E5=90=8E=E7=AE=A1?= =?UTF-8?q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A=93=E5=8D=95=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=87=86=E5=A4=87=E7=89=A9=E6=96=99=E5=90=8E=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E6=9B=B4=E6=96=B0=E9=94=80=E5=94=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9A=84=E9=94=80=E5=94=AE=E5=87=BA=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AftersalesWarehouseOutController.java | 4 +- .../domain/vo/SelectShippingDeviceVO.java | 2 + .../AfterSalesShippingDeviceMapper.java | 12 +++- .../IAftersalesWarehouseOutService.java | 4 ++ .../AftersalesWarehouseOutServiceImpl.java | 50 ++++++++++++++ .../mapper/SysSalesShippingInformMapper.java | 10 +++ .../warehouse/domain/WarehouseOutOrder.java | 15 +++++ .../impl/WarehouseOutOrderServiceImpl.java | 23 +++++-- .../AfterSalesShippingDeviceMapper.xml | 8 +++ .../system/SysSalesShippingInformMapper.xml | 36 ++++++++++ .../addShippingDevicesOne.html | 2 +- .../maintenanceEquipmentOne.html | 66 +++++++++++++++++-- 12 files changed, 216 insertions(+), 16 deletions(-) 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 f083025a..230b3b2b 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 @@ -241,9 +241,9 @@ public class AftersalesWarehouseOutController extends BaseController @Log(title = "售后维护设备出库", businessType = BusinessType.UPDATE) @PostMapping("/maintenanceEquipmentOne") @ResponseBody - public AjaxResult maintenanceEquipmentOneSave(WarehouseOutOrder warehouseOutOrder) + public AjaxResult maintenanceEquipmentOneSave(@RequestBody WarehouseOutOrder warehouseOutOrder) { - return toAjax(warehouseOutOrderService.updateWarehouseOutOrder(warehouseOutOrder)); + return toAjax(warehouseOutOrderService.updateMaintenanceEquipmentOne(warehouseOutOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java index 0fbae240..f6a0ec33 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/vo/SelectShippingDeviceVO.java @@ -18,5 +18,7 @@ public class SelectShippingDeviceVO { private String makePhotoUrl; + private String snCode; + } 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 2fd79a99..afe3d0d0 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 @@ -14,12 +14,20 @@ public interface AfterSalesShippingDeviceMapper /** * 查询出货设备 * - * @param shippingDeviceCode 出货设备ID + * @param shippingDeviceCode 出货设备Code * @return 出货设备 */ public AfterSalesShippingDevice selectAfterSalesShippingDeviceById(Long shippingDeviceCode); + /** + * 查询出货设备 + * + * @param shippingDeviceId 出货设备ID + * @return 出货设备 + */ + public AfterSalesShippingDevice selectAfterSalesShippingDeviceByShippingDeviceId(String shippingDeviceId); + /** * 查询选择设备 * @@ -64,7 +72,7 @@ public interface AfterSalesShippingDeviceMapper /** * 删除出货设备 * - * @param shippingDeviceCode 出货设备ID + * @param shippingDeviceId 出货设备ID * @return 结果 */ public int deleteAfterSalesShippingDeviceById(String shippingDeviceId); 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 1420df74..b091fc29 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 @@ -125,4 +125,8 @@ public interface IAftersalesWarehouseOutService * */ List showAftersalesShippingDeviceList(String materialNo); + /** + * 修改保存售后第一次维护设备 + */ + int updateMaintenanceEquipmentOne(WarehouseOutOrder warehouseOutOrder); } 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 d4859b94..e176bfef 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 @@ -1,6 +1,7 @@ package com.ruoyi.aftersales.service.impl; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -13,7 +14,9 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysSalesOrderChild; +import com.ruoyi.system.domain.SysSalesShippingInform; import com.ruoyi.system.mapper.SysSalesOrderChildMapper; +import com.ruoyi.system.mapper.SysSalesShippingInformMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; @@ -23,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.aftersales.service.IAftersalesWarehouseOutService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 出库单Service业务层处理 @@ -46,6 +50,9 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu @Autowired private WarehouseOutOrderDetailMapper outOrderDetailMapper; + @Autowired + private SysSalesShippingInformMapper shippingInformMapper; + /** * 查询出库单 * @@ -240,6 +247,49 @@ public class AftersalesWarehouseOutServiceImpl implements IAftersalesWarehouseOu return selectShippingDeviceVOs; } + /** + * 修改保存售后第一次维护设备 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateMaintenanceEquipmentOne(WarehouseOutOrder warehouseOutOrder) { + + String loginName = ShiroUtils.getLoginName(); + + List selectShippingDeviceVOList = warehouseOutOrder.getSelectShippingDeviceVOList(); + for (SelectShippingDeviceVO selectShippingDeviceVO : selectShippingDeviceVOList) { + AfterSalesShippingDevice afterSalesShippingDevice = new AfterSalesShippingDevice(); + afterSalesShippingDevice.setShippingDeviceId(selectShippingDeviceVO.getShippingDeviceId()); + afterSalesShippingDevice.setSnCode(selectShippingDeviceVO.getSnCode()); + afterSalesShippingDevice.setUpdateBy(loginName); + afterSalesShippingDevice.setUpdateTime(new Date()); + int updateShippingDeviceResult = shippingDeviceMapper.updateAfterSalesShippingDevice(afterSalesShippingDevice); + if (updateShippingDeviceResult <= 0){ + throw new BusinessException("更新出货设备数据失败"); + } + + } + + //设置出库单为待业务确认发货 + warehouseOutOrder.setWarehouseOutStatus("2"); + + //更新销售管理销售出库的出货状态 待业务确认发货 + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + sysSalesShippingInform.setOutOrderCode(warehouseOutOrder.getOutOrderCode()); + sysSalesShippingInform.setWarehouseOutStatus("2"); + sysSalesShippingInform.setUpdateBy(loginName); + sysSalesShippingInform.setUpdateTime(new Date()); + int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + if (updateShippingInformResult <= 0){ + log.warn("出库单号为空:{}",warehouseOutOrder.getOutOrderCode()); + throw new BusinessException("更新销售出库单数据失败"); + } + + + + return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); + } + /* * 售后第一次维护设备信息根据设备ID删除出货设备信息 * */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformMapper.java index 3aae2e63..1118c835 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformMapper.java @@ -43,6 +43,16 @@ public interface SysSalesShippingInformMapper */ public int updateSysSalesShippingInform(SysSalesShippingInform sysSalesShippingInform); + + /** + * 修改销售出货通知 + * + * @param sysSalesShippingInform 销售出货通知 + * @return 结果 + */ + public int updateSysSalesShippingInformByOutOrderCode(SysSalesShippingInform sysSalesShippingInform); + + /** * 删除销售出货通知 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java index ca862021..3304d077 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseOutOrder.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -130,6 +131,11 @@ public class WarehouseOutOrder extends BaseEntity /** 仓库出库单详情*/ private List warehouseOutOrderDetailList; + /** 添加出货设备列表*/ + + private List selectShippingDeviceVOList; + + public void setOutOrderId(Long outOrderId) { this.outOrderId = outOrderId; @@ -428,6 +434,14 @@ public class WarehouseOutOrder extends BaseEntity this.warehouseOutOrderDetailList = warehouseOutOrderDetailList; } + public List getSelectShippingDeviceVOList() { + return selectShippingDeviceVOList; + } + + public void setSelectShippingDeviceVOList(List selectShippingDeviceVOList) { + this.selectShippingDeviceVOList = selectShippingDeviceVOList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -469,6 +483,7 @@ public class WarehouseOutOrder extends BaseEntity .append("updateTime", getUpdateTime()) .append("remark", getRemark()) .append("warehouseOutOrderDetailList",getWarehouseOutOrderDetailList()) + .append("selectShippingDeviceVOList",getSelectShippingDeviceVOList()) .toString(); } } 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 f554a845..a189925d 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 @@ -9,10 +9,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.SysMakeOrderMapper; -import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper; -import com.ruoyi.system.mapper.SysMakeorderPickMapper; -import com.ruoyi.system.mapper.SysSalesOrderMapper; +import com.ruoyi.system.mapper.*; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; @@ -58,6 +55,10 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService @Autowired private RedisCache redisCache; + @Autowired + private SysSalesShippingInformMapper shippingInformMapper; + + /** * 查询仓库出库单 * @@ -187,7 +188,19 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService throw new BusinessException("更新出库单详情数据失败"); } } - //出库单点击准备物料后生成售后单 + + + SysSalesShippingInform sysSalesShippingInform = new SysSalesShippingInform(); + sysSalesShippingInform.setOutOrderCode(warehouseOutOrder.getOutOrderCode()); + //更新销售管理销售出库的出货状态 待售后维护设备1 + sysSalesShippingInform.setWarehouseOutStatus("1"); + sysSalesShippingInform.setUpdateBy(loginName); + sysSalesShippingInform.setUpdateTime(new Date()); + int updateShippingInformResult = shippingInformMapper.updateSysSalesShippingInformByOutOrderCode(sysSalesShippingInform); + if (updateShippingInformResult <= 0){ + log.warn("出库单号为空:{}",warehouseOutOrder.getOutOrderCode()); + throw new BusinessException("更新销售出库单数据失败"); + } int updateWarehouseOutOrderResult = warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder); return updateWarehouseOutOrderResult; diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index c93078fa..c4468920 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -79,6 +79,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where shipping_device_code = #{shippingDeviceCode} + + + + +
@@ -85,16 +85,53 @@ var prefix = ctx + "aftersales/warehouseOutOrder"; var warehouseOutOrder = [[${warehouseOutOrder}]]; - $("#form-warehouseOutOrder-edit").validate({ + $("#form-maintenanceEquipmentOne-edit").validate({ focusCleanup: true }); + // function submitHandler() { + // if ($.validate.form()) { + // $.operate.save(prefix + "/maintenanceEquipmentOne", $('#form-maintenanceEquipmentOne-edit').serialize()); + // } + // } + + function submitHandler() { - if ($.validate.form()) { - $.operate.save(prefix + "/edit", $('#form-warehouseOutOrder-edit').serialize()); - } + // 获取表单数据 + const shippingDevicesData = $("#form-maintenanceEquipmentOne-edit").serializeArray().reduce((obj, item) => { + obj[item.name] = item.value; + return obj; + }, {}); + + // 在需要收集所有子表数据的地方调用此函数 + var allSubData = getAllSubTablesData(); + + // 将表数据转换成与complaintNoticeData格式一致的数组 + var equipDetailDataList = allSubData.map(function(item) { + // 根据实际字段名调整 + return { + "shippingDeviceId": item.shippingDeviceId, + "deviceModelCode": item.deviceModelCode, + "deviceRunningNumber": item.deviceRunningNumber, + "makePhotoUrl": item.makePhotoUrl, + "snCode": item.snCode + // ...其他字段 + }; + }); + + // 合并表单数据和表格数据 + const combinedData = Object.assign({}, shippingDevicesData, { selectShippingDeviceVOList: equipDetailDataList }); + + console.log(combinedData) + // 使用 JSON.stringify() 序列化数据 + const jsonData = JSON.stringify(combinedData); + // 发送 AJAX 请求到后端接口 + $.operate.saveJson(prefix + "/maintenanceEquipmentOne", jsonData); } + + + $("input[name='outOrderTime']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -107,8 +144,10 @@ autoclose: true }); + $(function() { var options = { + id:'bootstrap-table', url: prefix + "/getMaintenanceEquipmentOneMaterials", modalName: "物料信息", showColumns: false, @@ -191,7 +230,6 @@ ] }; $.table.init(options); - }) @@ -237,6 +275,7 @@ }); }; + function queryParams(params) { var curParams = { // 传递参数查询参数 @@ -246,6 +285,21 @@ } + // 获取所有子表数据的函数 + // 获取所有子表数据的函数 + function getAllSubTablesData() { + var allSubData = []; + // 获取所有被展开的行 + var parentLength = $("#bootstrap-table").bootstrapTable("getData").length; + for (let i = 0; i < parentLength; i++) { + var sonData = $('#'+"child_table_" + i).bootstrapTable("getData"); + //循环获取子表中存在的行数据,每个行数据转换添加到allSubData数组中 + allSubData = allSubData.concat(sonData); + } + return allSubData; + } + + function deleteRow(shippingDeviceId) { // 弹出确认框询问用户是否确定删除 if (confirm("确定要删除这条记录吗?")) {