|
@@ -450,6 +450,53 @@
|
|
|
on a.productNo = b.productNo AND a.productLevel = b.`level` AND a.scolours = b.bcolours;
|
|
|
</select>
|
|
|
|
|
|
+ <select id="lsdPrintOutsourceOrderList" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
|
|
|
+ select a.*,
|
|
|
+ b.productUnitPrice -- 产品单价
|
|
|
+ from (select p.id as productId,
|
|
|
+ p.product_name as productName,
|
|
|
+ p.product_specifications as productSpecifications,
|
|
|
+ por.lot_num as lotNumber,
|
|
|
+ count(por.box_num) as boxNum,
|
|
|
+ TRUNCATE(sum(por.suttle), 2) as productNumber, -- 产品净重()
|
|
|
+ por.product_colour as productColour,
|
|
|
+ por.notice_number as noticeNumber,
|
|
|
+ pi.sale_order_no as saleNo,
|
|
|
+ p.product_no as productNo,
|
|
|
+ por.levels as productLevel,
|
|
|
+ por.colours as scolours,
|
|
|
+ IF(batch.batch_number IS NULL, '0', batch.batch_number) as batchNumber,
|
|
|
+ batch.batch_State as batchState,
|
|
|
+ batch.id as batchId
|
|
|
+ from (
|
|
|
+ SELECT p.*,c.sale_product_id,s.colours FROM `huaxian`.product_outbound_record p
|
|
|
+ LEFT JOIN `huaxian`.product_code_list c ON p.qr_code = c.qr_code
|
|
|
+ LEFT JOIN `huaxian`.sale_products s ON c.sale_product_id = s.id GROUP BY p.id
|
|
|
+ ) por -- 成品出库记录表
|
|
|
+ left join `huaxian`.production p on p.id = por.product_id -- 产品表
|
|
|
+ left join `huaxian`.product_invoice pi on por.notice_number = pi.notice_number -- 产品发货单表
|
|
|
+ left join `huaxian`.product_outbound_record_batch as batch
|
|
|
+ on batch.outbound_record_id = por.id and batch.del_flag = '0' -- 成品出库记录批次表
|
|
|
+ where por.del_flag = '0'
|
|
|
+ and pi.notice_number = #{noticeNumber} -- 通知单号
|
|
|
+ group by por.product_id, por.levels, por.lot_num, por.product_colour, por.batch_number) as a
|
|
|
+ left join (select sp.product_no as productNo, -- 产品编号
|
|
|
+ sp.product_unit_price as productUnitPrice, -- 产品单价
|
|
|
+ CONCAT(m.materie_encoding, m.materie_color_number) as productColour, -- 产品转码+色泽
|
|
|
+ sp.`level` as `level`,
|
|
|
+ sp.colours as bcolours
|
|
|
+ from `huaxian`.sale_order so -- 订单表
|
|
|
+ left join `huaxian`.sale_products sp
|
|
|
+ on so.sale_no = sp.sale_order_no and sp.del_flag = '0' -- 销售产品表
|
|
|
+ left join `huaxian`.production p
|
|
|
+ on sp.product_no = p.product_no and p.del_flag = '0' -- 产品表
|
|
|
+ left join `huaxian`.materiel m
|
|
|
+ on m.materiel_code = sp.colour_number and m.del_flag = '0' -- 物料信息表
|
|
|
+ where so.del_flag = '0'
|
|
|
+ and so.sale_no = #{saleNo}) as b -- 根据销售单编号得到当前订单包含的所有产品
|
|
|
+ on a.productNo = b.productNo AND a.scolours = b.bcolours;
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="printOutsourceOrderListNowEnd" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
|
|
|
select
|
|
|
a.* ,
|