PHP | <?php
require_once ('../WdtClient.php');
$c = new WdtClient();
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/stockin_order_push.php';
$stockin_info = array (
'outer_no' => 'ghs123safag',
"warehouse_no" => "WH001",
"post_fee" => "0.00",
"other_fee" => "0.00",
"goods_list" => array (
array (
"spec_no" => "test-ptsd-00001",
"stockin_num" => 2,
"stockin_price" => 0.00,
"position_no" => "ZANCUN",
"batch_no" => "",
"production_date" => "2015-06-09 00:00:01",
"validity_days" => 3,
"price" => 0.00,
"tax" => 0.00
)
)
);
$c->putApiParam('stockin_info', json_encode($stockin_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 StockinOrderPush {
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> stockin_info = new HashMap<String, Object>();
List<Map<String, Object>> goods_list = new ArrayList<Map<String, Object>>();
Map<String, Object> goods_1 = new HashMap<String, Object>();
goods_1.put("spec_no", "qqq");
goods_1.put("stockin_num", "2");
goods_1.put("stockin_price", 1);
goods_1.put("src_price", 1.2);
goods_list.add(goods_1);
stockin_info.put("warehouse_no", "ghs2test");
stockin_info.put("outer_no", "ghs201812101201");
stockin_info.put("goods_list", goods_list);
String stockin_info_json = JSON.toJSONString(stockin_info);
Map<String, String> params = new HashMap<String, String>();
params.put("stockin_info", stockin_info_json);
try {
String response = client.execute("stockin_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 StockinOrderPush
{
class StockinOrderPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/stockin_order_push.php";
var stockin_info = new
{
outer_no = "34567898765432",
warehouse_no = "api_test",
post_fee = "30",
other_fee = "40",
goods_list = new[]
{
new{
spec_no = "6521478635",
stockin_num = "1",
stockin_price = "11.11",
},
new{
spec_no = "test-ptsd-00001",
stockin_num = "1",
stockin_price = "11.11",
}
}
};
string json = stockin_info.ToJsonString();
client.putParams("stockin_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/')
stockin_info = {}
goods_list = []
goods_1 = {}
goods_1.update({"spec_no": 'spec_001'})
goods_1.update({"stockin_num": '10'})
goods_1.update({"stockin_price": '1'})
goods_1.update({"tax_price": ''})
goods_1.update({"tax": ''})
goods_1.update({"position_no": ''})
goods_1.update({"batch_no": ''})
goods_1.update({"batch_remark": ''})
goods_1.update({"production_date": ''})
goods_1.update({"validity_days": ''})
goods_1.update({"src_price": ''})
goods_1.update({"remark": ''})
goods_1.update({"is_enable_sn": '0'})
goods_1.update({"sn_list": ''})
goods_list.append(goods_1)
stockin_info.update({"outer_no": '12345678'})
stockin_info.update({"warehouse_no": 'test001'})
stockin_info.update({"outer_no": 'test001'})
stockin_info.update({"logistics_code": ''})
stockin_info.update({"logistics_no": ''})
stockin_info.update({"is_check": '0'})
stockin_info.update({"is_create_batch": '0'})
stockin_info.update({"post_fee": ''})
stockin_info.update({"other_fee": ''})
stockin_info.update({"remark": '备注'})
stockin_info.update({"reason": '入库原因'})
stockin_info.update({"goods_list": goods_list})
# del(stockin_info[0])
jsonArr = json.dumps(stockin_info, ensure_ascii=False)
params = {}
params.update({"stockin_info": jsonArr})
response = t.execute("stockin_order_push.php", params)
print(response) |