# 出入库单据
本文档将详细列举当前系统支持的出入库单据相关的 webhook
# 出入库单据存储
当前系统支持以下出入库类型 报文中 OperationType 字段,跟 BusinessType 无关。
public enum InventoryOperationType implements BaseEnum {
/**
* ########################################
* # 入库id为奇数, 出库id为偶数 #
* ########################################
*/
IN(-1, "全部入库"),
OUT(-2, "全部出库"),
CALIBRATION(100, "库存盘点"),
INIT_IN(1, "初始入库"),
SALE_OUT(2, "销售出库"),
PURCHASE_IN(3, "采购入库"),
PRODUCE_IN(5, "生产入库"),
TAKE_OUT(6, "备料出库"),
RETURN_IN(7, "还料入库"),
OTHER_OUT(8, "其他出库"),
OTHER_IN(9, "其他入库"),
TRANSFER_OUT(10, "库存移出"),
TRANSFER_IN(11, "库存移入"),
EXPEND_MATERIAL(12, "原料消耗"),
PROCEDURE_QC_IN(13, "工序检验入库"),
SALES_RETURN_IN(15, "退货入库"),
DISASSEMBLY_OUT(16, "拆装出库"),
ASSEMBLY_IN(17, "拆装入库"),
/**
* 从待检仓出去-关联采购检验任务
*/
PURCHASE_INSPECTION_OUT(18, "采购检验出库"),
/**
* 入到待检仓-关联采购入库任务
*/
PURCHASE_INSPECTION_IN(19, "采购检验入库"),
/**
* 采购检验过入到普通仓库显示 采购入库--关联采购检验任务
*/
PURCHASE_INSPECTION_AFTER_IN(119, "采购检验二次入库"),
PURCHASE_RETURN_OUT(20, "退货出库"),
SUPPLEMENT_OUT(68, "补料出库"),
PICK_MATERIAL_OUT(70, "领料出库"),
WORKSHOP_USE_IN(23, "车间备料入库"),
WORKSHOP_RETURN_OUT(24, "车间还料出库"),
WORKSHOP_SUPPLEMENT_IN(25, "车间补料入库"),
WORKSHOP_JBK_OUT(26, "车间报工原料消耗"),
WORKSHOP_CANCEL_JBK_IN(27, "车间撤销报工入库"),
WORKSHOP_OUTSOURCE_OUT(28, "车间委外转出"),
WORKSHOP_CANCEL_OUTSOURCE_IN(29, "车间撤销委外转出"),
WORKSHOP_BYORDER_OUT(30, "按单转调拨按单料消耗"),
WORKSHOP_ALLOCATE_IN(31, "按单转调拨调拨料增加"),
WORK_IN_PROCESS_USE(32, "在制品备料出库"),
WORK_IN_PROCESS_RETURN(33, "在制品还料入库"),
WORK_IN_PROCESS_STORAGE(35, "工序生产入库"),
WORK_IN_PROCESS_QC_STORAGE(37, "在制品检验入库"),
/**
* 第一次入库--关联委外入库任务
*/
WORKSHOP_OUTSOURCE_IN(39, "委外入库"),
WORKSHOP_CANCEL_JBK_OUT(41, "车间取消原料报工消耗"),
/**
* 从待检仓入到普通仓库--关联委外检验入库任务
*/
WORKSHOP_OUTSOURCE_QC_IN(107, "委外检验入库"),
/**
* 从待检仓出库--关联委外入库任务
*/
OUTSOURCE_INSPECTION_OUT(106, "委外检验出库"),
WORKSHOP_OUTSOURCE_RETURN(40, "委外退货出库"),
OUTSOURCE_INSPECTION_RETURN_OUT(42, "委外检验退货出库"),
PRODUCTION_JBK_IN(43, "车间报工入库"),
PRODUCTION_CANCEL_JBK_OUT(44, "车间撤销报工出库"),
PRODUCTION_WIP_IN(45, "在制品入库"),
PRODUCTION_WIP_ACTIVITY_FLOW_OUT(46, "生产活动流转出库"),
PRODUCTION_WIP_ACTIVITY_FLOW_IN(47, "生产活动流转入库"),
PRODUCTION_FINISH_CONSUME(48, "生产完成生产单消耗"),
PRODUCTION_CANCEL_FINISH_CONSUME(49, "取消生产完成生产单消耗"),
PRODUCE_OUT(50, "生产出库"),
PROCEDURE_QC_OUT(52, "工序检验出库"),
WIP_RETURN_OUT(54, "在制品还料出库"),
WIP_RECEIVE_IN(55, "在制品备料入库"),
WIP_STORAGE_OUT(56, "在制品生产出库"),
WIP_QC_STORAGE_OUT(58, "在制品检验出库"),
PRODUCTION_ADJUST_IN(59, "生产调整入库"),
PRODUCTION_ADJUST_OUT(60, "生产调整出库"),
INSPECT_SCRAP_IN(61, "报废入库"),
INSPECT_SCRAP_OUT(62, "在制品检验-报废出库"),
WORKSHOP_CANCEL_WIP_JBK_OUT(63, "车间取消在制品报工消耗"),
WIP_LOSE_OUT(64, "在制品丢失出库"),
WORKSHOP_JBK_ALLOCATE_OUT(66, "车间报工调拨料消耗"),
ASSEMBLY_DISASSEMBLY_WORK_IN_PROCESS_IN(81, "返修拆装在制品入库"),
ASSEMBLY_DISASSEMBLY_WORK_IN_PROCESS_OUT(82, "返修拆装在制品出库"),
ASSEMBLY_DISASSEMBLY_MATERIAL_IN(83, "返修拆装原料入库"),
ASSEMBLY_DISASSEMBLY_RETENTION_IN(85, "返修拆装留用入库"),
ASSEMBLY_DISASSEMBLY_RETENTION_OUT(86, "返修拆装留用出库"),
ASSEMBLY_DISASSEMBLY_SCRAPPED_IN(87, "返修拆装报废入库"),
ASSEMBLY_DISASSEMBLY_SCRAPPED_OUT(88, "返修拆装报废出库"),
CALIBRATION_GAIN(101, "盘盈"),
CALIBRATION_LOSS(102, "盘亏"),
EAS_GAIN(103, "EAS同步库存增加"),
EAS_LOSS(104, "EAS同步库存减少"),
ENABLE_BATCH_IN(201, "非批次物料向批次物料转换-入库"),
ENABLE_BATCH_OUT(202, "非批次物料向批次物料转换-出库"),
TOOLING_AND_MOLD_IN(203, "工模具归还-入库"),
TOOLING_AND_MOLD_OUT(204, "工模具领用-出库"),
TEST_IN(205, "入库"),
TEST_OUT(206, "出库"),
OPENAPI_IN(301, "openapi入库"),
OPENAPI_OUT(302, "openapi出库");
private int id;
private String typeName;
}
关联业务单据枚举
public enum OrderType {
ORDER(1, "订单"),
PROCUREMENT_ORDER(2, "采购单"),
PRODUCTION_BILL(3, "生产单"),
;
private int id;
private String name;
}
物料属性枚举
public enum ItemTypeEnum {
PRODUCTS(1, "products", "产品"),
SEMI_PRODUCTS(2, "semi_products", "半成品"),
MATERIALS(3, "materials", "原料"),
WORK_IN_PROCESS(4, "workInProcess", "在制品");
private int id;
private String name;
private String desc;
}
示例请求
curl --request POST \
--url 'http://${yourhost}/${yourpath}?businessType=CREATE_INVENTORY_BATCH' \
--header 'content-type: application/json' \
--data '{"requestId":"24852d91-5c43-4f67-99c5-e6e441337749","businessType":13,"data":{"code":"1603780324060","staffCode":"EM001","createTime":1603780324060,"operationTypeId":"3","operationType":"PURCHASE_IN","comments":"","records":[{"relativeOrderType":2,"relativeOrderNumber":"PUR-20201224-001","itemCode":"004","itemName":"WMS-测试物料","warehouseCode":"T-01","locationCode":null,"batchNumber":"20201221-001","quantity":10,"price":213,"relativeOrderPrice": 12.23}]}}'
请求报文说明
{
"requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
"businessType": 13,//业务类型,参考[webhook](/webhook/)定义
"data": {
"code": "L-20201224-0012",//出入库标识码,唯一标识 备料申请
"staffCode": "EM001",//操作员工Code
"createTime": 1603780324060,//出入库单系统创建时间
"operationTime": 1603780324060,//出入库单业务发生时间
"operationTypeId": 3, //库存操作类型枚举值,请参考上文定义
"operationType":"PURCHASE_IN",//库存操作类型示意
"comments":"",//库存操作备注
"records": [{
"relativeOrderType":2,// 关联业务单据类型 OrderType,参考上文定义
"relativeOrderNumber":"PUR-20201224-001",//关联业务单据号
"relativeApplyOrderNumber":"REC-20201224-001",//关联申请单号,比如销售的发货单,退货单,采购的收货,退货单。
"relativeEnterpriseCode":"CUS-10001",// 关联单据企业编码
"relativeEnterpriseName":"上海纽酷信息科技有限公司",//关联单据企业名称
"relativeProductCode":"父物料",//可选返回,用于备料出库,备料出库单对应生产的产品code
"applicant":"EM021",//申请人工号
"applicantDepartment":"研发部",//申请人部门
"currency":"CNY",//币种
"itemCode": "004",//申请单明细物料编码
"itemName": "WMS-测试物料",//申请单明细物料名称
"warehouseCode": "T-01",//物料仓库编码
"locationCode": "",//物料库位
"batchNumber":"20201221-001",//批次号码
"quantity": 10,//物料申请数量
"price": 213,//成本,仅入库有效,出库 price 无实际意义
"relativeOrderTax": 13,//税率
"relativeOrderPrice": 12.23,//关系单据的行含税单价,比如销售出库是指销售订单行价格,采购入库是指采购订单行价格,生产关联单据关联价格为0。
"itemType": "products"//物料属性
}]
}
}
# 出入库单据撤销
示例请求
curl --request POST \
--url 'http://${yourhost}/${yourpath}?businessType=DEAUDIT_INVENTORY_BATCH' \
--header 'content-type: application/json' \
--data '{"requestId":"24852d91-5c43-4f67-99c5-e6e441337749","businessType":14,"data":{"code":"1603780324060","staffCode":"EM001","createTime":1603780324060,"operationTypeId":"3","operationType":"PURCHASE_IN","comments":"","records":[{"relativeOrderType":2,"relativeOrderNumber":"PUR-20201224-001","itemCode":"004","itemName":"WMS-测试物料","warehouseCode":"T-01","locationCode":null,"batchNumber":"20201221-001","quantity":10,"price":213,"relativeOrderPrice": 12.23}]}}'
请求报文说明
{
"requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
"businessType": 14,//业务类型,参考[webhook](/webhook/)定义
"data": {
"code": "L-20201224-0012",//出入库标识码,唯一标识 备料申请
"staffCode": "EM001",//操作员工Code
"createTime": 1603780324060,//出入库单系统创建时间
"operationTime": 1603780324060,//出入库单业务发生时间
"operationTypeId": 3, //库存操作类型枚举值,请参考上文定义
"operationType":"PURCHASE_IN",//库存操作类型示意
"comments":"",//库存操作备注
"records": [{
"relativeOrderType":2,// 关联业务单据类型 OrderType,参考上文定义
"relativeOrderNumber":"PUR-20201224-001",//关联业务单据号
"relativeApplyOrderNumber":"REC-20201224-001",//关联申请单号,比如销售的发货单,退货单,采购的收货,退货单。
"relativeEnterpriseCode":"CUS-10001",// 关联单据企业编码
"relativeEnterpriseName":"上海纽酷信息科技有限公司",//关联单据企业名称
"relativeProductCode":"父物料",//可选返回,用于备料出库,备料出库单对应生产的产品code
"applicant":"EM021",//申请人工号
"applicantDepartment":"研发部",//申请人部门
"currency":"CNY",//币种
"itemCode": "004",//申请单明细物料编码
"itemName": "WMS-测试物料",//申请单明细物料名称
"warehouseCode": "T-01",//物料仓库编码
"locationCode": "",//物料库位
"batchNumber":"20201221-001",//批次号码
"quantity": 10,//物料申请数量
"price": 213,//成本,仅入库有效,出库 price 无实际意义
"relativeOrderTax": 13,//税率
"relativeOrderPrice": 12.23,//关系单据的行含税单价,比如销售出库是指销售订单行价格,采购入库是指采购订单行价格,生产关联单据关联价格为0。
"itemType": "products"//物料属性
}]
}
}