Compare commits
7 Commits
c2d2407262
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d322fe830e | |||
| c67f458c84 | |||
| fbe32b6e65 | |||
| d048f3fcf1 | |||
| bc690863c6 | |||
| 89ddd188b6 | |||
| 3c908eb895 |
@@ -113,8 +113,8 @@ public class DeliveryOrderController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('document:order:add')")
|
||||
@Log(title = "配送单据主-保存(含附件)", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody DeliveryOrderSaveDTO dto) {
|
||||
String username = "大爷的!";
|
||||
public AjaxResult save(@RequestBody DeliveryOrderSaveDTO dto) {;
|
||||
String username = getUsername();
|
||||
int rows = deliveryOrderService.saveOrderWithAttachments(dto, username);
|
||||
return toAjax(rows);
|
||||
}
|
||||
@@ -148,8 +148,8 @@ public class DeliveryOrderController extends BaseController {
|
||||
* 从智慧实物系统拉取待配送出库单据列表
|
||||
*/
|
||||
@GetMapping("/wisdom/rk/list")
|
||||
public AjaxResult listRkFromWisdom(String billNoCk) {
|
||||
List<DeliveryBillVO> list = deliveryOrderService.listWisdomRkForDelivery(billNoCk);
|
||||
public AjaxResult listRkFromWisdom(String billNo) {
|
||||
List<DeliveryBillVO> list = deliveryOrderService.listWisdomRkForDelivery(billNo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,8 @@ public class DeliveryOrder extends BaseEntity {
|
||||
@Excel(name = "配送单据号")
|
||||
private String orderNo;
|
||||
|
||||
/** rk_info主键ID */
|
||||
// @Excel(name = "rk_info主键ID")
|
||||
private Long rkInfoId;
|
||||
/** rk_record主键ID */
|
||||
private Long rkRecordId;
|
||||
|
||||
/** 制单人用户ID */
|
||||
// @Excel(name = "制单人ID")
|
||||
@@ -44,9 +43,8 @@ public class DeliveryOrder extends BaseEntity {
|
||||
@Excel(name = "存在问题描述")
|
||||
private String receiveProblem;
|
||||
|
||||
/** 出库单据号 */
|
||||
// @Excel(name = "出库单据号")
|
||||
private String billNoCk;
|
||||
/** 单据号(对应 rk_record.bill_no) */
|
||||
private String billNo;
|
||||
|
||||
/** 项目描述 */
|
||||
// @Excel(name = "项目描述")
|
||||
@@ -188,6 +186,9 @@ public class DeliveryOrder extends BaseEntity {
|
||||
@Excel(name = "总公里数")
|
||||
private BigDecimal totalKm;
|
||||
|
||||
@Excel(name = "主键ID")
|
||||
private Long rkInfoId;
|
||||
|
||||
// ===================== Getter & Setter =====================
|
||||
|
||||
public Long getId() { return id; }
|
||||
@@ -196,8 +197,12 @@ public class DeliveryOrder extends BaseEntity {
|
||||
public String getOrderNo() { return orderNo; }
|
||||
public void setOrderNo(String orderNo) { this.orderNo = orderNo; }
|
||||
|
||||
public Long getRkInfoId() { return rkInfoId; }
|
||||
public void setRkInfoId(Long rkInfoId) { this.rkInfoId = rkInfoId; }
|
||||
public Long getRkRecordId() {
|
||||
return rkRecordId;
|
||||
}
|
||||
public void setRkRecordId(Long rkRecordId) {
|
||||
this.rkRecordId = rkRecordId;
|
||||
}
|
||||
|
||||
public String getMakerUserName() {
|
||||
return makerUserName;
|
||||
@@ -206,6 +211,9 @@ public class DeliveryOrder extends BaseEntity {
|
||||
this.makerUserName = makerUserName;
|
||||
}
|
||||
|
||||
public Long getRkInfoId() { return rkInfoId; }
|
||||
public void setRkInfoId(Long rkInfoId) { this.rkInfoId = rkInfoId; }
|
||||
|
||||
public Long getMakerId() { return makerId; }
|
||||
public void setMakerId(Long makerId) { this.makerId = makerId; }
|
||||
|
||||
@@ -219,8 +227,12 @@ public class DeliveryOrder extends BaseEntity {
|
||||
public String getReceiveProblem() { return receiveProblem; }
|
||||
public void setReceiveProblem(String receiveProblem) { this.receiveProblem = receiveProblem; }
|
||||
|
||||
public String getBillNoCk() { return billNoCk; }
|
||||
public void setBillNoCk(String billNoCk) { this.billNoCk = billNoCk; }
|
||||
public String getBillNo() {
|
||||
return billNo;
|
||||
}
|
||||
public void setBillNo(String billNo) {
|
||||
this.billNo = billNo;
|
||||
}
|
||||
|
||||
public String getXmMs() { return xmMs; }
|
||||
public void setXmMs(String xmMs) { this.xmMs = xmMs; }
|
||||
@@ -326,7 +338,6 @@ public class DeliveryOrder extends BaseEntity {
|
||||
|
||||
public BigDecimal getTotalKm() { return totalKm; }
|
||||
public void setTotalKm(BigDecimal totalKm) { this.totalKm = totalKm; }
|
||||
|
||||
// ===================== toString =====================
|
||||
|
||||
@Override
|
||||
@@ -334,12 +345,12 @@ public class DeliveryOrder extends BaseEntity {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderNo", getOrderNo())
|
||||
.append("rkInfoId", getRkInfoId())
|
||||
.append("rkRecordId", getRkRecordId())
|
||||
.append("makerId", getMakerId())
|
||||
.append("makerUserName", getMakerUserName())
|
||||
.append("receiveStatus", getReceiveStatus()) // *** 类型已是 Integer ***
|
||||
.append("receiveProblem", getReceiveProblem())
|
||||
.append("billNoCk", getBillNoCk())
|
||||
.append("billNo", getBillNo())
|
||||
.append("xmMs", getXmMs())
|
||||
.append("xmNo", getXmNo())
|
||||
.append("wlNo", getWlNo())
|
||||
|
||||
@@ -7,14 +7,17 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class DeliveryOrderLineDTO {
|
||||
|
||||
/**
|
||||
* 对应智慧实物系统 rk_info 表的主键 ID
|
||||
* detailList 里的 id 就是这个值
|
||||
*/
|
||||
private Long rkInfoId;
|
||||
|
||||
/** 出库单据号 */
|
||||
private String billNoCk;
|
||||
/**
|
||||
* 对应智慧实物系统 rk_record 表主键 ID
|
||||
*/
|
||||
private Long rkRecordId;
|
||||
|
||||
/**
|
||||
* 单据号(以 rk_record.bill_no 为准)
|
||||
* 说明:出库生成配送单时,所有行必须属于同一 billNo
|
||||
*/
|
||||
private String billNo;
|
||||
|
||||
/** 项目描述 */
|
||||
private String xmMs;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DeliveryOrderGroupVO {
|
||||
/** 配送单号 */
|
||||
private String orderNo;
|
||||
/** 出库单据号 */
|
||||
private String billNoCk;
|
||||
private String billNo;
|
||||
/** 配送日期(格式:yyyy-MM-dd) */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date deliveryDate;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class DeliveryOrderVo {
|
||||
private String orderNo;
|
||||
|
||||
/** 出库单据号 */
|
||||
private String billNoCk;
|
||||
private String billNo;
|
||||
|
||||
/** 起始地点名称 */
|
||||
private String originName;
|
||||
|
||||
@@ -37,8 +37,8 @@ public interface IDeliveryOrderService {
|
||||
/** 详情:按单号查行 */
|
||||
List<DeliveryOrderDetailVO> listByOrderNo(String orderNo);
|
||||
|
||||
/** 从智慧实物系统查询待配送出库单据(可按出库单号 billNoCk 过滤) */
|
||||
List<DeliveryBillVO> listWisdomRkForDelivery(String billNoCk);
|
||||
/** 从智慧实物系统查询待配送出库单据(可按出库单号 billNo 过滤) */
|
||||
List<DeliveryBillVO> listWisdomRkForDelivery(String billNo);
|
||||
|
||||
// ======================== 统计 ========================
|
||||
|
||||
|
||||
@@ -141,43 +141,47 @@ public class DeliveryAttachmentServiceImpl implements IDeliveryAttachmentService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int executeBind(DeliveryExecuteBindDTO dto) {
|
||||
|
||||
// 0) 基础校验
|
||||
// ====================== 0. 基础校验 ======================
|
||||
if (dto == null || StringUtils.isBlank(dto.getOrderNo())) {
|
||||
throw new ServiceException("订单号不能为空");
|
||||
}
|
||||
|
||||
// 1) 校验订单存在(一个单号多行)
|
||||
List<DeliveryOrder> existList = deliveryOrderMapper.selectDeliveryOrderByOrderNo(dto.getOrderNo());
|
||||
// ====================== 1. 校验配送单是否存在 ======================
|
||||
List<DeliveryOrder> existList =
|
||||
deliveryOrderMapper.selectDeliveryOrderByOrderNo(dto.getOrderNo());
|
||||
|
||||
if (existList == null || existList.isEmpty()) {
|
||||
throw new ServiceException("配送单不存在:" + dto.getOrderNo());
|
||||
}
|
||||
|
||||
// ====== 从配送单中拿到所有 rk_info_id 列表(允许为空:手工配送单场景) ======
|
||||
List<Long> rkInfoIdList = existList.stream()
|
||||
.map(DeliveryOrder::getRkInfoId)
|
||||
// ====================== 2. 收集 rk_record_id ======================
|
||||
List<Long> rkRecordIdList = existList.stream()
|
||||
.map(DeliveryOrder::getRkRecordId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (rkInfoIdList.isEmpty()) {
|
||||
// 手工创建的配送单可能没有绑定 rk_info_id:允许为空,后续只跳过 WMS 回写
|
||||
log.warn("配送单未绑定 rk_info_id,将跳过 WMS 库存状态回写。orderNo={}", dto.getOrderNo());
|
||||
if (rkRecordIdList.isEmpty()) {
|
||||
log.warn("配送单未绑定 rk_record_id,将跳过 WMS 回写。orderNo={}",
|
||||
dto.getOrderNo());
|
||||
}
|
||||
// ======================================================================
|
||||
|
||||
// ====================== 3. 附件校验 ======================
|
||||
if (dto.getAttachments() == null || dto.getAttachments().isEmpty()) {
|
||||
throw new ServiceException("附件列表不能为空");
|
||||
}
|
||||
|
||||
// 2) 批量插入附件(只传 URL)
|
||||
// ====================== 4. 批量插入附件 ======================
|
||||
List<DeliveryAttachment> list = new ArrayList<>();
|
||||
String username = getUsername();
|
||||
|
||||
for (DeliveryAttachItemDTO it : dto.getAttachments()) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it.getScene() == null || it.getBizType() == null || it.getUrl() == null) {
|
||||
|
||||
if (it == null) continue;
|
||||
|
||||
if (it.getScene() == null ||
|
||||
it.getBizType() == null ||
|
||||
it.getUrl() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -188,38 +192,72 @@ public class DeliveryAttachmentServiceImpl implements IDeliveryAttachmentService
|
||||
a.setUrl(it.getUrl());
|
||||
a.setSortNo(it.getSortNo());
|
||||
a.setRemark(it.getRemark());
|
||||
a.setStatus("1"); // 已绑定
|
||||
|
||||
a.setStatus("1"); // 已绑定
|
||||
a.setIsDelete("0");
|
||||
a.setCreateBy(username);
|
||||
a.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
list.add(a);
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
throw new ServiceException("有效附件条目为空");
|
||||
}
|
||||
|
||||
deliveryAttachmentMapper.batchInsert(list);
|
||||
|
||||
// 3) 回写配送单(仅填需要更新的字段),交给已有 updateDeliveryOrder(按 order_no 更新)
|
||||
// ====================== 5. 回写配送单 ======================
|
||||
DeliveryOrder patch = new DeliveryOrder();
|
||||
patch.setOrderNo(dto.getOrderNo());
|
||||
|
||||
String scene = dto.getScene() == null ? "" : dto.getScene().toUpperCase(Locale.ROOT);
|
||||
String scene = dto.getScene() == null
|
||||
? ""
|
||||
: dto.getScene().toUpperCase(Locale.ROOT);
|
||||
|
||||
// ====================== ORIGIN:开始配送 ======================
|
||||
if ("ORIGIN".equals(scene)) {
|
||||
// 起点:司机信息 + 起点经纬度 + 状态=2(起运/配送中)
|
||||
if (dto.getDriverName() != null) patch.setDriverName(dto.getDriverName());
|
||||
if (dto.getDriverPhone() != null) patch.setDriverPhone(dto.getDriverPhone());
|
||||
if (dto.getPlateNo() != null) patch.setPlateNo(dto.getPlateNo());
|
||||
if (dto.getLng() != null) patch.setOriginLng(BigDecimal.valueOf(dto.getLng()));
|
||||
if (dto.getLat() != null) patch.setOriginLat(BigDecimal.valueOf(dto.getLat()));
|
||||
|
||||
if (dto.getDriverName() != null)
|
||||
patch.setDriverName(dto.getDriverName());
|
||||
|
||||
if (dto.getDriverPhone() != null)
|
||||
patch.setDriverPhone(dto.getDriverPhone());
|
||||
|
||||
if (dto.getPlateNo() != null)
|
||||
patch.setPlateNo(dto.getPlateNo());
|
||||
|
||||
if (dto.getLng() != null)
|
||||
patch.setOriginLng(BigDecimal.valueOf(dto.getLng()));
|
||||
|
||||
if (dto.getLat() != null)
|
||||
patch.setOriginLat(BigDecimal.valueOf(dto.getLat()));
|
||||
|
||||
// 本系统状态:配送中
|
||||
patch.setOrderStatus("2");
|
||||
|
||||
} else if ("DEST".equals(scene)) {
|
||||
// 终点:终点经纬度 + 费用 + 状态=3(已完成)
|
||||
if (dto.getLng() != null) patch.setDestLng(BigDecimal.valueOf(dto.getLng()));
|
||||
if (dto.getLat() != null) patch.setDestLat(BigDecimal.valueOf(dto.getLat()));
|
||||
// 🔥 回写 WMS:3 = 配送中
|
||||
if (rkRecordIdList != null && !rkRecordIdList.isEmpty()) {
|
||||
|
||||
boolean ok = updateWmsRecordIsDeliveryByIds(rkRecordIdList, 3);
|
||||
|
||||
if (!ok) {
|
||||
throw new ServiceException(
|
||||
"回写 WMS 为【配送中】失败,rk_record_id=" + rkRecordIdList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// ====================== DEST:完成配送 ======================
|
||||
else if ("DEST".equals(scene)) {
|
||||
|
||||
if (dto.getLng() != null)
|
||||
patch.setDestLng(BigDecimal.valueOf(dto.getLng()));
|
||||
|
||||
if (dto.getLat() != null)
|
||||
patch.setDestLat(BigDecimal.valueOf(dto.getLat()));
|
||||
|
||||
// 费用校验
|
||||
if (dto.getActualFee() != null) {
|
||||
if (dto.getActualFee().compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("实际费用不能为负数");
|
||||
@@ -234,73 +272,72 @@ public class DeliveryAttachmentServiceImpl implements IDeliveryAttachmentService
|
||||
patch.setTollFee(dto.getTollFee());
|
||||
}
|
||||
|
||||
// 接收状态校验
|
||||
Integer receiveStatus = dto.getReceiveStatus();
|
||||
if (receiveStatus == null) {
|
||||
throw new ServiceException("完成配送时必须选择接收物资状态");
|
||||
}
|
||||
if (receiveStatus != 0 && receiveStatus != 1 && receiveStatus != 2) {
|
||||
|
||||
if (receiveStatus != 0 &&
|
||||
receiveStatus != 1 &&
|
||||
receiveStatus != 2) {
|
||||
throw new ServiceException("接收物资状态不合法");
|
||||
}
|
||||
|
||||
patch.setReceiveStatus(receiveStatus);
|
||||
|
||||
if (receiveStatus == 2) {
|
||||
// 有问题必须写说明
|
||||
if (StringUtils.isBlank(dto.getReceiveProblem())) {
|
||||
throw new ServiceException("存在问题时必须填写问题描述");
|
||||
}
|
||||
patch.setReceiveProblem(dto.getReceiveProblem());
|
||||
if (receiveStatus == 2 &&
|
||||
StringUtils.isBlank(dto.getReceiveProblem())) {
|
||||
|
||||
throw new ServiceException("存在问题时必须填写问题描述");
|
||||
}
|
||||
|
||||
patch.setReceiveProblem(dto.getReceiveProblem());
|
||||
|
||||
// 本系统状态:已完成
|
||||
patch.setOrderStatus("3");
|
||||
|
||||
// 🔥 回写 WMS:4 = 配送完成
|
||||
if (rkRecordIdList != null && !rkRecordIdList.isEmpty()) {
|
||||
|
||||
boolean ok = updateWmsRecordIsDeliveryByIds(rkRecordIdList, 4);
|
||||
|
||||
if (!ok) {
|
||||
throw new ServiceException(
|
||||
"回写 WMS 为【配送完成】失败,rk_record_id=" + rkRecordIdList);
|
||||
}
|
||||
}
|
||||
|
||||
patch.setOrderStatus("3"); // 已完成
|
||||
} else {
|
||||
// scene 既不是 ORIGIN 也不是 DEST:不强制报错,避免影响“仅绑定附件”的场景
|
||||
// 如果你希望严格校验,可以改为 throw new ServiceException("scene 不合法");
|
||||
log.warn("executeBind 未识别的 scene={},将仅绑定附件并更新已有字段(如有)。orderNo={}", scene, dto.getOrderNo());
|
||||
log.warn("未识别 scene={},仅绑定附件", scene);
|
||||
}
|
||||
|
||||
deliveryOrderMapper.updateDeliveryOrder(patch);
|
||||
|
||||
// 4) ⭐ 仅当 DEST 场景且存在 rk_info_id 绑定时,才远程调用 WMS 回写 is_delivery=3
|
||||
if ("DEST".equals(scene)) {
|
||||
|
||||
if (rkInfoIdList != null && !rkInfoIdList.isEmpty()) {
|
||||
boolean ok = updateWmsIsDeliveryByIds(rkInfoIdList, 3);
|
||||
if (!ok) {
|
||||
// 让整个事务回滚,附件 + 配送单状态都撤回
|
||||
throw new ServiceException("回写 WMS 配送状态失败,rk_info_id 列表:" + rkInfoIdList);
|
||||
}
|
||||
} else {
|
||||
// 手工配送单:不回写 WMS
|
||||
log.info("DEST 场景下配送单无 rk_info_id 绑定,跳过 WMS 回写。orderNo={}", dto.getOrderNo());
|
||||
}
|
||||
}
|
||||
|
||||
return list.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程调用智慧实物管理系统,按 rk_info 主键ID列表更新 is_delivery 状态
|
||||
* 约定请求体结构:
|
||||
* {
|
||||
* "ids": [1, 2, 3],
|
||||
* "isDelivery": 3
|
||||
* }
|
||||
* 远程调用智慧实物管理系统
|
||||
* 更新 rk_record.is_delivery
|
||||
*
|
||||
* 0=不需要,1=需要,2=已接单,3=配送中,4=配送完成
|
||||
*/
|
||||
private boolean updateWmsIsDeliveryByIds(List<Long> rkInfoIdList, int isDelivery) {
|
||||
private boolean updateWmsRecordIsDeliveryByIds(List<Long> rkRecordIds, int isDelivery) {
|
||||
|
||||
String url = wisdomBaseUrl + "/wisdom/stock/updateDeliveryStatus";
|
||||
String url = wisdomBaseUrl + "/wisdom/record/updateDeliveryStatus";
|
||||
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("ids", rkInfoIdList);
|
||||
body.put("ids", rkRecordIds);
|
||||
body.put("isDelivery", isDelivery);
|
||||
|
||||
String json = JSON.toJSONString(body);
|
||||
|
||||
try {
|
||||
String resp = HttpUtils.sendPost(url, json, MediaType.APPLICATION_JSON_VALUE);
|
||||
String resp = HttpUtils.sendJsonPost(url, json);
|
||||
|
||||
if (StringUtils.isBlank(resp)) {
|
||||
log.error("WMS 更新失败,响应为空,url={} rkInfoIdList={}", url, rkInfoIdList);
|
||||
log.error("WMS 更新失败,响应为空,ids={}", rkRecordIds);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -309,20 +346,23 @@ public class DeliveryAttachmentServiceImpl implements IDeliveryAttachmentService
|
||||
if (result != null && result.isSuccess()) {
|
||||
return true;
|
||||
} else {
|
||||
String msg = (result == null)
|
||||
String msg = result == null
|
||||
? "响应为空"
|
||||
: String.valueOf(result.get(AjaxResult.MSG_TAG));
|
||||
log.error("WMS 更新失败,rkInfoIdList={},原因={}", rkInfoIdList, msg);
|
||||
|
||||
log.error("WMS 更新失败,ids={},原因={}", rkRecordIds, msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("调用 WMS 接口异常,rkInfoIdList={},error={}", rkInfoIdList, e.getMessage(), e);
|
||||
log.error("调用 WMS 接口异常,ids={},error={}",
|
||||
rkRecordIds, e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 保存目录 D:\delivery
|
||||
private static final String BASE_PATH = "D:/delivery";
|
||||
|
||||
|
||||
@@ -182,73 +182,47 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createOrder(DeliveryOrderCreateDTO dto) {
|
||||
|
||||
// ========== 0. 参数校验 ==========
|
||||
|
||||
if (dto == null || dto.getItems() == null || dto.getItems().isEmpty()) {
|
||||
throw new ServiceException("物料明细不能为空");
|
||||
}
|
||||
|
||||
// 取第一条 billNoCk,判断是“手动创建”还是“出库单生成”
|
||||
String billNoCk = dto.getItems().get(0).getBillNoCk();
|
||||
boolean fromWms = StringUtils.isNotBlank(billNoCk); // true = 出库单生成;false = 手动创建
|
||||
String billNo = dto.getItems().get(0).getBillNo();
|
||||
boolean fromWms = StringUtils.isNotBlank(billNo);
|
||||
|
||||
// 收集 rk_info 主键 id(仅用于出库单生成场景回写 WMS)
|
||||
List<Long> rkInfoIds = dto.getItems().stream()
|
||||
.map(DeliveryOrderLineDTO::getRkInfoId)
|
||||
List<Long> rkRecordIds = dto.getItems().stream()
|
||||
.map(DeliveryOrderLineDTO::getRkRecordId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 出库单生成场景必须有 rkInfoId
|
||||
if (fromWms && rkInfoIds.isEmpty()) {
|
||||
throw new ServiceException("明细行缺少 rk_info 主键 id,无法回写配送状态");
|
||||
if (fromWms && rkRecordIds.isEmpty()) {
|
||||
throw new ServiceException("明细行缺少 rk_record 主键 id");
|
||||
}
|
||||
|
||||
// ========== 1. 生成配送单号 ==========
|
||||
|
||||
String orderNo = StringUtils.isBlank(dto.getOrderNo())
|
||||
? "DO" + DateUtils.dateTimeNow("yyyyMMddHHmmssSSS")
|
||||
: dto.getOrderNo().trim();
|
||||
|
||||
Date now = DateUtils.getNowDate();
|
||||
String username = SecurityUtils.getUsername();
|
||||
Long currentUserId = null;
|
||||
try {
|
||||
currentUserId = SecurityUtils.getUserId();
|
||||
} catch (Exception e) {
|
||||
log.warn("获取当前登录用户ID失败:{}", e.getMessage());
|
||||
}
|
||||
|
||||
// 制单人用户ID:优先用前端传的 makerId,没有则回退到当前登录用户
|
||||
Long makerId = dto.getMakerId();
|
||||
if (makerId == null) {
|
||||
if (currentUserId == null) {
|
||||
throw new ServiceException("无法确定制单人用户ID,请重新登录后重试");
|
||||
}
|
||||
makerId = currentUserId;
|
||||
}
|
||||
Long currentUserId = SecurityUtils.getUserId();
|
||||
Long makerId = dto.getMakerId() != null ? dto.getMakerId() : currentUserId;
|
||||
|
||||
List<DeliveryOrder> rows = new ArrayList<>();
|
||||
|
||||
// ========== 2. 遍历每一条物料明细,组装行记录 ==========
|
||||
|
||||
for (DeliveryOrderLineDTO it : dto.getItems()) {
|
||||
|
||||
// ===== 出库单生成场景下的两个判断(手动创建时跳过) =====
|
||||
if (fromWms) {
|
||||
// 限制同一出库单
|
||||
if (!billNoCk.equals(it.getBillNoCk())) {
|
||||
throw new ServiceException("当前接口暂不支持多张出库单合并配送,请确保所有明细 billNoCk 相同");
|
||||
if (!billNo.equals(it.getBillNo())) {
|
||||
throw new ServiceException("暂不支持多单合并配送");
|
||||
}
|
||||
|
||||
if (it.getRkInfoId() == null) {
|
||||
throw new ServiceException("明细行缺少 rk_info 主键 id");
|
||||
if (it.getRkRecordId() == null) {
|
||||
throw new ServiceException("明细缺少 rk_record_id");
|
||||
}
|
||||
}
|
||||
|
||||
DeliveryOrder row = new DeliveryOrder();
|
||||
|
||||
// 2.1 公共头部字段(整单一致)
|
||||
row.setOrderNo(orderNo);
|
||||
row.setOriginName(dto.getOriginName());
|
||||
row.setOriginLng(dto.getOriginLng());
|
||||
@@ -267,13 +241,11 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
row.setDeliveryTon(dto.getDeliveryTon());
|
||||
row.setGoodsSize(dto.getGoodsSize());
|
||||
|
||||
// 制单人用户ID
|
||||
row.setMakerId(makerId);
|
||||
row.setReceiveStatus(dto.getReceiveStatus());
|
||||
row.setReceiveProblem(dto.getReceiveProblem());
|
||||
|
||||
// 配送状态:前端不传时默认 1(已接单 / 待起运)
|
||||
String orderStatus = StringUtils.isBlank(dto.getOrderStatus())
|
||||
? "1" : dto.getOrderStatus().trim();
|
||||
row.setOrderStatus(orderStatus);
|
||||
row.setOrderStatus(StringUtils.defaultIfBlank(dto.getOrderStatus(), "1"));
|
||||
|
||||
row.setVehicleTypeId(dto.getVehicleTypeId());
|
||||
row.setVehicleTypeName(dto.getVehicleTypeName());
|
||||
@@ -283,9 +255,10 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
row.setTotalKm(dto.getTotalKm());
|
||||
row.setRemark(dto.getRemark());
|
||||
|
||||
// 2.2 明细字段
|
||||
row.setRkInfoId(it.getRkInfoId()); // 关联 rk_info 主键ID(手动单可以为空)
|
||||
row.setBillNoCk(it.getBillNoCk());
|
||||
// 🔥 关键改造点
|
||||
row.setRkRecordId(it.getRkRecordId());
|
||||
row.setBillNo(it.getBillNo());
|
||||
|
||||
row.setXmMs(it.getXmMs());
|
||||
row.setXmNo(it.getXmNo());
|
||||
row.setWlNo(it.getWlNo());
|
||||
@@ -295,7 +268,6 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
row.setSapNo(it.getSapNo());
|
||||
row.setGysMc(it.getGysMc());
|
||||
|
||||
// 2.3 通用字段
|
||||
row.setIsDelete("0");
|
||||
row.setCreateTime(now);
|
||||
row.setCreateBy(username);
|
||||
@@ -303,19 +275,14 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
// ========== 3. 批量落库 ==========
|
||||
|
||||
if (!rows.isEmpty()) {
|
||||
deliveryOrderMapper.batchInsert(rows);
|
||||
}
|
||||
|
||||
// ========== 4. 回写 WMS(仅出库单生成场景,手动创建不回写、不远程调用) ==========
|
||||
|
||||
if (fromWms) {
|
||||
boolean ok = updateWmsIsDeliveryByIds(rkInfoIds, 2);
|
||||
boolean ok = updateWmsIsDeliveryByIds(rkRecordIds, 2);
|
||||
if (!ok) {
|
||||
// 回写失败,整单回滚,避免脏数据
|
||||
throw new ServiceException("已生成配送单,但回写 WMS 配送状态失败");
|
||||
throw new ServiceException("回写WMS失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,12 +296,12 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
* POST ${delivery.wisdom-base-url}/wisdom/stock/updateDeliveryStatus
|
||||
* Body: { "ids": [1, 2, 3], "isDelivery": 2 }
|
||||
*/
|
||||
private boolean updateWmsIsDeliveryByIds(List<Long> rkInfoIds, int isDelivery) {
|
||||
private boolean updateWmsIsDeliveryByIds(List<Long> rkRecordIds, int isDelivery) {
|
||||
|
||||
String url = wisdomBaseUrl + "/wisdom/stock/updateDeliveryStatus";
|
||||
String url = wisdomBaseUrl + "/wisdom/record/updateDeliveryStatus";
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("ids", rkInfoIds);
|
||||
map.put("ids", rkRecordIds);
|
||||
map.put("isDelivery", isDelivery);
|
||||
|
||||
String json = JSON.toJSONString(map);
|
||||
@@ -354,7 +321,7 @@ public class DeliveryOrderServiceImpl implements IDeliveryOrderService
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("WMS 调用异常 rkInfoIds={} error={}", rkInfoIds, e.getMessage(), e);
|
||||
log.error("WMS 调用异常 rkInfoIds={} error={}", rkRecordIds, e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
<id property="id" column="id"/>
|
||||
<!-- 单号 -->
|
||||
<result property="orderNo" column="order_no"/>
|
||||
<result property="billNoCk" column="bill_no_ck"/>
|
||||
<result property="billNo" column="bill_no"/>
|
||||
|
||||
<!-- 新增:rk_info 主键ID -->
|
||||
<result property="rkInfoId" column="rk_info_id"/>
|
||||
<result property="rkRecordId" column="rk_record_id"/>
|
||||
|
||||
<!-- 新增:制单人ID、接收物资状态、问题描述 -->
|
||||
<result property="makerId" column="maker_id"/>
|
||||
@@ -113,7 +113,7 @@
|
||||
<result property="makerId" column="maker_id"/>
|
||||
<result property="receiveStatus" column="receive_status"/>
|
||||
<result property="receiveProblem" column="receive_problem"/>
|
||||
<result property="billNoCk" column="bill_no_ck"/>
|
||||
<result property="billNo" column="bill_no"/>
|
||||
<result property="originName" column="origin_name"/>
|
||||
<result property="originLng" column="origin_lng" jdbcType="DECIMAL"/>
|
||||
<result property="originLat" column="origin_lat" jdbcType="DECIMAL"/>
|
||||
@@ -162,53 +162,52 @@
|
||||
<!-- ======================== 带附件的查询列(别名统一 dor) ======================== -->
|
||||
<sql id="selectDeliveryOrderVoWithAttach">
|
||||
select
|
||||
dor.id,
|
||||
dor.order_no,
|
||||
dor.bill_no_ck,
|
||||
dor.rk_info_id,
|
||||
dor.maker_id,
|
||||
-- 制单人用户名(连表 sys_user)
|
||||
su.user_name AS maker_user_name,
|
||||
dor.receive_status,
|
||||
dor.receive_problem,
|
||||
dor.xm_ms, dor.xm_no, dor.wl_no, dor.wl_ms, dor.real_qty, dor.dw, dor.sap_no, dor.gys_mc,
|
||||
dor.remark,
|
||||
dor.origin_name, dor.origin_lng, dor.origin_lat,
|
||||
dor.dest_name, dor.dest_lng, dor.dest_lat,
|
||||
dor.delivery_date, dor.plate_no, dor.order_status,
|
||||
dor.driver_name, dor.driver_phone,
|
||||
dor.shipper_name, dor.shipper_phone,
|
||||
dor.receiver_name, dor.receiver_phone, dor.receiver_org_name,
|
||||
dor.delivery_ton,
|
||||
dor.goods_size,
|
||||
-- 车型外键与名称
|
||||
dor.vehicle_type_id, dor.vehicle_type_name,
|
||||
-- 费用/里程
|
||||
dor.suggest_fee, dor.actual_fee, dor.toll_fee, dor.total_km,
|
||||
dor.create_by, dor.create_time, dor.update_by, dor.update_time, dor.is_delete,
|
||||
dor.id,
|
||||
dor.order_no,
|
||||
dor.bill_no,
|
||||
dor.rk_record_id,
|
||||
dor.maker_id,
|
||||
-- 制单人用户名(连表 sys_user)
|
||||
su.user_name AS maker_user_name,
|
||||
dor.receive_status,
|
||||
dor.receive_problem,
|
||||
dor.xm_ms, dor.xm_no, dor.wl_no, dor.wl_ms, dor.real_qty, dor.dw, dor.sap_no, dor.gys_mc,
|
||||
dor.remark,
|
||||
dor.origin_name, dor.origin_lng, dor.origin_lat,
|
||||
dor.dest_name, dor.dest_lng, dor.dest_lat,
|
||||
dor.delivery_date, dor.plate_no, dor.order_status,
|
||||
dor.driver_name, dor.driver_phone,
|
||||
dor.shipper_name, dor.shipper_phone,
|
||||
dor.receiver_name, dor.receiver_phone, dor.receiver_org_name,
|
||||
dor.delivery_ton,
|
||||
dor.goods_size,
|
||||
-- 车型外键与名称
|
||||
dor.vehicle_type_id, dor.vehicle_type_name,
|
||||
-- 费用/里程
|
||||
dor.suggest_fee, dor.actual_fee, dor.toll_fee, dor.total_km,
|
||||
dor.create_by, dor.create_time, dor.update_by, dor.update_time, dor.is_delete,
|
||||
|
||||
-- 附件列(att_ 前缀)
|
||||
da.id AS att_id,
|
||||
da.order_no AS att_order_no,
|
||||
da.scene AS att_scene,
|
||||
da.biz_type AS att_biz_type,
|
||||
da.url AS att_url,
|
||||
da.status AS att_status,
|
||||
da.sort_no AS att_sort_no,
|
||||
da.remark AS att_remark,
|
||||
da.create_by AS att_create_by,
|
||||
da.create_time AS att_create_time,
|
||||
da.update_by AS att_update_by,
|
||||
da.update_time AS att_update_time,
|
||||
da.is_delete AS att_is_delete
|
||||
-- 附件列(att_ 前缀)
|
||||
da.id AS att_id,
|
||||
da.order_no AS att_order_no,
|
||||
da.scene AS att_scene,
|
||||
da.biz_type AS att_biz_type,
|
||||
da.url AS att_url,
|
||||
da.status AS att_status,
|
||||
da.sort_no AS att_sort_no,
|
||||
da.remark AS att_remark,
|
||||
da.create_by AS att_create_by,
|
||||
da.create_time AS att_create_time,
|
||||
da.update_by AS att_update_by,
|
||||
da.update_time AS att_update_time,
|
||||
da.is_delete AS att_is_delete
|
||||
|
||||
from delivery_order dor
|
||||
left join delivery_attachment da
|
||||
on da.order_no = dor.order_no
|
||||
and da.is_delete = '0'
|
||||
<!-- 报表/列表查询连表 sys_user,按制单人ID 取用户名 -->
|
||||
left join sys_user su
|
||||
on su.user_id = dor.maker_id
|
||||
left join delivery_attachment da
|
||||
on da.order_no = dor.order_no
|
||||
and da.is_delete = '0'
|
||||
left join sys_user su
|
||||
on su.user_id = dor.maker_id
|
||||
</sql>
|
||||
|
||||
<!-- ======================== 不带附件的查询列 ======================== -->
|
||||
@@ -216,8 +215,8 @@
|
||||
select
|
||||
id,
|
||||
order_no,
|
||||
bill_no_ck,
|
||||
rk_info_id,
|
||||
bill_no,
|
||||
rk_record_id,
|
||||
maker_id,
|
||||
receive_status,
|
||||
receive_problem,
|
||||
@@ -237,6 +236,7 @@
|
||||
from delivery_order
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 仅用于列表:只查配送单据头字段,不查货物明细 -->
|
||||
<sql id="selectDeliveryOrderHeader">
|
||||
SELECT
|
||||
@@ -296,8 +296,8 @@
|
||||
|
||||
SELECT
|
||||
dor.order_no AS order_no,
|
||||
MAX(dor.bill_no_ck) AS bill_no_ck,
|
||||
MAX(dor.rk_info_id) AS rk_info_id,
|
||||
MAX(dor.bill_no) AS bill_no,
|
||||
MAX(dor.rk_record_id) AS rk_record_id,
|
||||
MAX(dor.maker_id) AS maker_id,
|
||||
MAX(dor.receive_status) AS receive_status,
|
||||
MAX(dor.receive_problem) AS receive_problem,
|
||||
@@ -324,84 +324,72 @@
|
||||
MAX(dor.toll_fee) AS toll_fee,
|
||||
MAX(dor.total_km) AS total_km,
|
||||
MAX(dor.remark) AS remark
|
||||
|
||||
FROM delivery_order dor
|
||||
|
||||
<where>
|
||||
(dor.is_delete = '0' OR dor.is_delete = 0 OR dor.is_delete IS NULL)
|
||||
|
||||
<!-- 单号 -->
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
AND dor.order_no = #{orderNo}
|
||||
</if>
|
||||
|
||||
<!-- 出库单据号 -->
|
||||
<if test="billNoCk != null and billNoCk != ''">
|
||||
AND dor.bill_no_ck = #{billNoCk}
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND dor.bill_no = #{billNo}
|
||||
</if>
|
||||
|
||||
<!-- 制单人 -->
|
||||
<if test="makerId != null">
|
||||
AND dor.maker_id = #{makerId}
|
||||
</if>
|
||||
|
||||
<!-- 接收物资状态 -->
|
||||
<if test="receiveStatus != null">
|
||||
AND dor.receive_status = #{receiveStatus}
|
||||
</if>
|
||||
|
||||
<!-- 项目描述(模糊) -->
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND dor.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 项目号 -->
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND dor.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 物料号 -->
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND dor.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 物料描述 -->
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND dor.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||
</if>
|
||||
|
||||
<!-- SAP订单编号 -->
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND dor.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 供应商名称 -->
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND dor.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 起始 / 目的地点模糊 -->
|
||||
<if test="originName != null and originName != ''">
|
||||
AND dor.origin_name LIKE CONCAT('%', #{originName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="destName != null and destName != ''">
|
||||
AND dor.dest_name LIKE CONCAT('%', #{destName}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 配送日期 -->
|
||||
<if test="deliveryDate != null">
|
||||
AND dor.delivery_date = #{deliveryDate}
|
||||
</if>
|
||||
|
||||
<!-- 车牌 -->
|
||||
<if test="plateNo != null and plateNo != ''">
|
||||
AND dor.plate_no = #{plateNo}
|
||||
</if>
|
||||
|
||||
<!-- ✅ 新增/确认:接收单位名称(模糊) -->
|
||||
<if test="receiverOrgName != null and receiverOrgName != ''">
|
||||
AND dor.receiver_org_name LIKE CONCAT('%', #{receiverOrgName}, '%')
|
||||
</if>
|
||||
|
||||
<!-- ✅ 新增/确认:配送状态(多选优先) -->
|
||||
<if test="orderStatusList != null and orderStatusList.size > 0">
|
||||
AND dor.order_status IN
|
||||
<foreach collection="orderStatusList" item="st" open="(" separator="," close=")">
|
||||
@@ -409,38 +397,41 @@
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- ✅ 新增/确认:配送状态(单选兜底) -->
|
||||
<if test="(orderStatusList == null or orderStatusList.size == 0)
|
||||
and orderStatus != null and orderStatus != ''">
|
||||
and orderStatus != null and orderStatus != ''">
|
||||
AND dor.order_status = #{orderStatus}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
GROUP BY dor.order_no
|
||||
ORDER BY MAX(dor.create_time) DESC
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 供 VO 使用:按单号查所有行明细 -->
|
||||
<select id="selectLinesByOrderNo"
|
||||
parameterType="java.lang.String"
|
||||
resultType="com.delivery.project.document.domain.dto.DeliveryOrderLineDTO">
|
||||
|
||||
SELECT
|
||||
dor.id,
|
||||
dor.rk_info_id AS rkInfoId,
|
||||
dor.bill_no_ck AS billNoCk,
|
||||
dor.xm_ms AS xmMs,
|
||||
dor.xm_no AS xmNo,
|
||||
dor.wl_no AS wlNo,
|
||||
dor.wl_ms AS wlMs,
|
||||
dor.real_qty AS realQty,
|
||||
dor.dw AS dw,
|
||||
dor.sap_no AS sapNo,
|
||||
dor.gys_mc AS gysMc,
|
||||
dor.remark AS remark
|
||||
dor.rk_record_id AS rkRecordId,
|
||||
dor.bill_no AS billNo,
|
||||
dor.xm_ms AS xmMs,
|
||||
dor.xm_no AS xmNo,
|
||||
dor.wl_no AS wlNo,
|
||||
dor.wl_ms AS wlMs,
|
||||
dor.real_qty AS realQty,
|
||||
dor.dw AS dw,
|
||||
dor.sap_no AS sapNo,
|
||||
dor.gys_mc AS gysMc,
|
||||
dor.remark AS remark
|
||||
FROM delivery_order dor
|
||||
WHERE (dor.is_delete = '0' OR dor.is_delete = 0 OR dor.is_delete IS NULL)
|
||||
AND dor.order_no = #{value}
|
||||
ORDER BY dor.id ASC
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 供 VO 使用:按单号查附件 -->
|
||||
@@ -584,9 +575,10 @@
|
||||
<select id="selectGroupList"
|
||||
parameterType="com.delivery.project.document.domain.DeliveryOrder"
|
||||
resultType="com.delivery.project.document.domain.vo.DeliveryOrderGroupVO">
|
||||
|
||||
SELECT
|
||||
dor.order_no AS orderNo,
|
||||
MAX(dor.bill_no_ck) AS billNoCk,
|
||||
MAX(dor.bill_no) AS billNo,
|
||||
MIN(dor.delivery_date) AS deliveryDate,
|
||||
MAX(dor.origin_name) AS originName,
|
||||
MAX(dor.dest_name) AS destName,
|
||||
@@ -596,7 +588,9 @@
|
||||
COUNT(1) AS itemCount,
|
||||
SUM(dor.real_qty) AS totalQty,
|
||||
MAX(dor.order_status) AS orderStatus
|
||||
|
||||
FROM delivery_order dor
|
||||
|
||||
<where>
|
||||
(dor.is_delete = '0' OR dor.is_delete = 0 OR dor.is_delete IS NULL)
|
||||
|
||||
@@ -610,21 +604,26 @@
|
||||
|
||||
<!-- 没有多选时,再走单个状态查询 -->
|
||||
<if test="(orderStatusList == null or orderStatusList.size == 0)
|
||||
and orderStatus != null and orderStatus != ''">
|
||||
and orderStatus != null and orderStatus != ''">
|
||||
AND dor.order_status = #{orderStatus}
|
||||
</if>
|
||||
|
||||
<if test="plateNo != null and plateNo != ''">
|
||||
AND dor.plate_no = #{plateNo}
|
||||
</if>
|
||||
|
||||
<if test="deliveryDate != null">
|
||||
AND DATE(dor.delivery_date) = DATE(#{deliveryDate})
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
GROUP BY dor.order_no
|
||||
ORDER BY MAX(dor.create_time) DESC
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 详情:同单号所有行(带附件 + makerUserName) -->
|
||||
<select id="selectByOrderNo"
|
||||
parameterType="string"
|
||||
@@ -646,17 +645,16 @@
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<!-- ======================== 插入 ======================== -->
|
||||
|
||||
<!-- 单条插入 -->
|
||||
<insert id="insertDeliveryOrder"
|
||||
parameterType="com.delivery.project.document.domain.DeliveryOrder"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
insert into delivery_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null">order_no,</if>
|
||||
<if test="billNoCk != null">bill_no_ck,</if>
|
||||
<if test="rkInfoId != null">rk_info_id,</if>
|
||||
<if test="billNo != null">bill_no,</if>
|
||||
<if test="rkRecordId != null">rk_record_id,</if>
|
||||
<if test="makerId != null">maker_id,</if>
|
||||
<if test="receiveStatus != null">receive_status,</if>
|
||||
<if test="receiveProblem != null">receive_problem,</if>
|
||||
@@ -670,6 +668,7 @@
|
||||
<if test="sapNo != null">sap_no,</if>
|
||||
<if test="gysMc != null">gys_mc,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
|
||||
<if test="originName != null">origin_name,</if>
|
||||
<if test="originLng != null">origin_lng,</if>
|
||||
<if test="originLat != null">origin_lat,</if>
|
||||
@@ -687,6 +686,7 @@
|
||||
<if test="receiverName != null">receiver_name,</if>
|
||||
<if test="receiverPhone != null">receiver_phone,</if>
|
||||
<if test="receiverOrgName != null">receiver_org_name,</if>
|
||||
|
||||
<if test="deliveryTon != null">delivery_ton,</if>
|
||||
<if test="goodsSize != null">goods_size,</if>
|
||||
<if test="orderStatus != null">order_status,</if>
|
||||
@@ -705,10 +705,11 @@
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
|
||||
<if test="billNoCk != null">#{billNoCk},</if>
|
||||
<if test="rkInfoId != null">#{rkInfoId},</if>
|
||||
<if test="billNo != null">#{billNo,jdbcType=VARCHAR},</if>
|
||||
<if test="rkRecordId != null">#{rkRecordId},</if>
|
||||
<if test="makerId != null">#{makerId},</if>
|
||||
<if test="receiveStatus != null">#{receiveStatus},</if>
|
||||
<if test="receiveProblem != null">#{receiveProblem},</if>
|
||||
@@ -722,6 +723,7 @@
|
||||
<if test="sapNo != null">#{sapNo},</if>
|
||||
<if test="gysMc != null">#{gysMc},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
|
||||
<if test="originName != null">#{originName},</if>
|
||||
<if test="originLng != null">#{originLng},</if>
|
||||
<if test="originLat != null">#{originLat},</if>
|
||||
@@ -739,6 +741,7 @@
|
||||
<if test="receiverName != null">#{receiverName},</if>
|
||||
<if test="receiverPhone != null">#{receiverPhone},</if>
|
||||
<if test="receiverOrgName != null">#{receiverOrgName},</if>
|
||||
|
||||
<if test="deliveryTon != null">#{deliveryTon},</if>
|
||||
<if test="goodsSize != null">#{goodsSize},</if>
|
||||
<if test="orderStatus != null">#{orderStatus},</if>
|
||||
@@ -757,12 +760,13 @@
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO delivery_order
|
||||
(order_no, bill_no_ck, rk_info_id, maker_id, receive_status, receive_problem,
|
||||
(order_no, bill_no, rk_record_id, maker_id, receive_status, receive_problem,
|
||||
xm_ms, xm_no, wl_no, wl_ms, real_qty, dw, sap_no, gys_mc, remark,
|
||||
origin_name, origin_lng, origin_lat,
|
||||
dest_name, dest_lng, dest_lat,
|
||||
@@ -777,27 +781,59 @@
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(
|
||||
#{it.orderNo},
|
||||
#{it.billNoCk},
|
||||
#{it.rkInfoId},
|
||||
#{it.billNo},
|
||||
#{it.rkRecordId},
|
||||
#{it.makerId},
|
||||
#{it.receiveStatus},
|
||||
#{it.receiveProblem},
|
||||
|
||||
#{it.xmMs}, #{it.xmNo}, #{it.wlNo}, #{it.wlMs}, #{it.realQty}, #{it.dw},
|
||||
#{it.sapNo}, #{it.gysMc}, #{it.remark},
|
||||
#{it.xmMs},
|
||||
#{it.xmNo},
|
||||
#{it.wlNo},
|
||||
#{it.wlMs},
|
||||
#{it.realQty},
|
||||
#{it.dw},
|
||||
#{it.sapNo},
|
||||
#{it.gysMc},
|
||||
#{it.remark},
|
||||
|
||||
#{it.originName}, #{it.originLng}, #{it.originLat},
|
||||
#{it.destName}, #{it.destLng}, #{it.destLat},
|
||||
#{it.originName},
|
||||
#{it.originLng},
|
||||
#{it.originLat},
|
||||
|
||||
#{it.deliveryDate}, #{it.plateNo},
|
||||
#{it.driverName}, #{it.driverPhone},
|
||||
#{it.shipperName}, #{it.shipperPhone}, #{it.receiverName}, #{it.receiverPhone}, #{it.receiverOrgName},
|
||||
#{it.destName},
|
||||
#{it.destLng},
|
||||
#{it.destLat},
|
||||
|
||||
#{it.deliveryTon}, #{it.goodsSize}, #{it.orderStatus},
|
||||
#{it.vehicleTypeId}, #{it.vehicleTypeName},
|
||||
#{it.deliveryDate},
|
||||
#{it.plateNo},
|
||||
|
||||
#{it.suggestFee}, #{it.actualFee}, #{it.tollFee}, #{it.totalKm},
|
||||
#{it.createBy}, #{it.createTime}, #{it.updateBy}, #{it.updateTime}, #{it.isDelete}
|
||||
#{it.driverName},
|
||||
#{it.driverPhone},
|
||||
|
||||
#{it.shipperName},
|
||||
#{it.shipperPhone},
|
||||
#{it.receiverName},
|
||||
#{it.receiverPhone},
|
||||
#{it.receiverOrgName},
|
||||
|
||||
#{it.deliveryTon},
|
||||
#{it.goodsSize},
|
||||
#{it.orderStatus},
|
||||
|
||||
#{it.vehicleTypeId},
|
||||
#{it.vehicleTypeName},
|
||||
|
||||
#{it.suggestFee},
|
||||
#{it.actualFee},
|
||||
#{it.tollFee},
|
||||
#{it.totalKm},
|
||||
|
||||
#{it.createBy},
|
||||
#{it.createTime},
|
||||
#{it.updateBy},
|
||||
#{it.updateTime},
|
||||
#{it.isDelete}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -805,10 +841,12 @@
|
||||
<!-- ======================== 更新 ======================== -->
|
||||
<update id="updateDeliveryOrder"
|
||||
parameterType="com.delivery.project.document.domain.DeliveryOrder">
|
||||
|
||||
UPDATE delivery_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
||||
<if test="rkInfoId != null">rk_info_id = #{rkInfoId},</if>
|
||||
|
||||
<if test="billNo != null">bill_no = #{billNo},</if>
|
||||
<if test="rkRecordId != null">rk_record_id = #{rkRecordId},</if>
|
||||
<if test="makerId != null">maker_id = #{makerId},</if>
|
||||
<if test="receiveStatus != null">receive_status = #{receiveStatus},</if>
|
||||
<if test="receiveProblem != null">receive_problem = #{receiveProblem},</if>
|
||||
@@ -858,10 +896,14 @@
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
|
||||
</trim>
|
||||
|
||||
WHERE order_no = #{orderNo}
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
<!-- ======================== 删除 ======================== -->
|
||||
<delete id="deleteDeliveryOrderById" parameterType="java.lang.Long">
|
||||
delete from delivery_order where id = #{id}
|
||||
|
||||
Reference in New Issue
Block a user