| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Utilities; |
| | | using WIDESEAWCS_DTO.Enum; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using static Microsoft.IO.RecyclableMemoryStreamManager; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | |
| | | 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> |
| | |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | task.CreateDate = DateTime.Now; |
| | | tasks.Add(task); |
| | | } |
| | | BaseDal.AddData(tasks); |
| | |
| | | BaseDal.AddData(task); |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"空æåºåºå¤±è´¥ï¼è¯¦æ
ï¼{content.Message}", "éè¦ç©ºæ"); |
| | | } |
| | | } |
| | | return content = WebResponseContent.Instance.Error(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | 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> |
| | |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"失败信æ¯ï¼{content.Message}", "ç§»åºä¿¡æ¯"); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | try |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å 餿°æ® |
| | | /// </summary> |
| | | /// <param name="keys">䏻鮿°ç»</param> |
| | | /// <returns></returns> |
| | | public virtual WebResponseContent DeleteData(object[] keys) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_Task> tasks = BaseDal.QureyDataByIds(keys); |
| | | foreach (Dt_Task task in tasks) |
| | | { |
| | | _task_HtyService.AddTaskHty(task); |
| | | } |
| | | |
| | | |
| | | if (typeof(Dt_Task).GetNavigatePro() == null) |
| | | return BaseDal.DeleteDataByIds(keys) ? WebResponseContent.Instance.OK() : WebResponseContent.Instance.Error(); |
| | | else |
| | | { |
| | | if (keys != null) |
| | | { |
| | | Type detailType = typeof(Dt_Task).GetDetailType(); |
| | | string name = typeof(Dt_Task).GetMainIdByDetail(); |
| | | List<object> dynamicDelKeys = new List<object>(); |
| | | |
| | | for (int i = 0; i < keys.Length; i++) |
| | | { |
| | | dynamicDelKeys.Add(keys[i]); |
| | | } |
| | | ((SqlSugarClient)BaseDal.Db).BeginTran(); |
| | | |
| | | if (dynamicDelKeys.Count > 0) |
| | | BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); |
| | | |
| | | BaseDal.DeleteDataByIds(keys); |
| | | |
| | | ((SqlSugarClient)BaseDal.Db).CommitTran(); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("åæ°é误"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ((SqlSugarClient)BaseDal.Db).RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |