配送系统接口修改

添加总金额字段
施工队导入逻辑修改
This commit is contained in:
2026-02-03 11:25:35 +08:00
parent 009901d5ee
commit c880e5f48a
15 changed files with 182 additions and 60 deletions

View File

@@ -122,6 +122,7 @@ public class SecurityConfig
"/AutoInventory/**",
"/ws/**",
"/photo/**",
"/wisdom/bill/delivery/list",
"/wisdom/record/**",
"/wisdom/stock/**",
"/system/media/**",

View File

@@ -25,7 +25,7 @@ public class ConstructionTeam extends BaseEntity
private String teamName;
/** 施工队编号 */
@Excel(name = "施工队编号")
// @Excel(name = "施工队编号")
private String teamCode;
/** 创建人 */

View File

@@ -146,26 +146,17 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService
StringBuilder failureMsg = new StringBuilder();
Date now = new Date();
// ===== ① Excel 内去重 =====
Set<String> teamCodeSet = new HashSet<>();
// ===== ① Excel 内名称去重 =====
Set<String> teamNameSet = new HashSet<>();
for (ConstructionTeam team : teamList)
{
String teamCode = team.getTeamCode();
String teamName = team.getTeamName();
if (StringUtils.isBlank(teamCode) || StringUtils.isBlank(teamName))
if (StringUtils.isBlank(teamName))
{
failureNum++;
failureMsg.append("<br/>施工队名称/编号不能为空,已跳过。");
continue;
}
if (!teamCodeSet.add(teamCode))
{
failureNum++;
failureMsg.append("<br/>施工队编号重复Excel 内):").append(teamCode);
failureMsg.append("<br/>施工队名称不能为空,已跳过。");
continue;
}
@@ -177,28 +168,17 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService
}
}
// ===== ② 数据库内去重 =====
// ===== ② 数据库校验 + 自动生成编号 =====
for (ConstructionTeam team : teamList)
{
try
{
// 跳过前面校验失败的数据
if (StringUtils.isBlank(team.getTeamCode()) || StringUtils.isBlank(team.getTeamName()))
if (StringUtils.isBlank(team.getTeamName()))
{
continue;
}
// 按编号查
ConstructionTeam existByCode =
constructionTeamMapper.selectByTeamCode(team.getTeamCode());
if (existByCode != null)
{
failureNum++;
failureMsg.append("<br/>施工队编号已存在:").append(team.getTeamCode());
continue;
}
// 按名称查
// 按名称查重
ConstructionTeam existByName =
constructionTeamMapper.selectByTeamName(team.getTeamName());
if (existByName != null)
@@ -208,6 +188,14 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService
continue;
}
// ===== 自动生成唯一编号 =====
String code;
do {
code = generateTeamCode();
} while (constructionTeamMapper.selectByTeamCode(code) != null);
team.setTeamCode(code);
// ===== 新增 =====
team.setCreatedBy(operName);
team.setCreatedAt(now);
@@ -226,9 +214,7 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService
catch (Exception e)
{
failureNum++;
failureMsg.append("<br/>施工队编号")
.append(team.getTeamCode())
.append(",施工队名称:")
failureMsg.append("<br/>施工队名称")
.append(team.getTeamName())
.append(" 导入失败:")
.append(e.getMessage());
@@ -245,5 +231,4 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService
return "导入成功,共 " + successNum + " 条数据";
}
}

View File

@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.github.pagehelper.PageHelper;
import com.zg.project.wisdom.domain.dto.BorrowReturnDTO;
import com.zg.project.wisdom.domain.dto.RkBillCreateDTO;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -136,4 +137,20 @@ public class RkBillController extends BaseController
return toAjax(rkBillService.returnBorrow(dto));
}
/**
* 配送出库单据查询
* @param
* @return
*/
@GetMapping("/delivery/list")
public AjaxResult listDelivery(RkBill query) {
query.setIsDelivery("1");
List<DeliveryBillVO> list = rkBillService.selectDeliveryBillList(query);
return AjaxResult.success(list);
}
}

View File

