BF 1953753 - PRoblems in the warehouse stock info...

This commit is contained in:
fer_luck 2008-04-29 00:10:25 +00:00
parent 981de1dbe6
commit 688f959441
3 changed files with 82 additions and 10 deletions

View File

@ -116,7 +116,7 @@ public final class InfoProduct extends Info implements ActionListener
private CTextField fieldVendor = new CTextField(10); private CTextField fieldVendor = new CTextField(10);
//Begin - fer_luck @ centuryon //Begin - fer_luck @ centuryon
private CTextPane fieldDescription = new CTextPane(); private CTextArea fieldDescription = new CTextArea();
JXTaskPane warehouseStockPanel = new JXTaskPane(); JXTaskPane warehouseStockPanel = new JXTaskPane();
CPanel tablePanel = new CPanel(); CPanel tablePanel = new CPanel();
MiniTable warehouseTbl = new MiniTable(); MiniTable warehouseTbl = new MiniTable();
@ -229,14 +229,14 @@ public final class InfoProduct extends Info implements ActionListener
warehouseTbl.addMouseListener(this); warehouseTbl.addMouseListener(this);
warehouseTbl.getSelectionModel().addListSelectionListener(this); warehouseTbl.getSelectionModel().addListSelectionListener(this);
warehouseTbl.autoSize(); warehouseTbl.autoSize();
warehouseTbl.setPreferredScrollableViewportSize(new Dimension(INFO_WIDTH - 10, 40));
warehouseTbl.setPreferredSize(new Dimension(INFO_WIDTH - 10, 40));
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{ ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
new ColumnInfo( new ColumnInfo(
Msg.translate(Env.getCtx(), "Value"), Msg.translate(Env.getCtx(), "Value"),
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
String.class), String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
@ -249,14 +249,14 @@ public final class InfoProduct extends Info implements ActionListener
substituteTbl.addMouseListener(this); substituteTbl.addMouseListener(this);
substituteTbl.getSelectionModel().addListSelectionListener(this); substituteTbl.getSelectionModel().addListSelectionListener(this);
substituteTbl.autoSize(); substituteTbl.autoSize();
substituteTbl.setPreferredScrollableViewportSize(new Dimension(INFO_WIDTH - 10, 40));
substituteTbl.setPreferredSize(new Dimension(INFO_WIDTH - 10, 40));
ColumnInfo[] s_layoutRelated = new ColumnInfo[]{ ColumnInfo[] s_layoutRelated = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
new ColumnInfo( new ColumnInfo(
Msg.translate(Env.getCtx(), "Value"), Msg.translate(Env.getCtx(), "Value"),
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
String.class), String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
@ -269,13 +269,11 @@ public final class InfoProduct extends Info implements ActionListener
relatedTbl.addMouseListener(this); relatedTbl.addMouseListener(this);
relatedTbl.getSelectionModel().addListSelectionListener(this); relatedTbl.getSelectionModel().addListSelectionListener(this);
relatedTbl.autoSize(); relatedTbl.autoSize();
relatedTbl.setPreferredScrollableViewportSize(new Dimension(INFO_WIDTH - 10, 40));
relatedTbl.setPreferredSize(new Dimension(INFO_WIDTH - 10, 40));
CTabbedPane jTab = new CTabbedPane(); CTabbedPane jTab = new CTabbedPane();
jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl)); jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
jTab.setPreferredSize(new Dimension(INFO_WIDTH, 110)); jTab.setPreferredSize(new Dimension(INFO_WIDTH, 105));
jTab.addTab(Msg.translate(Env.getCtx(), "Description"), fieldDescription); jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl)); jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl)); jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, 110)); tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, 110));

View File

@ -0,0 +1,18 @@
CREATE OR REPLACE VIEW M_Product_SubstituteRelated_V AS
SELECT s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, mp.name, org.name as orgname
FROM M_SUBSTITUTE s
JOIN M_STORAGE ms ON ms.m_product_id = s.substitute_id
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
UNION
SELECT r.ad_client_id, r.ad_org_id, r.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, r.m_product_id, r.relatedproduct_id, r.description, 'R' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, mp.name, org.name as orgname
FROM M_RELATEDPRODUCT r
JOIN M_STORAGE ms ON ms.m_product_id = r.relatedproduct_id
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id;

View File

@ -0,0 +1,56 @@
DROP VIEW m_product_substituterelated_v;
CREATE OR
REPLACE VIEW m_product_substituterelated_v AS
SELECT s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.m_product_id,
s.substitute_id,
s.description,
'S' AS rowtype,
(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
mp.NAME,
ms.qtyonhand,
ms.qtyreserved,
mpr.pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name as orgname
FROM m_substitute s
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
UNION
SELECT r.ad_client_id,
r.ad_org_id,
r.isactive,
r.created,
r.createdby,
r.updated,
r.updatedby,
r.m_product_id,
r.relatedproduct_id AS substitute_id,
r.description,
'R' AS rowtype,
(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
mp.NAME,
ms.qtyonhand,
ms.qtyreserved,
mpr.pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name as orgname
FROM m_relatedproduct r
JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id;