销售发货
This commit is contained in:
@@ -20,15 +20,31 @@
|
||||
<result property="noTaxPrice" column="no_tax_price"/>
|
||||
</resultMap>
|
||||
<select id="selectVoListByOrderId" resultType="com.gear.oa.domain.vo.GearOrderDetailVo">
|
||||
SELECT * FROM gear_order_detail WHERE order_id = #{orderId} AND del_flag = 0
|
||||
SELECT
|
||||
d.*,
|
||||
COALESCE(p.product_name, mp.product_name) AS productName,
|
||||
COALESCE(p.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
||||
COALESCE(p.type, mp.product_type) AS productType,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model,
|
||||
mp.unit_price AS unitPrice
|
||||
FROM gear_order_detail d
|
||||
LEFT JOIN gear_product p ON d.product_id = p.product_id
|
||||
LEFT JOIN mat_product mp ON d.product_id = mp.product_id
|
||||
WHERE d.order_id = #{orderId} AND d.del_flag = 0
|
||||
</select>
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearOrderDetailVo">
|
||||
SELECT
|
||||
d.*,
|
||||
p.product_name AS productName,
|
||||
p.product_code AS productCode
|
||||
COALESCE(p.product_name, mp.product_name) AS productName,
|
||||
COALESCE(p.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
||||
COALESCE(p.type, mp.product_type) AS productType,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model,
|
||||
mp.unit_price AS unitPrice
|
||||
FROM gear_order_detail d
|
||||
LEFT JOIN gear_product p ON d.product_id = p.product_id
|
||||
LEFT JOIN mat_product mp ON d.product_id = mp.product_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="customerId" column="customer_id"/>
|
||||
<result property="company" column="company"/>
|
||||
<result property="salesManager" column="sales_manager"/>
|
||||
<result property="salesmanId" column="salesman_id"/>
|
||||
<result property="orderStatus" column="order_status"/>
|
||||
<result property="tradeType" column="trade_type"/>
|
||||
<result property="remark" column="remark"/>
|
||||
@@ -20,14 +21,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="taxAmount" column="tax_amount"/>
|
||||
<result property="noTaxAmount" column="no_tax_amount"/>
|
||||
<result property="contractExcelOssIds" column="contract_excel_oss_ids"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPlusPage" resultType="com.gear.oa.domain.vo.GearOrderVo">
|
||||
select o.order_id,
|
||||
o.order_code,
|
||||
o.customer_id,
|
||||
o.company,
|
||||
o.sales_manager,
|
||||
o.order_status,
|
||||
o.salesman_id,
|
||||
s.name as sales_manager,
|
||||
(CASE
|
||||
WHEN o.order_status = 3 THEN 3
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 3) THEN 2
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) THEN 1
|
||||
ELSE o.order_status
|
||||
END) AS order_status,
|
||||
o.remark,
|
||||
o.del_flag,
|
||||
o.create_time,
|
||||
@@ -36,9 +52,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
o.update_by,
|
||||
o.tax_amount,
|
||||
o.no_tax_amount,
|
||||
c.name as customerName
|
||||
o.contract_excel_oss_ids as contractExcelOssIds,
|
||||
c.name as customerName,
|
||||
(SELECT MAX(CAST(so.status AS SIGNED))
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0') AS shippingMaxStatus,
|
||||
(CASE
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) THEN 1
|
||||
ELSE 0
|
||||
END) AS shippedFlag,
|
||||
(SELECT MAX(so.ship_time)
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) AS lastShipTime
|
||||
from gear_order o
|
||||
left join gear_customer c on o.customer_id = c.customer_id and c.del_flag = 0
|
||||
left join gear_salesman s on o.salesman_id = s.salesman_id and s.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearOrderVo">
|
||||
@@ -46,8 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
o.order_code,
|
||||
o.customer_id,
|
||||
o.company,
|
||||
o.sales_manager,
|
||||
o.order_status,
|
||||
o.salesman_id,
|
||||
s.name as sales_manager,
|
||||
(CASE
|
||||
WHEN o.order_status = 3 THEN 3
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 3) THEN 2
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) THEN 1
|
||||
ELSE o.order_status
|
||||
END) AS order_status,
|
||||
o.remark,
|
||||
o.del_flag,
|
||||
o.create_time,
|
||||
@@ -56,9 +105,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
o.update_by,
|
||||
o.tax_amount,
|
||||
o.no_tax_amount,
|
||||
c.name as customerName
|
||||
o.contract_excel_oss_ids as contractExcelOssIds,
|
||||
c.name as customerName,
|
||||
(SELECT MAX(CAST(so.status AS SIGNED))
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0') AS shippingMaxStatus,
|
||||
(CASE
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) THEN 1
|
||||
ELSE 0
|
||||
END) AS shippedFlag,
|
||||
(SELECT MAX(so.ship_time)
|
||||
FROM gear_shipping_order so
|
||||
WHERE so.order_id = o.order_id
|
||||
AND so.del_flag = '0'
|
||||
AND CAST(so.status AS SIGNED) >= 2) AS lastShipTime
|
||||
from gear_order o
|
||||
left join gear_customer c on o.customer_id = c.customer_id and c.del_flag = 0
|
||||
left join gear_salesman s on o.salesman_id = s.salesman_id and s.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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.gear.oa.mapper.GearOrderProductionMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearOrderProduction" id="GearOrderProductionResult">
|
||||
<result property="productionId" column="production_id"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="orderDetailId" column="order_detail_id"/>
|
||||
<result property="productId" column="product_id"/>
|
||||
<result property="planQty" column="plan_qty"/>
|
||||
<result property="finishedQty" column="finished_qty"/>
|
||||
<result property="badQty" column="bad_qty"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearOrderProductionVo">
|
||||
SELECT
|
||||
p.*,
|
||||
COALESCE(gp.product_name, mp.product_name) AS productName,
|
||||
COALESCE(gp.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
||||
COALESCE(gp.type, mp.product_type) AS productType,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model
|
||||
FROM gear_order_production p
|
||||
LEFT JOIN gear_order_detail d ON p.order_detail_id = d.detail_id
|
||||
LEFT JOIN gear_product gp ON d.product_id = gp.product_id
|
||||
LEFT JOIN mat_product mp ON d.product_id = mp.product_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectVoListPlus" resultType="com.gear.oa.domain.vo.GearOrderProductionVo">
|
||||
SELECT
|
||||
p.*,
|
||||
COALESCE(gp.product_name, mp.product_name) AS productName,
|
||||
COALESCE(gp.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
||||
COALESCE(gp.type, mp.product_type) AS productType,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model
|
||||
FROM gear_order_production p
|
||||
LEFT JOIN gear_order_detail d ON p.order_detail_id = d.detail_id
|
||||
LEFT JOIN gear_product gp ON d.product_id = gp.product_id
|
||||
LEFT JOIN mat_product mp ON d.product_id = mp.product_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -25,6 +25,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where item_id = #{rawMaterialId} and item_type = 'raw_material' and del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectSumQuantityByItemIds" resultType="java.util.HashMap">
|
||||
SELECT item_id AS itemId, SUM(quantity) AS quantity
|
||||
FROM gear_stock
|
||||
WHERE del_flag = 0
|
||||
AND item_type = #{itemType}
|
||||
AND item_id IN
|
||||
<foreach collection="itemIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY item_id
|
||||
</select>
|
||||
|
||||
<!-- 分页联查物品名称和编码,支持Wrapper动态条件,返回Page<GearStockVo> -->
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearStockVo">
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user