| | |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | private readonly IDt_InboundOrderRepository _inboundOrderRepository; |
| | | private readonly IDt_OutboundOrderRepository _outboundorderRepository; |
| | | |
| | | private Timer _timer; |
| | | |
| | | public MyBackgroundService(ILogger<MyBackgroundService> logger, ILocationInfoRepository locationRepository, IStockInfoRepository stockInfoRepository, IDt_AreaInfoRepository areaInfoRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, ISys_ConfigService configService,IDt_InboundOrderRepository inboundOrderRepository) |
| | | public MyBackgroundService(ILogger<MyBackgroundService> logger, ILocationInfoRepository locationRepository, IStockInfoRepository stockInfoRepository, IDt_AreaInfoRepository areaInfoRepository, IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, ISys_ConfigService configService,IDt_InboundOrderRepository inboundOrderRepository, IDt_OutboundOrderRepository outboundorderRepository) |
| | | { |
| | | _logger = logger; |
| | | _locationRepository = locationRepository; |
| | |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _inboundOrderRepository = inboundOrderRepository; |
| | | _outboundorderRepository = outboundorderRepository; |
| | | } |
| | | |
| | | public Task StartAsync(CancellationToken cancellationToken) |
| | |
| | | { |
| | | try |
| | | { |
| | | #region å
¥åºåæ®åæ¥ |
| | | List<WMS_éè´å
¥æåå
¥åºèªå¨æå°æ¸
å_ST> ERPPrintChecklist =SqlSugarHelper.DBERP.Queryable<WMS_éè´å
¥æåå
¥åºèªå¨æå°æ¸
å_ST>().Where(x => true).ToList(); |
| | | |
| | | |
| | | var printCheckList = _inboundOrderRepository.QueryData(x => true); |
| | | List<Dt_InboundOrder> inboundOrderAdd = new List<Dt_InboundOrder>(); |
| | |
| | | { |
| | | Dt_InboundOrder Print = new Dt_InboundOrder() |
| | | { |
| | | OrderNo = GetOrderPintCode(), |
| | | OrderNo = GetOrderPintCode("OrderNoIn"), |
| | | UpperOrderNo = item.åå·, |
| | | DemandClassification = item.éæ±åç±», |
| | | OrderType = item.åæ®ç±»å, |
| | |
| | | { |
| | | if (x.OrderNo == null || x.OrderNo == "") |
| | | { |
| | | x.OrderNo = GetOrderPintCode(); |
| | | x.OrderNo = GetOrderPintCode("OrderNoIn"); |
| | | x.UpperOrderNo = item.åå·; |
| | | x.DemandClassification = item.éæ±åç±»; |
| | | x.OrderType = item.åæ®ç±»å; |
| | |
| | | { |
| | | _inboundOrderRepository.UpdateData(inboundOrderUpdate); |
| | | } |
| | | #endregion |
| | | |
| | | var OutBoundOrder = _outboundorderRepository.QueryData(x => true); |
| | | List<Dt_OutboundOrder> outboundOrderAdd = new List<Dt_OutboundOrder>(); |
| | | List<Dt_OutboundOrder> outboundOrderUpdate = new List<Dt_OutboundOrder>(); |
| | | |
| | | #region ERPçäº§é¢æå忥 |
| | | List<WMS_ç¨åå·¥ç¨åè´§åä¸è§è¡¨_ST> ERPMaterialRequisition = SqlSugarHelper.DBERP.Queryable<WMS_ç¨åå·¥ç¨åè´§åä¸è§è¡¨_ST>().Where(x => true).ToList(); |
| | | foreach (var item in ERPMaterialRequisition) |
| | | { |
| | | var x = OutBoundOrder.Where(x => x.MaterielCode == item.åä»¶æå· && x.UpperOrderNo == item.åå·).FirstOrDefault(); |
| | | if(x == null) |
| | | { |
| | | Dt_OutboundOrder outOrder = new Dt_OutboundOrder() |
| | | { |
| | | OrderNo = GetOrderPintCode("OrderNoOut"), |
| | | UpperOrderNo = item.åå·, |
| | | MaterielCode = item.åä»¶æå·, |
| | | MaterielName = item.åä»¶åå, |
| | | DemandClassification = item.éæ±åç§°, |
| | | OrderQuantity = item.åä»¶å®é
ç¨é, |
| | | OverOutQuantity = item.åä»¶åæ¾æ°é, |
| | | NotOutQuantity = item.åä»¶æªåæ°é, |
| | | OrderStatus =(int)OrderStateEmun.æªå¼å§, |
| | | OrderType =(int)OrderTypeEmun.çäº§é¢æå, |
| | | CreateType =(int)OrderCreateTypeEmun.ERPæ¨é, |
| | | }; |
| | | outboundOrderAdd.Add(outOrder); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | if (outboundOrderAdd.Count > 0) |
| | | { |
| | | _outboundorderRepository.AddData(outboundOrderAdd); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public string GetOrderPintCode() |
| | | public string GetOrderPintCode(string printCode) |
| | | { |
| | | string PrintCode = ""; |
| | | var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == "OrderNo").ToList().FirstOrDefault(); |
| | | var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault(); |
| | | |
| | | if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd")) |
| | | { |