| | |
| | | /// <summary> |
| | | /// ZHAGVä»»å¡åé |
| | | /// </summary> |
| | | [Description("PPAGVä»»å¡åé")] |
| | | [Description("ZHAGVä»»å¡åé")] |
| | | Agv_ZHSendTask, |
| | | |
| | | /// <summary> |
| | |
| | | [Description("æåMESæåº")] |
| | | OutMesRworkProduct = 250, |
| | | /// <summary> |
| | | /// é²çåæ´¾å·¥å°ä»¶ |
| | | /// </summary> |
| | | [Description("é²çåæ´¾å·¥å°ä»¶")] |
| | | MaskOutNoticeSmall = 260, |
| | | |
| | | /// <summary> |
| | | /// é²çåæ´¾å·¥å¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é²çåæ´¾å·¥å¤§ä»¶")] |
| | | MaskOutNoticeLarge = 265, |
| | | /// <summary> |
| | | /// é²çå°çº¿è¾¹å°ä»¶ |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å°ä»¶")] |
| | | MaskOutSmall = 270, |
| | | |
| | | /// <summary> |
| | | /// é²çå°çº¿è¾¹å¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å¤§ä»¶")] |
| | | MaskOutLarge = 275, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | |
| | | /// </summary> |
| | | [Description("æå空æ¡ååº")] |
| | | EmptyProductBack = 630, |
| | | |
| | | /// <summary> |
| | | /// é»çå
¥åºå°ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åºå°ä»¶")] |
| | | InZHProductSmall = 640, |
| | | /// <summary> |
| | | /// é»çå
¥åºå¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åºå¤§ä»¶")] |
| | | InZHProductLarge = 645, |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | |
| | | agvResponseContent.Message = requestZH.Status ? "æå" : "失败"; |
| | | return agvResponseContent; |
| | | case "outbin"://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeFinish(task.CurrentAddress); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | |
| | | break; |
| | | case "getSafetySignal"://å®å
¨ä¿¡å·ç³è¯· |
| | | { |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var content = TakeRequest(task.CurrentAddress); |
| | | //if (!content.Status) throw new Exception(content.Message); |
| | |
| | | Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); |
| | | if (dt_Station == null) |
| | | { |
| | | throw new Exception($"{task.NextAddress}AGVç«å°æªå®ä¹"); |
| | | throw new Exception($"{task.NextAddress}ç«å°æªå®ä¹"); |
| | | } |
| | | task.CurrentAddress = dt_Station.StationCode; |
| | | task.NextAddress = ""; |
| | |
| | | } |
| | | task.NextAddress = stationManger?.AGVStationCode ?? ""; |
| | | task.DeviceCode = stationManger?.Remark ?? ""; |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | if (task.Roadway != "SC01_ZH") |
| | | { |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x =>( x.StationCode == task.NextAddress || x.StackerCraneStationCode==task.NextAddress )&& x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | { |
| | | public partial class AGV_ZHJob |
| | | { |
| | | /// <summary> |
| | | /// ä¸åä»»å¡ |
| | | /// </summary> |
| | | public void SendAGVTask() |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var task in newTasks) |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt() && !string.IsNullOrEmpty(x.DeviceCode) && nameof(AGV_ZHJob).Contains(x.DeviceCode)).OrderByDescending(x => x.Grade).OrderBy(x => x.CreateDate).ToList(); |
| | | if (newTasks.Count > 0) |
| | | { |
| | | try |
| | | foreach (var agvTask in newTasks) |
| | | { |
| | | AgvTaskDTO TaskDTO = new AgvTaskDTO() |
| | | try |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyyyMMddHHmmss") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "FLC" : "FLR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | TaskTyp = "22", |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type="00", |
| | | positionCode=task.CurrentAddress |
| | | positionCode=agvTask.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type="00", |
| | | positionCode=task.NextAddress |
| | | type="04", |
| | | positionCode=agvTask.NextAddress |
| | | } |
| | | }, |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSendTask(TaskDTO, APIEnum.Agv_ZHSendTask); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | }, |
| | | TaskCode = agvTask.AgvTaskNum, |
| | | PodTyp = agvTask.PalletType < 2 ? "XX" : "DD", |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO); |
| | | if (content.Status) |
| | | { |
| | | agvTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | _taskService.UpdateTask(agvTask, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | agvTask.ExceptionMessage = content.Message; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | agvTask.ExceptionMessage = ex.Message; |
| | | WriteError(nameof(AGV_ZHJob), ex.Message, ex); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var WaitToTask in WaitToTasks) |
| | | { |
| | | AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO(); |
| | | if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | if (WaitToTasks.FirstOrDefault(x => x.TaskState == TaskStatusEnum.AGV_Puting.ObjToInt() || x.TaskState == TaskStatusEnum.Finish.ObjToInt()) != null) |
| | |
| | | continue; |
| | | } |
| | | otherDevice.SetValue(GroundStationDBName.W_PutPalletType, WaitToTask.PalletType, stationManger.StationCode); |
| | | |
| | | replyDTO.ReqCode = Guid.NewGuid().ToString().Replace("-", "");//WaitToTask.TaskNum.ToString(), |
| | | replyDTO.taskCode = WaitToTask.AgvTaskNum; |
| | | replyDTO.nextPositionCode = new CodePath() |
| | | { |
| | | type="00", |
| | | positionCode= stationManger.AGVStationCode |
| | | }; |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | replyDTO.ReqCode = Guid.NewGuid().ToString().Replace("-", "");//WaitToTask.TaskNum.ToString(), |
| | | replyDTO.taskCode = WaitToTask.AgvTaskNum; |
| | | } |
| | | |
| | | AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(), |
| | | taskCode = WaitToTask.AgvTaskNum, |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSecureReply(replyDTO); |
| | | if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); |
| | | Console.Out.WriteLine(nameof(AGV_ZHJob) + ":" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | SendAGVTask(); |
| | | |
| | | SendAGVWaitToTask(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | monthLabel: { |
| | | formatter: "{M}æ", |
| | | }, |
| | | range: "2025-05", |
| | | range: dayjs().format('YYYY-MM'), |
| | | yearLabel: { |
| | | show: false, |
| | | }, |
| | |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | if (beRelocation.Row> maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x=>x.Row>maxDepth).ToList(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | if (beRelocation.Row <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | //夿妿已å®ä¹è´§ä½ç±»åçè´§ä½åæªå®ä¹ç±»åç空货ä½é½ä¸ºç©ºéæ¾æ»¡è¶³æ¡ä»¶çè´§ä½ |
| | | if (!definedTypeEmptyLocations.Any() && !undefinedTypeEmptyLocations.Any()) |
| | | { |
| | | ////夿妿已å®ä¹è´§ä½ç±»åçè´§ä½åæªå®ä¹ç±»åç空货ä½é½ä¸ºç©ºéæ¾æ»¡è¶³æ¡ä»¶çè´§ä½ |
| | | //if (!definedTypeEmptyLocations.Any() && !undefinedTypeEmptyLocations.Any()) |
| | | //{ |
| | | |
| | | } |
| | | //} |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_ZH >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == 3 || palletType == 4) |
| | | if (palletTypeInfo.IsOdd) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList(); |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("æåMESæåº")] |
| | | OutMesRworkProduct =250, |
| | | |
| | | /// <summary> |
| | | /// é²çåæ´¾å·¥å°ä»¶ |
| | | /// </summary> |
| | | [Description("é²çåæ´¾å·¥å°ä»¶")] |
| | | MaskOutNoticeSmall = 260, |
| | | |
| | | /// <summary> |
| | | /// é²çåæ´¾å·¥å¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é²çåæ´¾å·¥å¤§ä»¶")] |
| | | MaskOutNoticeLarge = 265, |
| | | /// <summary> |
| | | /// é²çå°çº¿è¾¹å°ä»¶ |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å°ä»¶")] |
| | | MaskOutSmall = 270, |
| | | |
| | | /// <summary> |
| | | /// é²çå°çº¿è¾¹å¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å¤§ä»¶")] |
| | | MaskOutLarge = 275, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | //æ£å¼ |
| | | //string authorization = "AppKey 1930944618148245504"; |
| | | string authorization = "AppKey 1784536762910281728"; |
| | | //æµè¯ |
| | | string authorization = "AppKey 1930944618148245504"; |
| | | //string authorization = "AppKey 1930944618148245504"; |
| | | |
| | | |
| | | headers = new Dictionary<string, string> |
| | | { |
| | | { "Authorization", authorization }, |
| | | //æ£å¼ |
| | | //{ "Site_tenant_id", "6ec60d66-b08e-4ff3-90fa-57748053f79b" } |
| | | { "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } |
| | | //æµè¯ |
| | | { "Site_tenant_id", "6ec60d66-b08e-4ff3-90fa-57748053f79b" } |
| | | //{ "Site_tenant_id", "6ec60d66-b08e-4ff3-90fa-57748053f79b" } |
| | | }; |
| | | if (headers != null) |
| | | { |
| | |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | /// <summary> |
| | | /// MESé²çæ¹æ¬¡è·å |
| | | /// </summary> |
| | | public class MesLotInfoModel |
| | | { |
| | | /// <summary> |
| | | /// ç©ææå· |
| | | /// </summary> |
| | | public string Product { get; set; } |
| | | /// <summary> |
| | | /// ç©æçæ¬ |
| | | /// </summary> |
| | | public string ProductVersion { get; set; } |
| | | /// <summary> |
| | | /// ç©ææ°é |
| | | /// </summary> |
| | | public decimal Qty { get; set; } |
| | | /// <summary> |
| | | /// 卿 |
| | | /// </summary> |
| | | public string DateCode { get; set; } |
| | | /// <summary> |
| | | /// æ¹æ¬¡ |
| | | /// </summary> |
| | | public string LotNo { get; set; } |
| | | /// <summary> |
| | | /// æ¯å¦æ»¡Lot |
| | | /// </summary> |
| | | public bool IsFullNumber { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | /// <summary> |
| | | /// é²çåå¤ç派工éç¥WMS |
| | | /// </summary> |
| | | [ModelValidate] |
| | | public class SolderMaskOutNotice |
| | | { |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [PropertyValidate("æ¹æ¬¡å·", NotNullAndEmpty = true)] |
| | | public string LotNo { get; set; } |
| | | /// <summary> |
| | | /// ç®æ å°åç |
| | | /// </summary> |
| | | [PropertyValidate("ç®æ å°åç ", NotNullAndEmpty = true)] |
| | | public string TargetAddressCode { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// é²çç«åºå°çº¿è¾¹ç¹ |
| | | /// </summary> |
| | | [ModelValidate] |
| | | public class SolderMaskOut |
| | | { |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [PropertyValidate("æ¹æ¬¡å·", NotNullAndEmpty = true)] |
| | | public string LotNo { get; set; } |
| | | /// <summary> |
| | | /// ç®æ å°åç |
| | | /// </summary> |
| | | [PropertyValidate("ç®æ å°åç ", NotNullAndEmpty = true)] |
| | | public string TargetAddressCode { get; set; } |
| | | } |
| | | } |
| | |
| | | /// åºåæ°é |
| | | /// </summary> |
| | | [ExporterHeader(DisplayName = "åºåæ°é")] |
| | | public float StockQuantity { get; set; } |
| | | public decimal StockQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåºæ°é |
| | | /// </summary> |
| | | [ExporterHeader(DisplayName = "åºåºæ°é")] |
| | | public float OutboundQuantity { get; set; } |
| | | public decimal OutboundQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåç¶æ |
| | |
| | | /// <returns></returns> |
| | | MesResponseContent TestToolOut(TestToolOutModel model); |
| | | |
| | | //é²çå°çº¿è¾¹ |
| | | MesResponseContent SolderMaskOut(SolderMaskOut model); |
| | | //é²ç派工 |
| | | MesResponseContent SolderMaskOutNotice(SolderMaskOutNotice model); |
| | | /// <summary> |
| | | /// çæåºåºä»»å¡ |
| | | /// </summary> |
| | |
| | | ReceiptDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Remark = " " |
| | | }; |
| | | //è°ç¨QMSæ¥ææ£éªæ¥å£ |
| | | string response = _invokeQMSService.InvokeReceiveCheckApi(qMSReceiveCheck); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | if (!mesResponseContent.BSucc) |
| | |
| | | WarehouseId = a.WarehouseId, |
| | | MaterielCode = b.MaterielCode, |
| | | MaterielName = b.MaterielName, |
| | | StockQuantity = b.StockQuantity, |
| | | OutboundQuantity = b.OutboundQuantity, |
| | | StockQuantity =(decimal) b.StockQuantity, |
| | | OutboundQuantity =(decimal) b.OutboundQuantity, |
| | | StockStatus = a.StockStatus, |
| | | Unit = b.Unit, |
| | | Remark = a.Remark, |
| | |
| | | var groupedData = new Dictionary<string, MaterielnfoStatisticsDTO>(); |
| | | foreach (var item in allData) |
| | | { |
| | | // ç¡®ä¿åå§å¼ä¸ºdecimalç±»å |
| | | if (groupedData.ContainsKey(item.MaterielCode)) |
| | | { |
| | | groupedData[item.MaterielCode].StockQuantity += item.StockQuantity; |
| | | groupedData[item.MaterielCode].OutboundQuantity += item.OutboundQuantity; |
| | | groupedData[item.MaterielCode].StockQuantity += Convert.ToDecimal(item.StockQuantity); |
| | | groupedData[item.MaterielCode].OutboundQuantity += Convert.ToDecimal(item.OutboundQuantity); |
| | | } |
| | | else |
| | | { |
| | |
| | | WarehouseId = item.WarehouseId, |
| | | MaterielCode = item.MaterielCode, |
| | | MaterielName = item.MaterielName, |
| | | StockQuantity = item.StockQuantity, |
| | | OutboundQuantity = item.OutboundQuantity, |
| | | StockQuantity = Convert.ToDecimal(item.StockQuantity), |
| | | OutboundQuantity = Convert.ToDecimal(item.OutboundQuantity), |
| | | StockStatus = item.StockStatus, |
| | | Unit = item.Unit, |
| | | Remark = item.Remark |
| | |
| | | WarehouseId = a.WarehouseId, |
| | | MaterielCode = b.MaterielCode, |
| | | MaterielName = b.MaterielName, |
| | | StockQuantity = b.StockQuantity, |
| | | OutboundQuantity = b.OutboundQuantity, |
| | | StockQuantity = (decimal)b.StockQuantity, |
| | | OutboundQuantity =(decimal) b.OutboundQuantity, |
| | | StockStatus = a.StockStatus, |
| | | Unit = b.Unit, |
| | | Remark = a.Remark, |
| | |
| | | { |
| | | static object lock_out = new object(); |
| | | |
| | | static object solderMask_out = new object(); |
| | | |
| | | /// <summary> |
| | | /// æµè¯æ¶åºä» |
| | | /// </summary> |
| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_CSJ"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | responseContent.Error(ex.Message); |
| | | } |
| | | return responseContent; |
| | | } |
| | | } |
| | | public MesResponseContent SolderMaskOutNotice(SolderMaskOutNotice model) |
| | | { |
| | | lock (solderMask_out) |
| | | { |
| | | MesResponseContent responseContent = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); |
| | | if (exsit != null) |
| | | { |
| | | return responseContent.Error($"ç®æ å°åéå¤"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.LotNo)); |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çåº:æ {model.LotNo}å¯ç¨åºå"); |
| | | } |
| | | Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | if (exsit2 != null) |
| | | { |
| | | return responseContent.Error($"é²çä»»å¡{stockInfo.PalletCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && |
| | | x.WarehouseId == stockInfo.WarehouseId && |
| | | x.LocationStatus == (int)LocationStatusEnum.InStock && |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çè´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çæé²çåºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = model.TargetAddressCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = stockInfo.PalletType<2 ? (int)TaskTypeEnum.MaskOutNoticeSmall : (int)TaskTypeEnum.MaskOutNoticeLarge, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.åºåºéå®; |
| | | LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(taskOut); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_ZH"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | responseContent.Error(ex.Message); |
| | | } |
| | | return responseContent; |
| | | } |
| | | } |
| | | |
| | | public MesResponseContent SolderMaskOut(SolderMaskOut model) |
| | | { |
| | | lock (solderMask_out) |
| | | { |
| | | MesResponseContent responseContent = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); |
| | | if (exsit != null) |
| | | { |
| | | return responseContent.Error($"ç®æ å°åéå¤"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.LotNo)); |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çåº:æ {model.LotNo}å¯ç¨åºå"); |
| | | } |
| | | Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | if (exsit2 != null) |
| | | { |
| | | return responseContent.Error($"é²çä»»å¡{stockInfo.PalletCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && |
| | | x.WarehouseId == stockInfo.WarehouseId && |
| | | x.LocationStatus == (int)LocationStatusEnum.InStock && |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çè´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çæé²çåºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = model.TargetAddressCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = stockInfo.PalletType < 2 ? (int)TaskTypeEnum.MaskOutSmall : (int)TaskTypeEnum.MaskOutLarge, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.åºåºéå®; |
| | | LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(taskOut); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_ZH"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == palletTypeInfo.WarehouseId); |
| | | |
| | | //夿æ¯å¦æçåºåæ¯å¦å·²åå¨ |
| | | Dt_StockInfo stockInfoOld = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).First(); |
| | | if (stockInfoOld!=null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æçå·åºå{model.CarrierCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_StockInfo_Hty stockInfo_Hty = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).OrderByDescending(x => x.SourceId).First(); |
| | | Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.StockId == stockInfo_Hty.SourceId); |
| | | |
| | | |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | |
| | | { |
| | | return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //è·åé»çæ¹æ¬¡ |
| | | WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | if (!requestLotInfo.Status) |
| | | ////è·åé»çæ¹æ¬¡ |
| | | //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | //if (!requestLotInfo.Status) |
| | | //{ |
| | | // return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); |
| | | //} |
| | | //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | MesLotInfoModel mesLotInfo = new MesLotInfoModel() |
| | | { |
| | | return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); |
| | | } |
| | | MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | Product="FH001", |
| | | ProductVersion="A1", |
| | | Qty=20, |
| | | LotNo= materialLot, |
| | | IsFullNumber=true |
| | | }; |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | MaterielSpec = mesLotInfo.ProductVersion, |
| | |
| | | //BaseDal.AddData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH", agvTaskCode); |
| | | content.OK(data: taskIn); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | heightType = 1; |
| | | } |
| | | |
| | | Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, task.PalletType, task.WarehouseId, needRelocationItem.LocationCode, heightType); |
| | | Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, stockInfo.PalletType, task.WarehouseId, needRelocationItem.LocationCode, heightType); |
| | | if (newLocation != null) |
| | | { |
| | | Dt_Task newTask = new Dt_Task() |
| | |
| | | { |
| | | return _taskService.TestToolOut(model.Content); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¶MESé²ç派工 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("SolderMaskOutNotice"), AllowAnonymous, MethodParamsValidate] |
| | | public MesResponseContent SolderMaskOutNotice([FromBody] Root<SolderMaskOutNotice> model) |
| | | { |
| | | return _taskService.SolderMaskOutNotice(model.Content); |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶MESé²çå°çº¿è¾¹ |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("SolderMaskOut"), AllowAnonymous, MethodParamsValidate] |
| | | public MesResponseContent SolderMaskOut([FromBody] Root<SolderMaskOut> model) |
| | | { |
| | | return _taskService.SolderMaskOut(model.Content); |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶MESæµè¯æ¶éåº |
| | | /// </summary> |