# Web Services

# Get WMS barcode format

GET WMS barcode format.

HTTP Request

GET http://[server]/jsf/rfws/erp/wms/dataCapture/getBarcodeFormat

Parameters

Name Type Description
authorization String(Header) Required. Access Token obtained via OAuth
client_id String(Header) Required. Client ID in M18 [OAuth Applications]
beId int(Query) Business entity ID, if beId is passed, only return specified BE's barcode format
id string(Query) List of WMS barcode format ID, split by ",", if id is not passed, return all barcode format

Sample request:

OkHttpClient client = new OkHttpClient();

String url = "http://" + server + "/jsf/rfws/erp/wms/dataCapture/getBarcodeFormat"
    +"?id=" + URLEncoder.encode("1,2,3", "UTF-8");

Request request = new Request.Builder()
  .url(url)
  .get()
  .addHeader("client_id", clientID)
  .addHeader("authorization", "Bearer " + token)
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Result (in JSON Array)

Name Type Description
id int WMS barcode format ID
code string WMS barcode format Code
desc string Description of WMS barcode format
beId int beId of WMS barcode format
tarModule string Target Data Module
sourceType string Product Data Source
groupScanned boolean Group scan records of the same barcode into one row
action string Actions after barcode scanning, should be "saveRecord" or "saveDraft"
includedFields string Fields to be included in barcode format
displayFields string Fields to be displayed upon barcode scanning
tarModuleMess string Mess of Target Data Module
sourceTypeMess string Mess of Product Data Source

Structure of Fields (in JSON Array:"includedFields", "displayFields")

Name Type Description
field string use in Upload WMS barcode
barcodeField string use in barcode
order int order of fields
inputField boolean true if field is an input field
autoCopy boolean true if field's value can be auto copied
mess string Mess of field
pattern string Pattern of field

Structure of mess (in JSON Object:"tarModuleMess", "sourceTypeMess", "includedFields.mess", "displayFields.mess")

Name Type Description
code string messcode
en string label of messcode in English
zh-CN string label of messcode in Simplified Chinese
zh-TW string label of messcode in Traditional Chinese

Structure of pattern (in JSON Object:"includedFields.pattern", "displayFields.pattern")

Name Type Description
fieldName string Name of field
fieldType string Type of field
displayAs string Display type of field, values:lookup, textfield, checkbox, textarea, combobox
lookupType string Lookup type of field
fieldWidth string Display width of field
precision string Precision, if field's value is a number
scale string Scale, if field's value is a number
options string Options, a JSON array, use when displayAs = combobox

Sample response:

