单商品多运单发货接口错误码自查方案

说明:

本文介绍说明关于如何调用单商品分为多个运单发货接口的参考说明。

接口信息:

接口名称:单商品分为多个运单发货接口
接口 API:youzan.trade.dc.delivery.ordersingleitemsend.3.0.1
接口链接:
https://doc.youzanyun.com/doc#/content/API/1-381/detail/api/0/525

代码示例:

 DefaultYZClient yzClient = new DefaultYZClient();
        YouzanTradeDcDeliveryOrdersingleitemsend youzanTradeDcDeliveryOrdersingleitemsend = new YouzanTradeDcDeliveryOrdersingleitemsend();
        //创建参数对象,并设置参数
        YouzanTradeDcDeliveryOrdersingleitemsendParams youzanTradeDcDeliveryOrdersingleitemsendParams = new YouzanTradeDcDeliveryOrdersingleitemsendParams();
        youzanTradeDcDeliveryOrdersingleitemsendParams.setTid("E20190731180345057400007");
        youzanTradeDcDeliveryOrdersingleitemsendParams.setRequestId("8989");
        youzanTradeDcDeliveryOrdersingleitemsendParams.setKdtId(42587152L);
        youzanTradeDcDeliveryOrdersingleitemsendParams.setOid(1531011395132327895L);
        youzanTradeDcDeliveryOrdersingleitemsendParams.setTotalNum(3);
        List<YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpackages> expackages =new ArrayList<YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpackages>();
        //申明list数组
        YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpackages youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages = new YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpackages();
        YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpress express =new YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpress();
        express.setExpressId(1);
        express.setExpressName("申通快递");
        express.setExpressNo("29898989826");
        youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages.setNum(2);
        youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages.setExpress(express);
        expackages.add(youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages);
        express = new YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpress();
        express.setExpressId(2);
        express.setExpressName("中通快递");
        express.setExpressNo("29898989844");
        youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages = new YouzanTradeDcDeliveryOrdersingleitemsendParams.YouzanTradeDcDeliveryOrdersingleitemsendParamsExpackages();
        youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages.setExpress(express);
        youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages.setNum(1);
        expackages.add(youzanTradeDcDeliveryOrdersingleitemsendParamsExpackages);
        youzanTradeDcDeliveryOrdersingleitemsendParams.setExPackages(expackages);

        youzanTradeDcDeliveryOrdersingleitemsend.setAPIParams(youzanTradeDcDeliveryOrdersingleitemsendParams);

错误码自查方案:

{"code":102570059,"success":false,"message":"所发包裹的商品总数必须等于该商品的购买总数"}

解决方法:需要检查传入的包裹中的商品总数是否等于该订单中的商品购买总数;如订单中的商品个数是 5 个,即所发的包裹的商品总数必须等于 5;

{"code":102570007,"success":false,"message":"不能重复提交已发过货的商品"}

解决方法:订单中的商品已发货完成,不能再次重复提交;

{"code":50000,"success":false,"message":"系统异常"}

解决方法:请检查传入的 yz_open_id 是否正确,可通过接口 youzan.user.openid.get.1.0.0 获取;

{"code":102570002,"success":false,"message":"发货商品不合法, 无法发货"}

解决方法:请检查订单中的商品是否已发货或者无需发货

注意:

1. 单商品发货接口:
适用于:
一个订单下有 1 个商品,要分为多个运单发货;
一个订单下有 n 个商品,其中某个商品数量大于 1,要分为多个运单发货;
注:如果是第 2 种情况,要一次性发完,即发货商品的包裹中数量要等于订单中的发货商品数量;
2. 订单发货接口(正常的普通发货接口)
适用于:
一个订单下有多种商品,要拆单发货(一个商品仅支持一个运单);
一个订单下有单个商品,卖家要进行发货操作;