Browse Source

[feat] 销售管理

新增 销售订单发货前端页面
新增销售订单修改保存后端发货接口
新增 通过销售订单号查询销售订单子表后端接口
新增 根据销售单号和物料号更新销售单子表数据后端接口
新增 通过销售订单号查询销售订单子表后端接口
新增 销售发货的同时 生成仓库出库单后端接口
新增 销售发货的同时 生成仓库出库单明细后端接口
新增 销售发货的同时生成销售出货通知单列表后端接口
dev
liuxiaoxu 4 months ago
committed by zhangsiqi
parent
commit
917c1fba44
  1. 43
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  2. 34
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java
  4. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java
  6. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  7. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java
  8. 48
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  9. 51
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  10. 6
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java
  11. 69
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  12. 19
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  13. 68
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  14. 231
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html

43
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<SysUser> 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<SysSalesOrderChild> list = sysSalesOrderChildService.selectOrderChildListBySalesOrderCode(salesOrderCode);
return getDataTable(list) ;
}
}

34
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();
}
}

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java

@ -27,4 +27,14 @@ public interface SysSalesOrderChildMapper {
* 根据物料号和销售订单号查询销售订单子表数据
* */
SysSalesOrderChild selectSalesOrderChildByCodeAndNo(SysSalesOrderChild sysSalesOrderChild);
/*
* 通过销售订单号查询销售订单子表
* */
List<SysSalesOrderChild> selectOrderChildListBySalesOrderCode(String salesOrderCode);
/*
* 根据销售单号和物料号更新销售单子表数据
* */
int updateSysSalesOrderChildByCodeAndQuoteId(SysSalesOrderChild sysSalesOrderChild);
}

4
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<SysSalesOrderChild> selectOrderChildListBySalesOrderCode(String salesOrderCode);
}

5
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);
}

7
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);
}

9
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<SysSalesOrderChild> selectOrderChildListBySalesOrderCode(String salesOrderCode) {
return sysCustomerQuoteChildMapper.selectOrderChildListBySalesOrderCode(salesOrderCode);
}
}

48
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();

51
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);
}
}

6
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);
}

69
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<SysSalesOrderChild> 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("新增出库单明细数据失败");
}
}
}
}

19
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);

68
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -32,6 +32,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="expiryDay" column="expiry_day" />
<result property="outBoundQuantity" column="out_bound_quantity" />
<result property="unBoundQuantity" column="un_bound_quantity" />
<result property="finishNum" column="finish_num" />
<result property="applyShippingNum" column="apply_shipping_num" />
<result property="hasApplyShippingNum" column="has_apply_shipping_num" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@ -84,6 +87,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and materialCode = #{materialCode}
</select>
<select id="selectOrderChildListBySalesOrderCode" resultMap="SysSalesOrderChildResult">
select id, quoteId, materialId, materialCode, materialName, materialType, processMethod, brand,
warehouseDept,materialNum, photoUrl,finish_num,apply_shipping_num,has_apply_shipping_num
from sys_sales_order_child
where quoteId = #{quoteId}
</select>
<insert id="insertSysSalesOrderChild" parameterType="SysSalesOrderChild" useGeneratedKeys="true" keyProperty="id">
insert into sys_sales_order_child
@ -115,6 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expiryDay != null">expiry_day,</if>
<if test="outBoundQuantity != null">out_bound_quantity,</if>
<if test="unBoundQuantity != null">un_bound_quantity,</if>
<if test="finishNum != null">finish_num,</if>
<if test="applyShippingNum != null">apply_shipping_num,</if>
<if test="hasApplyShippingNum != null">has_apply_shipping_num,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
@ -151,6 +164,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expiryDay != null">#{expiryDay},</if>
<if test="outBoundQuantity != null">#{outBoundQuantity},</if>
<if test="unBoundQuantity != null">#{unBoundQuantity},</if>
<if test="finishNum != null">#{finishNum},</if>
<if test="applyShippingNum != null">#{applyShippingNum}</if>
<if test="hasApplyShippingNum != null">#{hasApplyShippingNum},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
@ -191,6 +207,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expiryDay != null">expiry_day = #{expiryDay},</if>
<if test="outBoundQuantity != null">out_bound_quantity = #{outBoundQuantity},</if>
<if test="unBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if>
<if test="finishNum != null">finish_num = #{finishNum},</if>
<if test="applyShippingNum != null">apply_shipping_num = #{applyShippingNum},</if>
<if test="hasApplyShippingNum != null">has_apply_shipping_num = #{hasApplyShippingNum},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
@ -202,6 +221,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateSysSalesOrderChildByCodeAndQuoteId" parameterType="SysSalesOrderChild">
update sys_sales_order_child
<trim prefix="SET" suffixOverrides=",">
<if test="quoteId != null">quoteId = #{quoteId},</if>
<if test="materialId != null">materialId = #{materialId},</if>
<if test="materialCode != null">materialCode = #{materialCode},</if>
<if test="materialName != null">materialName = #{materialName},</if>
<if test="materialType != null">materialType = #{materialType},</if>
<if test="processMethod != null">processMethod = #{processMethod},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="photoUrl != null">photoUrl = #{photoUrl},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="describe != null">`describe` = #{describe},</if>
<if test="warehouseDept != null">warehouseDept = #{warehouseDept},</if>
<if test="countTax != null">countTax = #{countTax},</if>
<if test="usdTax != null">usdTax = #{usdTax},</if>
<if test="materialNum != null">materialNum = #{materialNum},</if>
<if test="materialSole != null">materialSole = #{materialSole},</if>
<if test="materialRmb != null">materialRmb = #{materialRmb},</if>
<if test="materialNoRmb != null">materialNoRmb = #{materialNoRmb},</if>
<if test="materialNoUsd != null">materialNoUsd = #{materialNoUsd},</if>
<if test="materialUsd != null">materialUsd = #{materialUsd},</if>
<if test="materialUsdSum != null">materialUsdSum = #{materialUsdSum},</if>
<if test="materialNoUsdSum != null">materialNoUsdSum = #{materialNoUsdSum},</if>
<if test="materialNoRmbSum != null">materialNoRmbSum = #{materialNoRmbSum},</if>
<if test="materialRmbSum != null">materialRmbSum = #{materialRmbSum},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="expiryDay != null">expiry_day = #{expiryDay},</if>
<if test="outBoundQuantity != null">out_bound_quantity = #{outBoundQuantity},</if>
<if test="unBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if>
<if test="finishNum != null">finish_num = #{finishNum},</if>
<if test="applyShippingNum != null">apply_shipping_num = #{applyShippingNum},</if>
<if test="hasApplyShippingNum != null">has_apply_shipping_num = #{hasApplyShippingNum},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where quoteId = #{quoteId}
and materialCode = #{materialCode}
</update>
<delete id="deleteSysSalesOrderChildById" parameterType="Long">
delete from sys_sales_order_child where id = #{id}
</delete>

