parent
cac29bc18f
commit
dcec97c057
|
|
@ -1,15 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/apache-commons-lang.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/bcprov-ext-jdk15on-160.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/jackcess-encrypt-2.1.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/org-apache-commons-logging.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/hsqldb.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/jackcess-2.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="META-INF/poi-ooxml-3.9.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="META-INF/ucanaccess-4.0.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.compiere.model.CalloutEngine;
|
|||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.X_M_InventoryLine;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
public class MID_CalloutInventoryLine extends CalloutEngine implements IColumnCallout {
|
||||
|
||||
|
|
@ -23,8 +24,15 @@ public class MID_CalloutInventoryLine extends CalloutEngine implements IColumnCa
|
|||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String isEnd = "N";
|
||||
int PS_PPO_ID = (int) mTab.getValue("ps_ppoline_ID");
|
||||
if(PS_PPO_ID > 0) {
|
||||
isEnd = DB.getSQLValueStringEx(null, "SELECT IsEndProduct FROM PS_PPOLine WHERE PS_PPOLine_ID =?", new Object[] { PS_PPO_ID });
|
||||
}
|
||||
BigDecimal retValue = (BigDecimal) value;
|
||||
if(isEnd.equals("Y"))
|
||||
retValue = retValue.multiply(new BigDecimal(-1));
|
||||
|
||||
mTab.setValue(X_M_InventoryLine.COLUMNNAME_QtyInternalUse, retValue);
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,17 @@ public class MID_CalloutInventoryLineMA extends CalloutEngine implements IColumn
|
|||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
int M_InventoryLine_ID = (int) mTab.getValue(X_M_InventoryLineMA.COLUMNNAME_M_InventoryLine_ID);
|
||||
String isEnd = "N";
|
||||
MInventoryLine invL = new MInventoryLine(ctx, M_InventoryLine_ID, null);
|
||||
int PS_PPO_ID = invL.get_ValueAsInt("ps_ppoline_ID");
|
||||
if(PS_PPO_ID > 0) {
|
||||
isEnd = DB.getSQLValueStringEx(null, "SELECT IsEndProduct FROM PS_PPOLine WHERE PS_PPOLine_ID =?", new Object[] { PS_PPO_ID });
|
||||
}
|
||||
|
||||
BigDecimal retValue = (BigDecimal) value;
|
||||
if(isEnd.equals("Y"))
|
||||
retValue = retValue.multiply(new BigDecimal(-1));
|
||||
mTab.setValue(X_M_InventoryLineMA.COLUMNNAME_MovementQty, retValue);
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import andromedia.midsuit.model.MID_MBillingListLine;
|
|||
import andromedia.midsuit.model.MID_MDDOrder;
|
||||
import andromedia.midsuit.model.MID_MDDOrderLine;
|
||||
import andromedia.midsuit.model.MID_MProductionConfirm;
|
||||
import andromedia.midsuit.model.MID_MRequisition;
|
||||
import andromedia.midsuit.model.MID_MRequisitionTrx;
|
||||
import andromedia.midsuit.model.MID_MRequisitionTrxLine;
|
||||
import andromedia.midsuit.model.MID_PPO;
|
||||
|
|
@ -44,6 +45,7 @@ public class MID_ModelFactory implements IModelFactory{
|
|||
mapTableModels.put(MID_MDDOrderLine.Table_Name, "andromedia.midsuit.model.MID_MDDOrderLine");
|
||||
mapTableModels.put(MID_PPOLine.Table_Name, "andromedia.midsuit.model.MID_PPOLine");
|
||||
mapTableModels.put(X_C_OrderLineMA.Table_Name, "andromedia.midsuit.model.X_C_OrderLineMA");
|
||||
mapTableModels.put(MID_MRequisition.Table_Name, "andromedia.midsuit.model.MID_MRequisition");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package andromedia.midsuit.factory;
|
|||
import org.adempiere.base.event.AbstractEventHandler;
|
||||
import org.adempiere.base.event.IEventTopics;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.MDepreciationWorkfile;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInventoryLine;
|
||||
|
|
@ -16,6 +17,7 @@ import org.compiere.model.PO;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.osgi.service.event.Event;
|
||||
|
||||
import andromedia.midsuit.validator.MID_DeprWorkfileValidator;
|
||||
import andromedia.midsuit.validator.MID_InOutValidator;
|
||||
import andromedia.midsuit.validator.MID_InventoryLineMAValidator;
|
||||
import andromedia.midsuit.validator.MID_InventoryLineValidator;
|
||||
|
|
@ -50,7 +52,8 @@ public class MID_ValidatorFactory extends AbstractEventHandler {
|
|||
msg = MID_InventoryLineMAValidator.executeEvent(event, getPO(event));
|
||||
if(getPO(event).get_TableName().equals(MInventory.Table_Name))
|
||||
msg = MID_InventoryValidator.executeEvent(event, getPO(event));
|
||||
|
||||
if(getPO(event).get_TableName().equals(MDepreciationWorkfile.Table_Name))
|
||||
msg = MID_DeprWorkfileValidator.executeEvent(event, getPO(event));
|
||||
logEvent(event, getPO(event), msg);
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +86,9 @@ public class MID_ValidatorFactory extends AbstractEventHandler {
|
|||
registerTableEvent(IEventTopics.PO_BEFORE_CHANGE, MPaymentAllocate.Table_Name);
|
||||
registerTableEvent(IEventTopics.PO_BEFORE_NEW, MPaymentAllocate.Table_Name);
|
||||
|
||||
//Asset Workfile
|
||||
registerTableEvent(IEventTopics.PO_AFTER_CHANGE, MDepreciationWorkfile.Table_Name);
|
||||
|
||||
// Product Price
|
||||
registerTableEvent(IEventTopics.PO_AFTER_NEW, MProductPrice.Table_Name);
|
||||
registerTableEvent(IEventTopics.PO_AFTER_CHANGE,MProductPrice.Table_Name);
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ public class MID_CreateFromOrder extends CreateFrom {
|
|||
* 3 Product Name
|
||||
* 4 Qty Entered
|
||||
*/
|
||||
String isSOTrxParam = isSOTrx ? "Y":"N";
|
||||
StringBuilder sqlStmt = new StringBuilder();
|
||||
if(!isSOTrx){
|
||||
sqlStmt.append("SELECT rl.M_RequisitionLine_ID, rl.Line, "); //1..2
|
||||
sqlStmt.append("CASE WHEN rl.M_Product_ID IS NOT NULL THEN (SELECT p.Value||'-'||p.Name FROM M_Product p WHERE p.M_Product_ID = rl.M_Product_ID) END as ProductName, "); //3
|
||||
sqlStmt.append("rl.qty as Qty, mr.DateRequired, "); //4..5
|
||||
|
|
@ -102,28 +102,11 @@ public class MID_CreateFromOrder extends CreateFrom {
|
|||
sqlStmt.append("INNER JOIN M_Requisition mr ON mr.M_Requisition_ID=rl.M_Requisition_ID ");
|
||||
sqlStmt.append(" LEFT JOIN (SELECT M_RequisitionLine_ID, COALESCE(SUM(QtyOrdered),0) as QtyOrdered FROM C_OrderLine");
|
||||
sqlStmt.append(" GROUP BY M_RequisitionLine_ID) ol ON (ol.M_RequisitionLine_ID=rl.M_RequisitionLine_ID)");
|
||||
sqlStmt.append(" WHERE rl.AD_Client_ID=? AND mr.DocStatus=? ");
|
||||
sqlStmt.append(" AND (rl.qty > ol.QtyOrdered OR COALESCE(rl.qty - COALESCE(ol.QtyOrdered,0), 0) > 0)");}
|
||||
else{
|
||||
sqlStmt.append("SELECT rl.MID_RequisitionLine_ID, rl.Line, "); //1..2
|
||||
sqlStmt.append("CASE WHEN rl.M_Product_ID IS NOT NULL THEN (SELECT p.Value||'-'||p.Name FROM M_Product p WHERE p.M_Product_ID = rl.M_Product_ID) END as ProductName, "); //3
|
||||
sqlStmt.append("rl.qty as Qty, mr.DateRequired, "); //4..5
|
||||
sqlStmt.append("CASE WHEN rl.C_UOM_ID IS NOT NULL THEN (SELECT u.Name FROM C_UOM u WHERE u.C_UOM_ID = rl.C_UOM_ID) END AS uomName, "); //7
|
||||
sqlStmt.append("CASE WHEN rl.C_Charge_ID IS NOT NULL THEN (SELECT c.Name FROM C_Charge c WHERE c.C_Charge_ID = rl.C_Charge_ID) END as ChargeName, ");
|
||||
sqlStmt.append("COALESCE(rl.qty - COALESCE(ol.QtyOrdered,0), 0) as sisapo ");
|
||||
sqlStmt.append("FROM MID_RequisitionLine rl ");
|
||||
sqlStmt.append("INNER JOIN MID_Requisition mr ON mr.MID_Requisition_ID=rl.MID_Requisition_ID ");
|
||||
sqlStmt.append(" LEFT JOIN (SELECT MID_RequisitionLine_ID, COALESCE(SUM(QtyOrdered),0) as QtyOrdered FROM C_OrderLine");
|
||||
sqlStmt.append(" GROUP BY MID_RequisitionLine_ID) ol ON (ol.MID_RequisitionLine_ID=rl.MID_RequisitionLine_ID)");
|
||||
sqlStmt.append(" WHERE rl.AD_Client_ID=? AND mr.DocStatus=? ");
|
||||
sqlStmt.append(" WHERE rl.AD_Client_ID=? AND mr.DocStatus=? and mr.IsSOTrx=? ");
|
||||
sqlStmt.append(" AND (rl.qty > ol.QtyOrdered OR COALESCE(rl.qty - COALESCE(ol.QtyOrdered,0), 0) > 0)");
|
||||
}
|
||||
|
||||
if (M_Requisition_ID > 0) {
|
||||
if(!isSOTrx)
|
||||
sqlStmt.append("AND rl.M_Requisition_ID=? ");
|
||||
else
|
||||
sqlStmt.append("AND rl.MID_Requisition_ID=? ");
|
||||
sqlStmt.append("AND rl.M_Requisition_ID=? ");
|
||||
MRequisition req = new MRequisition(Env.getCtx(), M_Requisition_ID, null);
|
||||
desc = req.getDescription();
|
||||
}
|
||||
|
|
@ -147,8 +130,8 @@ public class MID_CreateFromOrder extends CreateFrom {
|
|||
int count = 1;
|
||||
PreparedStatement pstmt = DB.prepareStatement(sqlStmt.toString(), null);
|
||||
pstmt.setInt(count, Env.getAD_Client_ID(Env.getCtx())); count++;
|
||||
pstmt.setString(count, DocAction.STATUS_Completed);
|
||||
|
||||
pstmt.setString(count, DocAction.STATUS_Completed); count++;
|
||||
pstmt.setString(count, isSOTrxParam);
|
||||
if (M_Requisition_ID > 0) {
|
||||
count++;
|
||||
pstmt.setInt(count, M_Requisition_ID);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import java.math.BigDecimal;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
|
@ -616,7 +617,7 @@ public abstract class MID_CreateFromShipment extends CreateFrom
|
|||
protected void configureMiniTable (IMiniTable miniTable)
|
||||
{
|
||||
miniTable.setColumnClass(0, Boolean.class, false); // Selection
|
||||
miniTable.setColumnClass(1, BigDecimal.class, false); // Qty
|
||||
miniTable.setColumnClass(1, BigDecimal.class, true); // Qty
|
||||
miniTable.setColumnClass(2, String.class, true); // UOM
|
||||
miniTable.setColumnClass(3, String.class, false); // Locator
|
||||
miniTable.setColumnClass(4, String.class, true); // Product
|
||||
|
|
@ -833,6 +834,9 @@ public abstract class MID_CreateFromShipment extends CreateFrom
|
|||
inout.setC_Activity_ID(p_order.getC_Activity_ID());
|
||||
inout.setUser1_ID(p_order.getUser1_ID());
|
||||
inout.setUser2_ID(p_order.getUser2_ID());
|
||||
inout.set_ValueOfColumn("RegisterDate", (Timestamp) p_order.get_Value("RegisterDate") == null ? null : (Timestamp)p_order.get_Value("RegisterDate"));
|
||||
inout.set_ValueOfColumn("RegisterNo", p_order.get_ValueAsString("RegisterNo") == null ? null : p_order.get_ValueAsString("RegisterNo"));
|
||||
inout.set_ValueOfColumn("MID_AJUDocumentType_ID", p_order.get_ValueAsInt("MID_AJUDocumentType_ID"));
|
||||
inout.set_ValueOfColumn("noaju1", p_order.get_ValueAsString("noaju1") == null ? null : p_order.get_ValueAsString("noaju1"));
|
||||
inout.set_ValueOfColumn("noaju2", p_order.get_ValueAsString("noaju2") == null ? null : p_order.get_ValueAsString("noaju2"));
|
||||
inout.set_ValueOfColumn("noaju3", p_order.get_ValueAsString("noaju3") == null ? null : p_order.get_ValueAsString("noaju3"));
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.compiere.process.SvrProcess;
|
|||
import andromedia.midsuit.model.MID_PPOLine;
|
||||
import andromedia.midsuit.model.X_ps_ppoline;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
|
@ -49,7 +50,10 @@ public class MID_InventoryLineCreate extends SvrProcess{
|
|||
invL.setAD_Org_ID(inv.getAD_Org_ID());
|
||||
invL.setM_Inventory_ID(inv.getM_Inventory_ID());
|
||||
invL.setM_Product_ID(line.getM_Product_ID());
|
||||
invL.setQtyInternalUse(line.getQtyUsed());
|
||||
if(line.isEndProduct())
|
||||
invL.setQtyInternalUse(line.getQtyUsed().multiply(new BigDecimal(-1)));
|
||||
else
|
||||
invL.setQtyInternalUse(line.getQtyUsed());
|
||||
invL.set_ValueOfColumn("ps_ppo_ID", PS_PPO_ID);
|
||||
invL.setC_Charge_ID(p_C_Charge_ID);
|
||||
invL.set_ValueOfColumn("ps_ppoline_ID", line.getps_ppoline_ID());
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public class MID_InventoryValidator {
|
|||
}
|
||||
|
||||
private static String beforePrepare(MInventory inv) {
|
||||
if(inv.getCostingMethod()!=null)
|
||||
return "";
|
||||
for(MInventoryLine lines : inv.getLines(false)) {
|
||||
if(lines.getM_Locator_ID()==0)
|
||||
throw new AdempiereException("No Locator ON Line "+lines.getLine());
|
||||
|
|
|
|||
Loading…
Reference in New Issue