/// <summary> /// DoUnpackByDN /// </summary> /// <param name="editor">editor</param> /// <param name="station">station</param> /// <param name="customer">customer</param> /// <param name="DN">DN</param> public void DoUnpackByDN( string editor, string station, string customer, string DN) { logger.Debug("(_UnpackAllbyDN)DoUnpackByDN start.DN:" + DN); string keyStr = ""; try { var currentDelivery = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, IMES.FisObject.PAK.DN.Delivery>().Find(DN); if (station == null) { station = ""; } Delivery newDelivery = currentRepository.Find(DN); if (newDelivery == null) { throw new FisException("CHK877", new string[] { });//DN不存在 } IList<IProduct> productList = new List<IProduct>(); productList = productRepository.GetProductListByDeliveryNo(DN); if (null == productList) { return; } if (0 == productList.Count) { return; } string line = ""; string sessionKey = DN; keyStr = sessionKey; Session currentSession = new Session(sessionKey, SessionType, editor, station, line, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", line); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", SessionType); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "UnpackByDN.xoml", "UnpackByDN.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.DeliveryNo, DN); currentSession.AddValue(Session.SessionKeys.ProdNoList, productList); currentSession.AddValue(Session.SessionKeys.IsComplete, false); string isSuper = "Y"; CommonImpl cmi = new CommonImpl(); IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("SAP", "Name"); string isExcuteDeleteSAPsn = ""; string allowUnpackCode = ""; foreach (ConstValueInfo constV in lstConst) { if (constV.name == "ExcuteDeleteSNonSAP") { isExcuteDeleteSAPsn = constV.value; } if (constV.name == "AllowUnpackCode") { allowUnpackCode = constV.value; } } string plant = System.Configuration.ConfigurationManager.AppSettings["PlantCode"]; currentSession.AddValue("IsSuper", isSuper); currentSession.AddValue("ExcuteDeleteSNonSAP", isExcuteDeleteSAPsn); currentSession.AddValue("AllowUnpackCode", allowUnpackCode); currentSession.AddValue("PlantCode", plant); currentSession.AddValue("DNStatus", currentDelivery.Status); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } return; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw e; } finally { Session sessionDelete = SessionManager.GetInstance.GetSession(keyStr, SessionType); ; if (sessionDelete != null) { SessionManager.GetInstance.RemoveSession(sessionDelete); } logger.Debug("(_UnpackAllbyDN)DoUnpackByDN end, DN:" + DN); } }
///<summary> /// 根据指定的sn or dn解除绑定 /// 使用工作流070UnpackDNByall.xoml /// </summary> public void UnpackBySNCheck(string prodSn, string pdline, string editor, string station, string customer) { logger.Debug("(UnpackAllBySN)Unpack start, prodid:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer); string currentSessionKey = prodSn; try { //station = "SP"; Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType); if (currentCommonSession == null) { currentCommonSession = new Session(currentSessionKey, ProductSessionType, editor, station, pdline, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", currentSessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentCommonSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", pdline); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", Session.SessionType.Product); WorkflowInstance instance; // if (station == "SP") { instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackBySN.xoml", "unpackbysn.rules", wfArguments); } // else // { // instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackDNBySN.xoml", "UnpackDNBySN.rules", wfArguments); // } //currentCommonSession.AddValue(Session.SessionKeys.CN, "ALL"); //currentCommonSession.AddValue(Session.SessionKeys.Pallet, false); currentCommonSession.AddValue(Session.SessionKeys.IsComplete, false); string isSuper = "Y"; CommonImpl cmi = new CommonImpl(); IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("SAP", "Name"); string isExcuteDeleteSAPsn = ""; string allowUnpackCode = ""; foreach (ConstValueInfo constV in lstConst) { if (constV.name == "ExcuteDeleteSNonSAP") { isExcuteDeleteSAPsn = constV.value; } if (constV.name == "AllowUnpackCode") { allowUnpackCode = constV.value; } } string plant = System.Configuration.ConfigurationManager.AppSettings["PlantCode"]; currentCommonSession.AddValue("IsSuper", isSuper); currentCommonSession.AddValue("ExcuteDeleteSNonSAP", isExcuteDeleteSAPsn); currentCommonSession.AddValue("AllowUnpackCode", allowUnpackCode); currentCommonSession.AddValue("PlantCode", plant); currentCommonSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentCommonSession)) { currentCommonSession.WorkflowInstance.Terminate("Session:" + currentSessionKey + " Exists."); FisException ex; List<string> erpara = new List<string>(); erpara.Add(currentSessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentCommonSession.WorkflowInstance.Start(); currentCommonSession.SetHostWaitOne(); } else { FisException ex; List<string> erpara = new List<string>(); erpara.Add(currentSessionKey); ex = new FisException("CHK020", erpara); throw ex; } if (currentCommonSession.Exception != null) { if (currentCommonSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentCommonSession.ResumeWorkFlow(); } throw currentCommonSession.Exception; } return; } catch (FisException e) { throw e; } catch (Exception e) { throw new SystemException(e.Message); } finally { logger.Debug("(UnpackAllBySN)Unpack end, prodid:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer); } }
/// <summary> /// GetInstance /// </summary> /// <returns></returns> public static CommonImpl GetInstance() { if (_Instance == null) { _Instance = new CommonImpl(); } return _Instance; }