From 8529ae408d5e41d5982a8caab2a035e360cfc6c6 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 五月 2024 18:26:29 +0800
Subject: [PATCH] WMS添加PDA人工出库接口

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs |   76 ++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 35 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 48cf3b6..bffb2d7 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"
@@ -207,7 +207,7 @@
             catch (Exception ex)
             {
                 //WriteDBLog.Error("鏌ヨ杞﹁疆鏁版嵁", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
-                WriteLog.Write_Log(namea, namea + "鎶ラ敊", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
+                WriteLog.Write_Log("鎶ラ敊鏃ュ織", namea, "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
             }
         }
         #endregion
@@ -388,7 +388,7 @@
             catch (Exception ex)
             {
                 //WriteDBLog.Error("鏌ヨ杞﹁疆璁㈠崟", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
-                WriteLog.Write_Log(namea, namea + "鎶ラ敊", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
+                WriteLog.Write_Log("鎶ラ敊鏃ュ織", namea, "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
             }
         }
         #endregion
@@ -444,14 +444,6 @@
                         }
                         #endregion
 
-                        var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
-
-                        #region 涓嬫枡浣嶆槸鍚︿负绌虹姸鎬佸悓姝ョ粰妗佹灦
-                        foreach (var station in Stations)
-                        {
-                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
-                        }
-                        #endregion
 
                         if (finished && !updatefinished)
                         {
@@ -481,11 +473,11 @@
                             #endregion
 
                             var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
-                            if (AreaNr == 0)
-                            {
-                                client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
-                                continue;
-                            }
+                            //if (AreaNr == 0)
+                            //{
+                            //    client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
+                            //    continue;
+                            //}
 
                             #region 鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�
                             var area = client.ReadByOrder<Int16>("place_prog", name);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
@@ -499,7 +491,7 @@
                             }
                             #endregion
 
-                            var areaCode = PipelineJob.area_code(name);   //鏍规嵁涓嬫枡鍙e崟鍏冨悕鑾峰彇鍖哄煙浠g爜
+                            var areaCode = Pipeline.area_code(name);   //鏍规嵁涓嬫枡鍙e崟鍏冨悕鑾峰彇鍖哄煙浠g爜
                             var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
                             if (station != null)
                             {
@@ -526,21 +518,6 @@
                                         throw new Exception($"{station.stationCode}宸插瓨鍦ㄨ溅杞甋N鍙凤細{Wheel_SN}");
                                 }
 
-                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
-                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
-                                station.quantity++;
-                                if (station.quantity == 1)
-                                {
-                                    station.stationType = Mes_Work.drawingNo;
-                                    station.Number = Mes_Work.workOrder;
-                                    station.heatNumber = Mes_Work.heatID;
-                                    station.tray_status = "StrogeTray";
-                                }
-
-                                var count = stationinfoRepository.Update(station, true);
-                                if (count < 1)
-                                    throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}");
-
                                 #region 娓呯┖缁欐鏋剁殑涓嬫枡淇℃伅
                                 client.WriteByOrder("W_IndexNr", (Int16)0, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
                                 client.WriteByOrder("W_Storage_Type", (Int16)0, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
@@ -555,6 +532,24 @@
                                 //    $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕nW_AreaNr锛歿0}\nW_IndexNr锛歿0}\nW_Storage_Type锛歿0}\n\n" +
                                 //    $"鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿true}\nW_Enabl_Load锛歿false}", "PCS");
                                 #endregion
+
+                                #region 璐т綅鐘舵�佹洿鏂�
+                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
+                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
+                                station.quantity++;
+                                if (station.quantity == 1)
+                                {
+                                    station.stationType = Mes_Work.drawingNo;
+                                    station.Number = Mes_Work.workOrder;
+                                    station.heatNumber = Mes_Work.heatID;
+                                    station.tray_status = "StrogeTray";
+                                }
+
+                                var count = stationinfoRepository.Update(station, true);
+                                if (count < 1)
+                                    throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}"); 
+                                #endregion
+
 
                                 #region 淇敼宸ュ崟鐘舵��
                                 var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
@@ -571,6 +566,15 @@
                                 #endregion
                             }
                         }
+
+                        var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
+
+                        #region 涓嬫枡浣嶆槸鍚︿负绌虹姸鎬佸悓姝ョ粰妗佹灦
+                        foreach (var station in Stations)
+                        {
+                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
+                        }
+                        #endregion
 
                         var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                         if (!Request) continue;
@@ -610,8 +614,8 @@
                         #endregion
 
 
-                        var wheel = PipelineJob.QueryMateriel(Work.drawingNo);
-                        var wheel1 = PipelineJob.QueryMateriel1(Work.drawingNo);
+                        var wheel = Pipeline.QueryMateriel(Work.drawingNo);
+                        var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
                         if (wheel == null && wheel1 == null)
                         {
                             #region 鏃ュ織璁板綍
@@ -892,13 +896,15 @@
                     }
                     catch (Exception ex)
                     {
-                        WriteDBLog.Error(name, $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+                        //WriteDBLog.Error(name, $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+                        WriteLog.Write_Log("鎶ラ敊鏃ュ織", name, "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
                     }
                 }
             }
             catch (Exception ex)
             {
-                WriteDBLog.Error("涓嬫枡鍖�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+                //WriteDBLog.Error("涓嬫枡鍖�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+                WriteLog.Write_Log("鎶ラ敊鏃ュ織", "涓嬫枡鍖�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
             }
         }
         #endregion

--
Gitblit v1.9.3