[
    {
        "id":1,
        "code":"GRN-FORMAT-001",
        "desc":"GRN for Vendor V001",
        "beId":1,
        "beCode":"DEFAULT",
        "beDesc":"Default Company",
        "tarModule":"an",
        "tarModuleMess":{"code":"ce01_trdg.GRN","en":"Goods Receipt Note","zh-CN":"进货单","zh-TW":"進貨單"},
        "sourceType":"po",
        "sourceTypeMess":{"code":"ce01_trdg.purchaseOrder","en":"Purchase Order","zh-CN":"采购订单","zh-TW":"採購合約"},
        "groupScanned":false,
        "action":"saveRecord",
        "includedFields":[
            {"field":"mainpo.id","barcodeField":"sourceId","order":20,"inputField":true,"autoCopy":false,"mess":{"code":"ce01_trdg.purchaseOrder","en":"Purchase Order","zh-CN":"采购订单","zh-TW":"採購合約"},"pattern":{"fieldName":"mainpo.id","fieldLabel":"Purchase Order","fieldRequired":true,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"po","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"pot.proId","barcodeField":"proId","order":30,"inputField":true,"autoCopy":false,"mess":{"code":"ce01_trdg.product","en":"Product","zh-CN":"产品","zh-TW":"產品"},"pattern":{"fieldName":"pot.proId","fieldLabel":"Product","fieldRequired":true,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"trdgpro","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"pot.lot","barcodeField":"sourceLot","order":40,"inputField":true,"autoCopy":false,"mess":{"code":"ce01_trdg.lot","en":"Lot","zh-CN":"行次","zh-TW":"行次"},"pattern":{"fieldName":"pot.lot","fieldLabel":"Lot","fieldRequired":true,"fieldRight":0,"fieldType":"varchar","lookupType":"ce01_lot","lookupFormatId":0,"fieldWidth":2,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"textfield","options":[]}},
            {"field":"qty","barcodeField":"qty","order":60,"inputField":true,"autoCopy":false,"mess":{"code":"ce01_core.qty","en":"Quantity","zh-CN":"数量","zh-TW":"數量"},"pattern":{"fieldName":"qty","fieldLabel":"Quantity","fieldRequired":false,"fieldRight":0,"fieldType":"decimal","lookupType":"trdg_salesPurQty","lookupFormatId":0,"fieldWidth":20,"precision":15,"scale":2,"max":9999999.99,"min":-9999999.99,"displayAs":"textfield","options":[]}},
            {"field":"unitId","barcodeField":"unitId","order":70,"inputField":true,"autoCopy":false,"mess":{"code":"ce01_core.unit","en":"Unit","zh-CN":"单位","zh-TW":"單位"},"pattern":{"fieldName":"unitId","fieldLabel":"Unit","fieldRequired":false,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"proUnit","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"lotcost.lotno","barcodeField":"lotno","order":71,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_trdg.lotNo","en":"Lot No.","zh-CN":"批号","zh-TW":"批號"},"pattern":{"fieldName":"lotcost.lotno","fieldLabel":"Lot No.","fieldRequired":false,"fieldRight":0,"fieldType":"varchar","lookupType":"lotno","lookupFormatId":0,"fieldWidth":30,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"textfield","options":[]}}
        ],
        "displayFields":[
            {"field":"mainpo.venId","barcodeField":"","order":1,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_core.ven","en":"Vendor","zh-CN":"供应商","zh-TW":"供應商"},"pattern":{"fieldName":"mainpo.venId","fieldLabel":"Vendor","fieldRequired":false,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"approvedVen","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"mainpo.id","barcodeField":"","order":2,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_trdg.purchaseOrder","en":"Purchase Order","zh-CN":"采购订单","zh-TW":"採購合約"},"pattern":{"fieldName":"mainpo.id","fieldLabel":"Purchase Order","fieldRequired":true,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"po","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"pot.proId","barcodeField":"","order":3,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_trdg.product","en":"Product","zh-CN":"产品","zh-TW":"產品"},"pattern":{"fieldName":"pot.proId","fieldLabel":"Product","fieldRequired":true,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"trdgpro","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"pot.lot","barcodeField":"","order":4,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_trdg.lot","en":"Lot","zh-CN":"行次","zh-TW":"行次"},"pattern":{"fieldName":"pot.lot","fieldLabel":"Lot","fieldRequired":true,"fieldRight":0,"fieldType":"varchar","lookupType":"ce01_lot","lookupFormatId":0,"fieldWidth":2,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"textfield","options":[]}},
            {"field":"qty","barcodeField":"","order":5,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_core.qty","en":"Quantity","zh-CN":"数量","zh-TW":"數量"},"pattern":{"fieldName":"qty","fieldLabel":"Quantity","fieldRequired":false,"fieldRight":0,"fieldType":"decimal","lookupType":"trdg_salesPurQty","lookupFormatId":0,"fieldWidth":20,"precision":15,"scale":2,"max":9999999.99,"min":-9999999.99,"displayAs":"textfield","options":[]}},
            {"field":"unitId","barcodeField":"","order":6,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_core.unit","en":"Unit","zh-CN":"单位","zh-TW":"單位"},"pattern":{"fieldName":"unitId","fieldLabel":"Unit","fieldRequired":false,"fieldRight":0,"fieldType":"int_unsigned","lookupType":"proUnit","lookupFormatId":0,"fieldWidth":0,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"lookup","options":[]}},
            {"field":"lotcost.lotno","barcodeField":"","order":7,"inputField":false,"autoCopy":false,"mess":{"code":"ce01_trdg.lotNo","en":"Lot No.","zh-CN":"批号","zh-TW":"批號"},"pattern":{"fieldName":"lotcost.lotno","fieldLabel":"Lot No.","fieldRequired":false,"fieldRight":0,"fieldType":"varchar","lookupType":"lotno","lookupFormatId":0,"fieldWidth":30,"precision":0,"scale":0,"max":0,"min":0,"displayAs":"textfield","options":[]}}
        ]
    }
]

# Upload WMS barcode

Upload WMS barcode

HTTP Request

PUT http://[server]/jsf/rfws/erp/wms/dataCapture/uploadBarcode

Parameters

Name Type Description
authorization String(Header) Required. Access Token obtained via OAuth
client_id String(Header) Required. Client ID in M18 [OAuth Applications]
barcodeData string(Body) Required. A JSON Array contains barcode data

Structure of barcodeData (in JSON Array)

Name Type Description
formatId int WMS barcode format ID
locId int Location ID
tDate date Date of generated records
draft boolean If draft = true, data will save as draft
data string A JSON Array, Details of scanned barcode

Structure of data (in JSON Array:"data")

Name Type Description
__id int Mark the row of data, use in response
scannedCount int Scanned Count of this barcode
[includeFields] includeFields is defined in WMS barcode format

Sample request:

OkHttpClient client = new OkHttpClient();

MediaType jsonMT = MediaType.parse("application/json; charset=utf-8");
RequestBody requestBody = RequestBody.create(jsonMT, "[barcodeData]");

Request request = new Request.Builder()
  .url("http://[server]/jsf/rfws/erp/coi/saveGRN")
  .put(requestBody)
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Sample of barcodeData

[
  {
    "formatId": 1,
    "locId": 1,
    "tDate": "2020-07-23",
    "draft": true,
    "data": [
      {
        "__id": 1,
        "mainpo.id": "PO20070002",
        "pot.proId": "TEST-001",
        "pot.lot": "A",
        "qty": 1,
        "unitId": "CTN",
        "scannedCount": 1
      }
    ]
  }
]

Result (in JSON Array)

Name Type Description
formatId int WMS barcode format ID
details string A JSON Array, Details of upload result

Structure of details (in JSON Array:"details")

Name Type Description
formatId int WMS barcode format ID
dataIds string A JSON Array, related to "__id" of data in barcodeData
pass boolean Indicate if record save success
draft boolean Indicate if record save as draft
id int record's ID
code string record's Code
msgs string Error Messages

Sample of Result

[
  {
    "formatId": 1,
    "details": [
      {
        "formatId": 1,
        "dataIds": [1],
        "pass": true,
        "draft": false,
        "id": 10,
        "code": "GRN20070014",
        "msgs": []
      }
    ]
  }
]

# Development Config

# Make custom module as a Target Data Module in WMS barcode format

In module.xml, add a param(key = "isInventoryModule" and value = "true") to your module

Sample: Make mi as a Target Data Module

<?xml version="1.0"?>
<md xmlns="http://www.multiable.com/module" app="ce01_trdgex">
  <module name="mi" mess="ce01_trdgex.stockIn" extend="false" mainTable="mainmi" recType="" useBe ="true" useAccess="true" useAttach="true" useApv="true" useChangenote="true" tableOrders="mit;mitlot">
    <table name="mainmi" key="id" c="true" r="true" d="true" u="true" initRow="1" hpk="" fKey="" order=""/>
    <table name="remmi" key="id" c="true" r="true" d="true" u="true" initRow="1" hpk="hId" fKey="" order=""/>
    <table name="mit" key="id" c="true" r="true" d="true" u="true" initRow="0" hpk="hId" fKey="proId;lot" order="" cpnType="table" columnOrders="sourceType;sourceId;proId;unitId"/>
    <table name="mitlot" key="id" c="true" r="true" d="true" u="true" initRow="0" hpk="hId" fKey="" order="" hfName="mit" hfKey="footerKey" sfKey="footerKey" cpnType="table" columnOrders="proId;unitId"/>
    
    <checker class="com.multiable.erp.trdgex.ejb.checker.StockInChecker"/>
    
    <param key="mainFooter" value="mit"/>
    <param key="mainFooterUcFormula" value="up"/>  
    <param key="mainLotno" value="mitlot"/>
    <param key="allowNegaQty" value="true"/>
    <param key="tradeType" value="stock"/>
    <param key="useDoctype" value="doctypeId"/>  
    <param key="isInventoryModule" value="true"/>
    <param key="remTable" value="remmi"/>
    <param key="invConfEditQtyLogic" value="false"/>
    
    <importExtend name="priceDescOriginDto" extendSrc="/view/erp/trdgex/share/trdgexPriceDescOriginImport.xhtml" dtoClass ="com.multiable.erp.trdgex.share.importation.TrdgexPriceDescOriginImportDto"/>
    <importExtend name="reloadRateDto" extendSrc="/view/erp/core/share/reloadRateImport.xhtml" dtoClass ="com.multiable.erp.core.share.importation.ReloadRateImportDto"/>
  </module>
</md>

# Make custom module as a Product Data Source in WMS barcode format

In bsflow.xml, add an item of your module in the target module

Sample: Make po as a Product Data Source of oldso

<?xml version="1.0"?>
<bsflow xmlns="http://www.multiable.com/erp/bsflow">
  <flow module="oldso" skipModule="pro">
    <item sourceType="pro" moduleLookupType="" keyLookupType="approvedSalesPro" />
    <item sourceType="oldqu" moduleLookupType="multiqu" loadDataHelper="com.multiable.erp.trdg.interfaces.TradeOutstrandingHelper"
      keyLookupType="qufooter" loadDisc="true" loadRemarks="true" />
    <item sourceType="po" moduleLookupType="multipo" keyLookupType="pofooter" loadDataHelper="com.multiable.erp.trdg.interfaces.TradeOutstrandingHelper"
      skipCheckLoad="true" loadOutstanding="true" useOrigin="true" />
  </flow>
</bsflow>