Validator
This commit is contained in:
parent
72a59a4901
commit
d646a47f7f
|
|
@ -63,7 +63,7 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
|
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "DateRequired"));
|
columnNames.add(Msg.translate(Env.getCtx(), "DateRequired"));
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID"));
|
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID"));
|
||||||
// columnNames.add(Msg.translate(Env.getCtx(), "SisaPO"));
|
columnNames.add(Msg.translate(Env.getCtx(), "SisaPO"));
|
||||||
return columnNames;
|
return columnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +189,7 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
Timestamp p_dateRequired = rs.getTimestamp(5);
|
Timestamp p_dateRequired = rs.getTimestamp(5);
|
||||||
line.add(p_dateRequired); //5 - DateRequired
|
line.add(p_dateRequired); //5 - DateRequired
|
||||||
line.add(rs.getString(6)); // 7 - UOM
|
line.add(rs.getString(6)); // 7 - UOM
|
||||||
// line.add((BigDecimal)rs.getBigDecimal(8)); //9 - SisaPO
|
line.add((BigDecimal)rs.getBigDecimal(8)); //9 - SisaPO
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
@ -318,7 +318,7 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
miniTable.setColumnClass(5, Timestamp.class, true); // 5-DateRequired
|
miniTable.setColumnClass(5, Timestamp.class, true); // 5-DateRequired
|
||||||
miniTable.setColumnClass(6, String.class, true); // 7-UOM
|
miniTable.setColumnClass(6, String.class, true); // 7-UOM
|
||||||
//miniTable.setColumnClass(8, BigDecimal.class, true); // 8-QtyRequired
|
//miniTable.setColumnClass(8, BigDecimal.class, true); // 8-QtyRequired
|
||||||
// miniTable.setColumnClass(8, BigDecimal.class, false); // 9-SisaPO
|
miniTable.setColumnClass(8, BigDecimal.class, false); // 9-SisaPO
|
||||||
|
|
||||||
|
|
||||||
// Table UI
|
// Table UI
|
||||||
|
|
@ -340,7 +340,7 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
{
|
{
|
||||||
MOrderLine orderLine = new MOrderLine(order);
|
MOrderLine orderLine = new MOrderLine(order);
|
||||||
BigDecimal qty = (BigDecimal)miniTable.getValueAt(i, 4); // 4 - Qty
|
BigDecimal qty = (BigDecimal)miniTable.getValueAt(i, 4); // 4 - Qty
|
||||||
// BigDecimal sisapo = (BigDecimal)miniTable.getValueAt(i, 7); // 9 - SisaPO
|
BigDecimal sisapo = (BigDecimal)miniTable.getValueAt(i, 7); // 9 - SisaPO
|
||||||
BigDecimal qtyOrdered = qty;
|
BigDecimal qtyOrdered = qty;
|
||||||
// BigDecimal qtyOrdered = sisapo;
|
// BigDecimal qtyOrdered = sisapo;
|
||||||
KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 1); // 1-Line
|
KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 1); // 1-Line
|
||||||
|
|
@ -552,8 +552,8 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
orderLine.set_ValueOfColumn("PriceRequisition", reqLine.getPriceActual());
|
orderLine.set_ValueOfColumn("PriceRequisition", reqLine.getPriceActual());
|
||||||
|
|
||||||
orderLine.set_ValueOfColumn("DiscAmt", Env.ZERO);
|
orderLine.set_ValueOfColumn("DiscAmt", Env.ZERO);
|
||||||
orderLine.set_ValueOfColumn("MIDRequisition_ID", reqLine.getMID_Requisition_ID());
|
orderLine.set_ValueOfColumn("MID_Requisition_ID", reqLine.getMID_Requisition_ID());
|
||||||
orderLine.set_ValueOfColumn("MIDRequisitionLine_ID", reqLine.getMID_RequisitionLine_ID());
|
orderLine.set_ValueOfColumn("MID_RequisitionLine_ID", reqLine.getMID_RequisitionLine_ID());
|
||||||
|
|
||||||
orderLine.set_ValueOfColumn("IsTrackAsAsset", reqLine.get_ValueAsBoolean("IsTrackAsAsset"));
|
orderLine.set_ValueOfColumn("IsTrackAsAsset", reqLine.get_ValueAsBoolean("IsTrackAsAsset"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class MID_MRequisitionTrx extends X_MID_Requisition implements DocAction{
|
||||||
@Override
|
@Override
|
||||||
public boolean closeIt() {
|
public boolean closeIt() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package andromedia.midsuit.process;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.model.MInOut;
|
import org.compiere.model.MInOut;
|
||||||
import org.compiere.model.MInvoice;
|
import org.compiere.model.MInvoice;
|
||||||
import org.compiere.model.MOrder;
|
import org.compiere.model.MOrder;
|
||||||
|
|
@ -40,47 +41,47 @@ public class MID_CompleteRecord extends SvrProcess{
|
||||||
case "C_Order" :
|
case "C_Order" :
|
||||||
MOrder o = new MOrder(getCtx(), record_ID, get_TrxName());
|
MOrder o = new MOrder(getCtx(), record_ID, get_TrxName());
|
||||||
if(!o.processIt(DocAct))
|
if(!o.processIt(DocAct))
|
||||||
return o.getProcessMsg();
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
o.saveEx();
|
o.saveEx();
|
||||||
break;
|
break;
|
||||||
case "M_InOut" :
|
case "M_InOut" :
|
||||||
MInOut io = new MInOut(getCtx(), record_ID, get_TrxName());
|
MInOut io = new MInOut(getCtx(), record_ID, get_TrxName());
|
||||||
if(!io.processIt(DocAct))
|
if(!io.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
io.saveEx();
|
io.saveEx();
|
||||||
break;
|
break;
|
||||||
case "C_Invoice" :
|
case "C_Invoice" :
|
||||||
MInvoice inv = new MInvoice(getCtx(), record_ID, get_TrxName());
|
MInvoice inv = new MInvoice(getCtx(), record_ID, get_TrxName());
|
||||||
if(!inv.processIt(DocAct))
|
if(!inv.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
inv.saveEx();
|
inv.saveEx();
|
||||||
break;
|
break;
|
||||||
case "C_Payment" :
|
case "C_Payment" :
|
||||||
MPayment p = new MPayment(getCtx(), record_ID, get_TrxName());
|
MPayment p = new MPayment(getCtx(), record_ID, get_TrxName());
|
||||||
if(!p.processIt(DocAct))
|
if(!p.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
p.saveEx();
|
p.saveEx();
|
||||||
break;
|
break;
|
||||||
case "MID_Requisition" :
|
case "MID_Requisition" :
|
||||||
MID_MRequisitionTrx rs = new MID_MRequisitionTrx(getCtx(), record_ID, get_TrxName());
|
MID_MRequisitionTrx rs = new MID_MRequisitionTrx(getCtx(), record_ID, get_TrxName());
|
||||||
if(!rs.processIt(DocAct))
|
if(!rs.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
rs.saveEx();
|
rs.saveEx();
|
||||||
break;
|
break;
|
||||||
case "M_Requisition" :
|
case "M_Requisition" :
|
||||||
MRequisition req = new MRequisition(getCtx(), record_ID, get_TrxName());
|
MRequisition req = new MRequisition(getCtx(), record_ID, get_TrxName());
|
||||||
if(!req.processIt(DocAct))
|
if(!req.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
req.saveEx();
|
req.saveEx();
|
||||||
break;
|
break;
|
||||||
case "M_RMA" :
|
case "M_RMA" :
|
||||||
MRMA rma = new MRMA(getCtx(), record_ID, get_TrxName());
|
MRMA rma = new MRMA(getCtx(), record_ID, get_TrxName());
|
||||||
if(!rma.processIt(DocAct))
|
if(!rma.processIt(DocAct))
|
||||||
return "Failed to Complete Document !!!";
|
throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
rma.saveEx();
|
rma.saveEx();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default : return "Table not defined by WS !!!";
|
default : throw new AdempiereException( "Failed to Complete Document !!!");
|
||||||
}
|
}
|
||||||
return "Document Process Complete !!!";
|
return "Document Process Complete !!!";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import org.compiere.model.Query;
|
||||||
import org.compiere.model.X_C_DocType;
|
import org.compiere.model.X_C_DocType;
|
||||||
import org.compiere.model.X_M_InOut;
|
import org.compiere.model.X_M_InOut;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
|
import org.compiere.util.DB;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
public class MID_RMAValidator {
|
public class MID_RMAValidator {
|
||||||
|
|
@ -120,7 +121,11 @@ public class MID_RMAValidator {
|
||||||
MRMALine rmaLine = new MRMALine(RMA.getCtx(), 0, RMA.get_TrxName());
|
MRMALine rmaLine = new MRMALine(RMA.getCtx(), 0, RMA.get_TrxName());
|
||||||
rmaLine.setM_RMA_ID(RMA.getM_RMA_ID());
|
rmaLine.setM_RMA_ID(RMA.getM_RMA_ID());
|
||||||
rmaLine.setM_InOutLine_ID(iol.getM_InOutLine_ID());
|
rmaLine.setM_InOutLine_ID(iol.getM_InOutLine_ID());
|
||||||
rmaLine.setQty(iol.getMovementQty());
|
BigDecimal qtyReturned = DB.getSQLValueBD(RMA.get_TrxName(), "SELECT COALESCE(SUM(Qty),0) FROM M_RMALine WHERE M_InOutLine_ID =?", iol.getM_InOutLine_ID());
|
||||||
|
if(iol.getMovementQty().subtract(qtyReturned).signum()==0)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
rmaLine.setQty(iol.getMovementQty().subtract(qtyReturned));
|
||||||
rmaLine.setAD_Org_ID(RMA.getAD_Org_ID());
|
rmaLine.setAD_Org_ID(RMA.getAD_Org_ID());
|
||||||
rmaLine.setDescription(iol.getDescription());
|
rmaLine.setDescription(iol.getDescription());
|
||||||
if (!rmaLine.save())
|
if (!rmaLine.save())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue