SELECT
a.site,
a.bu_no,
A.order_no AS notifyNo,
d.inspection_no AS order_no,
a.order_status,
d.part_no,
d.part_desc,
D.related_order_no AS po_orderNo,
D.related_order_line_no AS po_itemNo,
c.SupplierName,
c.supplierID AS supplierId,
b.inspector_date,
b.submit_date,
d.required_qty as order_qty,
roll_qty,
roll_count,
inspection_result,
disposal_measures,
B.batch_qualified_qty,
b.inspector_no
from inbound_notification_head a
inner join inbound_notification_detail D on a.site = D.site and a.bu_no = D.bu_no and a.order_no = D.order_no AND A.order_type ='采购入库'
left join qc_iqc_record b on D.site = b.site and D.bu_no = b.bu_no and D.inspection_no = b.inspection_no
inner join Supplier c on a.site = c.Site and a.Supplier_ID = c.supplierID
and A.site=#{query.site,jdbcType=VARCHAR}
and A.bu_no=#{query.buNo,jdbcType=CHAR}
and d.inspection_no like '%'+ #{query.orderNo} +'%'
and a.order_no like '%'+ #{query.notifyNo} +'%'
and b.part_no like '%'+ #{query.partNo,jdbcType=CHAR} +'%'
and b.part_desc like '%'+ #{query.partDesc,jdbcType=CHAR} +'%'
and b.inspector_date > #{query.startDate}
and #{query.endDate} > b.inspector_date
and a.order_status = #{query.orderStatus,jdbcType=VARCHAR}
and c.SupplierName like '%'+ #{query.supplierName} +'%'
and d.related_order_no like '%'+ #{query.poOrderNo} +'%'
and d.related_order_line_no = #{query.supplierName}
SELECT
ROW_NUMBER () OVER (ORDER BY a.created_date) orderId,
a.site,
a.bu_no,
a.inspection_no,
a.order_no,
a.item_no,
a.roll_no,
a.roll_qty,
a.part_no,
a.part_desc,
a.supplier_id,
a.supplier_name,
a.order_qty,
a.created_by,
a.created_date,
a.update_by,
a.updated_date,
a.delflag,
a.version,
a.print_flag,
a.citem_code,
a.citem_class,
a.sendto_address,
a.hardtag_in_flag,
a.batch_no,
a.production_date,
a.validity_period,
a.chip_disk_no,
a.expiration_warning_date,
a.expiration_date
from po_order_roll_no a
where
A.site = #{site} and A.bu_no = #{buNo}
and A.inspection_no = #{inspectionNo,jdbcType=VARCHAR}
SELECT
b.expiration_day,
ISNULL(b.expiration_flag ,'N') AS expiration_flag,
b.exceed_in_ratio,
b.expiration_warning_day,
ISNULL(a.batch_qualified_qty, 0) * (1 + ISNULL(b.exceed_in_ratio, 0) / 100.0)
- ISNULL((
SELECT SUM(roll_qty)
FROM po_order_roll_no
WHERE site = #{site}
AND bu_no = #{buNo}
AND inspection_no = #{orderNo}
), 0) AS remainingIssuableQty
from qc_iqc_record a
left join part b on a.site = b.site and a.bu_no = b.bu_No and a.part_no = b.PartNo
where a.inspection_no = #{orderNo} and a.site = #{site} and a.bu_no = #{buNo}
insert into po_order_roll_no
(site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
created_by,created_date,delflag,version,print_flag,
hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
) values
(#{site},#{buNo},#{inspectionNo},#{orderNo},#{itemNo},#{rollNo},#{rollQty},#{partNo},#{partDesc},#{supplierId},#{supplierName},#{orderQty},
#{createdBy},GetDate(),#{delflag},#{version},#{printFlag},
#{hardtagInFlag},#{batchNo},#{productionDate},#{expirationWarningDate},#{expirationDate})
delete from po_order_roll_no where site=#{site} and bu_no=#{buNo} and roll_no=#{rollNo} and inspection_no=#{inspectionNo}
update po_order_roll_no set print_flag=isnull(print_flag,0)+1
WHERE
site = #{site}
and bu_no=#{buNo}
AND roll_no IN
#{item.rollNo}
select site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
created_by,created_date,delflag,version,print_flag,
hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
from po_order_roll_no
WHERE
site = #{site}
and bu_no=#{buNo}
AND roll_no IN
#{item.rollNo}
order by created_date
select
a.site,
a.bu_no,--事业部
a.roll_no,--标签条码
a.qty_on_hand,--标签数量
a.status,--状态
a.part_no,--物料编码
b.PartDescription,--物料名称
b.Spec,--规格型号
b.UMID,
UM.UMName,--单位名称
a.label_type,--标签类型
a.parent_roll_no, --上级标签号
a.parent_roll_type,--上级标签类型
a.warehouse_id,
W.WareHouseName,--仓库名称
a.location_id,
L.LocationName,--货位名称
a.first_in_date,--入库日期
a.manufacture_date,--生产日期
a.expired_date, --有效期
a.orderref0,--来源单据类型
a.orderref1,--来源单据号
a.orderref2,--来源单据行号
a.batch_no, --合约号码
a.wdr, --批次号
a.remark, --备注说明
SUM(a.qty_on_hand) OVER() AS total_qty
from inventory_stock a
LEFT JOIN PART b ON a.site = b.Site AND a.part_no = b.PartNo
LEFT JOIN UM ON b.Site = UM.Site AND b.UMID = UM.UMID
LEFT JOIN WareHouse W ON a.site = W.Site AND a.warehouse_id = W.WareHouseID
LEFT JOIN Location L ON a.site = L.Site AND a.location_id = L.LocationID
a.site in (select site from AccessSite where userID = #{query.userName})
and a.status != '出库'
and A.warehouse_id in
#{warehouseId}
and A.orderref0 like '%'+#{query.orderref0}+'%'
and A.orderref1 like '%'+ #{query.orderref1}+'%'
and A.remark like '%'+ #{query.remark}+'%'
and A.location_id like '%'+ #{query.locationId}+'%'
and A.roll_no like '%'+ #{query.rollNo}+'%'
and A.parent_roll_no like '%'+ #{query.parentRollNo}+'%'
and A.part_no like '%'+ #{query.partNo}+'%'
and b.PartDescription like '%'+ #{query.partDescription}+'%'
and A.status in
#{status}
and a.label_type = #{query.labelType}
and a.batch_no like '%'+ #{query.batchNo}+'%'
SELECT
expiration_flag as expirationFlag,
expiration_day as expirationDay,
expiration_warning_day as expirationWarningDay
FROM part
WHERE site = #{site}
AND bu_no = #{buNo}
AND PartNo = #{partNo}
SELECT
id,
file_name as fileName
FROM sys_oss
WHERE order_ref1 = #{orderRef1}
AND order_ref2 = #{orderRef2}
SELECT COUNT(1)
FROM po_order_roll_no
WHERE site = #{site}
AND roll_no = #{rollNo}
UPDATE inventory_stock
SET
batch_no = #{batchNo,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
WHERE site = #{site,jdbcType=VARCHAR}
AND bu_no = #{buNo,jdbcType=VARCHAR}
AND roll_no = #{rollNo,jdbcType=VARCHAR}
update inventory_stock set status = '冻结',status_tb = 'F' where site = #{site} and bu_no = #{buNo} and roll_no = #{rollNo}
SELECT DISTINCT
WareHouseID as warehouseId,
WareHouseName as warehouseName
FROM WareHouse
WHERE site in (select site from AccessSite where userID = #{userName})
ORDER BY WareHouseID