Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.kosta.aoi.process;
- import java.sql.Timestamp;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.aoi.enh.component.ENHValidatorFactory;
- import org.compiere.model.MOrder;
- import org.compiere.model.Query;
- import org.compiere.process.SvrProcess;
- import org.kosta.aoi.model.X_C_Populate_Generatexml;
- public class GenerateXmlFromPopulate extends SvrProcess {
- protected String msg = null;
- private ArrayList<String> orderIdSucess = new ArrayList<String>();
- @Override
- protected void prepare() {
- }
- @Override
- protected String doIt() throws Exception {
- ENHValidatorFactory enhFactory = new ENHValidatorFactory();
- List<X_C_Populate_Generatexml> populate_orderList = new Query(getCtx(), X_C_Populate_Generatexml.Table_Name, "processed='N'", get_TrxName())
- .setClient_ID()
- .setOnlyActiveRecords(true)
- .list();
- for(X_C_Populate_Generatexml populateOrder : populate_orderList){
- String validation = null;
- MOrder order = new MOrder(getCtx(), populateOrder.getC_Order_ID(), get_TrxName());
- validation = enhFactory.callWebPOUrlXml(order, msg);
- if(validation == null ){
- populateOrder.setProcessed(true);
- populateOrder.setxmlgenerated(true);
- populateOrder.setgenerateddate(GetTime());
- populateOrder.saveEx();
- orderIdSucess.add(populateOrder.getC_Order().getDocumentNo());
- }
- }
- setMsgReturn();
- return msg;
- }
- private void setMsgReturn(){
- msg+= "Generate XML Sucess For = ";
- for(String populate : orderIdSucess){
- msg += populate+", ";
- }
- }
- private Timestamp GetTime(){
- // get timing when this function is running use for set id on description po header.
- Date date= new Date();
- long time = date.getTime();
- Timestamp ts = new Timestamp(time);
- return ts;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement