using Estsh.Core.Dapper; using Estsh.Core.Model.EnumUtil; using Estsh.Core.Model.Result; using Estsh.Core.Models; using Estsh.Core.Quartz.BaseService; using Estsh.Core.Util; using Estsh.Core.Wms.IRepositories; using Estsh.Core.Wms.Repositories; namespace Estsh.Core.Wms.Jobs { /// /// 获取bom拆分生产下线数据发送生产汇报信息给SAP /// public class WMSProductionReportJob : IJobService { private readonly IMesMovtrnResultRepository repository; private static readonly string TABLE_NAME = "MES_MOVTRN"; private static readonly string INTERFACE_NAME = "InsertProductionReportInfo"; public WMSProductionReportJob(IMesMovtrnResultRepository _repository) { this.repository = _repository; } public string ExecuteService(string parameter) { try { List mesMovtrns = repository.GetRusultInfo(TABLE_NAME); if (mesMovtrns.Count <= 0) { return "没有待处理的生产汇报信息!"; } SapInterfaceResult result = repository.doResultsPush(mesMovtrns, TABLE_NAME, INTERFACE_NAME); return result.message; } catch (Exception ex) { LogHelper.Error("生产汇报接口错误!" + ex); return "生产汇报接口错误!" + ex.Message; } } } public interface IMesMovtrnResultRepository : IWmsResultRepository { } public class MesMovtrnResultRepository : WmsResultRepository, IMesMovtrnResultRepository { public MesMovtrnResultRepository(DapperDbContext _dapperDbContext) : base(_dapperDbContext) { } } }