Browse Source

[feat]销售管理

出货通知新增发起出货后端接口
出货通知新增根据销售订单id集合查询销售订单集合后端接口
出货前端页面:新增没有值默认为”empty“;按照万材调整实现前端销售单号和订单类型根据在销售订单页面选择的时候动态生成
销售订单页面修改出货按钮:从表格内调整到表头;并且实现如下:
   1、 需勾选销售订单后,才能发起【出货】
   2、如果选择多条销售订单只能选择同一个客户的销售订单,否则提示”请选择同个客户下的销售订单“,
   3 收款结案:除了已经结案的都可以选择
   4、出货状态除了全部出货、部分验收、全部验收都可以选择
   上面要都要满足
bom新增页面:新增没有值默认为”empty“
销售估价采购新增页面:新增没有值默认为”empty“
dev
liuxiaoxu 3 weeks ago
parent
commit
229e484451
  1. 25
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java
  4. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml
  6. 10
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  7. 20
      ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html
  8. 50
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html
  9. 87
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

25
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java

@ -536,15 +536,30 @@ public class SysSalesOrderController extends BaseController
return getDataTable(list); 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";
// }
/** /**
* 发起出货 * 发起出货
*/ */
@GetMapping("/salesDeliverGoods/{salesOrderId}") @GetMapping("/salesDeliverGoods")
public String salesDeliverGoods(@PathVariable("salesOrderId") Long salesOrderId, ModelMap mmap) public String deliverGoods(@RequestParam List<Long> salesOrderIds, ModelMap mmap) {
{
SysSalesOrder sysSalesOrder = sysSalesOrderService.selectSysSalesOrderById(salesOrderId); List<SysSalesOrder> salesOrders = sysSalesOrderService.selectBatchSalesOrderById(salesOrderIds);
SysSalesOrder sysSalesOrder = salesOrders.get(0);
mmap.put("salesOrders", salesOrders);
mmap.put("sysSalesOrder", sysSalesOrder); mmap.put("sysSalesOrder", sysSalesOrder);
return prefix + "/salesDeliverGoods"; return prefix + "/salesDeliverGoods";
} }
/** /**

6
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java

@ -86,4 +86,10 @@ public interface SysSalesOrderMapper
* 导出查询所有的销售订单 * 导出查询所有的销售订单
* */ * */
List<SysSalesOrderVo> selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder); List<SysSalesOrderVo> selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder);
/**
* 通过销售订单id批量查询销售订单
* */
List<SysSalesOrder> selectBatchSalesOrderById(List<Long> salesOrderIds);
} }

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java

@ -137,4 +137,10 @@ public interface ISysSalesOrderService
* 根据销售订单对象对象作废销售订单 * 根据销售订单对象对象作废销售订单
* */ * */
int cancelSysSalesOrderByObject(SysSalesOrder sysSalesOrder); int cancelSysSalesOrderByObject(SysSalesOrder sysSalesOrder);
/**
* 通过销售订单id批量查询销售订单
* */
List<SysSalesOrder> selectBatchSalesOrderById(List<Long> salesOrderIds);
} }

