| | |
| | | using NetTaste; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | |
| | |
| | | public string urlWMSMovelibraryTask = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSMovelibraryTask"]; |
| | | public string urlRelocationTaskCompleted = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlRelocationTaskCompleted"]; |
| | | public string urlQueryinventory = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlQueryinventory"]; |
| | | public string urlEmptyOutbound = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlEmptyOutbound"]; |
| | | public string urlRawmaterialout = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlRawmaterialout"]; |
| | | public string urlPalletQueryinventory = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlPalletQueryinventory"]; |
| | | /// <summary> |
| | | /// æ¥æ¶WMSä»»å¡ä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | public class GenerateInv |
| | | { |
| | | public string SourceAddress { get; set; } |
| | | public string PalletCode { get; set; } |
| | | } |
| | | |
| | | public class GenerateInv3 |
| | | { |
| | | |
| | | public string PalletCode { get; set; } |
| | | public int outCount { get; set; } |
| | | public string TargetAddress { get; set; } |
| | | } |
| | | public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | palletCode = "6431-jdsda-jjal333-300"; |
| | | content = HttpHelper.Get<WebResponseContent>($"{urlWMSTask}?sourceAddress={sourceAddress}&palletCode={palletCode}"); |
| | | GenerateInv generate = new GenerateInv() |
| | | { |
| | | SourceAddress=sourceAddress, |
| | | PalletCode = palletCode |
| | | }; |
| | | content = HttpHelper.Post<WebResponseContent>($"{urlWMSTask}", generate); |
| | | Dt_Task task = new Dt_Task(); |
| | | if (content != null) |
| | | { |
| | |
| | | task.TaskState = (int)TaskInStatusEnum.Line_InFinish; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | BaseDal.AddData(task); |
| | | } |
| | | else |
| | | { |
| | | |
| | | return null; |
| | | return content = WebResponseContent.Instance.Error(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | return content = WebResponseContent.Instance.Error(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æ¥è¯¢åºä½ |
| | | /// è¿è¡ç»ç |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ToPlatform(string palletCode) |
| | | { |
| | | try |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | GenerateInv generate = new GenerateInv() |
| | | { |
| | | SourceAddress = "", |
| | | PalletCode = palletCode |
| | | }; |
| | | |
| | | return content = HttpHelper.Post<WebResponseContent>($"{urlQueryinventory}", generate); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | /*WebResponseContent content = new WebResponseContent(); |
| | | GenerateInv generate = new GenerateInv() |
| | | { |
| | | SourceAddress = "", |
| | | PalletCode = palletCode |
| | | }; |
| | | content = HttpHelper.Post<WebResponseContent>($"{urlQueryinventory}", generate); |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | return content; |
| | | } |
| | | } |
| | | return content = WebResponseContent.Instance.Error();*/ |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSTask2(string palletCode,string sourceAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | return content = HttpHelper.Get<WebResponseContent>($"{urlQueryinventory}?palletCode={palletCode}"); |
| | | try |
| | | { |
| | | GenerateInv generate = new GenerateInv() |
| | | { |
| | | SourceAddress = sourceAddress, |
| | | PalletCode = palletCode |
| | | }; |
| | | content = HttpHelper.Post<WebResponseContent>($"{urlEmptyOutbound}", generate); |
| | | Dt_Task task = new Dt_Task(); |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.TaskType = (int)TaskOutboundTypeEnum.Outbound; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | BaseDal.AddData(task); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | return content = WebResponseContent.Instance.Error(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSTask3(string palletCode, int outCount,string Loc) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (outCount==0) |
| | | { |
| | | outCount = 1; |
| | | } |
| | | GenerateInv3 generate = new GenerateInv3() |
| | | { |
| | | PalletCode = palletCode, |
| | | outCount = outCount, |
| | | TargetAddress= Loc |
| | | }; |
| | | content = HttpHelper.Post<WebResponseContent>($"{urlRawmaterialout}", generate); |
| | | Dt_Task task = new Dt_Task(); |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.TaskType = (int)TaskOutboundTypeEnum.Outbound; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | BaseDal.AddData(task); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | return content = WebResponseContent.Instance.Error(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | public WebResponseContent RequestWMSTask4() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | return content = HttpHelper.Get<WebResponseContent>($"{urlPalletQueryinventory}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ ¹æ®æ·±åºä½åwmsç³è¯·å¤ææµ
åºä½æ¯å¦æè´§ï¼æ¯å¦éè¦è¿è¡ç§»åºæä½ |
| | | /// </summary> |
| | |
| | | { |
| | | if (content.Status) |
| | | { |
| | | if (Convert.ToInt32(content.Data) != _Task.TaskNum) |
| | | if(content.Data != null) |
| | | { |
| | | task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); |
| | | task.TaskState = (int)TaskRelocationTypeEnum.Relocation; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | task.Grade = 3; |
| | | BaseDal.AddData(task); |
| | | return task; |
| | | } |
| | | if (task.TaskNum != _Task.TaskNum) |
| | | { |
| | | |
| | | task.TaskState = (int)TaskRelocationTypeEnum.Relocation; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | task.TaskNum = task.TaskNum; |
| | | task.Grade = 3; |
| | | task.TaskType= (int)TaskRelocationTypeEnum.Relocation; |
| | | BaseDal.AddData(task); |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | public Dt_Task IngStackerCraneTask(string deviceNo) |
| | | { |
| | | string deviceNot = deviceNo == "SC01" ? "1" : "2"; |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNot && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting); |
| | | //string deviceNot = deviceNo == "SC01" ? "1" : "2"; |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting); |
| | | } |
| | | |
| | | public Dt_Task IngStackerCraneTask2(string deviceNo) |
| | | { |
| | | //string deviceNot = deviceNo == "SC01" ? "1" : "2"; |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns>è¿åä»»å¡å®ä½å¯¹è±¡éåï¼å¯è½ä¸ºnull</returns> |
| | | public List<Dt_Task> QueryStationIsOccupiedOutTasks(string deviceNo, string SourceAddress) |
| | | { |
| | | return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && SourceAddress.Contains(x.SourceAddress), TaskOrderBy); |
| | | return BaseDal.QueryData(x => x.Roadway == deviceNo && SourceAddress.Contains(x.SourceAddress), TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡ç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public class GenerateInv2 |
| | | { |
| | | public string PalletCode { get; set; } |
| | | public string SourceAddress { get; set; } |
| | | public string TargetAddress { get; set; } |
| | | } |
| | | public WebResponseContent StackCraneTaskCompleted(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | } |
| | | else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation) |
| | | { |
| | | content = HttpHelper.Get<WebResponseContent>($"{urlRelocationTaskCompleted}?PalletCode={task.PalletCode}&SourceAddress ={ task.SourceAddress}TargetAddress ={task.TargetAddress}"); |
| | | GenerateInv2 generate = new GenerateInv2() |
| | | { |
| | | PalletCode = task.PalletCode, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress |
| | | |
| | | }; |
| | | content = HttpHelper.Post<WebResponseContent>($"{urlRelocationTaskCompleted}", generate); |
| | | task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish; |
| | | task.ModifyDate = DateTime.Now; |
| | | BaseDal.DeleteData(task); |