From 0b5ccdca6263cf7a2cee460f30c76ef1efea2811 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 27 四月 2024 17:47:27 +0800
Subject: [PATCH] 人工出库,人工入库,人工移库,PDA扫码确认外协物料已被取走接口

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs |  122 ++++++++++++++++++++++------------------
 1 files changed, 68 insertions(+), 54 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index 16e7225..ae19956 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -1022,66 +1022,80 @@
         }
         #endregion
 
-        /// <summary>
-        /// AGV浠诲姟
-        /// </summary>
         public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype)
         {
             VOLContext Context = new VOLContext();
             Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
-            Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
-
             var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
             if (task != null) return;
-            //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault();
-            //if (mes_Head == null)
-            //{
-            //    stationinfo.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟澶磋〃锛�";
-            //    stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
-            //    stationinfoRepository.Update(stationinfo, true);
-            //    return;
-            //}
-
-            dt_stationinfo TargetLocation = null;
-            //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum);
-            //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound";
-
-            if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area))
-                TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
-            else if (tasktype == "TaskType_Inbound")
-                TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo);
-            //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo);
-            if (TargetLocation != null)
-            {
-                dt_agvtask agvtask = new dt_agvtask()
-                {
-                    agv_fromaddress = stationinfo.stationCode,
-                    agv_id = Guid.NewGuid(),
-                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
-                    agv_grade = 1,
-                    agv_createtime = DateTime.Now,
-                    agv_taskstate = "Create",
-                    agv_materielid = stationinfo.stationType,
-                    agv_qty = stationinfo.quantity,
-                    agv_tasktype = tasktype,
-                    agv_toaddress = TargetLocation.stationCode,
-                    agv_userid = "绯荤粺",
-                    bindSN = stationinfo.bindSN,
-                    agv_worktype = Convert.ToInt32(Work.processCode),
-                    agv_materbarcode = Work.materialCode,
-                    agv_Traytype = stationinfo.tray_type,
-                    jobID = stationinfo.Number,
-                    agv_TrayStatus = stationinfo.tray_status
-                };
-                agvtaskRepository.Add(agvtask, true);
-                stationinfo.location_state = LocationStateEnum.InBusy.ToString();
-                stationinfoRepository.Update(stationinfo, true);
-                TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
-                TargetLocation.stationType = agvtask.agv_materielid;
-                TargetLocation.heatNumber = stationinfo.heatNumber;
-                TargetLocation.Number = agvtask.jobID;
-                stationinfoRepository.Update(TargetLocation, true);
-            }
+            if (!string.IsNullOrEmpty(Work.area))
+                tasktype = "TaskType_OutsourceInbound";
+            AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, stationinfo, tasktype, Work);
         }
+
+        #region MyRegion
+        /// <summary>
+        /// AGV浠诲姟
+        /// </summary>
+        //public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype)
+        //{
+        //    VOLContext Context = new VOLContext();
+        //    Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+        //    Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
+
+        //    var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
+        //    if (task != null) return;
+        //    //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault();
+        //    //if (mes_Head == null)
+        //    //{
+        //    //    stationinfo.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟澶磋〃锛�";
+        //    //    stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
+        //    //    stationinfoRepository.Update(stationinfo, true);
+        //    //    return;
+        //    //}
+
+        //    dt_stationinfo TargetLocation = null;
+        //    //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum);
+        //    //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound";
+
+        //    if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area))
+        //        TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
+        //    else if (tasktype == "TaskType_Inbound")
+        //        TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo);
+        //    //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo);
+        //    if (TargetLocation != null)
+        //    {
+        //        dt_agvtask agvtask = new dt_agvtask()
+        //        {
+        //            agv_fromaddress = stationinfo.stationCode,
+        //            agv_id = Guid.NewGuid(),
+        //            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+        //            agv_grade = 1,
+        //            agv_createtime = DateTime.Now,
+        //            agv_taskstate = "Create",
+        //            agv_materielid = stationinfo.stationType,
+        //            agv_qty = stationinfo.quantity,
+        //            agv_tasktype = tasktype,
+        //            agv_toaddress = TargetLocation.stationCode,
+        //            agv_userid = "绯荤粺",
+        //            bindSN = stationinfo.bindSN,
+        //            agv_worktype = Convert.ToInt32(Work.processCode),
+        //            agv_materbarcode = Work.materialCode,
+        //            agv_Traytype = stationinfo.tray_type,
+        //            jobID = stationinfo.Number,
+        //            agv_TrayStatus = stationinfo.tray_status
+        //        };
+        //        agvtaskRepository.Add(agvtask, true);
+        //        stationinfo.location_state = LocationStateEnum.InBusy.ToString();
+        //        stationinfoRepository.Update(stationinfo, true);
+        //        TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
+        //        TargetLocation.stationType = agvtask.agv_materielid;
+        //        TargetLocation.heatNumber = stationinfo.heatNumber;
+        //        TargetLocation.Number = agvtask.jobID;
+        //        stationinfoRepository.Update(TargetLocation, true);
+        //    }
+        //}
+        #endregion
+
     }
 }

--
Gitblit v1.9.3