# 库存任务

本文档将详细列举当前系统支持的库存任务相关的 webhook

businessType 字段请参考webhook定义

# 创建生产备料申请

示例请求

curl --request POST \
  --url 'http://${yourhost}/${yourpath}?businessType=CREATE_MATERIAL_REQUIREMENT' \
  --header 'content-type: application/json' \
  --data '{\n	"requestId":1603780324060,\n	"businessType":1,\n	"data":{"code":"1603780324060","staffCode":"EM001","planTime":1603780324060,"createTime":1603780324060,"workOrderCode":"WO-20201102-001","workOrderItemCode":"IRON-001","workShopWarehouseCode":"WS-1001","workOrderProcedureCode":"WOP-1001","workOrderProcedureName":"WOP-1001","records":[{"itemCode":"004","itemName":"WMS-出库测试物料","defaultWarehouseCode":"T-01","defaultLocationCode":null,"quantity":10,"confirmedQuantity":0}]}\n}'

请求报文说明

{
	"requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
	"businessType": 1,//业务类型,参考[webhook](/webhook/)定义
	"data": {
		"code": "1603780324060",//生产备料单标识码,唯一标识 备料申请
		"staffCode": "EM001",//申请员工Code
		"planTime": 1603780324060,//计划用料时间
		"createTime": 1603780324060,//申请单创建时间
		"workOrderCode": "WO-20201102-001",//领料单关联生产单号码
		"workOrderItemCode": "IRON-001",//领料单关联生产单生产产出无编码
		"workShopWarehouseCode": "WS-1001",// 车间仓库编码
		"workOrderProcedureCode": "WOP-1001",//用料工序编码
		"workOrderProcedureName": "WOP-1001",//用料工序名称
		"records": [{
			"itemCode": "004",//申请单明细物料编码
			"itemName": "WMS-出库测试物料",//申请单明细物料名称
			"defaultWarehouseCode": "T-01",//物料默认仓库编码
			"defaultLocationCode": null,//物料默认库位
			"quantity": 10,//物料申请数量
			"confirmedQuantity": 0//物料确认数量
		}]
	}
}

# 创建生产入库申请

示例请求

curl --request POST \
  --url 'http://${yourhost}/${yourpath}?businessType=CREATE_PRODUCTION_IN' \
  --header 'content-type: application/json' \
  --data '{\n	"requestId":1223,\n	"businessType":4,\n	"data":{"code":"20201102001","staffCode":"EM001","planTime":1604300900684,"createTime":1604300500684,"workOrderCode":"WO-20201102-001","workOrderItemCode":"IRON-001","workShopWarehouseCode":"WS-1001","workOrderProcedureCode":"WOP-1001","workOrderProcedureName":"WOP-1001","records":[{"itemCode":"012","itemName":"IRON-MT-01","defaultWarehouseCode":"T-01","defaultLocationCode":null,"quantity":10,"confirmedQuantity":0,"lotCode":"WO-20201102-001-0001"}]}\n}'

请求报文说明

{
	"requestId": 1223,
	"businessType": 4,
	"data": {
    "code": "20201102001",//生产入库单标识码,唯一标识 还料申请
		"staffCode": "EM001",//申请员工Code
		"planTime": 1603780324060,//计划入库时间
		"createTime": 1603780324060,//入库申请单创建时间
		"workOrderCode": "WO-20201102-001",//入库申请关联生产单号码
		"workOrderItemCode": "IRON-001",//入库申请单关联生产单生产产出无编码
		"workShopWarehouseCode": "WS-1001",// 车间仓库编码
		"workOrderProcedureCode": "WOP-1001",//还料工序编码
		"workOrderProcedureName": "WOP-1001",//还料工序名称
		"records": [{
			"itemCode": "004",//申请单明细物料编码
			"itemName": "WMS-出库测试物料",//申请单明细物料名称
			"defaultWarehouseCode": "T-01",//物料默认仓库编码
			"defaultLocationCode": null,//物料默认库位
			"quantity": 10,//物料申请数量
			"confirmedQuantity": 0//物料确认数量
			"lotCode": "WO-20201102-001-0001"//报工批量码
		}]
	}
}

# 创建生产还料申请

示例请求

curl --request POST \
  --url 'http://${yourhost}/${yourpath}?businessType=CREATE_MATERIAL_RETURN' \
  --header 'content-type: application/json' \
  --data '{\n	"requestId":20201102001,\n	"businessType":7,\n	"data":{"code":"20201102001","staffCode":"EM001","planTime":1603780324060,"createTime":1604300500684,"workOrderCode":"WO-20201102-001","workOrderItemCode":"IRON-001","workShopWarehouseCode":"WS-1001","workOrderProcedureCode":"WOP-1001","workOrderProcedureName":"WOP-1001","records":[{"itemCode":"004","itemName":"IRON-MT-01","defaultWarehouseCode":"T-01","defaultLocationCode":null,"quantity":5,"confirmedQuantity":0,"batchNumber":"WO-0001"}]}\n}'

