You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using Estsh.Core.Model.EnumUtil;
|
|
using Estsh.Core.Models;
|
|
using Estsh.Core.Quartz.BaseService;
|
|
using Estsh.Core.Util;
|
|
using Estsh.Core.Wms.IRepositories;
|
|
using System.Diagnostics;
|
|
|
|
namespace Estsh.Core.Wms.Jobs
|
|
{
|
|
/// <summary>
|
|
/// 库存零件原材料 扣减
|
|
/// </summary>
|
|
public class ProductDeductJob : IJobService
|
|
{
|
|
private readonly IProductDeductRepository productDeduct;
|
|
|
|
public ProductDeductJob(IProductDeductRepository _productDeduct)
|
|
{
|
|
this.productDeduct = _productDeduct;
|
|
}
|
|
|
|
public string ExecuteService(string parameter)
|
|
{
|
|
try
|
|
{
|
|
//List<SysStock> wmsProducts = productDeduct.GetProductDeductInfo();
|
|
List<WmsProductDeduct> wmsProducts = productDeduct.GetProductDeductInfo2();
|
|
if (wmsProducts.Count <= 0)
|
|
{
|
|
return "没有待扣减的数据!";
|
|
}
|
|
Stopwatch sw = new Stopwatch();
|
|
sw.Start();
|
|
|
|
//bool bl = productDeduct.InsertProductDeductInfo(wmsProducts);
|
|
bool bl = productDeduct.InsertProductDeductInfo2(wmsProducts);
|
|
|
|
sw.Stop();
|
|
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
|
|
LogHelper.Info("当前操作:库存零件原材料扣减,当前时间差:" + timeFor);
|
|
if (bl == true)
|
|
{
|
|
return "待扣减原材料数据同步成功!";
|
|
}
|
|
else
|
|
{
|
|
return "待扣减原材料数据同步失败!";
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error("生成库存零件扣减错误!" + ex);
|
|
return "生成库存零件扣减错误!" + ex.Message;
|
|
}
|
|
}
|
|
}
|
|
}
|