From 25be6fbad7853391a52d3a56752cd1c308c2dfd0 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 14 五月 2024 15:40:30 +0800 Subject: [PATCH] 添加AGV任务删除功能 --- 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" index 8f5044e..fc7bb72 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" @@ -26,6 +26,7 @@ using WIDESEA_Comm.LogInfo; using StackExchange.Redis; using WIDESEA_Comm; +using WIDESEA_Entity.DomainModels.Mes; namespace WIDESEA_WMS.Services { @@ -47,6 +48,62 @@ //base.Init(dbRepository); } + public WebResponseContent addNgTask(MesRequestTemp requestTemp) + { + WebResponseContent content = new WebResponseContent(); + try + { + var fromaddress = requestTemp.from_address; + VOLContext context = new VOLContext(); + Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); + IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); + var station = stationinfoRepository.Find(x => x.stationCode == fromaddress).FirstOrDefault(); + if (_repository.Find(x => x.agv_fromaddress == fromaddress || x.agv_toaddress == fromaddress).Any()) + throw new Exception($"璐т綅{fromaddress}宸插瓨鍦ㄤ换鍔★紒"); + if (station == null) throw new Exception($"鏈壘鍒拌揣浣峽fromaddress}锛�"); + if (!station.enable) throw new Exception($"璐т綅{fromaddress}鏈惎鐢紒"); + if (station.quantity < 1) throw new Exception($"璐т綅{fromaddress}鏃犺溅杞紒"); + var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault(); + if (Work == null) throw new Exception($"鏈壘鍒拌揣浣峽fromaddress}鐨勬満鍔犲伐宸ュ崟淇℃伅"); + dt_agvtask agvtask = new dt_agvtask() + { + agv_fromaddress = station.stationCode, + agv_id = Guid.NewGuid(), + agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), + agv_grade = 2, + agv_createtime = DateTime.Now, + agv_taskstate = "Queue", + agv_materielid = station.stationType, + agv_qty = station.quantity, + agv_tasktype = "TaskType_OutsourceInbound", + agv_toaddress = "", + agv_userid = UserContext.Current.UserName, + bindSN = station.bindSN, + agv_worktype = Convert.ToInt32(Work.processCode), + agv_materbarcode = Work.materialCode, + agv_Traytype = station.tray_type, + jobID = station.Number, + agv_TrayStatus = station.tray_status + }; + _repository.Add(agvtask, true); + station.location_state = LocationStateEnum.InBusy.ToString(); + stationinfoRepository.Update(station, true); + content.OK(); + } + catch (Exception ex) + { + content.Message = ex.Message; + } + return content; + } + public override WebResponseContent Update(SaveModel saveModel) + { + WebResponseContent content = new WebResponseContent(); + var agv_id = saveModel.MainData["agv_id"].ToString(); + var task = _repository.Find(x => x.agv_id.ToString() == agv_id).FirstOrDefault(); + if (task.agv_taskstate != AGVTaskStateEnum.Queue.ToString()) return content.Error("褰撳墠浠诲姟涓嶅彲鏇存敼锛�"); + return base.Update(saveModel); + } #region 娣诲姞NG浠诲姟 public override WebResponseContent Add(SaveModel saveDataModel) { -- Gitblit v1.9.3