|
@@ -601,6 +601,18 @@
|
|
|
</delete>
|
|
|
<!-- 友情提示!!!-->
|
|
|
<!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
|
|
|
+ <!--根据插入时间排序-->
|
|
|
+ <sql id="orderBy">
|
|
|
+ <if test="orderField != null and orderField != ''">
|
|
|
+ order by "${orderField}"
|
|
|
+ <if test="orderType != null and orderType != ''">
|
|
|
+ ${orderType}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="orderField == null ">
|
|
|
+ order by "insertTime" desc
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
<select id="getSaleOrderInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
|
|
|
select * from(
|
|
|
select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
@@ -616,7 +628,8 @@
|
|
|
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.SALE_REMARK "saleRemark",
|
|
|
+ a_s_order.INSERT_TIME "insertTime"
|
|
|
from AMS_SALE_ORDER a_s_order
|
|
|
left join (select sale_material.SALE_ORDER_ID saleOrderId,
|
|
|
sum(tt.sum1) saleSum1,
|
|
@@ -717,10 +730,11 @@
|
|
|
"saleRemark" like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <include refid="orderBy"></include>
|
|
|
</where>
|
|
|
+ <include refid="orderBy"></include>
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
<select id="getSaleOrderReported" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
|
|
|
select * from(
|
|
|
select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
@@ -736,7 +750,8 @@
|
|
|
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.SALE_REMARK "saleRemark",
|
|
|
+ a_s_order.INSERT_TIME "insertTime"
|
|
|
from AMS_SALE_ORDER a_s_order
|
|
|
left join (select sale_material.SALE_ORDER_ID saleOrderId,
|
|
|
sum(tt.sum1) saleSum1,
|
|
@@ -837,8 +852,9 @@
|
|
|
"saleRemark" like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <include refid="orderBy"></include>
|
|
|
+
|
|
|
</where>
|
|
|
+ <include refid="orderBy"></include>
|
|
|
</select>
|
|
|
|
|
|
<select id="getSaleOrderDetail" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
|
|
@@ -848,7 +864,9 @@
|
|
|
receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
|
|
|
sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
|
|
|
sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
|
|
|
- sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
|
|
|
+ sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
|
|
|
+ sale_material.INSERT_TIME "insertTime"
|
|
|
+
|
|
|
from AMS_SALE_ORDER_MATERIAL sale_material
|
|
|
left join AMS_SALE_ORDER a_s_order
|
|
|
on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
@@ -922,7 +940,8 @@
|
|
|
receive_address.ADDRESS_DELIVERY_ADDRESS "saleShippingAddress",
|
|
|
sale_material.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
|
|
|
sale_material.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
|
|
|
- sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
|
|
|
+ sale_material.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
|
|
|
+ sale_material.INSERT_TIME "insertTime"
|
|
|
from AMS_SALE_ORDER_MATERIAL sale_material
|
|
|
left join AMS_SALE_ORDER a_s_order
|
|
|
on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
@@ -982,18 +1001,10 @@
|
|
|
from RMS_CONSIGNEE
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectMaxId" resultType="java.math.BigDecimal">
|
|
|
- select max(SALE_ORDER_ID) from AMS_SALE_ORDER
|
|
|
- </select>
|
|
|
+<!-- <select id="selectMaxId" resultType="java.math.BigDecimal">-->
|
|
|
+<!-- select max(SALE_ORDER_ID) from AMS_SALE_ORDER-->
|
|
|
+<!-- </select>-->
|
|
|
|
|
|
- <sql id="orderBy">
|
|
|
- <if test="orderField != null and orderField != ''">
|
|
|
- order by "${orderField}"
|
|
|
- <if test="orderType != null and orderType != ''">
|
|
|
- ${orderType}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- </sql>
|
|
|
|
|
|
<select id="selectBySaleOrderId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
|
|
|
select
|
|
@@ -1028,7 +1039,8 @@
|
|
|
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.SALE_REMARK "saleRemark",
|
|
|
+ a_s_order.INSERT_TIME "insertTime"
|
|
|
from AMS_SALE_ORDER a_s_order
|
|
|
left join (select sale_material.SALE_ORDER_ID saleOrderId,
|
|
|
sum(tt.sum1) saleSum1,
|
|
@@ -1141,8 +1153,8 @@
|
|
|
"saleRemark" like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <include refid="orderBy"></include>
|
|
|
</where>
|
|
|
+ <include refid="orderBy"></include>
|
|
|
</select>
|
|
|
<!-- 展示所有销售公司已审核的销售订单 -->
|
|
|
<select id="getSaleOrderList" parameterType="java.util.Map" resultType="java.util.Map">
|
|
@@ -1165,6 +1177,141 @@
|
|
|
left join rms_receive_address rra on asom.sale_shipping_address_id=rra.address_id
|
|
|
where aso.sale_order_status in (2, 4) and adso.DISPATCH_STATUS = #{status} and adso.DISPATCH_TYPE=0
|
|
|
</select>
|
|
|
+<!-- 销售公司查询已审核的销售订单 -->
|
|
|
+ <select id="getSaleOrderListBySaleCompany" parameterType="java.util.Map" resultType="java.util.Map">
|
|
|
+ select * from(
|
|
|
+ select a_s_order.SALE_ORDER_ID "saleOrderId",
|
|
|
+ a_s_order.SALE_NUMBER "saleNumber",
|
|
|
+ allmaterial_info.saleSum1 "materialTheoreticalWeight",
|
|
|
+ allmaterial_info.saleSum2 "saleOrderMaterialNumber",
|
|
|
+ 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"
|
|
|
+ from AMS_SALE_ORDER a_s_order
|
|
|
+ left join (select sale_material.SALE_ORDER_ID saleOrderId,
|
|
|
+ sum(tt.sum1) saleSum1,
|
|
|
+ sum(tt.sum2) saleSum2
|
|
|
+ from AMS_SALE_ORDER_MATERIAL sale_material
|
|
|
+ left join
|
|
|
+ (select truckno_material.SALE_ORDER_MATERIAL_ID s_order_material,
|
|
|
+ sum(truckno_material.material_theoretical_weight) sum1,
|
|
|
+ sum(truckno_material.sale_order_material_number) sum2
|
|
|
+ from AMS_SALE_TRUCKNO_MATERIAL truckno_material group by
|
|
|
+ truckno_material.SALE_ORDER_MATERIAL_ID) tt
|
|
|
+ on tt.s_order_material = sale_material.SALE_ORDER_MATERIAL_ID
|
|
|
+
|
|
|
+ group by
|
|
|
+ sale_material.SALE_ORDER_ID) allmaterial_info
|
|
|
+ on a_s_order.SALE_ORDER_ID=allmaterial_info.saleOrderId
|
|
|
+ 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
|
|
|
+ where a_s_order.SALE_ORDER_STATUS=2)
|
|
|
+ <where>
|
|
|
+ <if test="saleNumber != null">
|
|
|
+ and
|
|
|
+ <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
|
|
|
+ "saleNumber" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="materialTheoreticalWeight != null">
|
|
|
+ and
|
|
|
+ <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
|
|
|
+ "materialTheoreticalWeight" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderMaterialNumber != null">
|
|
|
+ and
|
|
|
+ <foreach collection="saleOrderMaterialNumber" item="item" open="(" separator="or" close=")">
|
|
|
+ "saleOrderMaterialNumber" 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>
|
|
|
+ <include refid="orderBy"></include>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 通过收货地址,匹配对应的承运商-->
|
|
|
<select id="getCarrier" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
|
@@ -1177,4 +1324,63 @@
|
|
|
<!-- from-->
|
|
|
<!-- where-->
|
|
|
<!-- </select>-->
|
|
|
+
|
|
|
+ <select id="selectInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
|
|
|
+ select distinct ASO.SHIPPER_ID "shipperId",
|
|
|
+ ASO.RECEIVE_ID "reciveId",
|
|
|
+ ASO.SALE_ORDER_ISSELF_MENTION "saleOrderIsselfMention",
|
|
|
+ ASO.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReciveCustomer",
|
|
|
+ ASO.SALE_REMARK "saleRemark"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ from AMS_SALE_ORDER ASO
|
|
|
+ left join AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ 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_MATERIAL RM
|
|
|
+ on RM.MATERIAL_ID=ASTM.MATERIAL_ID
|
|
|
+ where ASO.SALE_ORDER_ID=#{saleOrderId}
|
|
|
+ </select>
|
|
|
+<!-- 根据销售订单id查找物资信息 -->
|
|
|
+ <select id="selectMaterialInfoBySaleOrderId" resultType="java.util.Map" parameterType="java.util.LinkedHashMap">
|
|
|
+ select distinct ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "cxh",
|
|
|
+ ASTM.SALE_ORDER_MATERIAL_NUMBER "orderPlanWeight",
|
|
|
+ RM.MATERIAL_CODE "materialCode",
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
+ CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",
|
|
|
+ RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
|
|
|
+ RM.MATERIAL_ID "materialId",
|
|
|
+ ASTM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
+ ASTM.TRUCKNO_MATERIAL_ID "trucknoMaterialId",
|
|
|
+ ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
|
|
|
+ ASOM.SALE_SHIPPING_ADDRESS_ID "saleShipperAddressId",
|
|
|
+ CONCAT( CONCAT( CONCAT( RRA.ADDRESS_PROVINCE, RRA.ADDRESS_DISTRICT ), RRA.ADDRESS_TOWN ), RRA.ADDRESS_DELIVERY_ADDRESS ) "saleShipperAddressName",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE "saleOrderConsignee",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel"
|
|
|
+
|
|
|
+ from AMS_SALE_ORDER ASO
|
|
|
+ left join AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ 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_MATERIAL RM
|
|
|
+ on RM.MATERIAL_ID=ASTM.MATERIAL_ID
|
|
|
+ LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
|
+ ON ASOM.SALE_SHIPPING_ADDRESS_ID=RRA.ADDRESS_ID
|
|
|
+ where ASO.SALE_ORDER_ID=#{saleOrderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSaleOrderMaterialIdBySaleOrderId" resultType="java.util.Map" parameterType="java.math.BigDecimal">
|
|
|
+ select ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
+ ASTM.TRUCKNO_MATERIAL_ID "TruckNoMaterialId"
|
|
|
+
|
|
|
+ from AMS_SALE_ORDER ASO
|
|
|
+ left join AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ on ASO.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
|
|
|
+ left join AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
+ on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
|
|
|
+ where ASO.SALE_ORDER_ID=#{saleOrderId}
|
|
|
+ </select>
|
|
|
</mapper>
|