| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_TaskInfoService; |
| | | using WIDESEA_DTO.ERP; |
| | |
| | | [ApiController] |
| | | public class LargeController : ControllerBase |
| | | { |
| | | private readonly IOutboundService _outboundService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITask_HtyService _task_HtyService; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IMesProInOrderService _mesProInOrderService; |
| | | private readonly IOutProStockInfoService _outProStockInfoService; |
| | | private readonly WebSocketServer _webSocketServer; |
| | | private readonly IProStockInfoDetailService _proStockInfoDetailService; |
| | | private readonly IProStockInfoService _proStockInfoService; |
| | | |
| | | public LargeController(IOutboundService outboundService, ITaskService taskService, ITask_HtyService task_HtyService, IBasicService basicService, IMesProInOrderService mesProInOrderService, IOutProStockInfoService outProStockInfoService, IProStockInfoDetailService proStockInfoDetailService, IProStockInfoService proStockInfoService, WebSocketServer webSocketServer) |
| | | public LargeController( ITaskService taskService, ITask_HtyService task_HtyService, IBasicService basicService, IProStockInfoDetailService proStockInfoDetailService, IProStockInfoService proStockInfoService, WebSocketServer webSocketServer) |
| | | { |
| | | _outboundService = outboundService; |
| | | _taskService = taskService; |
| | | _task_HtyService = task_HtyService; |
| | | _basicService = basicService; |
| | | _mesProInOrderService = mesProInOrderService; |
| | | _outProStockInfoService = outProStockInfoService; |
| | | _proStockInfoDetailService = proStockInfoDetailService; |
| | | _proStockInfoService = proStockInfoService; |
| | | _webSocketServer = webSocketServer; |
| | |
| | | } |
| | | return WebResponseContent.Instance.OK(_webSocketServer.OnlineSessions.Select(x=>x.Url).Serialize()); |
| | | } |
| | | ///// <summary> |
| | | ///// æå彿任å¡ç»è®¡ |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("ProMonthTaskStatistics"), AllowAnonymous] |
| | | //public WebResponseContent ProMonthTaskStatistics() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // //è·å彿æåç任塿»é |
| | | // int inboundCount = _taskService.Repository.QueryData(x => x.TaskType == TaskTypeEnum.InProduct.ObjToInt()).Count; |
| | | // int outboundCount = _taskService.Repository.QueryData(x => x.TaskType == TaskTypeEnum.OutProduct.ObjToInt()).Count; |
| | | // int backboundCount = _taskService.Repository.QueryData(x => x.TaskType == TaskTypeEnum.EmptyProductBack.ObjToInt()).Count; |
| | | // int surplusCount = _taskService.Repository.QueryData(x => x.TaskType == TaskTypeEnum.InProductBack.ObjToInt()).Count; |
| | | // content.OK("æå", new { inboundCount, outboundCount, backboundCount, surplusCount }); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | ///// <summary> |
| | | ///// æåè´§ä½ |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("ProLocationStatistics"), AllowAnonymous] |
| | | //public WebResponseContent ProLocationStatistics(int Id) |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // //è·åæåçè´§ä½ |
| | | // int freeCount = _basicService.LocationInfoService.Repository.QueryData(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.WarehouseId == Id).Count; |
| | | // int inStockCount = _basicService.LocationInfoService.Repository.QueryData(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.WarehouseId == Id).Count; |
| | | // int lockCount = _basicService.LocationInfoService.Repository.QueryData(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.WarehouseId == Id).Count; |
| | | // content.OK("æå", new { freeCount, inStockCount, lockCount }); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | ///// <summary> |
| | | ///// æåå
¥åºäº§é |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("Productions"), AllowAnonymous] |
| | | //public WebResponseContent Productions() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // List<Object> list = new List<Object>(); |
| | | // DateTime dateTody = DateTime.Today.AddDays(+1); |
| | | // for (int i = 1; i <= 7; i++) |
| | | // { |
| | | // DateTime date = dateTody.AddDays(-1); |
| | | // List<Dt_MesProInOrder> mesIn = _mesProInOrderService.Repository.Db.Queryable<Dt_MesProInOrder>().Where(x => x.CreateDate < dateTody && x.CreateDate >= date).Includes(x => x.Details).ToList(); |
| | | // int PcsCounts = 0; |
| | | // foreach (var item in mesIn) |
| | | // { |
| | | // PcsCounts+=(int)item.Details.Sum(x=>x.OKPCSQTY); |
| | | // } |
| | | // dateTody = date; |
| | | // list.Add(new { today = date.ToString("MM/dd"), pcsCounts = PcsCounts }); |
| | | // } |
| | | // content.OK("æå", list); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | ///// <summary> |
| | | ///// æååºåºäº§é |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("ProductionsOut"), AllowAnonymous] |
| | | //public WebResponseContent ProductionsOut() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // List<Object> list = new List<Object>(); |
| | | // DateTime dateTody = DateTime.Today.AddDays(+1); |
| | | // for (int i = 1; i <= 7; i++) |
| | | // { |
| | | // DateTime date = dateTody.AddDays(-1); |
| | | // List<Dt_ProOutOrder> mesIn = _outboundService.ProOutOrderService.Repository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.CreateDate < dateTody && x.CreateDate >= date).Includes(x => x.Details).ToList(); |
| | | // int PcsCounts = 0; |
| | | // foreach (var item in mesIn) |
| | | // { |
| | | // PcsCounts += (int)item.Details.Sum(x => x.QtyPcs); |
| | | // } |
| | | // dateTody = date; |
| | | // list.Add(new { today = date.ToString("MM/dd"), pcsCounts = PcsCounts }); |
| | | // } |
| | | // content.OK("æå", list); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | ///// <summary> |
| | | ///// æååºåºäº§é |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("ProductionRanking"), AllowAnonymous] |
| | | //public WebResponseContent ProductionRanking() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // var list = _proStockInfoDetailService.Repository.QueryData(x => true).GroupBy(x => x.ProductCode).Select(x => new { pCode = x.Key, qtys = x.Sum(x=>x.StockPcsQty) }).OrderByDescending(x=>x.qtys).Take(5); |
| | | |
| | | // content.OK("æå", list); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | ///// <summary> |
| | | ///// æååºå |
| | | ///// </summary> |
| | | ///// <param name="model"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost, Route("ProductionStock"), AllowAnonymous] |
| | | //public WebResponseContent ProductionStock() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // int cpCount = 0; |
| | | // int yfCount = 0; |
| | | // int wsCount = 0; |
| | | // List<Dt_ProStockInfo> cpproStockInfos = _proStockInfoService.Repository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.ProStockAttribute == ProStockAttributeEnum.æå.ObjToInt()).Includes(x => x.proStockInfoDetails).ToList(); |
| | | // List<Dt_ProStockInfo> yfproStockInfos = _proStockInfoService.Repository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.ProStockAttribute == ProStockAttributeEnum.ç å.ObjToInt()).Includes(x => x.proStockInfoDetails).ToList(); |
| | | // List<Dt_ProStockInfo> wsproStockInfos = _proStockInfoService.Repository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.ProStockAttribute == ProStockAttributeEnum.å°¾æ°.ObjToInt()).Includes(x => x.proStockInfoDetails).ToList(); |
| | | // foreach (var item in cpproStockInfos) |
| | | // { |
| | | // cpCount +=(int) item.proStockInfoDetails.Sum(x => x.StockPcsQty); |
| | | // } |
| | | // foreach (var item in yfproStockInfos) |
| | | // { |
| | | // yfCount += (int)item.proStockInfoDetails.Sum(x => x.StockPcsQty); |
| | | // } |
| | | // foreach (var item in wsproStockInfos) |
| | | // { |
| | | // wsCount += (int)item.proStockInfoDetails.Sum(x => x.StockPcsQty); |
| | | // } |
| | | // content.OK("æå", new { cpCount, yfCount, wsCount }); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | } |
| | | } |