仓库管理方案
# Web Services
# 获取 WMS 条码格式
获取 WMS 条码格式。
HTTP 请求
GET http://[server]/jsf/rfws/erp/wms/dataCapture/getBarcodeFormat
参数
| 名字 | 类型 | 说明 |
|---|---|---|
| authorization | String(Header) | 必填. 通过 OAuth 获取的访问令牌 |
| client_id | String(Header) | 必填. aiM18[授权应用列表]中的Client ID |
| beId | int(Query) | 企业法人ID, 如果传入 beId,则仅返回指定 BE 的条码格式 |
| id | string(Query) | WMS 条码格式 ID 列表,以", "分隔,如果未传递 id,则返回所有条码格式 |
请求示例:
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();
结果 (JSON 数组)
| 名字 | 类型 | 说明 |
|---|---|---|
| id | int | WMS 条码格式 ID |
| code | string | WMS 条码格式编号 |
| desc | string | WMS 条码格式的说明 |
| beId | int | WMS 条码格式的beId |
| tarModule | string | 目标数据模块 |
| sourceType | string | 产品数据来源 |
| groupScanned | boolean | 将相同条码的扫描记录归为一行 |
| action | string | 扫描条码后的操作,应为 "saveRecord" 或 "saveDraft" |
| includedFields | string | 条码格式中应包含的字段 |
| displayFields | string | 扫描条码时显示的字段 |
| tarModuleMess | string | 目标数据模块描述 |
| sourceTypeMess | string | 产品数据来源描述 |
字段结构(JSON 数组:"includedFields"、"displayFields" )
| 名字 | 类型 | 说明 |
|---|---|---|
| field | string | 在上传 WMS 条码中使用 |
| barcodeField | string | 在条码中使用 |
| order | int | 字段顺序 |
| inputField | boolean | 如果字段是输入字段,则为 true |
| autoCopy | boolean | 如果字段的值可以自动复制,则为 true |
| mess | string | 字段描述 |
| pattern | string | 字段模式 |
mess结构 (JSON 对象:"tarModuleMess"、 "sourceTypeMess"、 "includedFields.mess"、 "displayFields.mess" )
| 名字 | 类型 | 说明 |
|---|---|---|
| code | string | messcode |
| en | string | messcode的英文标签 |
| zh-CN | string | messcode的简体中文标签 |
| zh-TW | string | messcode的繁体中文标签 |
pattern结构 (JSON 对象:"includedFields.pattern"、 "displayFields.pattern")
| 名字 | 类型 | 说明 |
|---|---|---|
| fieldName | string | 字段名 |
| fieldType | string | 字段类型 |
| displayAs | string | 显示字段类型,值:lookup、 textfield、 checkbox、 textarea、 combobox |
| lookupType | string | 字段的Lookup类型 |
| fieldWidth | string | 字段显示宽度 |
| precision | string | 精度,如果字段值为数字 |
| scale | string | 比例,如果字段值为数字 |
| options | string | 选项,JSON 数组,在 displayAs = combobox 时使用 |
返回示例:
[
{
"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":[]}}
]
}
]
# 上传 WMS 条码
上传 WMS 条码
HTTP 请求
PUT http://[server]/jsf/rfws/erp/wms/dataCapture/uploadBarcode
参数
| 名字 | 类型 | 说明 |
|---|---|---|
| authorization | String(Header) | 必填. 通过 OAuth 获取的访问令牌 |
| client_id | String(Header) | 必填. aiM18[授权应用列表]中的Client ID |
| barcodeData | string(Body) | 必填. 一个包含条码数据的 JSON 数组 |
barcodeData结构 (JSON 数组)
| 名字 | 类型 | 说明 |
|---|---|---|
| formatId | int | WMS 条码格式 ID |
| locId | int | 地点 ID |
| tDate | date | 生成记录的日期 |
| draft | boolean | 如果draft = true, 数据将保存为草稿 |
| data | string | 一个JSON 数组, 扫描条码的详情 |
data结构 (JSON数组:"data" )
| 名字 | 类型 | 说明 |
|---|---|---|
| __id | int | 标记数据行,在响应中使用 |
| scannedCount | int | 该条码的扫描计数 |
| [includeFields] | includeFields 在 WMS 条码格式中定义 |
请求示例:
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();
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
}
]
}
]
结果 (JSON 数组)
| 名字 | 类型 | 说明 |
|---|---|---|
| formatId | int | WMS 条码格式 ID |
| details | string | JSON 数组,上传结果详情 |
details结构 (JSON 数组:"details" )
| 名字 | 类型 | 说明 |
|---|---|---|
| formatId | int | WMS 条码格式 ID |
| dataIds | string | JSON 数组,与barcodeData中的data的"__id "相关 |
| pass | boolean | 指示单据是否保存成功 |
| draft | boolean | 指示单据是否保存为草稿 |
| id | int | 单据的 ID |
| code | string | 单据的编号 |
| msgs | string | 错误信息 |
结果示例
[
{
"formatId": 1,
"details": [
{
"formatId": 1,
"dataIds": [1],
"pass": true,
"draft": false,
"id": 10,
"code": "GRN20070014",
"msgs": []
}
]
}
]
# 开发配置
# 将自定义模块作为 WMS 条码格式的目标数据模块
在 module.xml中,为模块添加 param(key = "isInventoryModule",value = "true")。
示例: 将
mi作为一个目标数据模块
<?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>
# 将自定义模块作为 WMS 条码格式的产品数据来源
在 bsflow.xml中,为目标模块添加一个你的模块的item
示例: 将
po作为一个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>
Last Updated: 2025/05/29, 08:51:05