feat(sip): 优化发货单相关功能

- 新增发货单编码生成逻辑
- 修改发货单列表导出功能
-调整订单编辑页面字段显示- 优化模板下载功能
master
chenhao 2025-05-21 10:54:46 +08:00
parent 59b536aac9
commit 41445b32cd
9 changed files with 114 additions and 33 deletions

View File

@ -26,7 +26,7 @@
</div> </div>
<a th:href="@{/index}"> <a th:href="@{/index}">
<li class="logo hidden-xs"> <li class="logo hidden-xs">
<span class="logo-lg">RuoYi</span> <span class="logo-lg">SIP</span>
</li> </li>
</a> </a>
<div class="sidebar-collapse"> <div class="sidebar-collapse">

View File

@ -388,20 +388,19 @@
function downloadTem() { function downloadTem() {
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象 var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL window.location.href =prefix + "/list/export"
// 当请求完成时执行的回调函数 $.modal.closeLoading();
$.modal.loading("正在下载,请稍候..."); // $.post(prefix + "/list/export", {}, function (result) {
xhr.onload = function (data) { // if (result.code == web_status.SUCCESS) {
const url = window.URL.createObjectURL(data.currentTarget.response) // window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
const a=document.createElement('a') // } else if (result.code == web_status.WARNING) {
a.href= url // $.modal.alertWarning(result.msg)
a.download='合同清单模板.xlsx' // } else {
document.append(a) // $.modal.alertError(result.msg);
a.click() // }
a.remove() // $.modal.closeLoading();
$.modal.closeLoading(); // })
}
xhr.send();
} }
document.getElementById('uploadInput').addEventListener('change', function (event) { document.getElementById('uploadInput').addEventListener('change', function (event) {

View File

@ -104,7 +104,7 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label is-required">客户编码</label> <label class="col-sm-4 control-label is-required">客户名称</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group"> <div class="input-group">
<input name="customerName" th:field="*{customerName}" class="form-control" type="text" <input name="customerName" th:field="*{customerName}" class="form-control" type="text"
@ -117,7 +117,7 @@
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label is-required">客户名称</label> <label class="col-sm-4 control-label is-required">客户编码</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input readonly name="customerCode" th:field="*{customerCode}" class="form-control" type="text" <input readonly name="customerCode" th:field="*{customerCode}" class="form-control" type="text"
required > required >
@ -234,7 +234,7 @@
width: "680", width: "680",
url: url, url: url,
height:'600', height:'600',
callBack: doSubmitPartner callBack: doSubmitPartner
}; };
$.modal.openOptions(options); $.modal.openOptions(options);
@ -324,21 +324,19 @@
}); });
function downloadTem() { function downloadTem() {
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL
// 当请求完成时执行的回调函数
$.modal.loading("正在下载,请稍候..."); $.modal.loading("正在下载,请稍候...");
xhr.onload = function (data) { window.location.href=prefix + "/list/export"
const url = window.URL.createObjectURL(data.currentTarget.response) $.modal.closeLoading();
const a=document.createElement('a') // $.post(prefix + "/list/export", {}, function (result) {
a.href= url // if (result.code == web_status.SUCCESS) {
a.download='合同清单模板.xlsx' // window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
document.append(a) // } else if (result.code == web_status.WARNING) {
a.click() // $.modal.alertWarning(result.msg)
a.remove() // } else {
$.modal.closeLoading(); // $.modal.alertError(result.msg);
} // }
xhr.send(); // $.modal.closeLoading();
// })
} }

View File

