新增配合配送系统远程调用接口

This commit is contained in:
2025-11-25 16:30:46 +08:00
parent b294cc41e1
commit f338e53883
10 changed files with 299 additions and 126 deletions

View File

@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import com.github.pagehelper.PageHelper;
import com.zg.project.wisdom.domain.dto.*;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -55,7 +56,7 @@ public class RkInfoController extends BaseController
@ApiOperation("按单据分组bill_no列表若存在出库则同时返回 bill_no_ck")
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
// @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
@PostMapping("/bill/groups")
public TableDataInfo billGroups(@RequestBody RkInfoQueryDTO query) {
// 分页
@@ -226,10 +227,12 @@ public class RkInfoController extends BaseController
* @param
* @return
*/
@Log(title = "配送出库单据查询", businessType = BusinessType.OTHER)
@GetMapping("/delivery")
public AjaxResult listAllForDelivery(RkInfo query) {
List<RkInfo> list = rkInfoService.selectDeliveryAll(query);
@GetMapping("/delivery/list")
public AjaxResult listDelivery(RkInfo query) {
// 保险起见,这里强制条件(也可以在 service 里写死)
query.setIsChuku("1");
query.setIsDelivery("1");
List<DeliveryBillVO> list = rkInfoService.selectDeliveryBillList(query);
return AjaxResult.success(list);
}
@@ -297,4 +300,16 @@ public class RkInfoController extends BaseController
return AjaxResult.success("追加入库成功");
}
@PostMapping("/updateDeliveryStatus")
public AjaxResult updateDeliveryStatus(@RequestBody RkDeliveryUpdateDTO dto) {
if (dto.getBillNoCk() == null) {
return AjaxResult.error("出库单据号不能为空");
}
int rows = rkInfoService.updateDeliveryStatus(dto.getBillNoCk(), dto.getIsDelivery());
return AjaxResult.success(rows);
}
}

View File

@@ -101,7 +101,7 @@ public class RkInfo extends BaseEntity
private String billNoCk;
/** 是否需要配送(0否 1是) */
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是")
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
private String isDelivery;
/** 县局 */

View File

@@ -0,0 +1,9 @@
package com.zg.project.wisdom.domain.dto;
import lombok.Data;
@Data
public class RkDeliveryUpdateDTO {
private String billNoCk;
private Integer isDelivery; // 0否 1是 2配送中 3已完成
}

View File

@@ -0,0 +1,32 @@
package com.zg.project.wisdom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zg.project.wisdom.domain.RkInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 待配送出库单据 VO1 对多:一个出库单据 + 多条货物明细)
*/
@Data
public class DeliveryBillVO implements Serializable {
/** 出库单据号rk_info.bill_no_ck */
private String billNoCk;
/** 领货人(出库理货员) */
private String ckLihuoY;
/** 施工队/出库班组 */
private String teamCode;
/** 领用时间(出库时间) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lyTime;
/** 该出库单据下的所有货物明细 */
private List<RkInfo> detailList;
}

View File

@@ -222,14 +222,6 @@ public interface RkInfoMapper
List<RkInfo> listRkInfoByPcode(String pcode);
/**
* 获取需要配送的出库单
* @param query
* @return
*/
List<RkInfo> selectDeliveryAll(RkInfo query);
/**
* 查询 rk_info 全量明细(仅未删除)
*/
@@ -240,4 +232,15 @@ public interface RkInfoMapper
int updateBillInfo(RkInfo query);
/**
* 修改出库单据状态
*/
int updateDeliveryStatus(@Param("billNoCk") String billNoCk,
@Param("isDelivery") Integer isDelivery);
/**
* 查询出库单据
*/
List<RkInfo> selectDeliveryCkList(@Param("q") RkInfo query);
}

View File

