| | |
| | | using Admin.NET.Application; |
| | | using iWareCC.Common.Helper; |
| | | using iWareCC.StationService; |
| | | using iWareCommon.Common.Globle; |
| | | using iWareCommon.Utils; |
| | | using iWareModel; |
| | | using iWareSql.DataAccess; |
| | | using iWareSql.DBModel; |
| | | using iWareSql.WmsDBModel; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.ServiceModel.Configuration; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using WZ.Useful.Commons; |
| | | using XiGang.Core.Model; |
| | | //using Admin.NET.Application; |
| | | //using iWareCC.Common.Helper; |
| | | //using iWareCC.StationService; |
| | | //using iWareCommon.Common.Globle; |
| | | //using iWareCommon.Utils; |
| | | //using iWareModel; |
| | | //using iWareSql.DataAccess; |
| | | //using iWareSql.DBModel; |
| | | //using iWareSql.WmsDBModel; |
| | | //using System; |
| | | //using System.Collections.Generic; |
| | | //using System.Linq; |
| | | //using System.Runtime.Remoting.Messaging; |
| | | //using System.ServiceModel.Configuration; |
| | | //using System.Text; |
| | | //using System.Threading; |
| | | //using System.Threading.Tasks; |
| | | //using WZ.Useful.Commons; |
| | | //using XiGang.Core.Model; |
| | | |
| | | namespace iWareCC.ThreadService |
| | | { |
| | | /// <summary> |
| | | /// BZ30é½å¥éªè¯ |
| | | /// </summary> |
| | | public static class DataProcess_ValidateQiTao |
| | | { |
| | | public static async void Handler() |
| | | { |
| | | var alertMsg = ""; |
| | | LogType logType = LogType.DataProcess_ValidateQiTao; |
| | | while (true) |
| | | { |
| | | Thread.Sleep(2000);//ä¼ç 2ç§ï¼å°ä¼ç åå°åé¢ï¼æ¯ä¸ºäºä¸é¢çcontinueæ¹æ³æ§è¡å䏿¾ç¤ºé误信æ¯çæç¤ºï¼ï¼ï¼ãEditBy shaocx,2022-05-24ã |
| | | SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = string.Empty; |
| | | try |
| | | { |
| | | if (SystemValue.isAllowRuning_DataProcess_ValidateQiTao && SystemValue.isStartedModel) |
| | | { |
| | | var rgvLocation = StationLocationEnum.BZ39.ToString(); |
| | | //namespace iWareCC.ThreadService |
| | | //{ |
| | | // /// <summary> |
| | | // /// BZ30é½å¥éªè¯ |
| | | // /// </summary> |
| | | // public static class DataProcess_ValidateQiTao |
| | | // { |
| | | // public static async void Handler() |
| | | // { |
| | | // var alertMsg = ""; |
| | | // LogType logType = LogType.DataProcess_ValidateQiTao; |
| | | // while (true) |
| | | // { |
| | | // Thread.Sleep(2000);//ä¼ç 2ç§ï¼å°ä¼ç åå°åé¢ï¼æ¯ä¸ºäºä¸é¢çcontinueæ¹æ³æ§è¡å䏿¾ç¤ºé误信æ¯çæç¤ºï¼ï¼ï¼ãEditBy shaocx,2022-05-24ã |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = string.Empty; |
| | | // try |
| | | // { |
| | | // //if (SystemValue.isAllowRuning_DataProcess_ValidateQiTao && SystemValue.isStartedModel) |
| | | // if (SystemValue.isStartedModel) |
| | | // { |
| | | // var rgvLocation = StationLocationEnum.BZ30.ToString(); |
| | | |
| | | using (WmsDBModel wmsDB = new WmsDBModel()) |
| | | { |
| | | var bz30Config = wmsDB.SysConfig.Where(x => x.Code == "wms_bz30_qitao").FirstOrDefault(); |
| | | if (bz30Config == null) |
| | | { |
| | | SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"没æé
ç½® wms_bz30_qitao å¼"; |
| | | continue; |
| | | } |
| | | var configValue = bz30Config.Value; |
| | | if (string.IsNullOrEmpty(configValue) || configValue.IndexOf('|') <= -1) |
| | | { |
| | | SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"é
ç½® wms_bz30_qitao å¼{configValue}为空æä¸æ£ç¡®"; |
| | | continue; |
| | | } |
| | | var configValues = configValue.Split('|'); |
| | | var packageCode = configValues[0]; |
| | | var qitaoValue = configValues[1];//é½å¥ ä¸é½å¥ |
| | | // using (WmsDBModel wmsDB = new WmsDBModel()) |
| | | // { |
| | | // var bz30Config = wmsDB.SysConfig.Where(x => x.Code == "wms_bz30_qitao").FirstOrDefault(); |
| | | // if (bz30Config == null) |
| | | // { |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"没æé
ç½® wms_bz30_qitao å¼"; |
| | | // continue; |
| | | // } |
| | | // var configValue = bz30Config.Value; |
| | | // if (string.IsNullOrEmpty(configValue) || configValue.IndexOf('|') <= -1) |
| | | // { |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"é
ç½® wms_bz30_qitao å¼{configValue}为空æä¸æ£ç¡®"; |
| | | // continue; |
| | | // } |
| | | // var configValues = configValue.Split('|'); |
| | | // var packageCode = configValues[0]; |
| | | // var qitaoValue = configValues[1];//é½å¥ ä¸é½å¥ |
| | | // var _UnlinePerson = configValues[2]; |
| | | // bool iscomplete = false; |
| | | // if (qitaoValue.Equals("é½å¥")) |
| | | // { |
| | | // iscomplete = true; |
| | | // } |
| | | // //TODO:æ¨éç»PLC å»åªä¸ªæ¹åï¼ |
| | | |
| | | //TODO:æ¨éç»PLC å»åªä¸ªæ¹åï¼ |
| | | /* |
| | | using (StationServiceClient client = new StationServiceClient()) |
| | | { |
| | | var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.å
¥åºæ¨¡å¼, rgvLocation); |
| | | if (!res.result) |
| | | { |
| | | SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"{rgvLocation.ToString()}-æ¨éç»PLCåæ¢æ¨¡å¼ å¤±è´¥,ChangeModeAsync è¿å:{res.resMsg}"; |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-æ¨éç»PLCåæ¢æ¨¡å¼ æå,ChangeModeAsyncï¼åæ°: ç«ç¹{rgvLocation}"); |
| | | } |
| | | } |
| | | //*/ |
| | | // using (StationServiceClient client = new StationServiceClient()) |
| | | // { |
| | | // var res = client.WriteQiTaoInfo((int)EDevice.Station, rgvLocation, iscomplete); |
| | | // if (!res.result) |
| | | // { |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"{rgvLocation.ToString()}-æ¨éç»PLCæ¯å¦é½å¥å¤±è´¥,ChangeModeAsync è¿å:{res.resMsg}"; |
| | | // continue; |
| | | // } |
| | | // else |
| | | // { |
| | | // Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-æ¨éç»PLCæ¯å¦é½å¥ æå,ChangeModeAsyncï¼åæ°: ç«ç¹{rgvLocation}"); |
| | | // } |
| | | // } |
| | | // // |
| | | |
| | | |
| | | //æ´æ°å¼ |
| | | bz30Config.Value = ""; |
| | | var gahter = wmsDB.mes_package_gather.Where(x => x.PackageCode == packageCode).FirstOrDefault(); |
| | | if (gahter != null) |
| | | { |
| | | gahter.UpiStatus = (int)UpiStatusEnum.å·²ä¸çº¿; |
| | | gahter.AreaCode = (int)AreaCodeEnum.ä¸çº¿åºå; |
| | | } |
| | | var upiList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == packageCode).ToList(); |
| | | foreach (var item in upiList) |
| | | { |
| | | item.UpiStatus = (int)UpiStatusEnum.å·²ä¸çº¿; |
| | | item.AreaCode = (int)AreaCodeEnum.ä¸çº¿åºå; |
| | | item.UpdateTime = DateTime.Now; |
| | | } |
| | | //å é¤éåä¿¡æ¯ |
| | | var lineQueue = wmsDB.mes_package_linequeue.Where(x => x.PackageCode == packageCode).FirstOrDefault(); |
| | | if (lineQueue != null) |
| | | { |
| | | wmsDB.mes_package_linequeue.Remove(lineQueue); |
| | | } |
| | | //æ°å¢ä¸çº¿è®°å½ |
| | | mes_package_unline_record record = new mes_package_unline_record(); |
| | | record = ClassHelper.RotationMapping<mes_package_unline_record, mes_package_gather>(gahter); |
| | | record.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | record.CreateTime = DateTime.Now; |
| | | record.UpdateTime = DateTime.Now; |
| | | record.OpRemark = "ä¸çº¿"; |
| | | wmsDB.mes_package_unline_record.Add(record); |
| | | // //æ´æ°å¼ |
| | | // bz30Config.Value = ""; |
| | | // var package = wmsDB.mes_package_gather.Where(x => x.PackageCode == packageCode).FirstOrDefault(); |
| | | // if (package != null) |
| | | // { |
| | | // package.UpiStatus = (int)UpiStatusEnum.å·²ä¸çº¿; |
| | | // package.AreaCode = (int)AreaCodeEnum.ä¸çº¿åºå; |
| | | // } |
| | | // var upiList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == packageCode).ToList(); |
| | | // foreach (var item in upiList) |
| | | // { |
| | | // item.UpiStatus = (int)UpiStatusEnum.å·²ä¸çº¿; |
| | | // item.AreaCode = (int)AreaCodeEnum.ä¸çº¿åºå; |
| | | // item.UpdateTime = DateTime.Now; |
| | | // } |
| | | // //å é¤éåä¿¡æ¯ |
| | | // var lineQueue = wmsDB.mes_package_linequeue.Where(x => x.PackageCode == packageCode).FirstOrDefault(); |
| | | // if (lineQueue != null) |
| | | // { |
| | | // wmsDB.mes_package_linequeue.Remove(lineQueue); |
| | | // } |
| | | |
| | | |
| | | wmsDB.SaveChanges(); |
| | | } |
| | | } |
| | | // //å¤ç表 mes_order_gather |
| | | // var errmsg = ""; |
| | | // var result = MyExtendHelper.HandlerOrderGather(wmsDB, package, qitaoValue, _UnlinePerson, out errmsg); |
| | | // if (result == false) |
| | | // { |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = errmsg; |
| | | // continue; |
| | | // } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao += " åºç°å¼å¸¸:" + ex.Message + SysGloble.SPLIT_STR; |
| | | Log4NetHelper.WriteErrorLog(logType, " åºç°å¼å¸¸ï¼" + ex.Message, ex); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | // //æ°å¢ä¸çº¿è®°å½ |
| | | // //夿妿å
å·²ç»ä¸çº¿äºï¼å°±ä¸ååå
¥ä¸çº¿è®°å½äº |
| | | // var existPackObj = wmsDB.mes_package_unline_record.Where(x => x.PackageCode == package.PackageCode).FirstOrDefault(); |
| | | // if (existPackObj == null) |
| | | // { |
| | | // mes_package_unline_record record = new mes_package_unline_record(); |
| | | // record = ClassHelper.RotationMapping<mes_package_unline_record, mes_package_gather>(package); |
| | | // record.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | // record.CreateTime = DateTime.Now; |
| | | // record.UpdateTime = DateTime.Now; |
| | | // record.OpRemark = "ä¸çº¿"; |
| | | // wmsDB.mes_package_unline_record.Add(record); |
| | | // } |
| | | |
| | | // WmsRecordUpiProcessHandler.SaveWmsRecordPackageProcess(wmsDB, package, "BZ30", "é½å¥éªè¯"); |
| | | |
| | | |
| | | // wmsDB.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao += " åºç°å¼å¸¸:" + ex.Message + SysGloble.SPLIT_STR; |
| | | // Log4NetHelper.WriteErrorLog(logType, " åºç°å¼å¸¸ï¼" + ex.Message, ex); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // } |
| | | //} |