PHP | <?php
require_once ('../WdtClient.php');
$c = new WdtClient();
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/stockout_order_push.php';
$stockout_info = array (
'outer_no' => 'ghs_12',
"warehouse_no" => "001",
'num' => '1',
"remark" => "测试新增其他出库单",
"detail_list" => array (
array (
"spec_no" => "test-ptsd-00001",
'num' => '1',
'price' => '12'
)
)
);
$c->putApiParam('stockout_info', json_encode($stockout_info, JSON_UNESCAPED_UNICODE));
$json = $c->wdtOpenApi();
var_dump($json);
?> |
JAVA | package com.wangdian.api.stock;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.wangdian.api.WdtClient;
public class StockoutOrderPush {
public static void main(String[] args) {
// TODO Auto-generated method stub
WdtClient client = new WdtClient("传入sid", "传入appkey", "传入appsecret", "传入url");
//测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
//调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
Map<String, Object> stockout_info = new HashMap<String, Object>();
List<Map<String, Object>> detail_list = new ArrayList<Map<String, Object>>();
Map<String, Object> detail_1 = new HashMap<String, Object>();
detail_1.put("spec_no", "ghs201812070212123");
detail_1.put("num", "1");
detail_1.put("price", 11);
detail_list.add(detail_1);
stockout_info.put("warehouse_no", "ghs2test");
stockout_info.put("num", "2");
stockout_info.put("remark", "测试新增其他出库单");
stockout_info.put("outer_no", "ghs201812101205");
//stockin_info.put("logistics_code", "ZJS001");
stockout_info.put("detail_list", detail_list);
String stockout_info_json = JSON.toJSONString(stockout_info);
//System.out.println(purchase_info_json);
Map<String, String> params = new HashMap<String, String>();
params.put("stockout_info", stockout_info_json);
try {
String response = client.execute("stockout_order_push.php", params);
System.out.println(response);
} catch (IOException e) {
e.printStackTrace();
}
}
} |
C# | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WdtSdk;
namespace StockoutOrderPush
{
class StockoutOrderPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/stockout_order_push.php";
var stockout_info = new
{
outer_no = "dd456789876543",
warehouse_no = "api_test",
detail_list = new[]
{
new{
spec_no = "test-ptsd-00002",
num = "1",
price = "10"
},
new{
spec_no = "test-ptsd-00001",
num = "1",
price = "10"
}
}
};
string json = stockout_info.ToJsonString();
client.putParams("stockout_info", json);
string result = client.wdtOpenapi();
Console.WriteLine(result);
Console.ReadKey();
}
}
} |
python
| import WdtClient
import json
t = WdtClient.WdtClient('appkey', 'appsecret', 'sid', 'http://sandbox.wangdian.cn/openapi2/')
stockout_info = {}
detail_list = []
detail_1 = {}
detail_1.update({"spec_no": 'spec_001'})
detail_1.update({"num": '10'})
detail_1.update({"price": '1'})
detail_1.update({"position_no": ''})
detail_1.update({"batch_no": ''})
detail_1.update({"remark": ''})
detail_1.update({"is_enable_sn": '0'})
detail_1.update({"sn_list": ''})
detail_list.append(detail_1)
stockout_info.update({"outer_no": '12345678'})
stockout_info.update({"warehouse_no": 'test001'})
stockout_info.update({"outer_no": 'test001'})
stockout_info.update({"logistics_code": ''})
stockout_info.update({"logistics_no": ''})
stockout_info.update({"is_check": '0'})
stockout_info.update({"goods_total_amount": '10'})
stockout_info.update({"goods_total_cost": '5'})
stockout_info.update({"post_cost": ''})
stockout_info.update({"remark": '备注'})
stockout_info.update({"reason": '其他出库原因'})
stockout_info.update({"detail_list": detail_list})
# del(stockout_info[0])
jsonArr = json.dumps(stockout_info, ensure_ascii=False)
params = {}
params.update({"stockout_info": jsonArr})
response = t.execute("stockout_order_push.php", params)
print(response) |