@@ -7,6 +7,7 @@ import com.zg.project.Inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.vo.ChartDataVO;
import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.*;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
/**
@@ -156,13 +157,6 @@ public interface IRkInfoService
*/
List<RkInfo> listRkInfoByPcode(String pcode);
/**
* 获取需要配送的出库列表
* @param query
* @return
*/
List<RkInfo> selectDeliveryAll(RkInfo query);
/**
* 分页查询 rk_info 所有明细(仅未删除)
*/
@@ -179,4 +173,19 @@ public interface IRkInfoService
* @param dto
*/
void appendToExistingBill(PcRkInfoBatchDTO dto);
/**
* 修改出库单的配送状态
* @param billNoCk
* @param isDelivery
* @return
*/
int updateDeliveryStatus(String billNoCk, Integer isDelivery);
/**
* 获取指定出库单的配送信息
* @param
* @return
*/
List<DeliveryBillVO> selectDeliveryBillList(RkInfo query);
}

View File

@@ -23,6 +23,7 @@ import com.zg.project.system.service.ISysConfigService;
import com.zg.project.wisdom.domain.AuditSignature;
import com.zg.project.wisdom.domain.GysJh;
import com.zg.project.wisdom.domain.dto.*;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import com.zg.project.wisdom.mapper.AuditSignatureMapper;
import com.zg.project.wisdom.mapper.GysJhMapper;
import com.zg.project.wisdom.utils.BillNoUtil;
@@ -991,15 +992,6 @@ public class RkInfoServiceImpl implements IRkInfoService
return rkInfoMapper.listRkInfoByPcode(pcode);
}
/**
* 获取需要配送的出库列表
* @param query
* @return
*/
@Override
public List<RkInfo> selectDeliveryAll(RkInfo query) {
return rkInfoMapper.selectDeliveryAll(query);
}
@Override
public List<RkInfo> selectAllRkInfo(RkInfo query) {
@@ -1134,4 +1126,44 @@ public class RkInfoServiceImpl implements IRkInfoService
}
}
}
@Override
public int updateDeliveryStatus(String billNoCk, Integer isDelivery) {
return rkInfoMapper.updateDeliveryStatus(billNoCk, isDelivery);
}
@Override
public List<DeliveryBillVO> selectDeliveryBillList(RkInfo query) {
// 先查出所有符合条件的明细
List<RkInfo> list = rkInfoMapper.selectDeliveryCkList(query);
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
// 按 billNoCk 分组:一个单据对应一组明细
Map<String, DeliveryBillVO> map = new LinkedHashMap<>();
for (RkInfo item : list) {
String billNoCk = item.getBillNoCk();
// 兜底:如果 bill_no_ck 为空,就用 bill_no
if (StringUtils.isEmpty(billNoCk)) {
billNoCk = item.getBillNo();
}
DeliveryBillVO vo = map.get(billNoCk);
if (vo == null) {
vo = new DeliveryBillVO();
vo.setBillNoCk(billNoCk);
vo.setCkLihuoY(item.getCkLihuoY());
vo.setTeamCode(item.getTeamCode());
vo.setLyTime(item.getLyTime());
vo.setDetailList(new ArrayList<>());
map.put(billNoCk, vo);
}
vo.getDetailList().add(item);
}
return new ArrayList<>(map.values());
}
}

View File

@@ -7,9 +7,9 @@ spring:
# 主库数据源
master:
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.20:3306/wisdom?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
url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: shzg

View File

@@ -69,8 +69,8 @@ spring:
redis:
# 地址
# host: 101.132.133.142
host: 192.168.1.20
# host: 192.168.1.251
# host: 192.168.1.28
host: 192.168.1.251
# host: localhost
# 端口默认为6379
port: 6379

View File