@@ -127,6 +127,15 @@ public class RkInfo extends BaseEntity
@Excel(name = "供应商名称")
private String gysMc;
/** SAP订单编号 */
@Excel(name = "SAP订单编号")
private String sapNo;
/** 行号 */
@Excel(name = "行号")
private String xh;
/** 计划交货金额 */
@Excel(name = "计划交货金额")
@JsonSerialize(using = BigDecimalSerializer.class)
@@ -137,14 +146,6 @@ public class RkInfo extends BaseEntity
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal htDj;
/** SAP订单编号 */
@Excel(name = "SAP订单编号")
private String sapNo;
/** 行号 */
@Excel(name = "行号")
private String xh;
/** 计划交货数量 */
@Excel(name = "计划交货数量")
@JsonSerialize(using = BigDecimalSerializer.class)
@@ -164,6 +165,11 @@ public class RkInfo extends BaseEntity
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal realQty;
/** 导出用:总金额 = realQty * htDj不落库 */
@Excel(name = "总金额")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal totalAmount;
/** 库位码 */
@Excel(name = "库位码")
private String pcode;
@@ -579,6 +585,14 @@ public class RkInfo extends BaseEntity
return realQty;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public void setPcode(String pcode)
{
this.pcode = pcode;
@@ -846,6 +860,7 @@ public class RkInfo extends BaseEntity
.append("isUpdate", getIsUpdate())
.append("startDate", startDate)
.append("endDate", endDate)
.append("totalAmount", totalAmount)
.toString();
}
}

View File

@@ -142,6 +142,14 @@ public class RkRecord extends BaseEntity
@Excel(name = "供应商名称")
private String gysMc;
/** SAP订单编号 */
@Excel(name = "SAP订单编号")
private String sapNo;
/** 行号 */
@Excel(name = "行号")
private String xh;
/** 计划交货金额 */
@Excel(name = "计划交货金额")
@JsonSerialize(using = BigDecimalSerializer.class)
@@ -152,14 +160,6 @@ public class RkRecord extends BaseEntity
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal htDj;
/** SAP订单编号 */
@Excel(name = "SAP订单编号")
private String sapNo;
/** 行号 */
@Excel(name = "行号")
private String xh;
/** 计划交货数量 */
@Excel(name = "计划交货数量")
@JsonSerialize(using = BigDecimalSerializer.class)
@@ -179,6 +179,11 @@ public class RkRecord extends BaseEntity
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal realQty;
/** 导出用:总金额 = realQty * htDj不落库 */
@Excel(name = "总金额")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal totalAmount;
/** 库位码 */
@Excel(name = "库位码")
private String pcode;
@@ -606,6 +611,14 @@ public class RkRecord extends BaseEntity
return realQty;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public void setPcode(String pcode)
{
this.pcode = pcode;
@@ -864,6 +877,7 @@ public class RkRecord extends BaseEntity
.append("htQty", getHtQty())
.append("dw", getDw())
.append("realQty", getRealQty())
.append("totalAmount", totalAmount)
.append("pcode", getPcode())
.append("pcodeId", getPcodeId())
.append("trayCode", getTrayCode())

View File

@@ -0,0 +1,39 @@
package com.zg.project.wisdom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zg.project.wisdom.domain.RkRecord;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 待配送出库单据 VO
* 以 rk_bill 为主 + 多条 rk_record 明细
*/
@Data
public class DeliveryBillVO implements Serializable {
/** 单据号(对应 rk_bill.bill_no */
private String billNo;
/** 施工队编码 */
private String teamCode;
/** 施工队名称 */
private String teamName;
/** 理货员名称 */
private String operatorName;
/** 出库/操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date operationTime;
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
private String isDelivery;
/** 该单据下的货物明细 */
private List<RkRecord> recordList;
}

View File

@@ -145,4 +145,8 @@ public interface RkRecordMapper
* */
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
/**
* 根据单据号查询出入库记录
* */
List<RkRecord> selectByBillNo(String billNo);
}

View File

@@ -4,6 +4,7 @@ import java.util.List;
import com.zg.project.wisdom.domain.RkBill;
import com.zg.project.wisdom.domain.dto.BorrowReturnDTO;
import com.zg.project.wisdom.domain.dto.RkBillCreateDTO;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
/**
* 库存单据Service接口
@@ -77,4 +78,11 @@ public interface IRkBillService
* 还料入库
*/
int returnBorrow(BorrowReturnDTO dto);
/**
* 配送出库单据查询
* @param
* @return
*/
List<DeliveryBillVO> selectDeliveryBillList(RkBill query);
}

View File

