修改了上传
This commit is contained in:
@@ -1081,6 +1081,46 @@
|
|||||||
单据编码
|
单据编码
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Core.Dto.Erp.ErpProduceInStockSaveDto">
|
||||||
|
<summary>
|
||||||
|
修改生产入库单
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockSaveDto.Id">
|
||||||
|
<summary>
|
||||||
|
单据Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockSaveDto.Details">
|
||||||
|
<summary>
|
||||||
|
明细
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:WMS.Web.Core.Dto.Erp.ErpProduceInStockDetailsSaveDto">
|
||||||
|
<summary>
|
||||||
|
明细
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockDetailsSaveDto.DetailId">
|
||||||
|
<summary>
|
||||||
|
明细Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockDetailsSaveDto.FMoEntryId">
|
||||||
|
<summary>
|
||||||
|
生产订单号订单明细Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockDetailsSaveDto.Qty">
|
||||||
|
<summary>
|
||||||
|
数量
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.Erp.ErpProduceInStockDetailsSaveDto.Lot">
|
||||||
|
<summary>
|
||||||
|
批号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Core.Dto.Erp.ErpPurchaseInStockSaveDto">
|
<member name="T:WMS.Web.Core.Dto.Erp.ErpPurchaseInStockSaveDto">
|
||||||
<summary>
|
<summary>
|
||||||
修改采购入库单
|
修改采购入库单
|
||||||
|
|||||||
@@ -5700,7 +5700,7 @@
|
|||||||
<param name="loginInfo"></param>
|
<param name="loginInfo"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:WMS.Web.Domain.Services.InStockService.Push(WMS.Web.Core.Dto.Erp.ErpPushDto,WMS.Web.Domain.Entitys.InStockErpDetails,System.String,WMS.Web.Domain.IService.Public.IErpService,WMS.Web.Domain.Infrastructure.IInStockRepositories)">
|
<member name="M:WMS.Web.Domain.Services.InStockService.Push(WMS.Web.Core.Dto.Erp.ErpPushDto,WMS.Web.Domain.Entitys.InStockErpDetails,System.String,WMS.Web.Domain.IService.Public.IErpService,WMS.Web.Domain.Infrastructure.IInStockRepositories,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
下推
|
下推
|
||||||
</summary>
|
</summary>
|
||||||
|
|||||||
@@ -1,10 +1,74 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace WMS.Web.Core.Dto.Erp
|
namespace WMS.Web.Core.Dto.Erp
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改生产入库单
|
||||||
|
/// </summary>
|
||||||
|
public class ErpProduceInStockSaveDto
|
||||||
|
{
|
||||||
|
public ErpProduceInStockSaveDto() { }
|
||||||
|
public ErpProduceInStockSaveDto(string id)
|
||||||
|
{
|
||||||
|
this.Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据Id
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("FID")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 明细
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("FEntity")]
|
||||||
|
public List<ErpProduceInStockDetailsSaveDto> Details { get; set; } = new List<ErpProduceInStockDetailsSaveDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 明细
|
||||||
|
/// </summary>
|
||||||
|
public class ErpProduceInStockDetailsSaveDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 明细Id
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("FEntryID")]
|
||||||
|
public string DetailId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 生产订单号订单明细Id
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public string FMoEntryId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("FRealQty")]
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
|
||||||
|
public decimal FBaseRealQty { get; set; }
|
||||||
|
|
||||||
|
public decimal FStockRealQty { get; set; }
|
||||||
|
public decimal FBasePrdRealQty { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("FLot")]
|
||||||
|
public ErpLotSaveDto Lot { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改采购入库单
|
/// 修改采购入库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace WMS.Web.Domain.IService.Public
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Result<ErpPurchaseInStockSaveDto>> BillQueryForPurchaseInStock(string id);
|
Task<Result<ErpPurchaseInStockSaveDto>> BillQueryForPurchaseInStock(string id);
|
||||||
|
Task<Result<ErpProduceInStockSaveDto>> BillQueryForProduceInStock(string id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -986,7 +986,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//下推金蝶
|
//下推金蝶
|
||||||
var res = await this.Push(erpDto, det, entity.BillNo, sc_erpService, sc_inStockRepositories);
|
var res = await this.Push(erpDto, det, entity.BillNo, sc_erpService, sc_inStockRepositories,"pur");
|
||||||
if (res.result.IsSuccess)
|
if (res.result.IsSuccess)
|
||||||
entity.SyncSuccess(det.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
entity.SyncSuccess(det.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
||||||
else
|
else
|
||||||
@@ -1076,7 +1076,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//下推金蝶
|
//下推金蝶
|
||||||
var res = await this.Push(erpDto, det, entity.BillNo, sc_erpService, sc_inStockRepositories);
|
var res = await this.Push(erpDto, det, entity.BillNo, sc_erpService, sc_inStockRepositories, "prd");
|
||||||
if (res.result.IsSuccess)
|
if (res.result.IsSuccess)
|
||||||
entity.SyncSuccess(det.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
entity.SyncSuccess(det.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
||||||
else
|
else
|
||||||
@@ -1100,12 +1100,14 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <param name="erpDetail"></param>
|
/// <param name="erpDetail"></param>
|
||||||
/// <param name="billNo"></param>
|
/// <param name="billNo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<(Result result, SyncStatus syncStatus, string erpBillNo, string instockDetailId)> Push(ErpPushDto dto, InStockErpDetails erpDetail, string billNo, IErpService sc_erpService, IInStockRepositories sc_inStockRepositories)
|
private async Task<(Result result, SyncStatus syncStatus, string erpBillNo, string instockDetailId)> Push(ErpPushDto dto, InStockErpDetails erpDetail, string billNo, IErpService sc_erpService, IInStockRepositories sc_inStockRepositories,string pushType)
|
||||||
{
|
{
|
||||||
var erp_instock_detId = string.Empty;
|
var erp_instock_detId = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"入库单->开始下推 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(dto)}");
|
if (pushType == "prd")
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->开始下推 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(dto)}");
|
||||||
//下推动作
|
//下推动作
|
||||||
var res = await sc_erpService.Push(dto);
|
var res = await sc_erpService.Push(dto);
|
||||||
if (!res.IsSuccess)
|
if (!res.IsSuccess)
|
||||||
@@ -1114,12 +1116,17 @@ namespace WMS.Web.Domain.Services
|
|||||||
return (Result.ReFailure(res.Message, res.Status), SyncStatus.Fail, "", null);
|
return (Result.ReFailure(res.Message, res.Status), SyncStatus.Fail, "", null);
|
||||||
}
|
}
|
||||||
string id = res.Data;
|
string id = res.Data;
|
||||||
var resPurchaseInStock = await sc_erpService.BillQueryForPurchaseInStock(id);
|
var resPurchaseInStock = await sc_erpService.BillQueryForProduceInStock(id);
|
||||||
var purchaseInStock = resPurchaseInStock.Data;
|
var purchaseInStock = resPurchaseInStock.Data;
|
||||||
purchaseInStock.Details[0].Qty = erpDetail.Qty;
|
purchaseInStock.Details[0].Qty = erpDetail.Qty;
|
||||||
string formId = dto.TargetFormId.ToString();
|
purchaseInStock.Details[0].FBaseRealQty = erpDetail.Qty;
|
||||||
|
purchaseInStock.Details[0].FStockRealQty = erpDetail.Qty;
|
||||||
|
purchaseInStock.Details[0].FBasePrdRealQty = erpDetail.Qty;
|
||||||
|
string formId = dto.TargetFormId.ToString();
|
||||||
erp_instock_detId = purchaseInStock.Details[0].DetailId;
|
erp_instock_detId = purchaseInStock.Details[0].DetailId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//批号生成和同步
|
//批号生成和同步
|
||||||
if (string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
if (string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
||||||
{
|
{
|
||||||
@@ -1149,32 +1156,113 @@ namespace WMS.Web.Domain.Services
|
|||||||
}
|
}
|
||||||
//保存
|
//保存
|
||||||
_logger.LogInformation($"入库单->下推成功 开始保存 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(purchaseInStock)}");
|
_logger.LogInformation($"入库单->下推成功 开始保存 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(purchaseInStock)}");
|
||||||
var res_s = await sc_erpService.Save<ErpPurchaseInStockSaveDto>(purchaseInStock, formId);
|
|
||||||
if (!res_s.IsSuccess)
|
|
||||||
{
|
|
||||||
_logger.LogInformation($"入库单->保存失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res_s.Message}");
|
|
||||||
return (Result.ReFailure(res_s.Message, res_s.Status), SyncStatus.SubmitFail, "", purchaseInStock.Details[0].DetailId);
|
|
||||||
}
|
|
||||||
|
|
||||||
//提交
|
var res_s = await sc_erpService.Save<ErpProduceInStockSaveDto>(purchaseInStock, formId);
|
||||||
_logger.LogInformation($"入库单->保存成功 开始提交 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
if (!res_s.IsSuccess)
|
||||||
ErpOperateDto o_dto = new ErpOperateDto(formId, res_s.Data);//res_s.Data
|
{
|
||||||
var resSubmit = await sc_erpService.Submit(o_dto, formId);
|
_logger.LogInformation($"入库单->保存失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res_s.Message}");
|
||||||
if (!resSubmit.IsSuccess)
|
return (Result.ReFailure(res_s.Message, res_s.Status), SyncStatus.SubmitFail, "", purchaseInStock.Details[0].DetailId);
|
||||||
{
|
}
|
||||||
_logger.LogInformation($"入库单->提交失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
|
||||||
return (resSubmit, SyncStatus.SubmitFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
//提交
|
||||||
|
_logger.LogInformation($"入库单->保存成功 开始提交 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
ErpOperateDto o_dto = new ErpOperateDto(formId, res_s.Data);//res_s.Data
|
||||||
|
var resSubmit = await sc_erpService.Submit(o_dto, formId);
|
||||||
|
if (!resSubmit.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->提交失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
||||||
|
return (resSubmit, SyncStatus.SubmitFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
|
}
|
||||||
|
//审核
|
||||||
|
_logger.LogInformation($"入库单->提交成功 开始审核 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
resSubmit = await sc_erpService.Audit(o_dto, formId);
|
||||||
|
if (!resSubmit.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->审核失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
||||||
|
return (resSubmit, SyncStatus.CheckFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
|
}
|
||||||
|
_logger.LogInformation($"入库单->同步金蝶成功->单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
|
||||||
|
return (Result.ReSuccess(), SyncStatus.Success, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
}
|
}
|
||||||
//审核
|
else
|
||||||
_logger.LogInformation($"入库单->提交成功 开始审核 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
|
||||||
resSubmit = await sc_erpService.Audit(o_dto, formId);
|
|
||||||
if (!resSubmit.IsSuccess)
|
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"入库单->审核失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
_logger.LogInformation($"入库单->开始下推 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(dto)}");
|
||||||
return (resSubmit, SyncStatus.CheckFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
//下推动作
|
||||||
|
var res = await sc_erpService.Push(dto);
|
||||||
|
if (!res.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->下推失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res.Message}");
|
||||||
|
return (Result.ReFailure(res.Message, res.Status), SyncStatus.Fail, "", null);
|
||||||
|
}
|
||||||
|
string id = res.Data;
|
||||||
|
var resPurchaseInStock = await sc_erpService.BillQueryForPurchaseInStock(id);
|
||||||
|
var purchaseInStock = resPurchaseInStock.Data;
|
||||||
|
purchaseInStock.Details[0].Qty = erpDetail.Qty;
|
||||||
|
string formId = dto.TargetFormId.ToString();
|
||||||
|
erp_instock_detId = purchaseInStock.Details[0].DetailId;
|
||||||
|
|
||||||
|
|
||||||
|
//批号生成和同步
|
||||||
|
if (string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
||||||
|
{
|
||||||
|
var current_erp_material = await sc_erpService.BillQueryForMaterialByNumber(erpDetail.MaterialNumber);
|
||||||
|
if (current_erp_material != null && current_erp_material.IsBatchManage == true)
|
||||||
|
{
|
||||||
|
//1.获取最新的erp明细信息
|
||||||
|
var billNo_new = await sc_inStockRepositories.GetLastBillNo();
|
||||||
|
//erp明细:最新批号
|
||||||
|
int new_firstBillNo = billNo_new == null ? 0 : (billNo_new.FirstBillNo.HasValue ? billNo_new.FirstBillNo.Value : 0);
|
||||||
|
int new_lastBillNo = billNo_new == null ? 0 : (billNo_new.LastBillNo.HasValue ? billNo_new.LastBillNo.Value : 0);
|
||||||
|
|
||||||
|
//生成批号
|
||||||
|
erpDetail.GenerateBatchBillNo(new_firstBillNo, new_lastBillNo, current_erp_material.IsBatchManage);
|
||||||
|
//赋值批号
|
||||||
|
if (!string.IsNullOrEmpty(erpDetail.BatchBillNo))
|
||||||
|
{
|
||||||
|
purchaseInStock.Details[0].Lot = new ErpLotSaveDto();
|
||||||
|
purchaseInStock.Details[0].Lot.Number = erpDetail.BatchBillNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
purchaseInStock.Details[0].Lot = new ErpLotSaveDto();
|
||||||
|
purchaseInStock.Details[0].Lot.Number = erpDetail.BatchBillNo;
|
||||||
|
}
|
||||||
|
//保存
|
||||||
|
_logger.LogInformation($"入库单->下推成功 开始保存 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 数据: {JsonConvert.SerializeObject(purchaseInStock)}");
|
||||||
|
|
||||||
|
var res_s = await sc_erpService.Save<ErpPurchaseInStockSaveDto>(purchaseInStock, formId);
|
||||||
|
if (!res_s.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->保存失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{res_s.Message}");
|
||||||
|
return (Result.ReFailure(res_s.Message, res_s.Status), SyncStatus.SubmitFail, "", purchaseInStock.Details[0].DetailId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交
|
||||||
|
_logger.LogInformation($"入库单->保存成功 开始提交 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
ErpOperateDto o_dto = new ErpOperateDto(formId, res_s.Data);//res_s.Data
|
||||||
|
var resSubmit = await sc_erpService.Submit(o_dto, formId);
|
||||||
|
if (!resSubmit.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->提交失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
||||||
|
return (resSubmit, SyncStatus.SubmitFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
|
}
|
||||||
|
//审核
|
||||||
|
_logger.LogInformation($"入库单->提交成功 开始审核 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
resSubmit = await sc_erpService.Audit(o_dto, formId);
|
||||||
|
if (!resSubmit.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"入库单->审核失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
|
||||||
|
return (resSubmit, SyncStatus.CheckFail, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
|
}
|
||||||
|
_logger.LogInformation($"入库单->同步金蝶成功->单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
||||||
|
|
||||||
|
return (Result.ReSuccess(), SyncStatus.Success, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
_logger.LogInformation($"入库单->同步金蝶成功->单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
|
|
||||||
return (Result.ReSuccess(), SyncStatus.Success, o_dto.Numbers.First(), purchaseInStock.Details[0].DetailId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -155,6 +155,73 @@ namespace WMS.Web.Domain.Services.Public
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<Result<List<ErpPurchaseInStockDetailsDto>>> BillQueryForPurchaseInStockBy(string purchaseDetailId, List<string> sourceBillNos)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//1.先登录金蝶-拿到token
|
||||||
|
var token_result = await this.Init();
|
||||||
|
if (!token_result.IsSuccess)
|
||||||
|
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(token_result);
|
||||||
|
|
||||||
|
|
||||||
|
//3.获取金蝶采购订单:拼接参数和条件
|
||||||
|
var query = new ErpBillQueryDto(token_result.Data);
|
||||||
|
var param = new ErpBillQueryParamDto(FormIdParam.STK_InStock.ToString());
|
||||||
|
param.FieldKeys = "FID,FInStockEntry_FEntryID,FRealQty,FPOOrderNo,FBillNo,FDocumentStatus";
|
||||||
|
param.Limit = 10000;
|
||||||
|
param.FilterString = $"FPOORDERENTRYID={purchaseDetailId}";
|
||||||
|
|
||||||
|
//根据原订单号查询
|
||||||
|
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||||
|
{
|
||||||
|
param.FilterString = param.FilterString + " and FBillNo not 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 + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
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<ErpPurchaseInStockDetailsDto>();
|
||||||
|
foreach (var item in result)
|
||||||
|
{
|
||||||
|
var lis = new ErpPurchaseInStockDetailsDto();
|
||||||
|
lis.OrderId = item[0];
|
||||||
|
lis.DetailId = item[1];
|
||||||
|
lis.Qty = Convert.ToDecimal(item[2]);
|
||||||
|
lis.PurchaseBillNo = item[3];
|
||||||
|
lis.OrderBillNo = item[4];
|
||||||
|
lis.DocumentStatus = item[5];
|
||||||
|
lis.PurchaseDetailId = purchaseDetailId;
|
||||||
|
erp_list.Add(lis);
|
||||||
|
}
|
||||||
|
return Result<List<ErpPurchaseInStockDetailsDto>>.ReSuccess(erp_list);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// erp:单据查询-采购入库单
|
/// erp:单据查询-采购入库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -3004,41 +3071,24 @@ namespace WMS.Web.Domain.Services.Public
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Result<List<ErpPurchaseInStockDetailsDto>>> BillQueryForPurchaseInStockBy(string purchaseDetailId, List<string> sourceBillNos)
|
|
||||||
|
|
||||||
|
public async Task<Result<ErpProduceInStockSaveDto>> BillQueryForProduceInStock(string id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//1.先登录金蝶-拿到token
|
//1.先登录金蝶-拿到token
|
||||||
var token_result = await this.Init();
|
var token_result = await this.Init();
|
||||||
if (!token_result.IsSuccess)
|
if (!token_result.IsSuccess)
|
||||||
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(token_result);
|
return Result<ErpProduceInStockSaveDto>.ReFailure(token_result);
|
||||||
|
|
||||||
|
|
||||||
//3.获取金蝶采购订单:拼接参数和条件
|
//3.获取金蝶采购订单:拼接参数和条件
|
||||||
var query = new ErpBillQueryDto(token_result.Data);
|
var query = new ErpBillQueryDto(token_result.Data);
|
||||||
var param = new ErpBillQueryParamDto(FormIdParam.STK_InStock.ToString());
|
var param = new ErpBillQueryParamDto(FormIdParam.PRD_INSTOCK.ToString());
|
||||||
param.FieldKeys = "FID,FInStockEntry_FEntryID,FRealQty,FPOOrderNo,FBillNo,FDocumentStatus";
|
param.FieldKeys = "FID,FEntity_FEntryID,FRealQty";
|
||||||
param.Limit = 10000;
|
param.Limit = 10000;
|
||||||
param.FilterString = $"FPOORDERENTRYID={purchaseDetailId}";
|
param.FilterString = $"FID={id}";
|
||||||
|
|
||||||
//根据原订单号查询
|
|
||||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
|
||||||
{
|
|
||||||
param.FilterString = param.FilterString + " and FBillNo not 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 + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
query.Data = JsonConvert.SerializeObject(param);
|
query.Data = JsonConvert.SerializeObject(param);
|
||||||
var json = JsonConvert.SerializeObject(query);
|
var json = JsonConvert.SerializeObject(query);
|
||||||
@@ -3048,27 +3098,89 @@ namespace WMS.Web.Domain.Services.Public
|
|||||||
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
||||||
|
|
||||||
//5.返回数据的组装
|
//5.返回数据的组装
|
||||||
var erp_list = new List<ErpPurchaseInStockDetailsDto>();
|
var erp_list = new ErpProduceInStockSaveDto(id);
|
||||||
foreach (var item in result)
|
foreach (var item in result)
|
||||||
{
|
{
|
||||||
var lis = new ErpPurchaseInStockDetailsDto();
|
var lis = new ErpProduceInStockDetailsSaveDto();
|
||||||
lis.OrderId = item[0];
|
|
||||||
lis.DetailId = item[1];
|
lis.DetailId = item[1];
|
||||||
lis.Qty = Convert.ToDecimal(item[2]);
|
lis.Qty = Convert.ToDecimal(item[2]);
|
||||||
lis.PurchaseBillNo = item[3];
|
// lis.PurchaseDetailId = "";
|
||||||
lis.OrderBillNo = item[4];
|
erp_list.Details.Add(lis);
|
||||||
lis.DocumentStatus = item[5];
|
|
||||||
lis.PurchaseDetailId = purchaseDetailId;
|
|
||||||
erp_list.Add(lis);
|
|
||||||
}
|
}
|
||||||
return Result<List<ErpPurchaseInStockDetailsDto>>.ReSuccess(erp_list);
|
return Result<ErpProduceInStockSaveDto>.ReSuccess(erp_list);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
return Result<ErpProduceInStockSaveDto>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//public async Task<Result<List<ErpPurchaseInStockDetailsDto>>> BillQueryForProduceInStockBy(string purchaseDetailId, List<string> sourceBillNos)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// //1.先登录金蝶-拿到token
|
||||||
|
// var token_result = await this.Init();
|
||||||
|
// if (!token_result.IsSuccess)
|
||||||
|
// return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(token_result);
|
||||||
|
|
||||||
|
|
||||||
|
// //3.获取金蝶采购订单:拼接参数和条件
|
||||||
|
// var query = new ErpBillQueryDto(token_result.Data);
|
||||||
|
// var param = new ErpBillQueryParamDto(FormIdParam.PRD_INSTOCK.ToString());
|
||||||
|
// param.FieldKeys = "FID,FEntity_FEntryID,FRealQty,FMoBillNo,FBillNo,FDocumentStatus";
|
||||||
|
// param.Limit = 10000;
|
||||||
|
// param.FilterString = $"FMoEntryId={purchaseDetailId}";
|
||||||
|
|
||||||
|
// //根据原订单号查询
|
||||||
|
// if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||||
|
// {
|
||||||
|
// param.FilterString = param.FilterString + " and FBillNo not 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 + ")";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 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<ErpPurchaseInStockDetailsDto>();
|
||||||
|
// foreach (var item in result)
|
||||||
|
// {
|
||||||
|
// var lis = new ErpPurchaseInStockDetailsDto();
|
||||||
|
// lis.OrderId = item[0];
|
||||||
|
// lis.DetailId = item[1];
|
||||||
|
// lis.Qty = Convert.ToDecimal(item[2]);
|
||||||
|
// lis.PurchaseBillNo = item[3];
|
||||||
|
// lis.OrderBillNo = item[4];
|
||||||
|
// lis.DocumentStatus = item[5];
|
||||||
|
// lis.PurchaseDetailId = purchaseDetailId;
|
||||||
|
// erp_list.Add(lis);
|
||||||
|
// }
|
||||||
|
// return Result<List<ErpPurchaseInStockDetailsDto>>.ReSuccess(erp_list);
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(ResultCodes.Erp_BillQuery_Error);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
public async Task<Result<List<ErpPurchaseInStockDetailsDto>>> BillQueryForProduceInStockBy(string purchaseDetailId, List<string> sourceBillNos)
|
public async Task<Result<List<ErpPurchaseInStockDetailsDto>>> BillQueryForProduceInStockBy(string purchaseDetailId, List<string> sourceBillNos)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -3079,12 +3191,12 @@ namespace WMS.Web.Domain.Services.Public
|
|||||||
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(token_result);
|
return Result<List<ErpPurchaseInStockDetailsDto>>.ReFailure(token_result);
|
||||||
|
|
||||||
|
|
||||||
//3.获取金蝶采购订单:拼接参数和条件
|
//3.获取金蝶生产汇报订单:拼接参数和条件
|
||||||
var query = new ErpBillQueryDto(token_result.Data);
|
var query = new ErpBillQueryDto(token_result.Data);
|
||||||
var param = new ErpBillQueryParamDto(FormIdParam.PRD_INSTOCK.ToString());
|
var param = new ErpBillQueryParamDto(FormIdParam.PRD_MORPT.ToString());
|
||||||
param.FieldKeys = "FID,FInStockEntry_FEntryID,FRealQty,FMoBillNo,FBillNo,FDocumentStatus";
|
param.FieldKeys = "FID,FEntity_FEntryID,FQuaQty,FMoBillNo,FBillNo,FDocumentStatus";
|
||||||
param.Limit = 10000;
|
param.Limit = 10000;
|
||||||
param.FilterString = $"FMoEntryId={purchaseDetailId}";
|
param.FilterString = $"FEntryID={purchaseDetailId}";
|
||||||
|
|
||||||
//根据原订单号查询
|
//根据原订单号查询
|
||||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user