请求报文说明

{
	"requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
	"businessType": 7,//业务类型,参考[webhook](/webhook/)定义
	"data": {
    "code": "20201102001",//生产还料单标识码,唯一标识 还料申请
		"staffCode": "EM001",//申请员工Code
		"planTime": 1603780324060,//计划用料时间
		"createTime": 1603780324060,//还料申请单创建时间
		"workOrderCode": "WO-20201102-001",//还料单关联生产单号码
		"workOrderItemCode": "IRON-001",//还料单关联生产单生产产出无编码
		"workShopWarehouseCode": "WS-1001",// 车间仓库编码
		"workOrderProcedureCode": "WOP-1001",//还料工序编码
		"workOrderProcedureName": "WOP-1001",//还料工序名称
		"records": [{
			"itemCode": "004",//申请单明细物料编码
			"itemName": "WMS-出库测试物料",//申请单明细物料名称
			"defaultWarehouseCode": "T-01",//物料默认仓库编码
			"defaultLocationCode": null,//物料默认库位
			"quantity": 10,//物料申请数量
			"confirmedQuantity": 0//物料确认数量
			"batchNumber": "WO-0001"//批次码
		}]
	}
}

# 创建销售发货出库申请

示例请求

curl --request POST \
  --url 'http://${yourhost}/${yourpath}?businessType=CREATE_SALES_OUT' \
  --header 'content-type: application/json' \
  --data '{"requestId":"852d91-5c43-4f67-99c5-e6e441337749","businessType":30,"data":{"code":"SO-20201102001","staffCode":"EM001","planTime":1603780324060,"createTime":1604300500684,"salesOrder":"WO-20201102-001","comments":"发货测试","records":[{"itemCode":"004","itemName":"WMS-出库测试物料","defaultWarehouseCode":"T-01","defaultLocationCode":null,"quantity":10,"confirmedQuantity":0}]}}'

请求报文说明

{
	"requestId":"852d91-5c43-4f67-99c5-e6e441337749",
	"businessType":30,
	"data":{
	"code":"SO-20201102001",//发货单号
	"staffCode":"EM001",//创建人
	"planTime":1603780324060,//计划时间
	"createTime":1604300500684,//创建时间
	"salesOrder":"WO-20201102-001",//关联订单编号
	"customerCode":"C-0010",
	"customerName":"上海纽酷信息科技有限公司",
	"comments":"发货测试",//退货单备注
    "deliveryCompany":"物流公司",//物流公司
    "deliveryOrderId":"物流单号",//物流单号
    "customerAddressInfo": {//收货信息
      "address": "中国上海市徐汇区中山南二路",//收货完整地址
      "city": "上海市",//收货地址城市
      "contact": "18800648897",//联系电话
      "country": "国家",//国家
      "customerLabel": "公司标签",//公司标签
      "district": "徐汇区",//地区
      "fax": "00237765",//传真号
      "province": "上海",//省份
      "receivePeople": "收货人",//收货人
    }

    "records":[{
			"itemCode": "004",//申请单明细物料编码
			"itemName": "WMS-测试物料",//申请单明细物料名称
			"defaultWarehouseCode": "T-01",//物料默认仓库编码
			"defaultLocationCode": null,//物料默认库位
			"quantity": 10,//物料申请数量
			"confirmedQuantity": 0//物料确认数量
	}]}
}

# 创建销售退货入库申请

示例请求

curl --request POST \
  --url 'http://${yourhost}/${yourpath}?businessType=CREATE_SALES_RETURN' \
  --header 'content-type: application/json' \
  --data '{\n	"requestId":20201102001,\n	"businessType":32,\n	"data":{"code":"SR-20201102001","staffCode":"EM001","planTime":1603780324060,"createTime":1604300500684,"salesOrder":"WO-20201102-001","comments":"退货测试","records":[{"itemCode":"004","itemName":"IRON-MT-01","defaultWarehouseCode":"T-01","defaultLocationCode":null,"quantity":5,"confirmedQuantity":0}]}\n}'

请求报文说明

{
	"requestId":"852d91-5c43-4f67-99c5-e6e441337749",
	"businessType":32,
	"data":{
	"code":"SR-20201102001",//单号
	"staffCode":"EM001",//创建人
	"planTime":1603780324060,//计划时间
	"createTime":1604300500684,//创建时间
	"salesOrder":"WO-20201102-001",//关联订单编号
	"customerCode":"C-0010",
	"customerName":"上海纽酷信息科技有限公司",
	"comments":"退货测试",//退货单备注
	"records":[{
			"itemCode": "004",//申请单明细物料编码
			"itemName": "WMS-出库测试物料",//申请单明细物料名称
			"defaultWarehouseCode": "T-01",//物料默认仓库编码
			"defaultLocationCode": null,//物料默认库位
			"quantity": 10,//物料申请数量
			"confirmedQuantity": 0//物料确认数量
	}]}
}