定时任务:其他入库单
This commit is contained in:
@@ -64,7 +64,7 @@ namespace WMS.Web.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测试:同步采购单的入库
|
||||
/// 测试:同步
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
@@ -77,7 +77,7 @@ namespace WMS.Web.Api.Controllers
|
||||
bool isTransaction = false;
|
||||
|
||||
//3.同步数据
|
||||
var result = await _inStockTaskService.SsynPurchaseInStock(null,isTransaction);
|
||||
var result = await _inStockTaskService.SysnMiscellaneous(null,isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
|
||||
//4.提交事务
|
||||
|
||||
@@ -401,7 +401,7 @@
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.TestController.InStock">
|
||||
<summary>
|
||||
测试:同步采购单的入库
|
||||
测试:同步
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
|
||||
@@ -555,11 +555,6 @@
|
||||
erp:其他入库单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.ErpMiscellaneousDto.Id">
|
||||
<summary>
|
||||
id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.ErpMiscellaneousDto.BillNo">
|
||||
<summary>
|
||||
单据编号
|
||||
|
||||
@@ -2463,6 +2463,13 @@
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.QuartzJob.InStockOrderQuartzJob.InStock(System.Boolean)">
|
||||
<summary>
|
||||
同步:入库单类型的数据(采购订单,其他入库单,)
|
||||
</summary>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.QuartzJob.OutStockOrderQuartzJob.Execute(Quartz.IJobExecutionContext)">
|
||||
<summary>
|
||||
执行方法
|
||||
|
||||
@@ -7,12 +7,9 @@ namespace WMS.Web.Core.Dto.Erp
|
||||
/// <summary>
|
||||
/// erp:其他入库单
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ErpMiscellaneousDto
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Purchase;
|
||||
using WMS.Web.Core.Dto.InStock;
|
||||
using WMS.Web.Core.Dto.InStockTask;
|
||||
@@ -20,16 +21,6 @@ namespace WMS.Web.Domain.Mappers
|
||||
.ForMember(x => x.Boxs, opt => opt.Ignore())
|
||||
.ForMember(x => x.Details, opt => opt.Ignore());
|
||||
CreateMap<UpdateInStockTaskDetailsRequest, InStockTaskDetails>();
|
||||
//.ForMember(x => x.SupplierId, opt => opt.Ignore())
|
||||
//.ForMember(x => x.OrgId, opt => opt.Ignore())
|
||||
//.ForMember(x => x.StockId, opt => opt.Ignore())
|
||||
//.ForMember(x => x.StockCode, opt => opt.Ignore())
|
||||
//.ForMember(x => x.FactoryPrice, opt => opt.Ignore())
|
||||
//.ForMember(x => x.AccruedQty, opt => opt.Ignore())
|
||||
//.ForMember(x => x.DeliveredQty, opt => opt.Ignore())
|
||||
//.ForMember(x => x.RealityQty, opt => opt.Ignore())
|
||||
//.ForMember(x => x.Remark, opt => opt.Ignore())
|
||||
//.ForMember(x => x.CreateTime, opt => opt.Ignore());
|
||||
CreateMap<UpdateInStockTaskBoxRequest, InStockTaskBox>();
|
||||
CreateMap<InStockTask, InStockTask>()
|
||||
.ForMember(x => x.Boxs, opt => opt.Ignore())
|
||||
@@ -39,17 +30,20 @@ namespace WMS.Web.Domain.Mappers
|
||||
|
||||
|
||||
|
||||
CreateMap<SaveInStockDetailsRequest, InStockDetails>().ReverseMap();
|
||||
CreateMap<ErpPurchaseInStockResultDto, InStockTask>()
|
||||
.ForMember(x => x.SourceBillNo, ops => ops.MapFrom(x => x.FBillNo))
|
||||
.ForMember(x => x.CreateTime, ops => ops.MapFrom(x => x.FCreateDate));
|
||||
CreateMap<SaveInStockDetailsRequest, InStockDetails>().ReverseMap();
|
||||
|
||||
CreateMap<InStockTask, InStockTaskInfoDto>()
|
||||
.ForMember(x => x.Details, ops => ops.Ignore());
|
||||
|
||||
CreateMap<InStockTaskDetails, InStockTaskDetailsInfoDto>();
|
||||
|
||||
|
||||
#region ERP-dto映射到wsm的任务表中
|
||||
|
||||
//ERP采购订单
|
||||
CreateMap<ErpPurchaseInStockResultDto, InStockTask>()
|
||||
.ForMember(x => x.SourceBillNo, ops => ops.MapFrom(x => x.FBillNo))
|
||||
.ForMember(x => x.CreateTime, ops => ops.MapFrom(x => x.FCreateDate));
|
||||
|
||||
CreateMap<ErpPurchaseInStockResultDto, InStockTaskDetails>()
|
||||
.ForMember(x => x.SupplierId, ops => ops.MapFrom(x => x.FSupplierId))
|
||||
.ForMember(x => x.OrgId, ops => ops.MapFrom(x => x.FPurchaseOrgId))
|
||||
@@ -60,7 +54,21 @@ namespace WMS.Web.Domain.Mappers
|
||||
.ForMember(x => x.AccruedQty, ops => ops.MapFrom(x => x.FQty))
|
||||
.ForMember(x => x.Remark, ops => ops.MapFrom(x => x.FEntryNote))
|
||||
.ReverseMap();
|
||||
|
||||
|
||||
|
||||
//ERP其他入库单
|
||||
CreateMap<ErpMiscellaneousDto, InStockTaskDetails>()
|
||||
.ForMember(x => x.OrgId, ops => ops.MapFrom(x => x.StockOrgId))
|
||||
.ForMember(x => x.MaterialId, ops => ops.MapFrom(x => x.MaterialId))
|
||||
.ForMember(x => x.StockCode, ops => ops.MapFrom(x => x.StockCode))
|
||||
.ForMember(x => x.AccruedQty, ops => ops.MapFrom(x => x.Qty))
|
||||
.ForMember(x => x.Remark, ops => ops.MapFrom(x => x.Remark));
|
||||
|
||||
CreateMap<ErpMiscellaneousDto, InStockTask>()
|
||||
.ForMember(x => x.SourceBillNo, ops => ops.MapFrom(x => x.BillNo))
|
||||
.ForMember(x => x.CreateTime, ops => ops.MapFrom(x => x.CreateTime));
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
@@ -55,7 +56,7 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"同步金蝶入库单数据:执行开始时间->{begindatetime}");
|
||||
//3.同步数据
|
||||
var result = await _inStockTaskService.SsynPurchaseInStock(null,isTransaction);
|
||||
var result = await this.InStock(isTransaction);
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"同步金蝶入库单数据:执行失败->{result.Message}");
|
||||
@@ -76,5 +77,25 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步:入库单类型的数据(采购订单,其他入库单,)
|
||||
/// </summary>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> InStock(bool isTransaction)
|
||||
{
|
||||
//1.同步数据:采购订单
|
||||
var purchase_result = await _inStockTaskService.SsynPurchaseInStock(null, isTransaction);
|
||||
if (!purchase_result.IsSuccess)
|
||||
return Result.ReFailure(purchase_result.Message,purchase_result.Status);
|
||||
|
||||
//2.同步数据:其他入库单
|
||||
var miscellaneou_result = await _inStockTaskService.SysnMiscellaneous(null, isTransaction);
|
||||
if (!miscellaneou_result.IsSuccess)
|
||||
return Result.ReFailure(miscellaneou_result.Message, miscellaneou_result.Status);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace WMS.Web.Domain.Services
|
||||
//2.2.提交修改
|
||||
var isSuccess = await _inStockTaskRepositories.UpdateRange(data_list, isTransaction);
|
||||
if (!isSuccess)
|
||||
return ResultList<ErpPurchaseInStockResultDto>.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
//2.3剔除:已修改的单据
|
||||
foreach (var item in erp_removeList)
|
||||
@@ -198,7 +198,7 @@ namespace WMS.Web.Domain.Services
|
||||
//3.1提交新增
|
||||
var isSuccess = await _inStockTaskRepositories.AddRange(add_entitys, isTransaction);
|
||||
if (!isSuccess)
|
||||
return ResultList<ErpPurchaseInStockResultDto>.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
|
||||
return Result.ReSuccess();
|
||||
@@ -243,7 +243,7 @@ namespace WMS.Web.Domain.Services
|
||||
//2.2.提交修改
|
||||
var isSuccess = await _inStockTaskRepositories.UpdateRange(data_list, isTransaction);
|
||||
if (!isSuccess)
|
||||
return ResultList<ErpPurchaseInStockResultDto>.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
//2.3剔除:已修改的单据
|
||||
foreach (var item in erp_removeList)
|
||||
@@ -261,7 +261,7 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
var dto = new InStockTask();
|
||||
dto.SourceBillNo = item;
|
||||
dto.Create(InstockType.Purchase);
|
||||
dto.Create(InstockType.Miscellaneous);
|
||||
|
||||
//找到当前对应来源单据编号的集合数据
|
||||
var current_erp_details = erp_list.Where(x => x.BillNo == item).ToList();
|
||||
@@ -272,7 +272,7 @@ namespace WMS.Web.Domain.Services
|
||||
//3.1提交新增
|
||||
var isSuccess = await _inStockTaskRepositories.AddRange(add_entitys, isTransaction);
|
||||
if (!isSuccess)
|
||||
return ResultList<ErpPurchaseInStockResultDto>.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
|
||||
return Result.ReSuccess();
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
var param = new ErpBillQueryParamDto(FormIdParam.PUR_PurchaseOrder.ToString());
|
||||
param.FieldKeys = "FBillNo,FSupplierId,FPurchaseOrgId,FModel,FMaterialName,FMaterialId,FSOSTOCKID,FQty,FEntryNote,FCreateDate,FCHUCHANGPRICE,FSOSTOCKID.FNumber,FStockInQty,FDocumentStatus,FBillTypeID,FMRPCloseStatus,FBillTypeID.FName";
|
||||
param.Limit = 10;
|
||||
param.Limit = 10000;
|
||||
//查询条件:备注其中的条件值以金蝶的值为准!!!
|
||||
//1.创建时间在两天前和当天时间之间
|
||||
//2.审核状态:已审核
|
||||
@@ -275,8 +275,8 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//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;
|
||||
param.FieldKeys = "FBillNo,FStockOrgId,FMATERIALID,FSTOCKID,FSTOCKID.FNumber,FQty,FCreateDate,FEntryNote";
|
||||
param.Limit = 10000;
|
||||
//查询条件:备注其中的条件值以金蝶的值为准!!!
|
||||
//1.创建时间在两天前和当天时间之间
|
||||
//2.审核状态:已审核
|
||||
@@ -332,15 +332,14 @@ namespace WMS.Web.Domain.Services.Public
|
||||
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];
|
||||
lis.BillNo =item[0];
|
||||
lis.StockOrgId = Convert.ToInt32(item[1]);
|
||||
lis.MaterialId = Convert.ToInt32(item[2]);
|
||||
lis.StockId = Convert.ToInt32(item[3]);
|
||||
lis.StockCode = item[4];
|
||||
lis.Qty = Convert.ToDecimal(item[5]);
|
||||
lis.CreateTime = Convert.ToDateTime(item[6]);
|
||||
lis.Remark = item[7];
|
||||
erp_list.Add(lis);
|
||||
}
|
||||
return ResultList<ErpMiscellaneousDto>.ReSuccess(erp_list);
|
||||
|
||||
Reference in New Issue
Block a user