@@ -1,6 +1,7 @@
package com.zg.project.wisdom.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -18,6 +19,7 @@ import com.zg.project.wisdom.domain.RkRecord;
import com.zg.project.wisdom.domain.dto.BorrowReturnDTO;
import com.zg.project.wisdom.domain.dto.BorrowReturnItemDTO;
import com.zg.project.wisdom.domain.dto.RkBillCreateDTO;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import com.zg.project.wisdom.mapper.GysJhMapper;
import com.zg.project.wisdom.mapper.RkInfoMapper;
import com.zg.project.wisdom.mapper.RkRecordMapper;
@@ -697,4 +699,29 @@ public class RkBillServiceImpl implements IRkBillService
return dto.getItems().size();
}
@Override
public List<DeliveryBillVO> selectDeliveryBillList(RkBill query) {
// 1. 查询出库单据
List<RkBill> billList = rkBillMapper.selectRkBillList(query);
List<DeliveryBillVO> result = new ArrayList<>();
for (RkBill bill : billList) {
DeliveryBillVO vo = new DeliveryBillVO();
BeanUtils.copyProperties(bill, vo);
// 2. 查询该单据对应的record明细
List<RkRecord> records =
rkRecordMapper.selectByBillNo(bill.getBillNo());
vo.setRecordList(records);
result.add(vo);
}
return result;
}
}

View File

@@ -8,6 +8,7 @@ spring:
master:
# url: jdbc:mysql://47.100.212.83:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.28:3306/wisdomnew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.251:3306/wisdomnew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8

View File

@@ -16,7 +16,7 @@ zg:
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8086
port: 8087
servlet:
# 应用的访问路径
context-path: /

View File

@@ -117,7 +117,7 @@
AND rb.bill_no = #{billNo}
</if>
<if test="operationType != null and operationType != ''">
<if test="operationType != null and operationType.trim() != ''">
AND rb.operation_type = #{operationType}
</if>

View File

@@ -43,6 +43,7 @@
<result property="htQty" column="ht_qty"/>
<result property="dw" column="dw"/>
<result property="realQty" column="real_qty"/>
<result property="totalAmount" column="total_amount"/>
<result property="pcode" column="pcode"/>
<result property="pcodeId" column="pcode_id"/>
<result property="trayCode" column="tray_code"/>
@@ -72,32 +73,27 @@
SELECT
ri.*,
/* 出入库类型名称 */
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
/* ===== 新增:计算总金额 ===== */
ri.real_qty * ri.ht_dj AS total_amount,
/* 物资类型名称 */
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
mt.type_name AS wl_type_name,
/* 仓库信息 */
wh.warehouse_name,
wh.parent_warehouse_code,
wh.parent_warehouse_name,
/* 理货员 */
su.nick_name AS operator_name,
/* 库龄 */
DATEDIFF(CURRENT_DATE, ri.operation_time) AS stock_age
FROM rk_info ri
LEFT JOIN stock_in_type sit ON ri.operation_type = sit.type_code
LEFT JOIN stock_out_type sot ON ri.operation_type = sot.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN sys_user su ON ri.operator = su.user_id
</sql>
<!-- ========================= 查询列表 ========================= -->
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
@@ -181,7 +177,10 @@
parameterType="java.util.List"
resultMap="RkInfoResult">
SELECT
ri.*
ri.*,
ri.real_qty * ri.ht_dj AS total_amount
FROM rk_info ri
WHERE ri.id IN
<foreach collection="rkInfoIds" item="id" open="(" separator="," close=")">

View File

@@ -53,7 +53,7 @@
<result property="htQty" column="ht_qty"/>
<result property="dw" column="dw"/>
<result property="realQty" column="real_qty"/>
<result property="totalAmount" column="total_amount"/>
<result property="pcode" column="pcode"/>
<result property="pcodeId" column="pcode_id"/>
<result property="trayCode" column="tray_code"/>
@@ -89,6 +89,9 @@
SELECT
rr.*,
/* ===== 新增:统一计算总金额 ===== */
rr.real_qty * rr.ht_dj AS total_amount,
su.nick_name AS operator_name,
mt.type_name AS wl_type_name,
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
@@ -96,7 +99,7 @@
-- 小仓
wh.warehouse_name AS warehouse_name,
-- ✅ 大仓(直接取小仓行里的父仓字段)
-- 大仓
wh.parent_warehouse_code AS parent_warehouse_code,
wh.parent_warehouse_name AS parent_warehouse_name,
@@ -723,4 +726,13 @@
</where>
</select>
<select id="selectByBillNo"
resultMap="RkRecordResult">
SELECT *
FROM rk_record
WHERE bill_no = #{billNo}
AND is_delete = '0'
</select>
</mapper>