IDEMPIERE-862 Create lines from MPS Lines function is not working
This commit is contained in:
parent
d2c3c23d9d
commit
f7af4d1e20
|
@ -0,0 +1,30 @@
|
|||
CREATE OR REPLACE VIEW m_packagelines_avail_v AS
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 ) AS qty, iol.m_product_id, p.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN ad_clientinfo ci ON ci.ad_client_id = iol.ad_client_id
|
||||
WHERE p.ispicklistprintdetails = 'N' AND iol.m_product_id <> COALESCE(ci.m_productfreight_id, 0 ) AND (iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 )) <> 0
|
||||
UNION
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line + pbom.line / 100 AS line, iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 ) AS qty, pbom.m_productbom_id AS m_product_id, p2.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN m_product_bom pbom ON p.m_product_id = pbom.m_product_id
|
||||
JOIN m_product p2 ON pbom.m_productbom_id = p2.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
WHERE p.isbom = 'Y' AND p.isverified = 'Y' AND p.ispicklistprintdetails = 'Y' AND (iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 )) <> 0
|
||||
ORDER BY 1, 2, 3, 5;
|
|
@ -0,0 +1,30 @@
|
|||
CREATE OR REPLACE VIEW m_packagelines_avail_v AS
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 ) AS qty, iol.m_product_id, p.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN ad_clientinfo ci ON ci.ad_client_id = iol.ad_client_id
|
||||
WHERE p.ispicklistprintdetails = 'N' AND iol.m_product_id <> COALESCE(ci.m_productfreight_id, 0 ) AND (iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 )) <> 0
|
||||
UNION
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line + pbom.line / 100 AS line, iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 ) AS qty, pbom.m_productbom_id AS m_product_id, p2.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN m_product_bom pbom ON p.m_product_id = pbom.m_product_id
|
||||
JOIN m_product p2 ON pbom.m_productbom_id = p2.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
WHERE p.isbom = 'Y' AND p.isverified = 'Y' AND p.ispicklistprintdetails = 'Y' AND (iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 )) <> 0
|
||||
ORDER BY 1, 2, 3, 5;
|
|
@ -0,0 +1,33 @@
|
|||
CREATE OR REPLACE VIEW m_packagelines_avail_v AS
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 ) AS qty, iol.m_product_id, p.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN ad_clientinfo ci ON ci.ad_client_id = iol.ad_client_id
|
||||
WHERE p.ispicklistprintdetails = 'N' AND iol.m_product_id <> COALESCE(ci.m_productfreight_id, 0 ) AND (iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 )) <> 0
|
||||
UNION
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line + pbom.line / 100 AS line, iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 ) AS qty, pbom.m_productbom_id AS m_product_id, p2.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN m_product_bom pbom ON p.m_product_id = pbom.m_product_id
|
||||
JOIN m_product p2 ON pbom.m_productbom_id = p2.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
WHERE p.isbom = 'Y' AND p.isverified = 'Y' AND p.ispicklistprintdetails = 'Y' AND (iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 )) <> 0
|
||||
ORDER BY 1, 2, 3, 5;
|
||||
|
||||
SELECT register_migration_script('201304171803_IDEMPIERE-861.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,33 @@
|
|||
CREATE OR REPLACE VIEW m_packagelines_avail_v AS
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 ) AS qty, iol.m_product_id, p.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN ad_clientinfo ci ON ci.ad_client_id = iol.ad_client_id
|
||||
WHERE p.ispicklistprintdetails = 'N' AND iol.m_product_id <> COALESCE(ci.m_productfreight_id, 0 ) AND (iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 )) <> 0
|
||||
UNION
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line + pbom.line / 100 AS line, iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 ) AS qty, pbom.m_productbom_id AS m_product_id, p2.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN m_product_bom pbom ON p.m_product_id = pbom.m_product_id
|
||||
JOIN m_product p2 ON pbom.m_productbom_id = p2.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
WHERE p.isbom = 'Y' AND p.isverified = 'Y' AND p.ispicklistprintdetails = 'Y' AND (iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 )) <> 0
|
||||
ORDER BY 1, 2, 3, 5;
|
||||
|
||||
SELECT register_migration_script('201304171803_IDEMPIERE-861.sql') FROM dual
|
||||
;
|
|
@ -579,6 +579,15 @@ public class MPackage extends X_M_Package
|
|||
for (int i = 0; i < ids.length; i++)
|
||||
{
|
||||
MPackageMPS packageMPS = new MPackageMPS(getCtx(), ids[i], get_TrxName());
|
||||
if (packageMPS.getWeight() == null || packageMPS.getWeight().compareTo(BigDecimal.ZERO) == 0)
|
||||
{
|
||||
String sql = "SELECT SUM(LineWeight) FROM X_PackageLineWeight plw WHERE plw.M_PackageMPS_ID=?";
|
||||
BigDecimal weight = DB.getSQLValueBD(get_TrxName(), sql, packageMPS.getM_PackageMPS_ID());
|
||||
if (weight == null)
|
||||
weight = BigDecimal.ZERO;
|
||||
packageMPS.setWeight(weight);
|
||||
packageMPS.saveEx();
|
||||
}
|
||||
|
||||
MShippingTransactionLine stl = new MShippingTransactionLine(st.getCtx(), 0, st.get_TrxName());
|
||||
stl.setAD_Client_ID(packageMPS.getAD_Client_ID());
|
||||
|
|
|
@ -72,7 +72,7 @@ public class VCreateFromPackageShipmentUI extends CreateFromPackageShipment
|
|||
|
||||
dialog.setTitle(getTitle());
|
||||
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_Package_ID);
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_PackageMPS_ID);
|
||||
MPackageMPS packageMPS = new MPackageMPS(Env.getCtx(), M_PackageMPS_ID, null);
|
||||
MPackage mPackage = new MPackage(Env.getCtx(), packageMPS.getM_Package_ID(), null);
|
||||
loadTableOIS(getShipmentData(mPackage.getM_InOut_ID()));
|
||||
|
|
|
@ -66,7 +66,7 @@ public class WCreateFromPackageShipmentUI extends CreateFromPackageShipment
|
|||
|
||||
window.setTitle(getTitle());
|
||||
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_Package_ID);
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_PackageMPS_ID);
|
||||
MPackageMPS packageMPS = new MPackageMPS(Env.getCtx(), M_PackageMPS_ID, null);
|
||||
MPackage mPackage = new MPackage(Env.getCtx(), packageMPS.getM_Package_ID(), null);
|
||||
loadTableOIS(getShipmentData(mPackage.getM_InOut_ID()));
|
||||
|
|
|
@ -119,7 +119,7 @@ public abstract class CreateFromPackageShipment extends CreateFrom
|
|||
|
||||
public boolean save(IMiniTable miniTable, String trxName)
|
||||
{
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_Package_ID);
|
||||
int M_PackageMPS_ID = (Integer) getGridTab().getValue(MPackageMPS.COLUMNNAME_M_PackageMPS_ID);
|
||||
MPackageMPS packageMPS = new MPackageMPS(Env.getCtx(), M_PackageMPS_ID, null);
|
||||
|
||||
MPackage mPackage = new MPackage(Env.getCtx(), packageMPS.getM_Package_ID(), null);
|
||||
|
|
Loading…
Reference in New Issue