| | |
| | | using System.Linq.Expressions; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Task; |
| | | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using System.Drawing.Printing; |
| | | using WIDESEA_Core.DB; |
| | | using System.Drawing; |
| | | using WIDESEA_ITaskInfoService; |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | |
| | | public partial class TaskService |
| | | { |
| | | |
| | |
| | | if (location != null) |
| | | { |
| | | Dt_LocationInfo result = _basicService.LocationInfoService.isDepth(location); |
| | | if (result != null && result.LocationStatus != LocationStatusEnum.Lock.ObjToInt() && result.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && result.LocationStatus != LocationStatusEnum.Free.ObjToInt()) |
| | | if (result != null && result.LocationStatus != LocationStatusEnum.Lock.ObjToInt() && result.LocationStatus != StatusEnum.PalletLock.ObjToInt() && result.LocationStatus != LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | int sum = 0; |
| | | for (int j = 0; j < task.Count; j++) |
| | |
| | | tasks.Add(task[i]); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (result != null && (result.LocationStatus == LocationStatusEnum.Lock.ObjToInt() || result.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())) |
| | | else if (result != null && (result.LocationStatus == LocationStatusEnum.Lock.ObjToInt() || result.LocationStatus == StatusEnum.PalletLock.ObjToInt())) |
| | | { |
| | | Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.LocationCode); |
| | | if (TaskInfo == null) |
| | |
| | | int maxPage = Convert.ToInt32(Math.Ceiling(count / 10.0)); |
| | | if (taskDTO.pageNo <= maxPage) |
| | | { |
| | | var inboundOrder = BaseDal.Db.Queryable<Dt_Task>().Where(expressionOrder).Where(x => x.TaskType == TaskTypeEnum.Outbound.ObjToInt()).OrderByDescending(x => x.CreateDate).Select(x => new Dt_Task { TaskNum = x.TaskNum, TaskId = x.TaskId, CreateDate = x.CreateDate, Creater = x.Creater }).ToList(); |
| | | var inboundOrder = BaseDal.Db.Queryable<Dt_Task>().Where(expressionOrder).Where(x => x.TaskType == TaskTypeEnum.Outbound.ObjToInt()).OrderByDescending(x => x.CreateDate).Select(x => new Dt_Task { TaskNum = x.TaskNum, TaskId = x.TaskId, CreateDate = x.CreateDate, Creater = x.Creater, Materialtype = x.Materialtype }).ToList(); |
| | | |
| | | content = WebResponseContent.Instance.OK(data: inboundOrder); |
| | | } |
| | |
| | | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 确认åºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestInbound(SaveModel saveModel) |
| | | { |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | int taskname = saveModel.MainData["taskname"].ObjToInt(); |
| | | string address = saveModel.MainData["startPoint"].ToString(); |
| | | string inboundBarcode = saveModel.MainData["barcode"].ToString(); |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskname); |
| | | string stationcode = saveModel.MainData["stationcode"].ToString(); |
| | | string PalletCode = saveModel.MainData["PalletCode"].ToString(); |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.SourceAddress == stationcode && x.Materialtype == PalletCode); |
| | | if (task != null) |
| | | { |
| | | task.SourceAddress = address; |
| | | task.TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(); |
| | | task.TaskStatus = AGVTaskStatusEnum.AGV_New.ObjToInt(); |
| | | BaseDal.UpdateData(task); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | content = WebResponseContent.Instance.Error("æªæ¾å°æ¤ä»»å¡"); |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°æ¤ä»»å¡æç©æç±»åä¸å¹é
"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡èµ·ç¹å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | content = WebResponseContent.Instance.Error($"ä»»å¡èµ·ç¹å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | private static readonly object text = new object(); |
| | | /// <summary> |
| | | /// åºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutboundTasks(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | lock (text) |
| | | { |
| | | string stationcode = saveModel.MainData["stationcode"].ToString(); |
| | | string PalletCode = saveModel.MainData["PalletCode"].ToString(); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_Task task = new Dt_Task() |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | CurrentAddress = "1", |
| | | Grade = 1, |
| | | NextAddress = "1", |
| | | PalletCode = PalletCode, |
| | | Roadway = "1", |
| | | SourceAddress = "", |
| | | TargetAddress = stationcode, |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | Depth = 1, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | | Repository.AddData(tasks); |
| | | content = WebResponseContent.Instance.OK(); |
| | | string stationcode = saveModel.MainData["stationcode"].ToString(); |
| | | string PalletCode = saveModel.MainData["PalletCode"].ToString(); |
| | | if (stationcode == "" || PalletCode == "")//å¼å¸¸è¿åãããããã |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:æ«ç ä¿¡æ¯ä¸è½ä¸ºç©º"); |
| | | } |
| | | Dt_CachePoint endCachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode.Contains("åææåº") && x.PointStatus == LocationStatusEnum.Free.ObjToInt());//&& x.PointStatus == LocationStatusEnum.Free.ObjToInt() |
| | | if (endCachePoint == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æªæ¾å°åææåºå¯ç¨ç¼åä½"}"); |
| | | } |
| | | Dt_CachePoint point = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode );//&& x.Materialtype == PalletCode |
| | | if (point == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æ«ç æ°æ®å¼å¸¸ï¼æªæ¾å°æ¤ç¼åæ¶æç©æç±»åä¸å¹é
"}"); |
| | | } |
| | | Dt_CachePoint points = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == stationcode && x.PointStatus == LocationStatusEnum.Free.ObjToInt()); |
| | | if (points == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"æ«ç æ°æ®å¼å¸¸ï¼æ¤ç¼åç¹å·²è¢«éå®"}"); |
| | | } |
| | | Dt_Task taskcode = BaseDal.QueryFirst(x => x.SourceAddress == stationcode || x.TargetAddress == stationcode); |
| | | if (taskcode != null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:该ç«ç¹å·²åå¨ä»»å¡"); |
| | | } |
| | | var pointname = _basicService.CachePointService.Repository.QueryData(x => x.PointName == point.PointName).ToList(); |
| | | foreach (var item in pointname) |
| | | { |
| | | var a = point.Remark.ObjToInt(); |
| | | var b = item.Remark.ObjToInt(); |
| | | if (b < a) |
| | | { |
| | | Dt_CachePoint c = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == item.PointCode && x.PointStatus == 0); |
| | | if (c != null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{"请æä»éå°å¤ç¼åç¹é¡ºåºè¯·æ±ä»»å¡"}"); |
| | | } |
| | | } |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = "1", |
| | | Grade = 1, |
| | | NextAddress = "1", |
| | | PalletCode = "", |
| | | Roadway = "1", |
| | | SourceAddress = endCachePoint.PointCode, |
| | | TargetAddress = stationcode, |
| | | TaskStatus = AGVTaskStatusEnum.AGV_Query.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | Materialtype = PalletCode, |
| | | Depth = 1, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | | Repository.AddData(tasks); |
| | | HCJLock(task); |
| | | //Main(); |
| | | content = WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | |
| | | } |
| | | public void Main() |
| | | { |
| | | PrintDocument printDocument = new PrintDocument(); |
| | | printDocument.PrintPage += new PrintPageEventHandler(PrintPage); |
| | | printDocument.Print(); |
| | | } |
| | | |
| | | |
| | | public WebResponseContent InboundTask(SaveModel saveModel) |
| | | private void PrintPage(object sender, PrintPageEventArgs e) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string stationcode = saveModel.MainData["stationcode"].ToString(); |
| | | string PalletCode = saveModel.MainData["PalletCode"].ToString(); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = "", |
| | | Grade = 1, |
| | | NextAddress = "", |
| | | PalletCode = PalletCode, |
| | | Roadway = "", |
| | | SourceAddress = stationcode, |
| | | TargetAddress = "", |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | Depth = 1, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | | Repository.AddData(tasks); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"æ·»å ä»»å¡å¼å¸¸,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | var agvtask = BaseDal.QueryData(x => x.TaskStatus == AGVTaskStatusEnum.AGV_Query.ObjToInt()).OrderByDescending(x => x.CreateDate).First(); |
| | | string textToPrint = "æ¾è´§è´§ä½ä½ï¼" + agvtask.SourceAddress + Environment.NewLine + "ç©æç±»åï¼" + agvtask.Materialtype + Environment.NewLine + "ä»»å¡å建æ¶é´ï¼" + agvtask.CreateDate; |
| | | Font printFont = new Font("Arial", 12); |
| | | e.Graphics.DrawString(textToPrint, printFont, Brushes.Black, 10, 10); |
| | | } |
| | | } |
| | | } |