@ -178,7 +178,7 @@ public class OrderInfoController extends BaseController
} }
@RequiresPermissions("sip:list:export") @RequiresPermissions("sip:list:export")
@Log(title = "发货清单", businessType = BusinessType.EXPORT) @Log(title = "发货清单", businessType = BusinessType.EXPORT)
@PostMapping("/list/export") @GetMapping("/list/export")
public void listExport(HttpServletRequest request, HttpServletResponse response) { public void listExport(HttpServletRequest request, HttpServletResponse response) {
try try
{ {

View File

@ -75,5 +75,6 @@ public class OrderDelivery extends BaseEntity
/** 删除时间 */ /** 删除时间 */
private Date deletedAt; private Date deletedAt;
private String total; private String total;
private Integer status;
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.sip.mapper; package com.ruoyi.sip.mapper;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.sip.domain.OrderDelivery; import com.ruoyi.sip.domain.OrderDelivery;
@ -58,4 +59,6 @@ public interface OrderDeliveryMapper
* @return * @return
*/ */
public int deleteOrderDeliveryByIds(String[] ids); public int deleteOrderDeliveryByIds(String[] ids);
int count(OrderDelivery orderDelivery);
} }

View File

@ -1,6 +1,9 @@
package com.ruoyi.sip.service.impl; package com.ruoyi.sip.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.sip.utils.CodeGeneratorUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.OrderDeliveryMapper; import com.ruoyi.sip.mapper.OrderDeliveryMapper;
@ -53,6 +56,10 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService
@Override @Override
public int insertOrderDelivery(OrderDelivery orderDelivery) public int insertOrderDelivery(OrderDelivery orderDelivery)
{ {
OrderDelivery queryCountParam = new OrderDelivery();
queryCountParam.setCreatedAt(DateUtils.getNowDate());
String deliveryCode = CodeGeneratorUtil.generateUniqueCode("OD", () -> orderDeliveryMapper.count(queryCountParam));
orderDelivery.setDeliveryCode(deliveryCode);
return orderDeliveryMapper.insertOrderDelivery(orderDelivery); return orderDeliveryMapper.insertOrderDelivery(orderDelivery);
} }

View File

@ -0,0 +1,59 @@
package com.ruoyi.sip.utils;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.utils.DateUtils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.IntSupplier;
/**
* @author : ch
* @version : 1.0
* @ClassName : CodeGeneratorUtil
* @Description :
* @DATE : Created in 9:55 2025/5/21
* <pre> Copyright: Copyright(c) 2025 </pre>
* <pre> Company : </pre>
* Modification History:
* Date Author Version Discription
* --------------------------------------------------------------------------
* 2025/05/21 ch 1.0 Why & What is modified: <> *
*/
public class CodeGeneratorUtil {
private static final String DELIMITER = "-";
private static final Map<String, AtomicLong> SEQUENCE_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> DATE_MAP = new ConcurrentHashMap<>();
/**
*
*
* @param prefix
* @param defaultValueSupplier
* @return
*/
public static String generateUniqueCode(String prefix, IntSupplier defaultValueSupplier) {
// 获取当前日期yyyyMMdd格式
String currentDate = DateUtils.dateTime();
if (!DATE_MAP.containsKey(currentDate)) {
DATE_MAP.clear();
SEQUENCE_MAP.clear();
DATE_MAP.put(currentDate, currentDate);
}
// 获取当前流水号并递增
AtomicLong sequence = SEQUENCE_MAP.computeIfAbsent(prefix, k -> {
if (CollUtil.isEmpty(SEQUENCE_MAP)) {
return new AtomicLong(defaultValueSupplier.getAsInt());
} else {
return new AtomicLong(0);
}
});
long currentSequence = sequence.incrementAndGet();
// 生成编码
return prefix + DELIMITER + currentDate + DELIMITER + String.format("%04d", currentSequence);
}
}

View File

@ -50,6 +50,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOrderDeliveryVo"/> <include refid="selectOrderDeliveryVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="count" resultType="java.lang.Integer">
select count(1) from order_delivery
<where>
<if test="status != null "> and tatus = #{status}</if>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="deliveryCode != null and deliveryCode != ''"> and delivery_code like concat('%', #{deliveryCode}, '%')</if>
<if test="deliveryDate != null "> and delivery_date = #{deliveryDate}</if>
<if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if>
<if test="logisticsCompany != null and logisticsCompany != ''"> and logistics_company = #{logisticsCompany}</if>
<if test="deliveryStatus != null and deliveryStatus != ''"> and delivery_status = #{deliveryStatus}</if>
<if test="createdAt != null "> and created_at between date_format(#{createdAt}, '%Y-%m-%d 00:00:00') and date_format(#{createdAt}, '%Y-%m-%d 23:59:59')</if>
</where>
</select>
<insert id="insertOrderDelivery" parameterType="OrderDelivery" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrderDelivery" parameterType="OrderDelivery" useGeneratedKeys="true" keyProperty="id">
insert into order_delivery insert into order_delivery