feat(wms): 添加父钢卷ID字段和发货报表导出功能
- 在WmsMaterialCoil实体类中添加parentCoilId字段 - 在WmsMaterialCoilBo业务对象中添加parentCoilId字段 - 在WmsMaterialCoilVo视图对象中添加parentCoilId字段 - 在MyBatis映射文件中添加parent_coil_id字段映射 - 实现分卷、切边、合卷操作中设置父钢卷ID的逻辑 - 新增发货报表导出查询方法和对应的SQL映射 - 添加按coilIds联查钢卷发货相关数据的功能 - 实现CSV格式长整型解析工具方法
This commit is contained in:
@@ -149,5 +149,9 @@ public class WmsMaterialCoil extends BaseEntity {
|
||||
* 独占状态(0=未独占,1=特殊分卷中)
|
||||
*/
|
||||
private Integer exclusiveStatus;
|
||||
|
||||
|
||||
// 父钢卷id
|
||||
private String parentCoilId;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,5 +241,8 @@ public class WmsMaterialCoilBo extends BaseEntity {
|
||||
// 接收前端传来是否排序的字段 OrderBy
|
||||
@TableField(exist = false)
|
||||
private Boolean orderBy;
|
||||
|
||||
// 父钢卷id
|
||||
private String parentCoilId;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,5 +352,9 @@ public class WmsMaterialCoilVo extends BaseEntity {
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date bindPlanDate;
|
||||
|
||||
|
||||
// 父钢卷id
|
||||
private String parentCoilId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1138,6 +1138,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
|
||||
validEntityBeforeSave(newCoil);
|
||||
|
||||
// 把老记录的coilId赋值给新纪录的parentCoilId
|
||||
newCoil.setParentCoilId(String.valueOf(oldCoil.getCoilId()));
|
||||
// 插入新记录
|
||||
boolean flag = baseMapper.insert(newCoil) > 0;
|
||||
|
||||
@@ -1419,6 +1421,8 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
newCoil.setQrcodeRecordId(newQrcodeId);
|
||||
|
||||
validEntityBeforeSave(newCoil);
|
||||
// 把老记录的coilId赋值给新纪录的parentCoilId
|
||||
newCoil.setParentCoilId(String.valueOf(oldCoil.getCoilId()));
|
||||
baseMapper.insert(newCoil);
|
||||
newCoils.add(newCoil);
|
||||
|
||||
@@ -1517,6 +1521,18 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
newCoil.setQrcodeRecordId(mergedQrcodeId);
|
||||
|
||||
validEntityBeforeSave(newCoil);
|
||||
// 收集所有参与合卷的原始钢卷ID并用逗号分隔
|
||||
List<Long> parentCoilIds = new ArrayList<>();
|
||||
for (WmsMaterialCoilBo originalCoilBo : bo.getNewCoils()) {
|
||||
if (originalCoilBo.getCoilId() != null) {
|
||||
parentCoilIds.add(originalCoilBo.getCoilId());
|
||||
}
|
||||
}
|
||||
String parentCoilIdsStr = parentCoilIds.stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
newCoil.setParentCoilId(parentCoilIdsStr);
|
||||
|
||||
baseMapper.insert(newCoil);
|
||||
newCoils.add(newCoil);
|
||||
|
||||
@@ -2350,6 +2366,36 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
return wmsMaterialCoilExportVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发货报表导出:按 coilIds 查询钢卷 + 发货单明细/主表/计划联查数据
|
||||
*/
|
||||
@Override
|
||||
public List<WmsMaterialCoilDeliveryExportVo> queryDeliveryExportList(WmsMaterialCoilBo bo) {
|
||||
List<Long> coilIds = parseCsvLongs(bo == null ? null : bo.getCoilIds());
|
||||
if (coilIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return baseMapper.selectDeliveryExportListByCoilIds(coilIds);
|
||||
}
|
||||
|
||||
private List<Long> parseCsvLongs(String csv) {
|
||||
if (StringUtils.isBlank(csv)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String[] arr = csv.split(",");
|
||||
List<Long> list = new ArrayList<>();
|
||||
for (String s : arr) {
|
||||
if (StringUtils.isBlank(s)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
list.add(Long.parseLong(s.trim()));
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
return list.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 钢卷发货
|
||||
* @param coilId
|
||||
|
||||
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="com.klp.domain.WmsMaterialCoil" id="WmsMaterialCoilResult">
|
||||
<result property="coilId" column="coil_id"/>
|
||||
<result property="parentCoilId" column="parent_coil_id"/>
|
||||
<result property="enterCoilNo" column="enter_coil_no"/>
|
||||
<result property="currentCoilNo" column="current_coil_no"/>
|
||||
<result property="supplierCoilNo" column="supplier_coil_no"/>
|
||||
@@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectVoPagePlus" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT
|
||||
mc.coil_id,
|
||||
mc.parent_coil_id,
|
||||
mc.export_time,
|
||||
mc.export_by,
|
||||
mc.enter_coil_no,
|
||||
@@ -441,6 +443,122 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 发货报表导出:按 coilIds 联查钢卷 + 发货单明细 + 发货单主表 + 发货计划 -->
|
||||
<select id="selectDeliveryExportListByCoilIds" resultType="com.klp.domain.vo.WmsMaterialCoilDeliveryExportVo">
|
||||
SELECT
|
||||
-- 钢卷ID
|
||||
mc.coil_id AS coilId,
|
||||
-- 类型(中文显示)
|
||||
CASE
|
||||
WHEN mc.item_type = 'product' THEN '成品'
|
||||
WHEN mc.item_type = 'raw_material' THEN '原料'
|
||||
ELSE mc.item_type
|
||||
END AS itemTypeDesc,
|
||||
mc.item_id AS itemId,
|
||||
mc.data_type AS dataType,
|
||||
w.warehouse_name AS warehouseName,
|
||||
aw.actual_warehouse_name AS actualWarehouseName,
|
||||
mc.enter_coil_no AS enterCoilNo,
|
||||
mc.supplier_coil_no AS supplierCoilNo,
|
||||
mc.current_coil_no AS currentCoilNo,
|
||||
mc.create_time AS createTime,
|
||||
mc.export_time AS exportTime,
|
||||
mc.update_time AS updateTime,
|
||||
mc.net_weight AS netWeight,
|
||||
mc.length AS length,
|
||||
mc.coating_type AS coatingType,
|
||||
mc.temper_grade AS temperGrade,
|
||||
NULL AS purpose,
|
||||
mc.trimming_requirement AS trimmingRequirement,
|
||||
mc.packaging_requirement AS packagingRequirement,
|
||||
mc.quality_status AS qualityStatus,
|
||||
mc.packing_status AS packingStatus,
|
||||
CASE
|
||||
WHEN mc.status = 0 THEN '在库'
|
||||
WHEN mc.status = 1 THEN '已发货'
|
||||
ELSE CAST(mc.status AS CHAR)
|
||||
END AS statusDesc,
|
||||
mc.remark AS remark,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'product' THEN pdt.product_name
|
||||
ELSE NULL
|
||||
END AS itemName,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN pdt.specification
|
||||
ELSE NULL
|
||||
END AS specification,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN pdt.material
|
||||
ELSE NULL
|
||||
END AS material,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN pdt.manufacturer
|
||||
ELSE NULL
|
||||
END AS manufacturer,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN pdt.surface_treatment_desc
|
||||
ELSE NULL
|
||||
END AS surfaceTreatmentDesc,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN pdt.zinc_layer
|
||||
ELSE NULL
|
||||
END AS zincLayer,
|
||||
|
||||
-- 发货计划
|
||||
pl.plan_id AS planId,
|
||||
pl.plan_name AS planName,
|
||||
pl.plan_date AS planDate,
|
||||
|
||||
-- 发货单主表
|
||||
wb.waybill_id AS waybillId,
|
||||
wb.waybill_no AS waybillNo,
|
||||
wb.waybill_name AS waybillName,
|
||||
wb.license_plate AS licensePlate,
|
||||
wb.consignee_unit AS consigneeUnit,
|
||||
wb.sender_unit AS senderUnit,
|
||||
wb.delivery_time AS deliveryTime,
|
||||
wb.weighbridge AS weighbridge,
|
||||
wb.sales_person AS salesPerson,
|
||||
wb.principal AS principal,
|
||||
wb.principal_phone AS principalPhone,
|
||||
wb.status AS waybillStatus,
|
||||
wb.remark AS waybillRemark,
|
||||
|
||||
-- 发货单明细
|
||||
dtl.detail_id AS detailId,
|
||||
dtl.product_name AS detailProductName,
|
||||
dtl.edge_type AS detailEdgeType,
|
||||
dtl.packaging AS detailPackaging,
|
||||
dtl.settlement_type AS detailSettlementType,
|
||||
dtl.raw_material_factory AS detailRawMaterialFactory,
|
||||
dtl.coil_no AS detailCoilNo,
|
||||
dtl.specification AS detailSpecification,
|
||||
dtl.material AS detailMaterial,
|
||||
dtl.quantity AS detailQuantity,
|
||||
dtl.weight AS detailWeight,
|
||||
dtl.unit_price AS detailUnitPrice,
|
||||
dtl.remark AS detailRemark
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON mc.actual_warehouse_id = aw.actual_warehouse_id
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_product pdt ON mc.item_type = 'product' AND mc.item_id = pdt.product_id
|
||||
LEFT JOIN wms_delivery_waybill_detail dtl ON dtl.coil_id = mc.coil_id AND dtl.del_flag = 0
|
||||
LEFT JOIN wms_delivery_waybill wb ON wb.waybill_id = dtl.waybill_id AND wb.del_flag = 0
|
||||
LEFT JOIN wms_delivery_plan pl ON pl.plan_id = wb.plan_id AND pl.del_flag = 0
|
||||
WHERE mc.del_flag = 0
|
||||
AND mc.coil_id IN
|
||||
<foreach collection="coilIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
ORDER BY mc.create_time DESC
|
||||
</select>
|
||||
<!-- 查询重复入场卷号的钢卷信息 -->
|
||||
<select id="selectDuplicateEnterCoilNoList" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT mc.*,
|
||||
|
||||
Reference in New Issue
Block a user