231
ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html

@ -0,0 +1,231 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('销售订单出货')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-salesDeliverGoods-edit" th:object="${sysSalesOrder}">
<input name="salesOrderId" th:field="*{salesOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="salesOrderType" class="form-control m-b" th:with="type=${@dict.getType('sys_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salesOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">销售单号:</label>
<div class="col-sm-8">
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyUser" th:field="*{applyUser}" class="form-control" type="text" disabled>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">出库类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="warehouseOutType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_out_type')}" disabled>-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOutType}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货联系人:</label>
<div class="col-sm-8">
<input name="customerDelivery" th:field="*{customerDelivery}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货电话:</label>
<div class="col-sm-8">
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址:</label>
<div class="col-sm-8">
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
<!--物料信息-->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var sysSalesOrder = [[${sysSalesOrder}]];
var prefix = ctx + "system/salesOrder";
$("#form-salesDeliverGoods-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const salesOrderData = $("#form-salesDeliverGoods-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"id":item.id,
"materialCode": item.materialCode,
"materialName": item.materialName,
"materialType": item.materialType,
"describe": item.describe,
"unit": item.unit,
"brand": item.brand,
"processMethod": item.processMethod,
"materialNum": item.materialNum,
"finishNum": item.finishNum,
"hasApplyShippingNum": item.hasApplyShippingNum,
"outBoundQuantity": item.outBoundQuantity,
"applyShippingNum": item.applyShippingNum,
// ...其他字段
};
});
const combinedData = Object.assign({}, salesOrderData, {
sysSalesOrderChildList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/salesDeliverGoods", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: prefix + "/salesDeliverGoodsDetailList",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '销售订单详情ID',
field: 'id',
visible: false
},
{
title: '料号',
field: 'materialCode',
},
{
title: '图片',
field: 'photoUrl',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '描述',
field: 'describe',
},
{
title: '单位',
field: 'unit',
},
{
title: '品牌',
field: 'brand',
},
{
title: '加工方式',
field: 'processMethod',
},
{
title: '订单数量',
field: 'materialNum',
},
{
title: '已完成数',
field: 'finishNum',
},
{
title: '已申请出货数',
field: 'hasApplyShippingNum',
},
{
title: '已出库数',
field: 'outBoundQuantity',
},
{
title: '申请出货数',
field: 'applyShippingNum',
editable:true,
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
salesOrderCode: sysSalesOrder.salesOrderCode
};
return curParams;
}
</script>
</body>
</html>
Loading…
Cancel
Save