配置测试数据

This commit is contained in:
tongfei
2023-10-26 17:48:41 +08:00
parent 918e4d203b
commit 5ab9b50308
8 changed files with 258 additions and 20 deletions

View File

@@ -64,27 +64,43 @@ namespace WMS.Web.Domain.Services.Public
/// <returns></returns>
public async Task<ResultList<ErpPurchaseInStockResultDto>> BillQueryForPurchaseInStock()
{
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress(this._erpOptions.EndpointAddress);
ERPGWSoapClient client = new ERPGWSoapClient(binding, address);
var token_result = await client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, "");
var query = new ErpBillQueryDto(token_result.AccessToken);
var param = new ErpBillQueryParamDto(FormIdParam.STK_InStock.ToString());
query.Data = JsonConvert.SerializeObject(param);
var json = JsonConvert.SerializeObject(query);
var result_json = await client.ExecuteBillQueryAsync(json);
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
var list = new List<ErpPurchaseInStockResultDto>();
foreach (var item in result)
try
{
var lis = new ErpPurchaseInStockResultDto();
lis.BillNo = item[0];
lis.Specifications = item[1];
list.Add(lis);
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress(this._erpOptions.EndpointAddress);
ERPGWSoapClient client = new ERPGWSoapClient(binding, address);
var token_result = await client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, "");
var query = new ErpBillQueryDto(token_result.AccessToken);
var param = new ErpBillQueryParamDto(FormIdParam.STK_InStock.ToString());
param.FieldKeys = this._erpOptions.PurchaseInstockFieldKeys;
query.Data = JsonConvert.SerializeObject(param);
var json = JsonConvert.SerializeObject(query);
var result_json = await client.ExecuteBillQueryAsync(json);
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
var list = new List<ErpPurchaseInStockResultDto>();
foreach (var item in result)
{
var lis = new ErpPurchaseInStockResultDto();
lis.BillNo = item[0];
lis.Specifications = item[1];
lis.SupplierName = item[2];
lis.OrgName = item[3];
lis.MaterialName = item[4];
lis.MaterialNumber = item[5];
list.Add(lis);
}
return ResultList<ErpPurchaseInStockResultDto>.ReSuccess(list);
}
return ResultList<ErpPurchaseInStockResultDto>.ReSuccess(list);
catch (Exception)
{
return ResultList<ErpPurchaseInStockResultDto>.ReFailure("错误",10001);
}
}
}
}