daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  *
  3.  */
  4. package org.jleaf.erp.purch.services.po;
  5.  
  6. import java.util.List;
  7. import org.jleaf.erp.purch.services.AbstractPurchasingService;
  8. import org.jlego.baseservices.util.ServiceUtil;
  9. import org.jlego.core.Dto;
  10. import org.jlego.core.annotation.Info;
  11. import org.jlego.core.annotation.InfoIn;
  12. import org.jlego.core.annotation.InfoOut;
  13. import org.jlego.core.annotation.ServiceDoc;
  14. import org.jlego.util.DtoUtil;
  15. import org.slf4j.Logger;
  16. import org.slf4j.LoggerFactory;
  17.  
  18. /**
  19.  * @author david 11 Sep 2012
  20.  *
  21.  */
  22. //@formatter:off
  23. @ServiceDoc
  24. @InfoIn(value = {
  25.         @Info(name = "result.header.userLoginId", description = "user login id", type = Long.class),
  26.         @Info(name = "result.header.roleLoginId", description = "role login id", type = Long.class),
  27.         @Info(name = "result.header.tenantLoginId", description = "tenant login id", type = Long.class),
  28.         @Info(name = "result.header.datetime", description = "datetime", type = String.class),
  29.         @Info(name = "result.header.sessionId", description = "session id", type = String.class),
  30.         @Info(name = "result.header.secureKey", description = "secure key", type = String.class),
  31.         @Info(name = "result.header.taskName", description = "task name", type = String.class),
  32.         @Info(name = "result.payload.docNo", description = "Nomor Transaksi", type = String.class),
  33.         @Info(name = "result.payload.docDate", description = "Tanggal Transaksi", type = String.class),
  34.         @Info(name = "result.payload.ouId", description = "Organisasi Unit id", type = Long.class),
  35.         @Info(name = "result.payload.extDocNo", description = "external document no", type = String.class),
  36.         @Info(name = "result.payload.extDocDate", description = "external document date", type = String.class),
  37.         @Info(name = "result.payload.remark", description = "remark", type = String.class),
  38.         @Info(name = "result.payload.partnerId", description = "partner / supplier id", type = Long.class),
  39.         @Info(name = "result.payload.purchaserId", description = "purchase officer id", type = Long.class),
  40.         @Info(name = "result.payload.warehouseId", description = "received warehouse id", type = Long.class),
  41.         @Info(name = "result.payload.flgDelivery", description = "flag delivery (pick up or deliver)", type = String.class),
  42.         @Info(name = "result.payload.currCode", description = "currency code", type = String.class),
  43.         @Info(name = "result.payload.topCode", description = "term of payment code", type = String.class),
  44.         @Info(name = "result.payload.purchaseOrderItemList", description = "list of purchase order item (lineNo, productId, flgStock, grossPricePo, flgTaxAmount, taxId, qtyPo, poUomId, qtyInt, activityGlId, ouRcId, eta, toleranceRcvQty)", type = List.class)
  45. })
  46. @InfoOut(value = {
  47.         @Info(name = "result.id", description = "po id", type = Long.class),
  48.         @Info(name = "result.successList", description = "success detail list to be saved (lineNo)", type = List.class),
  49.         @Info(name = "result.failList", description = "fail detail list to be saved (lineNo, errorKey, args)", type = List.class)
  50. })
  51. //@formatter:on
  52. public class AddPurchaseOrderService extends AbstractPurchasingService {
  53.  
  54.     private final static Logger LOG = LoggerFactory.getLogger(AddPurchaseOrderService.class);
  55.  
  56.     @Override
  57.     public String getTaskName() {
  58.         return "addPurchaseOrder";
  59.     }
  60.  
  61.     @SuppressWarnings({"unchecked", "rawtypes"})
  62.     @Override
  63.     public Dto process(Dto inputDto) throws Exception {
  64.         LOG.debug("BEGIN : process");
  65.  
  66.         // Declaring variables
  67.         Dto inputDtoForAddPurchaseOrder;
  68.         Dto outputDtoForAddPurchaseOrder;
  69.         Dto outputDto;
  70.  
  71.         // Validation input variables
  72.         ServiceUtil.valNullParams(
  73.                 inputDto,
  74.                 new String[]{"result.payload.docNo", "result.payload.docDate", "result.payload.ouId", "result.payload.extDocNo", "result.payload.extDocDate", "result.payload.remark", "result.payload.partnerId", "result.payload.purchaserId", "result.payload.warehouseId", "result.payload.flgDelivery", "result.payload.currCode", "result.payload.topCode", "result.payload.purchaseOrderItemList"});
  75.  
  76.         // Preparing input parameters
  77.         inputDtoForAddPurchaseOrder = new Dto();
  78.         inputDtoForAddPurchaseOrder.put("docNo", inputDto.getString("result.payload.docNo"));
  79.         inputDtoForAddPurchaseOrder.put("docDate", inputDto.getString("result.payload.docDate"));
  80.         inputDtoForAddPurchaseOrder.put("ouId", Long.valueOf(inputDto.getString("result.payload.ouId")));
  81.         inputDtoForAddPurchaseOrder.put("extDocNo", inputDto.getString("result.payload.extDocNo"));
  82.         inputDtoForAddPurchaseOrder.put("extDocDate", inputDto.getString("result.payload.extDocDate"));
  83.         inputDtoForAddPurchaseOrder.put("remark", inputDto.getString("result.payload.remark"));
  84.         inputDtoForAddPurchaseOrder.put("partnerId", Long.valueOf(inputDto.getString("result.payload.partnerId")));
  85.         inputDtoForAddPurchaseOrder.put("purchaserId", Long.valueOf(inputDto.getString("result.payload.purchaserId")));
  86.         inputDtoForAddPurchaseOrder.put("warehouseId", Long.valueOf(inputDto.getString("result.payload.warehouseId")));
  87.         inputDtoForAddPurchaseOrder.put("flgDelivery", inputDto.getString("result.payload.flgDelivery"));
  88.         inputDtoForAddPurchaseOrder.put("currCode", inputDto.getString("result.payload.currCode"));
  89.         inputDtoForAddPurchaseOrder.put("topCode", inputDto.getString("result.payload.topCode"));
  90.         inputDtoForAddPurchaseOrder.put("purchaseOrderItemList", DtoUtil.convertToArray(inputDto.get("result.payload.purchaseOrderItemList")));
  91.         inputDtoForAddPurchaseOrder.put("tenantLoginId", Long.valueOf(inputDto.getString("result.header.tenantLoginId")));
  92.         inputDtoForAddPurchaseOrder.put("userLoginId", Long.valueOf(inputDto.getString("result.header.userLoginId")));
  93.         inputDtoForAddPurchaseOrder.put("roleLoginId", Long.valueOf(inputDto.getString("result.header.roleLoginId")));
  94.         inputDtoForAddPurchaseOrder.put("datetime", inputDto.getString("result.header.datetime"));
  95.  
  96.         // Processing
  97.         outputDtoForAddPurchaseOrder = getBusinessTransaction("addPurchaseOrder").execute(inputDtoForAddPurchaseOrder);
  98.  
  99.         // Preparing output parameters
  100.         List successList = ServiceUtil.getFilteredList(outputDtoForAddPurchaseOrder.getList("successList"), new String[]{"lineNo"});
  101.         List failList = ServiceUtil.getFilteredList(outputDtoForAddPurchaseOrder.getList("failList"), new String[]{"lineNo", "errorKey", "args"});
  102.  
  103.         outputDto = new Dto();
  104.         outputDto.put("result", outputDtoForAddPurchaseOrder.strip("id"));
  105.         outputDto.put("result.successList", successList);
  106.         outputDto.put("result.failList", failList);
  107.        
  108.         LOG.debug("Output DTO : " + outputDto);
  109.         LOG.debug("END : process");
  110.         return outputDto;
  111.     }
  112. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top