///<summary> /// 根据指定的DummyPalletNo解除绑定 /// 使用工作流UnpackDummyPalletNo.xoml /// </summary> public void UnpackDummyPalletNo(string DummyPalletNo, string line, string editor, string customer) { logger.Debug("(UnpackDummyPalletNo)Unpack DummyPalletNo start, DummyPalletNo:" + DummyPalletNo + "line:" + line + "editor:" + editor + "customer:" + customer); FisException ex; List<string> erpara = new List<string>(); try { IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>(); Pallet CurrentPallet = iPalletRepository.Find(DummyPalletNo); if (CurrentPallet == null) { erpara.Add(DummyPalletNo); ex = new FisException("PAK049", erpara); //此Dummy Pallet No 不存在! throw ex; } PalletLogInfo condition = new PalletLogInfo(); condition.palletNo = DummyPalletNo; condition.station = "9A"; // condition = "Pass Pallet Verify_RCTO"; IList<PalletLogInfo> lstPalletLog = iPalletRepository.GetPalletLogInfoList( condition); if (lstPalletLog == null || lstPalletLog.Count <=0) { erpara.Add(DummyPalletNo); ex = new FisException("PAK119", erpara); //此Dummy Pallet No %1 状态错误,不能解绑! throw ex; } string sessionKey = DummyPalletNo; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, currentSessionType); if (currentSession == null) { string station = "UD"; //UC 更新:本站站号:UD; currentSession = new Session(sessionKey, currentSessionType, 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", currentSessionType); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackPalletNoForRCTO.xoml", "", wfArguments); currentSession.AddValue(Session.SessionKeys.DummyPalletNo,DummyPalletNo); currentSession.AddValue(Session.SessionKeys.Pallet, CurrentPallet); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(UnpackDummyPalletNo)Unpack PalletNo end, DummyPalletNo:" + DummyPalletNo + "line:" + line + "editor:" + editor + "customer:" + customer); } }
public ArrayList InputFirstCartonNo(string firstCN, string line, string editor, string station, string customer) { logger.Debug("(PalletVerifyForRCTO)InputFirstCartonNo start, custsn:" + firstCN + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer); FisException ex; List<string> erpara = new List<string>(); ArrayList retLst = new ArrayList(); try { // check carton info CartonStatusInfo condition = new CartonStatusInfo(); condition.cartonNo = firstCN; IList<CartonStatusInfo> CartonStatus = cartRep.GetCartonStatusInfo(condition); if (CartonStatus.Count == 0) { //erpara.Add("Invalid Carton No!"); erpara.Add(firstCN); ex = new FisException("PAC001", erpara); throw ex; } IList<IProduct>productList = productRepository.GetProductListByCartonNo(firstCN); if (productList.Count == 0) { //erpara.Add("This Carton does not be combined with Product!"); erpara.Add(firstCN); ex = new FisException("PAK161", erpara); throw ex; } string palletNo = productList[0].PalletNo; string DeliveryNo = productList[0].DeliveryNo; IProduct isNullCondition = new Product(); isNullCondition.PalletNo =""; IProduct eqCondition = new Product(); eqCondition.CartonSN =firstCN; IList<IProduct>productPalletLst = productRepository.GetProductInfoListByConditions( eqCondition, isNullCondition); if (productPalletLst.Count != 0) { //erpara.Add("This Carton does not be combined with Pallet!"); erpara.Add(firstCN); ex = new FisException("PAK162", erpara); throw ex; } ////check The Pallet have verified! PalletLogInfo log_condition = new PalletLogInfo(); log_condition.palletNo = palletNo; log_condition.station = "9A"; IList<PalletLogInfo> lstPallet = iPalletRepository.GetPalletLogInfoList(log_condition); if (lstPallet.Count > 0) { erpara.Add(palletNo); ex = new FisException("PAK163", erpara); //Pallet have verified throw ex; } ////check shipment int palletQty = DeliveryRepository.GetSumofDeliveryQtyFromDeliveryPallet(palletNo); IList<DeliveryPalletInfo> lstShipment = DeliveryRepository.GetDeliveryPalletListByPlt(palletNo); if (lstShipment.Count > 0) { string shipment = lstShipment[0].shipmentNo; string consolidate = DeliveryRepository.GetDeliveryInfoValue(DeliveryNo, "Consolidated"); if (consolidate != null && consolidate !="") { int count = DeliveryRepository.GetCountOfDeliveryNoPrefixForDoubleDeliveryInfoPairs("Consolidated", consolidate, "RedShipment", consolidate); if (palletNo.Substring(0, 2) != "BA" && palletNo.Substring(0, 2) != "NA") { string[] pattern = consolidate.Split('/'); int dnQty = 0; if (pattern.Length.ToString() != "2" || string.IsNullOrEmpty(pattern[0]) || string.IsNullOrEmpty(pattern[1])) { erpara.Add(firstCN); ex = new FisException("PAK024", erpara); //找不到该Delivery No 的Consolidated 属性 throw ex; } dnQty = Int32.Parse(pattern[1]); if (dnQty != count) { erpara.Add(firstCN); ex = new FisException("PAK165", erpara); //Delivery 尚未完全Download throw ex; } } //////////////// int SumCartonQty = 0; int SumDnPallletQty = 0; IList<Delivery> dnList = DeliveryRepository.GetDeliveryListByInfoTypeAndValue("Consolidated", consolidate); foreach (Delivery dn in dnList) { string DeliveryNo1 = dn.DeliveryNo; string cqty = DeliveryRepository.GetDeliveryInfoValue(DeliveryNo1, "CQty"); Decimal qty = Convert.ToDecimal(cqty); int cartonQty = (int)(dn.Qty / qty); if (dn.Qty % qty != 0) cartonQty++; SumCartonQty += cartonQty; int DnPallletQty = DeliveryRepository.GetSumDeliveryQtyOfACertainDN(DeliveryNo1); SumDnPallletQty += DnPallletQty; } if (SumCartonQty != SumDnPallletQty) { //从整机库get { erpara.Add(palletNo); ex = new FisException("CHK903", erpara); //PALLET 未完全Download! throw ex; } } } } retLst.Add(palletNo); retLst.Add(firstCN); retLst.Add(DeliveryNo); retLst.Add(palletQty); return retLst; } catch (FisException e) { throw e; } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(PalletVerifyImpl)InputCustSNOnCooLabel end, custsn:" + firstCN + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer); } }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string PalletNo = (string)CurrentSession.GetValue(Session.SessionKeys.DummyPalletNo); IPalletRepository PalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>(); PalletLogInfo newPalletLog = new PalletLogInfo(); newPalletLog.palletNo = PalletNo; newPalletLog.station = "9A"; PalletRepository.DeletePalletLog(newPalletLog); return base.DoExecute(executionContext); }
/// <summary> /// 重印 /// </summary> /// <param name="palletNo">palletNo</param> /// <param name="reason">reason</param> /// <param name="line">line</param> /// <param name="editor">editor</param> /// <param name="station">station</param> /// <param name="customer">customer</param> /// <param name="printItems">printItems</param> public ArrayList rePrint(string palletNo, string reason, string line, string editor, string station, string customer, IList<PrintItem> printItems) { logger.Debug("(PalletVerifyOnlyImpl)rePrint Start," + "palletNo:" + palletNo + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer + "printItems" + printItems); FisException ex; List<string> erpara = new List<string>(); ArrayList retLst = new ArrayList(); string sessionKey = Guid.NewGuid().ToString(); try { //获取Pallet Info IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>(); Pallet CurrentPallet = null; CurrentPallet = iPalletRepository.Find(palletNo); if (CurrentPallet == null) { erpara.Add(palletNo); ex = new FisException("CHK881", erpara); // Pallet不存在! throw ex; } PalletLogInfo condition = new PalletLogInfo(); condition.palletNo = palletNo; condition.station = "9A"; IList<PalletLogInfo>lstPallet = iPalletRepository.GetPalletLogInfoList(condition); if (lstPallet.Count <= 0) { erpara.Add(palletNo); ex = new FisException("PAK120", erpara); throw ex; } Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Common); if (currentSession == null) { currentSession = new Session(sessionKey, Session.SessionType.Common, 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", Session.SessionType.Common); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("PalletVerifyReprintForRCTO.xoml", "", wfArguments); currentSession.AddValue(Session.SessionKeys.PalletNo, palletNo); currentSession.AddValue(Session.SessionKeys.Pallet, palletNo); currentSession.AddValue(Session.SessionKeys.PrintLogName, "PalletReprintForRCTO"); currentSession.AddValue(Session.SessionKeys.PrintLogBegNo, palletNo); currentSession.AddValue(Session.SessionKeys.PrintLogEndNo, palletNo); currentSession.AddValue(Session.SessionKeys.PrintLogDescr, "PalletDataVerifyReprintForRCTO"); currentSession.AddValue(Session.SessionKeys.Reason, reason); currentSession.AddValue(Session.SessionKeys.PrintItems, printItems); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } IList<PrintItem> resultPrintItems = currentSession.GetValue(Session.SessionKeys.PrintItems) as IList<PrintItem>; retLst.Add(resultPrintItems); string printLabel = currentSession.GetValue(Session.SessionKeys.QCStatus) as string; retLst.Add(printLabel); string flag = (string)currentSession.GetValue(Session.SessionKeys.EEP); retLst.Add(flag); return retLst; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw new SystemException(e.Message); } finally { logger.Debug("(PalletVerifyOnlyImpl)rePrint End," + "palletNo:" + palletNo + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer + "printItems" + printItems); } }