2026-02-02 17:31:52 +08:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.nflg.wms.repository.mapper.WmsShipmentPackagingCodeMapper" >
2026-02-05 18:06:13 +08:00
<update id= "updateStatus" >
UPDATE wms_shipment_packaging_code
2026-02-10 21:38:01 +08:00
SET status=CASE WHEN EXISTS(SELECT id FROM wms_shipment_packaging_code_item WHERE packaging_code_id=wms_shipment_packaging_code."id") THEN 1 ELSE 0 END
2026-02-05 18:06:13 +08:00
where id = #{packagingCodeId}
</update>
<select id= "getVOByCode" resultType= "com.nflg.wms.common.pojo.vo.ShipmentPackagingCodeVO" >
SELECT c.*,di."name" AS "type_name"
FROM wms_shipment_packaging_code c
LEFT JOIN dictionary_item di ON c."type"=di."id"
where c.no=#{code}
<if test= "status!=null" >
and c.status=#{status}
</if>
</select>
<select id= "searchInCar" resultType= "com.nflg.wms.common.pojo.vo.BoxVO" >
SELECT pc.id,d."no" AS "delivery_no",pc."name" AS "box_name",d.plate_number,d.driver_name,d.driver_phone
2026-02-10 21:38:01 +08:00
,pc.status as "box_status",di.create_by as "pack_user",di.create_time as "pack_time"
2026-02-05 18:06:13 +08:00
FROM wms_shipment_packaging_code pc
INNER JOIN wms_shipment_delivery_item di ON di.packaging_code_id=pc."id"
INNER JOIN wms_shipment_delivery d ON di.delivery_id=d."id"
<where >
2026-02-10 21:38:01 +08:00
<if test= "qo.boxStatus != null" >
AND pc.status = #{qo.boxStatus}
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.startDate != null" >
AND di.create_time >= #{qo.startDate}
</if>
<if test= "qo.endDate != null" >
AND di.create_time < = #{qo.endDate}
</if>
<if test= "qo.deliveryNo != null and qo.deliveryNo != ''" >
2026-05-23 17:50:20 +08:00
and d.no ilike concat('%', #{qo.deliveryNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.contractNo != null and qo.contractNo != ''" >
2026-05-23 17:50:20 +08:00
and d.contract_no ilike concat('%', #{qo.contractNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.soNo != null and qo.soNo != ''" >
2026-05-23 17:50:20 +08:00
and d.so_no ilike concat('%', #{qo.soNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.materialDrawingNo != null and qo.materialDrawingNo != ''" >
2026-05-23 17:50:20 +08:00
and d.material_drawing_no ilike concat('%', #{qo.materialDrawingNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.materialNo != null and qo.materialNo != ''" >
2026-05-23 17:50:20 +08:00
and d.material_no ilike concat('%', #{qo.materialNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.deviceNo != null and qo.deviceNo != ''" >
2026-05-23 17:50:20 +08:00
and d.device_no ilike concat('%', #{qo.deviceNo}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.customerName != null and qo.customerName != ''" >
2026-05-23 17:50:20 +08:00
and d.customer_name ilike concat('%', #{qo.customerName}, '%')
2026-02-05 18:06:13 +08:00
</if>
<if test= "qo.plateNumber != null and qo.plateNumber != ''" >
2026-05-23 17:50:20 +08:00
and d.plate_number ilike concat('%', #{qo.plateNumber}, '%')
2026-02-05 18:06:13 +08:00
</if>
</where>
</select>
<select id= "searchForUnload" resultType= "com.nflg.wms.common.pojo.vo.ShipmentPackagingCodeVO" >
SELECT pc.*,di."name" AS "type_name"
FROM wms_shipment_packaging_code pc
LEFT JOIN dictionary_item di ON pc."type"=di."id"
2026-03-05 15:44:51 +08:00
INNER JOIN wms_shipment_delivery_item sdi ON sdi.packaging_code_id=pc."id"
INNER JOIN wms_shipment_delivery d ON sdi.delivery_id=d."id"
2026-02-05 18:06:13 +08:00
where pc.status=3 and d.no=#{code}
</select>
<select id= "getForInstall" resultType= "com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO" >
SELECT mciq."id",mciq."no",mci.material_no,mci.material_describe,mciq.num,mci.unit,mciq.status
FROM wms_shipment_packaging_code_item pci
INNER JOIN wms_shipment_material_code_item_qr mciq ON pci.material_code_item_qr_id=mciq."id"
INNER JOIN wms_shipment_material_code_item mci ON mciq.item_id=mci."id"
where mciq.status!=5 and pci.packaging_code_id=#{id}
</select>
2026-02-06 16:24:01 +08:00
<select id= "getItemsVOById" resultType= "com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeItemVO" >
SELECT mci.material_no,mci.material_describe,mci.num,mciq.num as "actual_num",mci.unit,mci.project_type
,mci.parent_material_describe,mci.production_order_number,mci.box_no,mciq.status
FROM wms_shipment_packaging_code_item pci
INNER JOIN wms_shipment_material_code_item_qr mciq ON pci.material_code_item_qr_id=mciq."id"
INNER JOIN wms_shipment_material_code_item mci ON mciq.item_id=mci."id"
2026-02-10 21:38:01 +08:00
where mciq.status!=5 and pci.packaging_code_id=#{qo.id}
2026-02-06 16:24:01 +08:00
</select>
2026-02-02 17:31:52 +08:00
</mapper>