10
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -131,6 +131,16 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
return null; return null;
} }
/**
* 通过销售订单id批量查询销售订单
* */
@Override
public List<SysSalesOrder> selectBatchSalesOrderById(List<Long> salesOrderIds) {
List<SysSalesOrder> sysSalesOrders = sysSalesOrderMapper.selectBatchSalesOrderById(salesOrderIds);
return sysSalesOrders;
}
/** /**
* 查询销售订单列表 * 查询销售订单列表
* *

8
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

@ -220,6 +220,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectBatchSalesOrderById" parameterType="Long" resultMap="SysSalesOrderResult">
<include refid="selectSysSalesOrderVo"/>
where sales_order_id in
<foreach item="salesOrderId" index="index" collection="list" open="(" separator="," close=")">
#{salesOrderId}
</foreach>
</select>
<insert id="insertSysSalesOrder" parameterType="SysSalesOrder" useGeneratedKeys="true" keyProperty="salesOrderId"> <insert id="insertSysSalesOrder" parameterType="SysSalesOrder" useGeneratedKeys="true" keyProperty="salesOrderId">
insert into sys_sales_order insert into sys_sales_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

10
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -409,14 +409,14 @@
return ""; return "";
} }
// 检查 storageLocation 是否存在 // 检查 remark 是否存在
if (row.storageLocation === undefined || row.storageLocation === null) { if (row.remark === undefined || row.remark === null) {
return ""; return "";
} }
// 根据 storageLocation 的值决定返回值 // 根据 remark 的值决定返回值
if (row.storageLocation) { if (row.remark) {
return row.storageLocation; return row.remark;
} else { } else {
return value; return value;
} }

20
ruoyi-admin/src/main/resources/templates/sales/estimate/purchaseAdd.html

@ -414,14 +414,14 @@
return ""; return "";
} }
// 检查 storageLocation 是否存在 // 检查 noTaxPurchaseRmb 是否存在
if (row.storageLocation === undefined || row.storageLocation === null) { if (row.noTaxPurchaseRmb === undefined || row.noTaxPurchaseRmb === null) {
return ""; return "";
} }
// 根据 storageLocation 的值决定返回值 // 根据 noTaxPurchaseRmb 的值决定返回值
if (row.storageLocation) { if (row.noTaxPurchaseRmb) {
return row.storageLocation; return row.noTaxPurchaseRmb;
} else { } else {
return value; return value;
} }
@ -445,14 +445,14 @@
return ""; return "";
} }
// 检查 storageLocation 是否存在 // 检查 taxPurchaseRmb 是否存在
if (row.storageLocation === undefined || row.storageLocation === null) { if (row.taxPurchaseRmb === undefined || row.taxPurchaseRmb === null) {
return ""; return "";
} }
// 根据 storageLocation 的值决定返回值 // 根据 taxPurchaseRmb 的值决定返回值
if (row.storageLocation) { if (row.taxPurchaseRmb) {
return row.storageLocation; return row.taxPurchaseRmb;
} else { } else {
return value; return value;
} }

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

@ -4,27 +4,33 @@
<th:block th:include="include :: header('销售订单出货')" /> <th:block th:include="include :: header('销售订单出货')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
</head> </head>
<style>
.
</style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-salesDeliverGoods-edit" th:object="${sysSalesOrder}"> <form class="form-horizontal m" id="form-salesDeliverGoods-edit" th:object="${sysSalesOrder}">
<input name="salesOrderId" th:field="*{salesOrderId}" type="hidden"> <div th:each="order : ${salesOrders}" class="col-sm-12" style="margin-left: -35px;">
<div class="form-group"> <div class="col-sm-6">
<label class="col-sm-3 control-label">订单类型:</label> <label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="salesOrderType" class="form-control m-b" th:with="type=${@dict.getType('sys_order_type')}" disabled> <select name="salesOrderType" class="form-control m-b" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salesOrderType}"></option> <option value="0" th:selected="${order.salesOrderType} == '0'">客户订单</option>
</select> <option value="1" th:selected="${order.salesOrderType} == '1'">研发订单</option>
<option value="2" th:selected="${order.salesOrderType} == '2'">其他订单</option>
</select>
</div>
</div> </div>
</div> <div class="col-sm-6" >
<div class="form-group"> <label class="col-sm-3 control-label">销售单号:</label>
<label class="col-sm-3 control-label">销售单号:</label> <div class="col-sm-8">
<div class="col-sm-8"> <input name="salesOrderCode" th:value="${order.salesOrderCode}" class="form-control" type="text" readonly>
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label> <label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8"> <div class="col-sm-7">
<input name="applyUser" th:field="*{applyUser}" class="form-control" type="text" disabled> <input name="applyUser" th:field="*{applyUser}" class="form-control" type="text" disabled>
</div> </div>
</div> </div>
@ -366,6 +372,24 @@
title: '申请出货数', title: '申请出货数',
field: 'applyShippingNum', field: 'applyShippingNum',
editable:true, editable:true,
formatter: function (value, row) {
// 检查 row 是否存在
if (!row) {
return "";
}
// 检查 storageLocation 是否存在
if (row.applyShippingNum === undefined || row.applyShippingNum === null) {
return "";
}
// 根据 storageLocation 的值决定返回值
if (row.applyShippingNum) {
return row.applyShippingNum;
} else {
return value;
}
}
}, },
] ]
}; };

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

@ -116,9 +116,13 @@
<a class="btn btn-success" onclick="exportSalesOrder()" shiro:hasPermission="system:salesOrder:exportSalesOrder"> <a class="btn btn-success" onclick="exportSalesOrder()" shiro:hasPermission="system:salesOrder:exportSalesOrder">
<i class="fa fa-download"></i> 导出销售订单模板 <i class="fa fa-download"></i> 导出销售订单模板
</a> </a>
<a class="btn btn-success" onclick="salesDeliverGoods()" shiro:hasPermission="system:salesOrder:salesDeliverGoods">
<i class="fa fa-plus"></i> 出货
</a>
<a class="btn btn-success" onclick="makeInvoice()" shiro:hasPermission="system:salesOrder:makeInvoice"> <a class="btn btn-success" onclick="makeInvoice()" shiro:hasPermission="system:salesOrder:makeInvoice">
<i class="fa fa-plus"></i> 开票 <i class="fa fa-plus"></i> 开票
</a> </a>
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
@ -408,11 +412,6 @@
// 进度查看 // 进度查看
actions.push('<a href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> '); actions.push('<a href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
} }
// 生产状态部分完成/全部完成
if (row.makeStatus == "5" || row.makeStatus == "6"){
actions.push('<a class=" ' + salesDeliverGoodsFlag + '" href="javascript:void(0)" onclick="salesDeliverGoods(\'' + row.salesOrderId + '\')"><i class="fa fa-edit"></i>出货</a> ');
}
if (row.closeStatus == 3){ if (row.closeStatus == 3){
actions.push('<a class=" ' + startAftersalesFlag + '" href="javascript:void(0)" onclick="startAftersales(\'' + row.salesOrderId + '\')"><i class="fa fa-edit"></i>售后</a> '); actions.push('<a class=" ' + startAftersalesFlag + '" href="javascript:void(0)" onclick="startAftersales(\'' + row.salesOrderId + '\')"><i class="fa fa-edit"></i>售后</a> ');
} }
@ -581,11 +580,6 @@
window.location.href =prefix + "/downloadFile?filepath="+ filepath; window.location.href =prefix + "/downloadFile?filepath="+ filepath;
} }
//出货
function salesDeliverGoods(salesOrderId){
var url = prefix + "/salesDeliverGoods/" + salesOrderId;
$.modal.open("出货",url);
}
//售后 //售后
function startAftersales(salesOrderId){ function startAftersales(salesOrderId){
@ -593,6 +587,79 @@
$.modal.open("售后",url); $.modal.open("售后",url);
} }
//出货
function salesDeliverGoods() {
// 获取选中的行
const selectedRows = $("#bootstrap-table").bootstrapTable('getSelections');
// 定义状态码常量
const AUDIT_STATUS_APPROVED = "1";//审核通过
const DELETE_FLAG = "2"; //作废
// const ALL_SHIPPING = "6"; //全部出货
// const PART_CHECK = "7"; //部分验收
// const ALL_CHECK = "8";//全部验收
// const HAS_CLOSE= "3";//已结案
var enterpriseCode; //客户id
let valid = true;//自定义验证状态
let validSalesOrderIds = []; // 存储有效的销售订单ID
//检查是否有选中行
if (selectedRows.length < 1){
showWarning("请先选择一条销售订单");
return;
}
//检查选中的订单是否同属于一个客户并且状态是否符合要求
selectedRows.forEach((row,index) =>{
if (index === 0){
enterpriseCode = row.enterpriseCode;
}else if (row.enterpriseCode !== enterpriseCode){
showWarning("请先选择同一客户下的销售订单");
valid = false;
return;
}
//检查是否作废
if (row.useStatus === DELETE_FLAG) {
showWarning("该订单已作废");
valid = false;
return;
}
//检查是否已审核
if (row.auditStatus !== AUDIT_STATUS_APPROVED){
showWarning("存在未审核的订单,请先审核");
valid = false;
return;
}
// //检查出货状态
// if ([ALL_SHIPPING,PART_CHECK,ALL_CHECK,HAS_CLOSE].includes(row.deliveryStatus)){
// showWarning("存在已出货的订单,请先取消出货");
// valid = false;
// return;
// }
// //检查结案状态
// if (row.closeStatus === HAS_CLOSE) {
// showWarning("存在已结案的订单");
// valid = false;
// return;
// }
// 如果所有条件都满足,将销售订单ID添加到有效列表中
validSalesOrderIds.push(row.salesOrderId);
});
//如果所有验证都通过,可以出货
if (valid && validSalesOrderIds.length > 0) {
var url = prefix + "/salesDeliverGoods?salesOrderIds=" + validSalesOrderIds.join(",");
$.modal.open("出货", url);
}
}
//开票 //开票
function makeInvoice() { function makeInvoice() {
// 获取选中的行 // 获取选中的行

Loading…
Cancel
Save