|
@@ -1510,13 +1510,24 @@
|
|
a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
|
|
a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
|
|
a_s_order.SALE_ORDER_TAX "saleOrderTax",
|
|
a_s_order.SALE_ORDER_TAX "saleOrderTax",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
- a_s_order.INSERT_TIME "insertTime"
|
|
|
|
|
|
+ a_s_order.INSERT_TIME "insertTime",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
|
|
from AMS_SALE_ORDER a_s_order
|
|
from AMS_SALE_ORDER a_s_order
|
|
left join RMS_SHIPPER r_shipper
|
|
left join RMS_SHIPPER r_shipper
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
left join RMS_CONSIGNEE r_consignee
|
|
left join RMS_CONSIGNEE r_consignee
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0
|
|
where a_s_order.SALE_ORDER_STATUS=0 and a_s_order.DELETED=0
|
|
|
|
+ <if test="con != null">
|
|
|
|
+ and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
|
|
|
|
+ </if>
|
|
<if test="consigneeSsoId != null" >
|
|
<if test="consigneeSsoId != null" >
|
|
and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
|
|
and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
|
|
</if>
|
|
</if>
|
|
@@ -1528,6 +1539,24 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="shipperName != null">
|
|
<if test="shipperName != null">
|
|
and
|
|
and
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
@@ -1606,14 +1635,25 @@
|
|
a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
|
|
a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
|
|
a_s_order.SALE_ORDER_TAX "saleOrderTax",
|
|
a_s_order.SALE_ORDER_TAX "saleOrderTax",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
- a_s_order.INSERT_TIME "insertTime"
|
|
|
|
|
|
+ a_s_order.INSERT_TIME "insertTime",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
|
|
from AMS_SALE_ORDER a_s_order
|
|
from AMS_SALE_ORDER a_s_order
|
|
left join RMS_SHIPPER r_shipper
|
|
left join RMS_SHIPPER r_shipper
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
left join RMS_CONSIGNEE r_consignee
|
|
left join RMS_CONSIGNEE r_consignee
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
where a_s_order.SALE_ORDER_STATUS=1
|
|
where a_s_order.SALE_ORDER_STATUS=1
|
|
and a_s_order.DELETED = 0
|
|
and a_s_order.DELETED = 0
|
|
|
|
+ <if test="con != null">
|
|
|
|
+ and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
|
|
|
|
+ </if>
|
|
<if test="consigneeSsoId != null">
|
|
<if test="consigneeSsoId != null">
|
|
and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
|
|
and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
|
|
</if>
|
|
</if>
|
|
@@ -1625,6 +1665,24 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="shipperName != null">
|
|
<if test="shipperName != null">
|
|
and
|
|
and
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
@@ -1841,12 +1899,20 @@
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
- a_s_order.INSERT_UPDATE_REMARK "materialName"
|
|
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel",
|
|
|
|
+ ASM.SALE_WAREHOUSE "saleWareHouse"
|
|
from AMS_SALE_ORDER a_s_order
|
|
from AMS_SALE_ORDER a_s_order
|
|
left join RMS_SHIPPER r_shipper
|
|
left join RMS_SHIPPER r_shipper
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
left join RMS_CONSIGNEE r_consignee
|
|
left join RMS_CONSIGNEE r_consignee
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.DELETED = 0
|
|
and a_s_order.DELETED = 0
|
|
@@ -1873,6 +1939,21 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="statusStr != null">
|
|
<if test="statusStr != null">
|
|
<foreach collection="statusStr" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="statusStr" item="item" open="(" separator="or" close=")">
|
|
and "statusStr" like '%${item}%'
|
|
and "statusStr" like '%${item}%'
|
|
@@ -2092,6 +2173,7 @@
|
|
RM.MATERIAL_NAME as "materialName",
|
|
RM.MATERIAL_NAME as "materialName",
|
|
ASM.MATERIAL_NUMBER as "materialNumber",
|
|
ASM.MATERIAL_NUMBER as "materialNumber",
|
|
ASM.MATERIAL_WEIGHT as "materialWeight",
|
|
ASM.MATERIAL_WEIGHT as "materialWeight",
|
|
|
|
+ ASM.SALE_WAREHOUSE as "saleWareHouse",
|
|
RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
|
|
RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL as "specificationModel",
|
|
RM.MATERIAL_CODE as "materialCode",
|
|
RM.MATERIAL_CODE as "materialCode",
|
|
nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
|
|
nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
|
|
@@ -2262,7 +2344,8 @@
|
|
|
|
|
|
<select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
|
|
<select id="getSaleMaterial" parameterType="java.util.Map" resultType="java.util.Map">
|
|
SELECT * FROM (SELECT
|
|
SELECT * FROM (SELECT
|
|
- RM.MATERIAL_NAME AS "materialName"
|
|
|
|
|
|
+ RM.MATERIAL_NAME AS "materialName",
|
|
|
|
+ ASM.SALE_WAREHOUSE AS "saleWareHouse"
|
|
FROM AMS_SALE_MATERIAL ASM
|
|
FROM AMS_SALE_MATERIAL ASM
|
|
LEFT JOIN RMS_MATERIAL RM
|
|
LEFT JOIN RMS_MATERIAL RM
|
|
ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
@@ -2374,6 +2457,7 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
|
|
<select id="getSaleOrderListToCarrier" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
|
+ SELECT * FROM (
|
|
select DISTINCT * from(
|
|
select DISTINCT * from(
|
|
select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
a_s_order.SALE_NUMBER "saleNumber",
|
|
a_s_order.SALE_NUMBER "saleNumber",
|
|
@@ -2391,8 +2475,11 @@
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
- a_s_order.INSERT_UPDATE_REMARK "materialName",
|
|
|
|
- a_s_order.UPDATE_TIME "updateTime"
|
|
|
|
|
|
+ a_s_order.UPDATE_TIME "updateTime",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
|
|
from AMS_SALE_ORDER a_s_order
|
|
from AMS_SALE_ORDER a_s_order
|
|
left join RMS_SHIPPER r_shipper
|
|
left join RMS_SHIPPER r_shipper
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
@@ -2400,23 +2487,32 @@
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
ON ASOM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_CARRIER RC
|
|
LEFT JOIN RMS_CARRIER RC
|
|
ON RC.CARRIER_ID = ADSO.CARRIER_ID
|
|
ON RC.CARRIER_ID = ADSO.CARRIER_ID
|
|
LEFT JOIN OMSTRUCK_ORDER OO
|
|
LEFT JOIN OMSTRUCK_ORDER OO
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.DELETED = 0
|
|
and a_s_order.DELETED = 0
|
|
and ADSO.DISPATCH_TYPE = 2
|
|
and ADSO.DISPATCH_TYPE = 2
|
|
and OO.ORDER_ID IS NULL
|
|
and OO.ORDER_ID IS NULL
|
|
- <if test="con != null">
|
|
|
|
- and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
|
|
|
|
- </if>
|
|
|
|
<if test="carrierSsoId != null" >
|
|
<if test="carrierSsoId != null" >
|
|
and RC.CARRIER_SSO_ID = #{carrierSsoId}
|
|
and RC.CARRIER_SSO_ID = #{carrierSsoId}
|
|
</if>
|
|
</if>
|
|
|
|
+ ) "CARRIER"
|
|
|
|
+ <where>
|
|
|
|
+ <if test="con != null">
|
|
|
|
+ "CARRIER"."consigneeCompanyName" LIKE #{con} or "CARRIER"."saleNumber" LIKE #{con} or "CARRIER"."saleRemark" LIKE #{con}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
)
|
|
)
|
|
<where>
|
|
<where>
|
|
<if test="saleNumber != null">
|
|
<if test="saleNumber != null">
|
|
@@ -2424,6 +2520,21 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="shipperName != null">
|
|
<if test="shipperName != null">
|
|
and
|
|
and
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
@@ -2518,8 +2629,11 @@
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.SALE_REMARK "saleRemark",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
a_s_order.INSERT_TIME "insertTime",
|
|
a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
|
|
a_s_order.SALE_ORDER_STATUS "saleOrderStatus",
|
|
- a_s_order.SALE_ORDER_STATUS "statusStr",
|
|
|
|
- a_s_order.INSERT_UPDATE_REMARK "materialName"
|
|
|
|
|
|
+ DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "nameSpecificationModel"
|
|
from AMS_SALE_ORDER_CARRIER a_s_o_carrier
|
|
from AMS_SALE_ORDER_CARRIER a_s_o_carrier
|
|
left join RMS_CARRIER r_carrier
|
|
left join RMS_CARRIER r_carrier
|
|
on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
|
|
on r_carrier.CARRIER_ID=a_s_o_carrier.CARRIER_ID
|
|
@@ -2529,6 +2643,10 @@
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
left join RMS_CONSIGNEE r_consignee
|
|
left join RMS_CONSIGNEE r_consignee
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
where a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.CLOSE_STATUS is null
|
|
and a_s_order.DELETED = 0
|
|
and a_s_order.DELETED = 0
|
|
@@ -2545,6 +2663,24 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="shipperName != null">
|
|
<if test="shipperName != null">
|
|
and
|
|
and
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
@@ -2637,10 +2773,16 @@
|
|
ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
|
|
ASO.SALE_ORDER_ISSELF_MENTION AS "isselfMention",
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
- ASO.SALE_ORDER_ID AS "saleOrderId"
|
|
|
|
|
|
+ ASO.SALE_ORDER_ID AS "saleOrderId",
|
|
|
|
+ RM.MATERIAL_NAME AS "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION AS "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL AS "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
@@ -2651,10 +2793,17 @@
|
|
ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
|
|
ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
|
|
LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
WHERE ASO.SALE_ORDER_STATUS IN (2,4)
|
|
WHERE ASO.SALE_ORDER_STATUS IN (2,4)
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ADSO.CARRIER_ID IS NULL
|
|
AND ADSO.CARRIER_ID IS NULL
|
|
AND ASO.DELETED = 0
|
|
AND ASO.DELETED = 0
|
|
|
|
+ <if test="con != null" >
|
|
|
|
+ AND RCO.CONSIGNEE_COMPANY_NAME LIKE #{con}
|
|
|
|
+ </if>
|
|
)
|
|
)
|
|
<where>
|
|
<where>
|
|
<if test="saleNumber != null">
|
|
<if test="saleNumber != null">
|
|
@@ -2663,6 +2812,24 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="truckNo != null">
|
|
<if test="truckNo != null">
|
|
and
|
|
and
|
|
<foreach collection="truckNo" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="truckNo" item="item" open="(" separator="or" close=")">
|
|
@@ -2733,6 +2900,7 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
<select id="getCarrierTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
|
+ SELECT * FROM(
|
|
SELECT DISTINCT *
|
|
SELECT DISTINCT *
|
|
FROM (
|
|
FROM (
|
|
SELECT ASO.SALE_NUMBER AS "saleNumber",
|
|
SELECT ASO.SALE_NUMBER AS "saleNumber",
|
|
@@ -2749,10 +2917,16 @@
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
ASO.SALE_ORDER_ID AS "saleOrderId",
|
|
ASO.SALE_ORDER_ID AS "saleOrderId",
|
|
- RCA.CARRIER_NAME AS "carrierName"
|
|
|
|
|
|
+ RCA.CARRIER_NAME AS "carrierName",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel",
|
|
|
|
+ RM.MATERIAL_NAME AS "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION AS "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL AS "materialModel"
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
@@ -2767,11 +2941,21 @@
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_CARRIER RCA
|
|
LEFT JOIN RMS_CARRIER RCA
|
|
ON RCA.CARRIER_ID = ADSO.CARRIER_ID
|
|
ON RCA.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
WHERE ASO.SALE_ORDER_STATUS IN (2,4)
|
|
WHERE ASO.SALE_ORDER_STATUS IN (2,4)
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ADSO.DISPATCH_TYPE = 2
|
|
AND ADSO.DISPATCH_TYPE = 2
|
|
AND OO.ORDER_ID IS NULL
|
|
AND OO.ORDER_ID IS NULL
|
|
AND ASO.DELETED = 0
|
|
AND ASO.DELETED = 0
|
|
|
|
+ ) "NOCAR"
|
|
|
|
+ <where>
|
|
|
|
+ <if test="con != null" >
|
|
|
|
+ "NOCAR"."carrierName" LIKE #{con} or "NOCAR"."consigneeCompanyName" LIKE #{con} or "NOCAR"."addressDeliveryAddress" LIKE #{con}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
)
|
|
)
|
|
<where>
|
|
<where>
|
|
<if test="saleNumber != null">
|
|
<if test="saleNumber != null">
|
|
@@ -2780,6 +2964,24 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="carrierName != null">
|
|
<if test="carrierName != null">
|
|
and
|
|
and
|
|
<foreach collection="carrierName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="carrierName" item="item" open="(" separator="or" close=")">
|
|
@@ -2879,6 +3081,7 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
<select id="getHaveCarTruckNoList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
|
+ SELECT * FROM (
|
|
SELECT DISTINCT *
|
|
SELECT DISTINCT *
|
|
FROM (
|
|
FROM (
|
|
SELECT ASO.SALE_NUMBER AS "saleNumber",
|
|
SELECT ASO.SALE_NUMBER AS "saleNumber",
|
|
@@ -2895,10 +3098,16 @@
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.INSERT_TIME AS "insertTime",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
ASOM.SALE_ORDER_MATERIAL_ID AS "saleOrderMaterialId",
|
|
ASO.SALE_ORDER_ID AS "saleOrderId",
|
|
ASO.SALE_ORDER_ID AS "saleOrderId",
|
|
- RCA.CARRIER_NAME AS "carrierName"
|
|
|
|
|
|
+ RCA.CARRIER_NAME AS "carrierName",
|
|
|
|
+ RM.MATERIAL_NAME AS "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION AS "materialSpecification",
|
|
|
|
+ RM.MATERIAL_MODEL AS "materialModel",
|
|
|
|
+ RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "nameSpecificationModel"
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
LEFT JOIN AMS_SALE_ORDER ASO
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
@@ -2913,12 +3122,22 @@
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
LEFT JOIN RMS_CARRIER RCA
|
|
LEFT JOIN RMS_CARRIER RCA
|
|
ON RCA.CARRIER_ID = ADSO.CARRIER_ID
|
|
ON RCA.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
WHERE OO.ORDER_TYPE = 1
|
|
WHERE OO.ORDER_TYPE = 1
|
|
AND ASO.SALE_ORDER_STATUS IN (2,4)
|
|
AND ASO.SALE_ORDER_STATUS IN (2,4)
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ASOM.ISSUE_STATUS IS NULL
|
|
AND ADSO.DISPATCH_TYPE = 2
|
|
AND ADSO.DISPATCH_TYPE = 2
|
|
AND OO.ORDER_ID IS NOT NULL
|
|
AND OO.ORDER_ID IS NOT NULL
|
|
AND OO.ORDER_STATUS IN (4,5)
|
|
AND OO.ORDER_STATUS IN (4,5)
|
|
|
|
+ ) "HAVECAR"
|
|
|
|
+ <where>
|
|
|
|
+ <if test="con != null" >
|
|
|
|
+ "HAVECAR"."carrierName" LIKE #{con} or "HAVECAR"."consigneeCompanyName" LIKE #{con} or "HAVECAR"."addressDeliveryAddress" LIKE #{con}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
)
|
|
)
|
|
<where>
|
|
<where>
|
|
<if test="saleNumber != null">
|
|
<if test="saleNumber != null">
|
|
@@ -2927,6 +3146,30 @@
|
|
"saleNumber" like '%${item}%'
|
|
"saleNumber" like '%${item}%'
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="carrierName != null">
|
|
<if test="carrierName != null">
|
|
and
|
|
and
|
|
<foreach collection="carrierName" item="item" open="(" separator="or" close=")">
|
|
<foreach collection="carrierName" item="item" open="(" separator="or" close=")">
|
|
@@ -3116,4 +3359,362 @@
|
|
<
|
|
<
|
|
]]> 2
|
|
]]> 2
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <!-- 查询内转焦炭订单 -->
|
|
|
|
+ <select id="getCokeInwardOrderList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
|
+ SELECT * FROM (
|
|
|
|
+ SELECT *from(
|
|
|
|
+ select
|
|
|
|
+ OO.ORDER_NUMBER "orderNumber",
|
|
|
|
+ ASO.SALE_NUMBER "saleNumber",
|
|
|
|
+ RC.CAPACITY_NUMBER "capacityNumber",
|
|
|
|
+ RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
|
|
|
|
+ RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN "addressDeliveryAddress",
|
|
|
|
+ ACTP.PRICE_VALUE "priceValue",
|
|
|
|
+ ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
|
|
|
|
+ OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
|
|
|
|
+ RS.SHIPPER_NAME "shipperName",
|
|
|
|
+ OO.ORDER_ID "orderId",
|
|
|
|
+ RC3.CARRIER_NAME "carrierName"
|
|
|
|
+ FROM OMSTRUCK_ORDER OO
|
|
|
|
+ LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
|
+ ON ASOM.SALE_ORDER_MATERIAL_ID=OO.ORDER_PLAN_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_ORDER ASO
|
|
|
|
+ ON ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
|
|
+ ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
|
+ LEFT JOIN RMS_CARRIER RC3
|
|
|
|
+ ON RC3.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
|
+ LEFT JOIN RMS_CONSIGNEE RC2
|
|
|
|
+ ON RC2.CONSIGNEE_ID=ASO.RECEIVE_ID
|
|
|
|
+ LEFT JOIN RMS_CAPACITY RC
|
|
|
|
+ ON OO.CAPACITY_ID=RC.CAPACITY_ID
|
|
|
|
+ LEFT JOIN RMS_SHIPPER RS
|
|
|
|
+ ON RS.SHIPPER_ID=ASO.SHIPPER_ID
|
|
|
|
+ LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
|
|
+ ON RRA.ADDRESS_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
|
|
+ LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
|
|
|
|
+ ON OO.PRICE_ID=ACTP.PRICE_ID
|
|
|
|
+ WHERE OO.ORDER_TYPE = 2
|
|
|
|
+ AND ASO.SHIPPER_ID = 2
|
|
|
|
+ AND ASO.CLOSE_STATUS = 0
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderStatus!=null">
|
|
|
|
+ AND OO.ORDER_STATUS = #{orderStatus}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ ) RRC
|
|
|
|
+ <if test="con != null">
|
|
|
|
+ WHERE RRC."consigneeCompanyName" LIKE #{con} or RRC."capacityNumber" LIKE #{con}
|
|
|
|
+ </if>
|
|
|
|
+ )
|
|
|
|
+ <where>
|
|
|
|
+ <if test="orderNumber != null">
|
|
|
|
+ <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "orderNumber" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="carrierName != null">
|
|
|
|
+ <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "carrierName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleNumber != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleNumber" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="capacityNumber != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "capacityNumber" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="shipperName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "shipperName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeCompanyName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "consigneeCompanyName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ <include refid="orderBy">
|
|
|
|
+ </include>
|
|
|
|
+ <if test="orderField == null ">
|
|
|
|
+ order by "orderNumber" desc
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getDispatchId" parameterType="DECIMAL" resultType="DECIMAL" >
|
|
|
|
+ SELECT ADSO.DISPATCH_ID AS "dispatchId"
|
|
|
|
+ FROM AMS_DISPATCH_SALE_ORDER ADSO
|
|
|
|
+ WHERE ADSO.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getSaleMaterialId" parameterType="DECIMAL" resultType="DECIMAL" >
|
|
|
|
+ SELECT ASTM.MATERIAL_ID AS "saleMaterialId"
|
|
|
|
+ FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
|
+ WHERE ASOM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getSaleList" resultType="java.util.Map" >
|
|
|
|
+ SELECT ASTM.TRUCKNO_MATERIAL_ID "truckNoMaterialId",
|
|
|
|
+ ASM.SALE_MATERIAL_ID "saleMaterialId",
|
|
|
|
+ ASM.MATERIAL_ID "materialId"
|
|
|
|
+ FROM AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
|
+ WHERE ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
|
+ AND ASM.MATERIAL_ID = #{materialId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getFuSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
|
+ select * from(
|
|
|
|
+ select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
|
|
+ a_s_order.SALE_NUMBER "saleNumber",
|
|
|
|
+ r_shipper.SHIPPER_NAME "shipperName",
|
|
|
|
+ r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
|
|
|
|
+ r_consignee.CONSIGNEE_WARRANTY_AMOUNT "consigneeWarrantyAmount",
|
|
|
|
+ r_consignee.CONSIGNEE_WARRANTY_WEIGHT "consigneeWarrantyWeight",
|
|
|
|
+ a_s_order.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
|
|
|
|
+ a_s_order.SALE_ACCOUNT_BALANCE "saleAccountBalance",
|
|
|
|
+ a_s_order.SALE_CURRENT_ORDER_AMOUNT "saleCurrentOrderAmount",
|
|
|
|
+ a_s_order.SALE_HISTORICAL_ORDER_AMOUNT "saleHistoricalOrderAmout",
|
|
|
|
+ a_s_order.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
|
|
|
|
+ a_s_order.SALE_UNIT_PRICE "saleUnitPrice",
|
|
|
|
+ a_s_order.SALE_ORDER_TAX "saleOrderTax",
|
|
|
|
+ a_s_order.SALE_REMARK "saleRemark",
|
|
|
|
+ a_s_order.INSERT_TIME "insertTime",
|
|
|
|
+ DECODE(a_s_order.SALE_ORDER_STATUS,2,'销售已审批',4,'财务已审批') "statusStr",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ ASM.MATERIAL_WEIGHT "materialWeight",
|
|
|
|
+ ASM.SALE_WAREHOUSE "saleWareHouse",
|
|
|
|
+ nvl(sumWeight.weight,0)+nvl(sumWeight2.weight,0) as "totalWeight",
|
|
|
|
+ nvl(sumWeight.weight ,0) as "netWeight",
|
|
|
|
+ nvl(sumWeight2.weight ,0) as "weight",
|
|
|
|
+ nvl(carCount.coun ,0) as "carCount",
|
|
|
|
+ RCA.CARRIER_NAME as "carrierName"
|
|
|
|
+ from AMS_SALE_ORDER a_s_order
|
|
|
|
+ left join RMS_SHIPPER r_shipper
|
|
|
|
+ on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
|
|
+ left join RMS_CONSIGNEE r_consignee
|
|
|
|
+ on a_s_order.RECEIVE_ID=r_consignee.CONSIGNEE_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
|
+ ON ASM.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN AMS_SALE_ORDER_CARRIER ASOC
|
|
|
|
+ ON ASOC.SALE_ORDER_ID = a_s_order.SALE_ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_CARRIER RCA
|
|
|
|
+ ON RCA.CARRIER_ID = ASOC.CARRIER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
|
|
+ left join (
|
|
|
|
+ select sum( t_w_result.RESULT_NET_WEIGHT) weight,a_s_o_material.SALE_ORDER_ID SALE_ORDER_ID
|
|
|
|
+ from AMS_SALE_ORDER_MATERIAL a_s_o_material
|
|
|
|
+ left join Omstruck_Order o_order
|
|
|
|
+ on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
|
|
|
|
+ left join Tmstruck_Total_Result t_t_result
|
|
|
|
+ on o_order.order_id=t_t_result.order_id
|
|
|
|
+ left join Tmstruck_Weight_Result t_w_result
|
|
|
|
+ on t_t_result.result_total_id=t_w_result.result_total_id
|
|
|
|
+ GROUP BY
|
|
|
|
+ a_s_o_Material.SALE_ORDER_ID
|
|
|
|
+
|
|
|
|
+ ) sumWeight
|
|
|
|
+ on sumWeight.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
|
|
+ left join (
|
|
|
|
+ select sum( o_o_material.ORDER_MATERIAL_WEIGHT) weight,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
|
|
|
|
+ from AMS_SALE_ORDER_MATERIAL a_s_o_material
|
|
|
|
+ left join Omstruck_Order o_order
|
|
|
|
+ on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
|
|
|
|
+ left join Tmstruck_Total_Result t_t_result
|
|
|
|
+ on o_order.order_id=t_t_result.order_id
|
|
|
|
+ left join Tmstruck_Weight_Result t_w_result
|
|
|
|
+ on t_t_result.result_total_id=t_w_result.result_total_id
|
|
|
|
+ left join OMSTRUCK_ORDER_MATERIAL o_o_material
|
|
|
|
+ on o_order.order_id=o_o_material.ORDER_ID
|
|
|
|
+ where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
|
|
|
|
+ GROUP BY
|
|
|
|
+ a_s_o_Material.SALE_ORDER_ID
|
|
|
|
+
|
|
|
|
+ ) sumWeight2
|
|
|
|
+ on sumWeight2.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
|
|
+ left join (
|
|
|
|
+ select count(o_order.order_id) coun ,a_s_o_Material.SALE_ORDER_ID SALE_ORDER_ID
|
|
|
|
+ from AMS_SALE_ORDER_MATERIAL a_s_o_material
|
|
|
|
+ left join Omstruck_Order o_order
|
|
|
|
+ on a_s_o_material.SALE_ORDER_MATERIAL_ID=o_order.order_plan_id
|
|
|
|
+ left join Tmstruck_Total_Result t_t_result
|
|
|
|
+ on o_order.order_id=t_t_result.order_id
|
|
|
|
+ left join Tmstruck_Weight_Result t_w_result
|
|
|
|
+ on t_t_result.result_total_id=t_w_result.result_total_id
|
|
|
|
+ where t_w_result.RESULT_NET_WEIGHT is null and o_order.order_status in (2,4,5)
|
|
|
|
+ GROUP BY
|
|
|
|
+ a_s_o_Material.SALE_ORDER_ID
|
|
|
|
+
|
|
|
|
+ ) carCount
|
|
|
|
+ on carCount.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
|
|
+ where ASM.SALE_WAREHOUSE = '副产品库'
|
|
|
|
+ and a_s_order.SALE_ORDER_STATUS in (2,4)
|
|
|
|
+ and a_s_order.CLOSE_STATUS is null
|
|
|
|
+ and a_s_order.DELETED = 0
|
|
|
|
+ and a_s_order.SHIPPER_ID = 1
|
|
|
|
+ and a_s_order.SALE_TYPE is null
|
|
|
|
+ <if test="con != null">
|
|
|
|
+ and (instr(r_consignee.CONSIGNEE_COMPANY_NAME, #{con}) > 0 or instr(a_s_order.SALE_NUMBER, #{con}) > 0)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeSsoId != null">
|
|
|
|
+ and r_consignee.CONSIGNEE_SSO_ID = #{consigneeSsoId}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY a_s_order.UPDATE_TIME DESC
|
|
|
|
+ )
|
|
|
|
+ <where>
|
|
|
|
+ <if test="saleNumber != null">
|
|
|
|
+ <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleNumber" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialName != null">
|
|
|
|
+ <foreach collection="materialName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialSpecification != null">
|
|
|
|
+ <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialSpecification" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="materialModel != null">
|
|
|
|
+ <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "materialModel" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="statusStr != null">
|
|
|
|
+ <foreach collection="statusStr" item="item" open="(" separator="or" close=")">
|
|
|
|
+ and "statusStr" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="shipperName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "shipperName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeCompanyName != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "consigneeCompanyName" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeWarrantyAmount != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="consigneeWarrantyAmount" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "consigneeWarrantyAmount" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeWarrantyWeight != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="consigneeWarrantyWeight" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "consigneeWarrantyWeight" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleOrderIsselfMention != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleOrderIsselfMention" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleOrderIsselfMention" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleAccountBalance != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleAccountBalance" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleAccountBalance" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleCurrentOrderAmount != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleCurrentOrderAmount" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleCurrentOrderAmount" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleHistoricalOrderAmout != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleHistoricalOrderAmout" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleHistoricalOrderAmout" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleOrderReceiveCustomer != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleOrderReceiveCustomer" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleOrderReceiveCustomer" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleUnitPrice != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleUnitPrice" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleUnitPrice" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleOrderTax != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleOrderTax" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleOrderTax" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleRemark != null">
|
|
|
|
+ and
|
|
|
|
+ <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
|
|
|
|
+ "saleRemark" like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 关闭未进厂的运单 -->
|
|
|
|
+ <update id="closeOrderNotIn" parameterType="DECIMAL" >
|
|
|
|
+ UPDATE OMSTRUCK_ORDER OO
|
|
|
|
+ SET OO.ORDER_STATUS = 7
|
|
|
|
+ WHERE OO.ORDER_ID IN (
|
|
|
|
+ SELECT OO.ORDER_ID "orderId"
|
|
|
|
+ FROM AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
|
+ LEFT JOIN OMSTRUCK_ORDER OO
|
|
|
|
+ ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
|
+ LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
|
|
|
|
+ ON TTR.ORDER_ID = OO.ORDER_ID
|
|
|
|
+ LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
|
|
|
|
+ ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
|
+ WHERE ASOM.SALE_ORDER_ID = #{saleOrderId}
|
|
|
|
+ AND TER.RESULT_ENTRY_GATE_TIME IS NULL
|
|
|
|
+ AND OO.ORDER_ID IS NOT NULL
|
|
|
|
+ AND OO.ORDER_STATUS IN (4,5)
|
|
|
|
+ )
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <select id="getCarMessageToEas" parameterType="DECIMAL" resultType="java.util.LinkedHashMap">
|
|
|
|
+ SELECT
|
|
|
|
+ RCA.CAPACITY_NUMBER AS "r1c1",
|
|
|
|
+ OO.ORDER_NUMBER AS "r1c2",
|
|
|
|
+ RM.EAS_MATERIAL_ID AS "r1c3",
|
|
|
|
+ RM.MATERIAL_NAME AS "r1c4",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL AS "r1c5"
|
|
|
|
+FROM OMSTRUCK_ORDER OO
|
|
|
|
+ LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
|
|
|
|
+ ON OOM.ORDER_ID = OO.ORDER_ID
|
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
|
+ ON RM.MATERIAL_ID = OOM.MATERIAL_ID
|
|
|
|
+LEFT JOIN RMS_CAPACITY RCA
|
|
|
|
+ ON OO.CAPACITY_ID = RCA.CAPACITY_ID
|
|
|
|
+LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
|
+ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
|
|
|
|
+LEFT JOIN AMS_SALE_ORDER ASO
|
|
|
|
+ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
|
|
+LEFT JOIN RMS_CONSIGNEE RC
|
|
|
|
+ON ASO.RECEIVE_ID = RC.CONSIGNEE_ID
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|