From d151ad916449dd1b081ce515daf893e54ef5511c Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周五, 20 12月 2024 18:08:17 +0800
Subject: [PATCH] 22
---
CC/iWareCC_ASRS/ThreadService/01_BZ01工位(清灰,洗板后工位)/DataProcess_BZ01.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 117 insertions(+), 3 deletions(-)
diff --git "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
index 4e74781..d991a57 100644
--- "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
@@ -11,6 +11,7 @@
using System.Linq;
using System.Net.NetworkInformation;
using System.Reflection.Emit;
+using System.Security.Cryptography.X509Certificates;
using System.ServiceModel.Configuration;
using System.Text;
using System.Threading;
@@ -24,6 +25,8 @@
/// </summary>
public static class DataProcess_BZ01
{
+ public static string timingForWait = "";//瀹氭椂鍣紝绛夊緟鏁版嵁
+
/// <summary>
/// BZ01宸ヤ綅锛堟竻鐏帮紝娲楁澘鍚庡伐浣嶏級
/// </summary>
@@ -32,6 +35,7 @@
var alertMsg = "";
LogType logType = LogType.DataProcess_BZ01;
string lastUpi = "";//鏈�鍚庤褰曠殑UPI鏁版嵁
+
while (true)
{
Thread.Sleep(1000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
@@ -66,13 +70,48 @@
SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-璇锋眰浜嗚В鐮侊紝浣嗘槸缁撴灉鏄┖鐨�,姝ゆ寰幆缁撴潫";
continue;
}
+
if (lastUpi == result)
{
- SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-閲嶅鐨刄PI{result}";
- continue;
+ //瀵绘壘涓婃鐨凚Z01楠岃瘉璁板綍
+ using (WmsDBModel wmsDB = new WmsDBModel())
+ {
+ var lastRecord = wmsDB.wms_record_upi_process.Where(x => x.Upi == lastUpi && x.Location == "BZ01").OrderByDescending(x => x.Id).FirstOrDefault();
+ if (lastRecord != null)
+ {
+ //鍙栨槸鍚� 榻愬寘
+ bool my_qitaoReault = false;
+ if (lastRecord.UpiStatus == (int)UpiStatusEnum.宸查綈鍖�)
+ {
+ my_qitaoReault = true;
+ }
+ //鎺ㄩ�丳LC
+ using (StationServiceClient client = new StationServiceClient())
+ {
+ var res = await client.WriteQiTaoInfoAsync((int)EDevice.Station, rgvLocation, my_qitaoReault);
+ if (!res.result)
+ {
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-銆愬崟鐙帹閫丳LC銆戞帹閫侀綈濂楃粨鏋滃け璐�,WriteQiTaoInfoAsync杩斿洖:{res.resMsg}";
+ continue;
+ }
+ else
+ {
+ Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-銆愬崟鐙帹閫丳LC銆戞帹閫侀綈濂楃粨鏋滄垚鍔�,WriteQiTaoInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation},榻愬缁撴灉:{my_qitaoReault}");
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-銆愬崟鐙帹閫丳LC銆戞帹閫侀綈濂楃粨鏋滄垚鍔�";
+ continue;
+ }
+ }
+ }
+ else
+ {
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-閲嶅鐨刄PI{result}";
+ continue;
+ }
+ }
}
+ //*/
var upiCode = result;
- lastUpi = upiCode;
+
var qitaoReault = false;//榻愬寘缁撴灉
using (WmsDBModel wmsDB = new WmsDBModel())
@@ -143,6 +182,39 @@
#endregion
}
+ //澧炲姞浼樺寲楠岃瘉 銆怑ditby shaocx,2024-12-16銆�
+ if (qitaoReault == false)
+ {
+ var lastPackageUpi_269 = FormCC.Globle_269_LastPackageUpi;
+ if (!string.IsNullOrEmpty(lastPackageUpi_269))
+ {
+ var arr = lastPackageUpi_269.Split('|');
+ if (upiObj.PackageCode == arr[0])
+ {//鏈�鍚庝竴娆″湪269鎵弿鐨勫寘鍙� 璺� 鐜板湪BZ01鐨勫寘鍙蜂竴鑷�,瑕佺瓑寰�
+ //wait
+ var isWaitOutTime = Wait269(wmsDB);
+ if (isWaitOutTime == false)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ //缁х画寰�涓嬭蛋
+ }
+ }
+ else
+ {
+ //wait
+ var isWaitOutTime = Wait269(wmsDB);
+ if (isWaitOutTime == false)
+ {
+ continue;
+ }
+ }
+ }
+
+ timingForWait = "";//閲嶇疆鏁版嵁
if (qitaoReault == false)
{
upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
@@ -275,6 +347,8 @@
// continue;
//}
+
+ lastUpi = upiCode;
using (StationServiceClient client = new StationServiceClient())
{
var res = await client.WriteQiTaoInfoAsync((int)EDevice.Station, rgvLocation, qitaoReault);
@@ -361,6 +435,46 @@
}
}
+ /// <summary>
+ /// 瓒呮椂楠岃瘉
+ /// </summary>
+ /// <param name="wmsDB"></param>
+ /// <param name="time"></param>
+ /// <returns>true:瓒呮椂 false锛氭湭瓒呮椂</returns>
+ private static bool Wait269(WmsDBModel wmsDB)
+ {
+ var bz30Config = wmsDB.SysConfig.Where(x => x.Code == "Wait_269").FirstOrDefault();
+ if (bz30Config == null)
+ {
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"娌℃湁閰嶇疆 Wait_269 鍊�";
+ return false;
+ }
+ int i = 0;
+ bool right = int.TryParse(bz30Config.Value, out i);
+ if (right == false)
+ {
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"閰嶇疆 Wait_269 鍊间笉鏄暣鏁�";
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(timingForWait))
+ {
+ timingForWait = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ }
+
+ string time = timingForWait;
+ //鍦�269鎵弿鐨勬椂闂�
+ var time_269 = Convert.ToDateTime(time);
+ TimeSpan ts = DateTime.Now - time_269;
+ var sec = ts.Seconds;
+ if (sec >= i)
+ {
+ //瓒呮椂
+ return true;
+ }
+ SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"閰嶇疆 Wait_269 鍊兼槸{i},褰撳墠闂撮殧鏄瘂sec}绉�,鏈秴鏃躲�傚紑濮嬬瓑寰呮椂闂磠timingForWait}";
+ return false;
+ }
/// <summary>
/// 鏄惁鍙互鎵ц鍑哄簱妯″紡
--
Gitblit v1.9.3