@@ -387,36 +387,64 @@
a.ly_time,
a.ck_lihuo_y,
u.user_name AS ck_lihuo_y_name,
ru.user_name AS lihuo_y_name
ru.user_name AS lihuo_y_name,
a.is_delivery AS is_delivery
FROM (
SELECT
MIN(t.id) AS id,
t.bill_no AS bill_no,
MIN(t.bill_no_ck) AS bill_no_ck,
MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type,
MIN(t.cangku) AS cangku,
MIN(t.rk_time) AS rk_time,
MIN(t.lihuo_y) AS lihuo_y,
MAX(t.is_chuku) AS is_chuku,
MIN(t.xj) AS xj,
MIN(t.xm_no) AS xm_no,
MIN(t.xm_ms) AS xm_ms,
MIN(t.xm_no_ck) AS xm_no_ck,
MIN(t.xm_ms_ck) AS xm_ms_ck,
MIN(t.gys_mc) AS gys_mc,
MIN(t.wl_no) AS wl_no,
MIN(t.wl_ms) AS wl_ms,
MIN(t.gys_no) AS gys_no,
MIN(t.sap_no) AS sap_no,
MIN(t.ck_type) AS ck_type,
MAX(t.ly_time) AS ly_time,
MIN(t.ck_lihuo_y) AS ck_lihuo_y
MIN(t.id) AS id,
t.bill_no AS bill_no,
MIN(t.bill_no_ck) AS bill_no_ck,
MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type,
MIN(t.cangku) AS cangku,
MIN(t.rk_time) AS rk_time,
MIN(t.lihuo_y) AS lihuo_y,
MAX(t.is_chuku) AS is_chuku,
MIN(t.xj) AS xj,
MIN(t.xm_no) AS xm_no,
MIN(t.xm_ms) AS xm_ms,
MIN(t.xm_no_ck) AS xm_no_ck,
MIN(t.xm_ms_ck) AS xm_ms_ck,
MIN(t.gys_mc) AS gys_mc,
MIN(t.wl_no) AS wl_no,
MIN(t.wl_ms) AS wl_ms,
MIN(t.gys_no) AS gys_no,
MIN(t.sap_no) AS sap_no,
MIN(t.ck_type) AS ck_type,
MAX(t.ly_time) AS ly_time,
MIN(t.ck_lihuo_y) AS ck_lihuo_y,
MIN(t.is_delivery) AS is_delivery
FROM (
<include refid="selectRkInfoForGroup"/>
SELECT
ri.id,
ri.bill_no,
ri.bill_no_ck,
ri.rk_type,
ri.wl_type,
ri.cangku,
ri.rk_time,
ri.lihuo_y,
ri.is_chuku,
ri.xj,
ri.xm_no,
ri.xm_ms,
ri.xm_no_ck,
ri.xm_ms_ck,
ri.gys_mc,
ri.wl_no,
ri.wl_ms,
ri.gys_no,
ri.sap_no,
ri.ck_type,
ri.ly_time,
ri.ck_lihuo_y,
ri.pcode,
ri.is_delete,
ri.is_delivery
FROM rk_info ri
) t
<where>
<!-- 删除标记默认0 -->
<!-- is_delete -->
<choose>
<when test="q.isDelete != null and q.isDelete != ''">
AND t.is_delete = #{q.isDelete}
@@ -426,7 +454,7 @@
</otherwise>
</choose>
<!-- is_chuku 优先列表,其次单值 -->
<!-- is_chuku / isChukuList -->
<choose>
<when test="q.isChukuList != null and q.isChukuList.size > 0">
AND t.is_chuku IN
@@ -439,7 +467,7 @@
</when>
</choose>
<!-- 关键词模糊 -->
<!-- keyword -->
<if test="q.keyword != null and q.keyword != ''">
AND (
t.xm_no LIKE concat('%', #{q.keyword}, '%')
@@ -456,39 +484,42 @@
)
</if>
<!-- 维度筛选 -->
<!-- 维度 -->
<if test="q.rkType != null and q.rkType != ''"> AND t.rk_type LIKE concat('%', #{q.rkType}, '%') </if>
<if test="q.wlType != null and q.wlType != ''"> AND t.wl_type LIKE concat('%', #{q.wlType}, '%') </if>
<if test="q.cangku != null and q.cangku != ''"> AND t.cangku LIKE concat('%', #{q.cangku}, '%') </if>
<!-- 入库/领用时间范围(闭区间) -->
<!-- 时间 -->
<if test="q.startTime != null"><![CDATA[ AND t.rk_time >= #{q.startTime} ]]></if>
<if test="q.endTime != null"><![CDATA[ AND t.rk_time <= #{q.endTime} ]]></if>
<if test="q.lyStartTime!= null"><![CDATA[ AND t.ly_time >= #{q.lyStartTime}]]></if>
<if test="q.lyEndTime != null"><![CDATA[ AND t.ly_time <= #{q.lyEndTime} ]]></if>
<!-- 其它等值/模糊 -->
<if test="q.lihuoY != null and q.lihuoY != ''"> AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%') </if>
<if test="q.xj != null and q.xj != ''"> AND t.xj LIKE concat('%', #{q.xj}, '%') </if>
<if test="q.billNo != null and q.billNo != ''"> AND t.bill_no LIKE concat('%', #{q.billNo}, '%') </if>
<!-- 模糊字段 -->
<if test="q.lihuoY != null and q.lihuoY != ''"> AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%') </if>
<if test="q.xj != null and q.xj != ''"> AND t.xj LIKE concat('%', #{q.xj}, '%') </if>
<if test="q.billNo != null and q.billNo != ''"> AND t.bill_no LIKE concat('%', #{q.billNo}, '%') </if>
<if test="q.billNoCk != null and q.billNoCk != ''"> AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%') </if>
<if test="q.xmNo != null and q.xmNo != ''"> AND t.xm_no LIKE concat('%', #{q.xmNo}, '%') </if>
<if test="q.xmMs != null and q.xmMs != ''"> AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%') </if>
<if test="q.wlNo != null and q.wlNo != ''"> AND t.wl_no LIKE concat('%', #{q.wlNo}, '%') </if>
<if test="q.wlMs != null and q.wlMs != ''"> AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%') </if>
<if test="q.gysNo != null and q.gysNo != ''"> AND t.gys_no LIKE concat('%', #{q.gysNo}, '%') </if>
<if test="q.gysMc != null and q.gysMc != ''"> AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%') </if>
<if test="q.sapNo != null and q.sapNo != ''"> AND t.sap_no LIKE concat('%', #{q.sapNo}, '%') </if>
<if test="q.xh != null and q.xh != ''"> AND t.xh LIKE concat('%', #{q.xh}, '%') </if>
<if test="q.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
<if test="q.xmNo != null and q.xmNo != ''"> AND t.xm_no LIKE concat('%', #{q.xmNo}, '%') </if>
<if test="q.xmMs != null and q.xmMs != ''"> AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%') </if>
<if test="q.wlNo != null and q.wlNo != ''"> AND t.wl_no LIKE concat('%', #{q.wlNo}, '%') </if>
<if test="q.wlMs != null and q.wlMs != ''"> AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%') </if>
<if test="q.gysNo != null and q.gysNo != ''"> AND t.gys_no LIKE concat('%', #{q.gysNo}, '%') </if>
<if test="q.gysMc != null and q.gysMc != ''"> AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%') </if>
<if test="q.sapNo != null and q.sapNo != ''"> AND t.sap_no LIKE concat('%', #{q.sapNo}, '%') </if>
<if test="q.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
<!-- 若查询出库单据,则要求已生成出库单号 -->
<if test="(q.isChuku != null and q.isChuku == 1)
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains(1))">
<if test="q.isDelivery != null and q.isDelivery != ''">
AND t.is_delivery = #{q.isDelivery}
</if>
<!-- 出库才要求 bill_no_ck 非空 -->
<if test="(q.isChuku != null and q.isChuku == '1')
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains('1'))">
AND t.bill_no_ck IS NOT NULL
</if>
<!-- 审核开启:剔除该 bill_no 下任意一条“审核失败”的明细 -->
<!-- 审核 -->
<if test="needAudit != null and needAudit == 1">
AND NOT EXISTS (
SELECT 1
@@ -507,10 +538,11 @@
LEFT JOIN stock_in_type si ON a.rk_type = si.type_code
LEFT JOIN stock_out_type so ON a.ck_type = so.type_code
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
LEFT JOIN material_type mt ON a.wl_type = mt.type_code
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id
LEFT JOIN material_type mt ON a.wl_type = mt.type_code
LEFT JOIN sys_user ru ON a.lihuo_y = ru.user_id
ORDER BY a.rk_time DESC
</select>
<!-- ================== /按单据分组查询 ================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
@@ -886,50 +918,6 @@
ORDER BY t.rk_time DESC, t.id DESC
</select>
<select id="selectDeliveryAll"
parameterType="com.zg.project.wisdom.domain.RkInfo"
resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
ri.is_delete = '0'
AND ri.is_delivery = '1'
AND ri.is_chuku = '1' <!-- 已出库,待配送 -->
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck = #{billNoCk}
</if>
<if test="ckType != null and ckType != ''">
AND ri.ck_type = #{ckType}
</if>
<if test="teamCode != null and teamCode != ''">
AND ri.team_code = #{teamCode}
</if>
<if test="status != null and status != ''">
AND ri.status = #{status}
</if>
<if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if>
<if test="lyEndTime != null">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if>
<if test="keyword != null and keyword != ''">
AND (
ri.xm_no_ck LIKE CONCAT('%', #{keyword}, '%')
OR ri.xm_ms_ck LIKE CONCAT('%', #{keyword}, '%')
OR ri.wl_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.wl_ms LIKE CONCAT('%', #{keyword}, '%')
OR ri.gys_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.gys_mc LIKE CONCAT('%', #{keyword}, '%')
OR ri.bill_no_ck LIKE CONCAT('%', #{keyword}, '%')
)
</if>
</where>
ORDER BY ri.ly_time DESC, ri.id DESC
</select>
<!-- 分页查询 rk_info 全量明细(支持 keyword 模糊过滤) -->
<select id="selectAllRkInfo"
parameterType="com.zg.project.wisdom.domain.RkInfo"
@@ -1143,6 +1131,84 @@
</where>
</select>
<select id="selectDeliveryCkList"
resultType="com.zg.project.wisdom.domain.RkInfo">
SELECT
id,
gys_jh_id AS gysJhId,
rk_type AS rkType,
wl_type AS wlType,
cangku,
rk_time AS rkTime,
borrow_time AS borrowTime,
return_time AS returnTime,
lihuo_y AS lihuoY,
is_chuku AS isChuku,
bill_no AS billNo,
bill_no_ck AS billNoCk,
is_delivery AS isDelivery,
remark,
xj,
xm_no AS xmNo,
xm_ms AS xmMs,
xm_no_ck AS xmNoCk,
xm_ms_ck AS xmMsCk,
wl_no AS wlNo,
wl_ms AS wlMs,
gys_no AS gysNo,
gys_mc AS gysMc,
jh_amt AS jhAmt,
ht_dj AS htDj,
sap_no AS sapNo,
xh,
jh_qty AS jhQty,
ht_qty AS htQty,
dw,
real_qty AS realQty,
pcode,
pcode_id AS pcodeId,
tray_code AS trayCode,
entity_id AS entityId,
ck_lihuo_y AS ckLihuoY,
ck_type AS ckType,
team_code AS teamCode,
ck_remark AS ckRemark,
ly_time AS lyTime,
has_moved AS hasMoved,
is_borrowed AS isBorrowed,
fycde_1 AS fycde1,
fycde_2 AS fycde2,
is_delete AS isDelete,
create_by AS createBy,
create_time AS createTime,
update_by AS updateBy,
update_time AS updateTime
FROM rk_info
WHERE is_delete = '0'
AND is_chuku = '1'
AND is_delivery = '1'
<!-- 可选过滤:比如你以后想限定县局、项目等 -->
<if test="q.xj != null and q.xj != ''">
AND xj = #{q.xj}
</if>
<if test="q.xmNoCk != null and q.xmNoCk != ''">
AND xm_no_ck = #{q.xmNoCk}
</if>
<if test="q.teamCode != null and q.teamCode != ''">
AND team_code = #{q.teamCode}
</if>
<if test="q.lyStartTime != null">
AND ly_time &gt;= #{q.lyStartTime}
</if>
<if test="q.lyEndTime != null">
AND ly_time &lt;= #{q.lyEndTime}
</if>
ORDER BY bill_no_ck, ly_time, id
</select>
<update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo">
UPDATE rk_info
<set>
@@ -1154,4 +1220,11 @@
WHERE bill_no = #{billNo}
</update>
<update id="updateDeliveryStatus">
UPDATE rk_info
SET is_delivery = #{isDelivery}
WHERE bill_no_ck = #{billNoCk}
AND is_delete = '0'
</update>
</mapper>