erp:其他入库单
This commit is contained in:
@@ -86,6 +86,54 @@ namespace WMS.Web.Domain.Services.Public
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查单据类型的值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ResultList<ErpBaseDto>> BillQueryForBillType()
|
||||
{
|
||||
try
|
||||
{
|
||||
//1.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpBaseDto>.ReFailure(token_result);
|
||||
|
||||
//2.时间条件:可能还有其它条件
|
||||
var beginTime = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00");
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//3.获取金蝶采购订单:拼接参数和条件
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
var param = new ErpBillQueryParamDto("BOS_BillType");
|
||||
param.FieldKeys = "FBILLTYPEID,FNumber,FName";
|
||||
param.Limit = 10000;
|
||||
param.FilterString = "";
|
||||
query.Data = JsonConvert.SerializeObject(param);
|
||||
var json = JsonConvert.SerializeObject(query);
|
||||
|
||||
//4.请求查询接口
|
||||
var result_json = await _client.ExecuteBillQueryAsync(json);
|
||||
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
||||
|
||||
//5.返回数据的组装
|
||||
var erp_list = new List<ErpBaseDto>();
|
||||
foreach (var item in result)
|
||||
{
|
||||
var lis = new ErpBaseDto();
|
||||
lis.Id = item[0];
|
||||
lis.Number = item[1];
|
||||
lis.Name =item[2];
|
||||
|
||||
erp_list.Add(lis);
|
||||
}
|
||||
return ResultList<ErpBaseDto>.ReSuccess(erp_list);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ResultList<ErpBaseDto>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// erp:单据查询-采购入库单
|
||||
/// </summary>
|
||||
@@ -199,6 +247,109 @@ namespace WMS.Web.Domain.Services.Public
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// erp:单据查询-其他入库单
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ResultList<ErpMiscellaneousDto>> BillQueryForMiscellaneous(List<string> sourceBillNos = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var stocks = await _basicsRepositories.GetUcStockAsync(ManagementSystemCode.GLXT0004.ToString(), "", _appOptions.CompanyId);
|
||||
if (stocks.Count == 0)
|
||||
return ResultList<ErpMiscellaneousDto>.ReFailure(ResultCodes.ErpStockNoData);
|
||||
var stocks_codes = stocks.Select(x => x.Code).ToList();
|
||||
|
||||
|
||||
//1.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpMiscellaneousDto>.ReFailure(token_result);
|
||||
|
||||
//2.时间条件:可能还有其它条件
|
||||
var beginTime = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00");
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//3.获取金蝶其他入库订单:拼接参数和条件
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
var param = new ErpBillQueryParamDto(FormIdParam.STK_MISCELLANEOUS.ToString());
|
||||
param.FieldKeys = "FID,FBillNo,FStockOrgId,FMATERIALID,FSTOCKID,FSTOCKID.FNumber,FQty,FCreateDate,FEntryNote";
|
||||
param.Limit = 10;
|
||||
//查询条件:备注其中的条件值以金蝶的值为准!!!
|
||||
//1.创建时间在两天前和当天时间之间
|
||||
//2.审核状态:已审核
|
||||
//3.单据类型:标准其他入库单;这里要注意了-----------测试端的“单据类型ID”和线上的可能不一样;上线的时候要核对下
|
||||
//5.仓库:wms系统的仓库值---现在这个没有加,因为还单点没有和金蝶同步
|
||||
param.FilterString = " FDocumentStatus='C' and FBillTypeID='d772ead981e748d69dda1caac7583f8c'";//
|
||||
param.FilterString = param.FilterString + " and FSTOCKID.FNumber in (";
|
||||
|
||||
var str = "";
|
||||
int index = 0;
|
||||
foreach (var scode in stocks_codes)
|
||||
{
|
||||
index++;
|
||||
if (index == stocks_codes.Count)
|
||||
str = str + $"'{scode}'";
|
||||
else
|
||||
str = str + $"'{scode}'" + ",";
|
||||
}
|
||||
param.FilterString = param.FilterString + str + ")";
|
||||
|
||||
//根据原订单号查询
|
||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||
{
|
||||
param.FilterString = param.FilterString + " and FBillNo in (";
|
||||
|
||||
var bill_str = "";
|
||||
int bill_index = 0;
|
||||
//var srt_b = JsonConvert.SerializeObject(sourceBillNos);
|
||||
foreach (var bill in sourceBillNos)
|
||||
{
|
||||
bill_index++;
|
||||
if (bill_index == sourceBillNos.Count)
|
||||
bill_str = bill_str + $"'{bill}'";
|
||||
else
|
||||
bill_str = bill_str + $"'{bill}'" + ",";
|
||||
}
|
||||
param.FilterString = param.FilterString + bill_str + ")";
|
||||
}//注意:当有单据编号的查询的时候,时间条件去掉;不然就查不到数据了
|
||||
else
|
||||
{
|
||||
param.FilterString = param.FilterString + " and FCreateDate>='" + beginTime + "' and FCreateDate<='" + endTime + "'";
|
||||
}
|
||||
|
||||
query.Data = JsonConvert.SerializeObject(param);
|
||||
var json = JsonConvert.SerializeObject(query);
|
||||
|
||||
//4.请求查询接口
|
||||
var result_json = await _client.ExecuteBillQueryAsync(json);
|
||||
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
||||
|
||||
//5.返回数据的组装
|
||||
var erp_list = new List<ErpMiscellaneousDto>();
|
||||
foreach (var item in result)
|
||||
{
|
||||
var lis = new ErpMiscellaneousDto();
|
||||
lis.Id = Convert.ToInt32(item[0]);
|
||||
lis.BillNo =item[1];
|
||||
lis.StockOrgId = Convert.ToInt32(item[2]);
|
||||
lis.MaterialId = Convert.ToInt32(item[3]);
|
||||
lis.StockId = Convert.ToInt32(item[4]);
|
||||
lis.StockCode = item[5];
|
||||
lis.Qty = Convert.ToDecimal(item[6]);
|
||||
lis.CreateTime = Convert.ToDateTime(item[7]);
|
||||
lis.Remark = item[8];
|
||||
erp_list.Add(lis);
|
||||
}
|
||||
return ResultList<ErpMiscellaneousDto>.ReSuccess(erp_list);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ResultList<ErpMiscellaneousDto>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// erp:单据查询-物料
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user