parent
6b3e9df70a
commit
8dd7aebf84
|
|
@ -6,15 +6,14 @@ import org.adempiere.exceptions.AdempiereException;
|
|||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRMALine;
|
||||
import org.compiere.model.MRequisition;
|
||||
import org.compiere.model.MRequisitionLine;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
import andromedia.midsuit.model.X_MID_UploadPEB;
|
||||
import andromedia.midsuit.model.X_MID_UploadTPB;
|
||||
import andromedia.midsuit.model.X_MID_UploadTPBLine;
|
||||
import andromedia.midsuit.model.X_MID_UploadTPBLineDet;
|
||||
|
|
@ -141,10 +140,12 @@ public class MID_TPBUpdateOrder extends SvrProcess{
|
|||
.setParameters(new Object[] { line.get_ID() })
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
|
||||
|
||||
for(X_MID_UploadTPBLineDet detailLine : detailLines) {
|
||||
if(detailLine.getM_RequisitionLine_ID()==0)
|
||||
throw new AdempiereException(" Requistion Line untuk Aju "+line.getNoAju()+" belum terisi !!!");
|
||||
|
||||
MRequisitionLine reqLine = new MRequisitionLine(getCtx(), detailLine.getM_RequisitionLine_ID(), get_TrxName());
|
||||
MOrderLine ol = new MOrderLine(order);
|
||||
ol.setM_Product_ID(detailLine.getM_Product_ID());
|
||||
ol.setC_UOM_ID(detailLine.getC_UOM_ID());
|
||||
|
|
@ -152,6 +153,7 @@ public class MID_TPBUpdateOrder extends SvrProcess{
|
|||
ol.setPriceList(detailLine.getPriceList());
|
||||
ol.setDiscount(detailLine.getDiscount());
|
||||
ol.setPrice(detailLine.getPriceActual());
|
||||
ol.setC_Tax_ID(reqLine.get_ValueAsInt("C_Tax_ID"));
|
||||
ol.set_ValueNoCheck("M_Requistion_ID", line.getM_Requisition_ID());
|
||||
ol.set_ValueNoCheck("M_RequisitionLine_ID", detailLine.getM_RequisitionLine_ID());
|
||||
ol.saveEx();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.compiere.model.MOrderLine;
|
|||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRMALine;
|
||||
import org.compiere.model.MRequisition;
|
||||
import org.compiere.model.MRequisitionLine;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
|
@ -139,13 +140,14 @@ public class MID_TPBUpdateOrderLine extends SvrProcess{
|
|||
for(X_MID_UploadTPBLineDet detailLine : detailLines) {
|
||||
if(detailLine.getM_RequisitionLine_ID()==0)
|
||||
throw new AdempiereException(" Requistion Line untuk Aju "+line.getNoAju()+" belum terisi !!!");
|
||||
|
||||
MRequisitionLine reqLine = new MRequisitionLine(getCtx(), detailLine.getM_RequisitionLine_ID(), get_TrxName());
|
||||
MOrderLine ol = new MOrderLine(order);
|
||||
ol.setM_Product_ID(detailLine.getM_Product_ID());
|
||||
ol.setC_UOM_ID(detailLine.getC_UOM_ID());
|
||||
ol.setQty(detailLine.getQty());
|
||||
ol.setPriceList(detailLine.getPriceList());
|
||||
ol.setDiscount(detailLine.getDiscount());
|
||||
ol.setC_Tax_ID(reqLine.get_ValueAsInt("C_Tax_ID"));
|
||||
ol.setPrice(detailLine.getPriceActual());
|
||||
ol.set_ValueNoCheck("M_Requistion_ID", line.getM_Requisition_ID());
|
||||
ol.set_ValueNoCheck("M_RequisitionLine_ID", detailLine.getM_RequisitionLine_ID());
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class MID_UploadTPB extends SvrProcess{
|
|||
String NoAju = checkRow.getCell(0).getStringCellValue();
|
||||
|
||||
String BC = checkRow.getCell(5).getStringCellValue();
|
||||
int MID_AJUDocumentType_ID = DB.getSQLValue(get_TrxName(), "SELECT MID_AJUDocumentType_ID FROM MID_AJUDocumentType WHERE Value=?", new Object[] { BC });
|
||||
int no = DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM MID_UploadTPBLine WHERE NoAju=? AND MID_AJUDocumentType_ID =?", new Object[] { NoAju, MID_AJUDocumentType_ID });
|
||||
int MID_AJUDocumentType_ID = DB.getSQLValue(get_TrxName(), "SELECT MID_AJUDocumentType_ID FROM MID_AJUDocumentType WHERE Value=? AND AD_Client_ID =? AND AD_Org_ID =?", new Object[] { BC, getAD_Client_ID(), tpb.getAD_Org_ID() });
|
||||
int no = DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM MID_UploadTPBLine WHERE NoAju=? AND MID_AJUDocumentType_ID =? AND AD_Client_ID =?", new Object[] { NoAju, MID_AJUDocumentType_ID, getAD_Client_ID() });
|
||||
if(no>0)
|
||||
documentValidation= documentValidation+NoAju+" ";
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ public class MID_UploadTPB extends SvrProcess{
|
|||
tpbLine.setProcessed(false);
|
||||
|
||||
AJU_DocType_Value = dataRow.getCell(5).getStringCellValue();
|
||||
int MID_AJUDocType_ID = DB.getSQLValue(get_TrxName(), "SELECT MID_AJUDocumentType_ID FROM MID_AjuDocumentType WHERE Value =?", new Object[] { AJU_DocType_Value });
|
||||
int MID_AJUDocType_ID = DB.getSQLValue(get_TrxName(), "SELECT MID_AJUDocumentType_ID FROM MID_AJUDocumentType WHERE Value=? AND AD_Client_ID =? AND AD_Org_ID =?", new Object[] { AJU_DocType_Value, getAD_Client_ID(), tpb.getAD_Org_ID() });
|
||||
if(MID_AJUDocType_ID <=0)
|
||||
throw new AdempiereException("AJU Document For "+AJU_DocType_Value+" !!!");
|
||||
tpbLine.setMID_AJUDocumentType_ID(MID_AJUDocType_ID);
|
||||
|
|
@ -153,12 +153,23 @@ public class MID_UploadTPB extends SvrProcess{
|
|||
tpbLine.setC_BPartner_Location_ID(MBPartnerLocation.getForBPartner(getCtx(), C_BPartner_ID, get_TrxName())[0].getC_BPartner_Location_ID());
|
||||
tpbLine.setC_DocTypeTarget_ID(p_C_DocType_ID);
|
||||
tpbLine.setSalesRep_ID(Env.getContextAsInt(getCtx(), "#AD_User_ID"));
|
||||
int M_Warehouse_ID = DB.getSQLValue(get_TrxName(), "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Value) like '%?%' AND AD_Client_ID =?", new Object[] {"MATERIAL", getAD_Client_ID()});
|
||||
// String sql = "SELECT M_Warehouse_ID FROM MID_AJUDocumentType WHERE MID_AJUDocumentType_ID =?";
|
||||
// int M_Warehouse_ID = DB.getSQLValue(get_TrxName(), sql, new Object[] { MID_AJUDocType_ID });
|
||||
int M_Warehouse_ID = 0;
|
||||
if(M_Warehouse_ID == 0)
|
||||
M_Warehouse_ID = DB.getSQLValue(get_TrxName(), "SELECT M_Warehouse_ID FROM M_Warehouse WHERE `(Value) like '%?%' AND AD_Client_ID =?", new Object[] {"MATERIAL", getAD_Client_ID()});
|
||||
|
||||
tpbLine.setM_Warehouse_ID(M_Warehouse_ID);
|
||||
|
||||
int M_PriceList_ID = DB.getSQLValue(get_TrxName(), "SELECT M_PriceList_ID FROM M_PriceList WHERE C_Currency_ID =? AND AD_Client_ID =? AND IsSOPriceList =?", new Object[] { C_Currency_ID, getAD_Client_ID(), false });
|
||||
tpbLine.setC_Currency_ID(C_Currency_ID);
|
||||
// sql = "SELECT M_PriceList_ID FROM MID_AJUDocumentType WHERE MID_AJUDocumentType_ID =?";
|
||||
|
||||
// int M_PriceList_ID = DB.getSQLValue(get_TrxName(), sql, new Object[] { MID_AJUDocType_ID });
|
||||
int M_PriceList_ID = 0;
|
||||
if(M_PriceList_ID == 0)
|
||||
M_PriceList_ID = DB.getSQLValue(get_TrxName(), "SELECT M_PriceList_ID FROM M_PriceList WHERE C_Currency_ID =? AND AD_Client_ID =? AND IsSOPriceList =?", new Object[] { C_Currency_ID, getAD_Client_ID(), false });
|
||||
|
||||
tpbLine.setM_PriceList_ID(M_PriceList_ID);
|
||||
tpbLine.setC_Currency_ID(C_Currency_ID);
|
||||
|
||||
tpbLine.saveEx();
|
||||
return tpbLine;
|
||||
|
|
|
|||
Loading…
Reference in New Issue