1. 程式人生 > >PO工單接口SQL

PO工單接口SQL

mat red egg creat ann ltr bold nor rod

select * from V_OUTMO_HEADER where LOC_ID =2021 ;


select * from V_OUTMO_HEADER where LOC_ID IN(2022,2023)  ;


SELECT * FROM V_OUTMO_DETAIL_MH WHERE  PRODUCTIONORDID IN (SELECT PRODUCTIONORDID FROM V_OUTMO_HEADER where LOC_ID =2021);

SELECT * FROM V_OUTMO_DETAIL_XG WHERE  PRODUCTIONORDID IN
(SELECT PRODUCTIONORDID FROM V_OUTMO_HEADER where LOC_ID IN(2022,2023)) ; select * from OUT_MO_WEBSERVICE; delete from OUT_MO_WEBSERVICE; --將2022、2023工廠的工單數據寫入表中 INSERT INTO STG.TEMP_OUT_MO(PRODUCTIONORDID, SO_ID, SO_LINE_ID, PEGGED_MO_ID, ITEM, QTYORDERED, CREATION_DATE, LOC_ID, PLANNEDSTARTDATE, PLANNEDENDDATE, QTYUOM, CUSTOMER_ID, BOM_ID)
SELECT PRODUCTIONORDID, LTRIM(SO_ID,0) AS SO_ID, SO_LINE_ID, PEGGED_MO_ID, ITEM, QTYORDERED, CREATION_DATE, LOC_ID, PLANNEDSTARTDATE, PLANNEDENDDATE, QTYUOM, CUSTOMER_ID, BOM_ID FROM STG.OUT_MO WHERE OUT_MO.LOC_ID in(2022,2023);

--2021
select * from v_out_mo;
select * from v_out_mo_item_1 out_mo_item   left
join sap_marc on substr(out_mo_item.loc_ID, 0, 4)=sap_marc.werks and out_mo_item.item=sap_marc.matnr ; --2022\2023 select * from v_out_mo; SELECT * FROM V_OUT_MO_ITEM_2 out_mo_item ;

PO工單接口SQL