5000171153/100_1
000000101001009470 001100981885;
000000102001001400 5000171153100_2023/2007;
SELECT * FROM IN_SFCHEADER WHERE MO_ID='001100981885'; SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000171153' AND DEMANDLINEID='100_1') OR DEMANDORDERID='5000171153/100_1-MFG000' OR DEMANDORDERID='5000171153/100_1-MFG001' OR DEMANDORDERID IN('001100981885') OR SUPPLYORDERID IN ('001100981885') OR DEMANDORDERID LIKE '%001100981885%';; SELECT * FROM ABPPMGR.supplydmdpeg_p A WHERE ITEM='000000102001001400' AND (DEMANDORDERID LIKE '5000171153%' or DEMANDORDERID LIKE '%001100981885%' or DEMANDORDERID LIKE '%001100981885%') ORDER BY ATTRIBUTE; SELECT * FROM IN_MO_SHORT WHERE MO_ID='001100981885' AND ITEM_ID='000000102001001400'; SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE PEGGED_SO_ID='5000171153' AND PEGGED_SO_LINE_ID='100'; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001400'); SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102001001400') order by attribute; SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE ITEM IN('000000102001001400'); SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%001100981885_2023_102001001400%';
下面才是正确数据
000000101001030648 001100977723(REL)
000000102001001967 001201263574(CRTD)
SELECT * FROM IN_SFCHEADER WHERE MO_ID ='001100977723';--成品MO REL 会产生MTL SELECT * FROM IN_MO WHERE MO_ID ='001201263574';---半成品MO CRTD SELECT * FROM IN_MO_SHORT WHERE MO_ID='001100977723' AND ITEM_ID='000000102001001967'; --70 SELECT * FROM IN_INVENTORY WHERE ITEM_ID='000000102001001967'; --2023_2007 70 非C SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE PEGGED_SO_ID='5000172861' AND PEGGED_SO_LINE_ID='1160';--无 SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,ISDEMANDLOCKED,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000172861' AND DEMANDLINEID='1160_1') OR DEMANDORDERID='5000172861/1160_1-MFG000' OR DEMANDORDERID='5000172861/1160_1-MFG001' OR DEMANDORDERID IN('001100977723','001201263574') OR SUPPLYORDERID IN ('001100977723','001201263574') OR DEMANDORDERID LIKE '%001100977723%';; SELECT * FROM ABPPMGR.supplydmdpeg_p A WHERE ITEM='000000102001001967' AND (DEMANDORDERID LIKE '5000172861%' or DEMANDORDERID LIKE '%001100977723%' or DEMANDORDERID LIKE '%001201263574%') ORDER BY ATTRIBUTE;---无 SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001967'); SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102001001967') order by attribute; SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE ITEM IN('000000102001001967'); SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%001100977723%';
案例三:多计划行绑定错误问题
5000171740/10_2
000000101010001638 5000171740/10_2-MFG000;
000000102010000183 001201285871(REL);
SELECT * FROM IN_SALES_ORDER WHERE SO_ID='5000171740' and so_line_id like '10%'; SELECT * FROM IN_SFCHEADER WHERE SO_ID='5000171740' or mo_id='001201285871'; SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000171740'-- AND DEMANDLINEID='10_1' ) OR DEMANDORDERID='5000171740/10_1-MFG000' OR DEMANDORDERID='5000171740/10_1-MFG001' OR DEMANDORDERID='5000171740/10_2-MFG000' OR DEMANDORDERID='5000171740/10_2-MFG001' OR DEMANDORDERID IN('001201285871') OR SUPPLYORDERID IN ('001201285871') ;; SELECT * FROM ABPPMGR.supplydmdpeg_p A ---无 WHERE ITEM='000000102010000183' AND (DEMANDORDERID LIKE '5000171740%' or DEMANDORDERID LIKE '%001201285871%' or DEMANDORDERID LIKE '%001201285871%') ORDER BY ATTRIBUTE; SELECT * FROM IN_MO_SHORT WHERE MO_ID='001100981885' AND ITEM_ID='000000102010000183';---无 SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE PEGGED_SO_ID='5000171740' AND PEGGED_SO_LINE_ID='10';---无 SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102010000183');---无 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102010000183') order by attribute;---无 SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE ITEM IN('000000101010001638'); SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000171740%' ORDER BY ATTRIBUTE;
案例四:非限制库存、非限制MO被按单吃了
5000173841/50_1
000000101001005156 001101000594(REL);
000000102001001401
SELECT * FROM IN_SALES_ORDER WHERE SO_ID='5000173841' and so_line_id = '50_1'; SELECT * FROM IN_SFCHEADER WHERE (SO_ID='5000173841' AND so_line_id = '50') or mo_id='001101000594'; SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000173841' AND DEMANDLINEID='50_1' ) OR DEMANDORDERID='5000173841/50_1-MFG000' OR DEMANDORDERID='5000173841/50_1-MFG001' OR DEMANDORDERID IN('001101000594') OR SUPPLYORDERID IN ('001101000594') ;; SELECT * FROM ABPPMGR.supplydmdpeg_p A ---无 WHERE ITEM='000000102001001401' AND (DEMANDORDERID LIKE '5000173841%' or DEMANDORDERID LIKE '%001101000594%' or DEMANDORDERID LIKE '%001101000594%') ORDER BY ATTRIBUTE; SELECT * FROM IN_MO_SHORT WHERE MO_ID='001101000594' AND ITEM_ID='000000102001001401';--240 SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE PEGGED_SO_ID='5000173841' AND PEGGED_SO_LINE_ID='50'; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001401');---无 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102001001401') order by attribute;---无 SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE property like '5000173841_50%'; SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000173841_50_1%' ORDER BY ATTRIBUTE; SELECT * FROM ABPPMGR.MST_ITEMBOMROUTING WHERE ITEM IN('000000101001005156','000000102001001401'); SELECT * FROM ABPPMGR.MST_ITEMBOMROUTING_p WHERE ITEM IN('000000101001005156','000000102001001401')order by ATTRIBUTE;
1、解决按单吃非限制半成品库存问题
2、按单吃了非限制半成品MO
以下代码于0724晚修改后,验证无效后取消
详细数据如下:
5000171153/60_1
000000101001027737CA 001100969936; 200pcs
000000102001001646CA 2023/2010; 400pcs
select * from in_sales_order where so_id='5000171153'; SELECT * FROM IN_MO where so_id='5000171153' and so_line_id='60'; SELECT * FROM IN_MO_SHORT WHERE MO_ID='001100969936';--无数据,REL MO才有 SELECT * FROM IN_INVENTORY WHERE ITEM_ID IN('000000102001001646','000000101001027737'); SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE ITEM_ID='000000102001001646'; SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED,OPERATIONSEQ FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000171153' AND DEMANDLINEID='60_1') OR DEMANDORDERID='5000171153/60_1-MFG000'OR DEMANDORDERID='5000171153/60_1-MFG001' OR DEMANDORDERID IN('001100969936') OR SUPPLYORDERID IN ('001100969936') ; -- create table abppmgr.testa as SELECT A.* FROM ABPPMGR.supplydmdpeg_p A WHERE ITEM='000000102001001646' AND (DEMANDORDERID LIKE '5000171153%' or DEMANDORDERID LIKE '%001100969936%' or DEMANDORDERID LIKE '%001100969936%') ORDER BY ATTRIBUTE; SELECT * FROM abppmgr.testa; --supplydmdpegging中locationid,lotlevel1,lotlevel2,SERIALNUM都必須等於inventory中相對應的值 否則綁定會失敗 SELECT PRODUCTIONORDID,BOMID,ITEM,QTYORDERED,REQUIREDDATE,ROUTINGID,UDF_MO_FACTORY FROM ABPPMGR.PRODUCTIONORDERS WHERE PRODUCTIONORDID LIKE '5000171153/60%';--无 SELECT ITEM,LOCATIONID,PROPERTY,QTYOPEN,REPLANORDER,SALESORDERID,SOLINENUM,UDF_SALESORDERID,UDF_SOLINENUM FROM ABPPMGR.SALESORDERLINE WHERE SALESORDERID='5000171153' AND SOLINENUM LIKE '60%';-- AND ITEM IN('000000101001027737'); SELECT ENTERPRISE, ENGINE_ID, SALESORDERID, SOLINENUM, ATTRIBUTECLASS, ATTRIBUTE, RELATIONSHIP, VALUE , SYS_CREATED_BY FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%500017115360%'; SELECT * FROM ABPPMGR.PRODUCTIONORDERS_P WHERE PRODUCTIONORDERID IN ('001100969936') ; SELECT BOMID,ITEM,PRIORITY,ROUTINGID FROM ABPPMGR.MST_ITEMBOMROUTING WHERE ITEM IN('000000102001001646','000000101001027737'); SELECT * FROM ABPPMGR.FORECASTDETAIL_P ; --attribute=FACTORY时value只能帶廠別 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102001001646','000000101001027737') order by attribute; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001646','000000101001027737');
案例六:成品MFG+半成品MO
5000166118/1900_1
000000101001014674CZ 5000166118/1900_1-MFG001; 450PCS
000000102001001578CZ 001201257026; 001201258698;
SELECT * FROM IN_MO where so_id='5000166118' and so_line_id='1900'; SELECT * FROM IN_MO_SHORT WHERE MO_ID in('001201257026','001201258698');--无数据,REL MO才有 SELECT * FROM IN_INVENTORY WHERE ITEM_ID IN('000000102001001578'); SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE ITEM_ID='000000102001001578';--no SELECT LOCATIONID,DEMANDORDERID,DEMANDLINEID,SUPPLYORDERID,QTYALLOCATED,ITEM,SUPPLYTYPE FROM ABPPMGR.SUPPLYDMDPEGPLAN WHERE ITEM IN('000000101001014674','000000102001001578');--前台显示 SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED,OPERATIONSEQ FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000166118' AND DEMANDLINEID='1900_1') OR DEMANDORDERID='5000166118/1900_1-MFG000' OR DEMANDORDERID IN('001201257026','001201258698') OR SUPPLYORDERID IN ('001201257026','001201258698') ; SELECT A.* FROM ABPPMGR.supplydmdpeg_p A WHERE ITEM='000000102001001578' AND (DEMANDORDERID LIKE '5000166118%' or DEMANDORDERID LIKE '%001201257026%' or DEMANDORDERID LIKE '%001201258698%') ORDER BY ATTRIBUTE;---NO --supplydmdpegging中locationid,lotlevel1,lotlevel2,SERIALNUM都必須等於inventory中相對應的值 否則綁定會失敗 SELECT PRODUCTIONORDID,BOMID,ITEM,QTYORDERED,REQUIREDDATE,ROUTINGID,UDF_MO_FACTORY FROM ABPPMGR.PRODUCTIONORDERS WHERE PRODUCTIONORDID LIKE '5000166118/1900%'; SELECT ITEM,LOCATIONID,PROPERTY,QTYOPEN,REPLANORDER,SALESORDERID,SOLINENUM,UDF_SALESORDERID,UDF_SOLINENUM FROM ABPPMGR.SALESORDERLINE WHERE SALESORDERID='5000166118' AND SOLINENUM LIKE '1900%';-- AND ITEM IN('000000101001027737'); SELECT ENTERPRISE, ENGINE_ID, SALESORDERID, SOLINENUM, ATTRIBUTECLASS, ATTRIBUTE, RELATIONSHIP, VALUE , SYS_CREATED_BY FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%50001661181900%'; SELECT * FROM ABPPMGR.PRODUCTIONORDERS_P WHERE PRODUCTIONORDERID IN ('001201257026','001201258698') ; SELECT BOMID,ITEM,PRIORITY,ROUTINGID FROM ABPPMGR.MST_ITEMBOMROUTING WHERE ITEM IN('000000102001001578','000000101001014674'); SELECT * FROM ABPPMGR.FORECASTDETAIL_P ; --attribute=FACTORY时value只能帶廠別 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM IN('000000102001001578','000000101001014674') order by attribute; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001578','000000101001014674');
案例七:成品MFG+半成品库存
5000173858/210_1
000000101002021061CZ 5000173858/210_1-MFG000; 105pcs
000000102002001124CZ 2022/2013; 105pcs
SELECT * FROM IN_sfcheader where so_id='5000173858' and so_line_id='310'; --无 SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000173858' AND DEMANDLINEID='210_1') OR DEMANDORDERID='5000173858/210_1-MFG000' OR DEMANDORDERID='5000173858/210_1-MFG001'; SELECT * FROM ABPPMGR.supplydmdpeg_p WHERE ITEM='000000102002001124' AND (DEMANDORDERID LIKE '5000173858%' ); SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE ITEM IN('000000102002001124'); SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000173858_210%'; --supplydmdpegging中locationid,lotlevel1,lotlevel2,SERIALNUM都必須等於inventory中相對應的值 否則綁定會失敗 SELECT PRODUCTIONORDID,BOMID,ITEM,QTYORDERED,REQUIREDDATE,ROUTINGID,UDF_MO_FACTORY FROM ABPPMGR.PRODUCTIONORDERS WHERE PRODUCTIONORDID LIKE '5000173858/210%'; SELECT ENTERPRISE, ENGINE_ID, SALESORDERID, SOLINENUM, ATTRIBUTECLASS, ATTRIBUTE, RELATIONSHIP, VALUE , SYS_CREATED_BY FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000173858%'; SELECT * FROM ABPPMGR.PRODUCTIONORDERS_P WHERE PRODUCTIONORDERID IN('001201241504','001201238002') ; SELECT BOMID,ITEM,PRIORITY,ROUTINGID FROM ABPPMGR.MST_ITEMBOMROUTING WHERE ITEM IN('000000101002021061','000000102002001124'); SELECT * FROM ABPPMGR.FORECASTDETAIL_P ; --attribute=FACTORY时value只能帶廠別 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM ='000000102002001124' and attributeclass like '' order by attribute; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102002001124'); SELECT * FROM IN_INVENTORY WHERE ITEM_ID ='000000102002001124';
案例七一:成品MFG+半成品库存+半成品MO
5000179765/110_1
000000101001020315 5000179765/110_1-MFG001;
000000102001001205 001201256950; 5000179765110_2023/2010
案例八:带SO号的半成品库存分配错误场景(成品mtl不欠料场景)
5000161187/50_1
000000101001020827 001100954403; 102pcs
000000102001001118 无需求;
SELECT * FROM IN_sfcheader where so_id='5000161187' and so_line_id='50'; --102 pcs SELECT * FROM IN_MO_SHORT WHERE MO_ID='001100954403' AND ITEM_ID='000000102001001118'; --NO 不欠料一定是MTL场景 SELECT * FROM IN_INVENTORY WHERE ITEM_ID='000000102001001118'; --2023_2007 70 非C SELECT * FROM IN_SEMI_ONHAND_LOCKED WHERE PEGGED_SO_ID='5000161187' AND PEGGED_SO_LINE_ID='50';--1464个库存 SELECT locationid,lotlevel1,lotlevel2,ITEM,SERIALNUM, DEMANDORDERID,DEMANDLINEID,DEMANDTYPE,OPERATIONSEQ,QTYINMOVE,SOURCEDATE,SUPPLYORDERID,SUPPLYTYPE,QTYALLOCATED FROM ABPPMGR.supplydmdpegging WHERE (DEMANDORDERID='5000161187' AND DEMANDLINEID='50_1') OR DEMANDORDERID='5000161187/50_1-MFG000' OR DEMANDORDERID='5000161187/50_1-MFG001'; SELECT * FROM ABPPMGR.supplydmdpeg_p WHERE ITEM='000000102001001118' ;--AND (DEMANDORDERID LIKE '5000161187%' ); SELECT item,locationid,property,qtyopen,qtyordered,salesorderid,solinenum FROM ABPPMGR.SALESORDERLINE WHERE ITEM IN('000000102002001124'); SELECT* FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000161187_50%'; --supplydmdpegging中locationid,lotlevel1,lotlevel2,SERIALNUM都必須等於inventory中相對應的值 否則綁定會失敗 SELECT PRODUCTIONORDID,BOMID,ITEM,QTYORDERED,REQUIREDDATE,ROUTINGID,UDF_MO_FACTORY FROM ABPPMGR.PRODUCTIONORDERS WHERE PRODUCTIONORDID LIKE '5000161187/50%'; SELECT ENTERPRISE, ENGINE_ID, SALESORDERID, SOLINENUM, ATTRIBUTECLASS, ATTRIBUTE, RELATIONSHIP, VALUE , SYS_CREATED_BY FROM ABPPMGR.SALESORDERLINE_P WHERE ATTRIBUTECLASS LIKE '%5000161187%'; SELECT * FROM ABPPMGR.PRODUCTIONORDERS_P WHERE PRODUCTIONORDERID IN('001100954403') ; SELECT BOMID,ITEM,PRIORITY,ROUTINGID FROM ABPPMGR.MST_ITEMBOMROUTING WHERE ITEM IN('000000101001020827','000000102001001118'); SELECT * FROM ABPPMGR.FORECASTDETAIL_P ; --attribute=FACTORY时value只能帶廠別 SELECT * FROM ABPPMGR.INVENTORYPROPERTY WHERE ITEM ='000000102001001118' and attributeclass like '' order by attribute; SELECT * FROM ABPPMGR.INVENTORY WHERE ITEM IN('000000102001001118');