/// <summary> /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string CartonNo = (string)CurrentSession.GetValue(Session.SessionKeys.Carton); IProductRepository repProduct = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); ///// Product setProductValue =new Product(); Product product_condition = new Product(); setProductValue.CartonSN = ""; setProductValue.DeliveryNo = ""; setProductValue.PalletNo = ""; product_condition.CartonSN = CartonNo; repProduct.BackUpProduct(Editor, product_condition,null); repProduct.BackUpProductStatusByCarton(CartonNo,Editor); repProduct.UpdateProductsDefered(CurrentSession.UnitOfWork, setProductValue, product_condition); return base.DoExecute(executionContext); }
/// <summary> /// /// </summary> /// <param name="inputSN"></param> /// <param name="model"></param> /// <param name="firstProID"></param> /// <param name="line"></param> /// <param name="editor"></param> /// <param name="station"></param> /// <param name="customer"></param> /// <returns></returns> public ArrayList InputSN(string inputCartonNo, string line, string editor, string station, string customer) { logger.Debug("(CombineCartonInDN)inputCartonNo start, inputCartonNo:" + inputCartonNo); try { ArrayList retLst = new ArrayList(); var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); //a. 如果用户录入的[Carton No] 在数据库(CartonStatus.CartonNo)中不存在,则报告错误:“Invalid Carton No!” carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>(); CartonStatusInfo carConf = new CartonStatusInfo(); carConf.cartonNo = inputCartonNo; IList<CartonStatusInfo> carList = cartRep.GetCartonStatusInfo(carConf); if (carList.Count == 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK139", errpara);//此Carton 不存在! } //b.如果用户录入的[Carton No] 已经结合了Pallet,则报告错误:“This Carton has combined Pallet!” IProduct eqCondition1 = new Product(); IProduct notNullCondition1 = new Product(); eqCondition1.CartonSN = inputCartonNo; notNullCondition1.PalletNo = ""; IList<IProduct> prodcutlist1 = productRep.GetProductInfoListByConditionsNotNull(eqCondition1, notNullCondition1); if (prodcutlist1.Count != 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK159", errpara);//“This Carton has combined Pallet!” } //c.如果用户录入的[Carton No] 已经结合了Delivery,则报告错误:“This Carton has combined Delivery!” IProduct eqCondition2 = new Product(); IProduct notNullCondition2 = new Product(); eqCondition2.CartonSN = inputCartonNo; notNullCondition2.DeliveryNo = ""; IList<IProduct> prodcutlist2 = productRep.GetProductInfoListByConditionsNotNull(eqCondition2, notNullCondition2); if (prodcutlist2.Count != 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK160", errpara);//“This Carton has combined Delivery!” } IList<IProduct> prodList = new List<IProduct>(); prodList = productRep.GetProductListByCartonNo(inputCartonNo); if (prodList.Count == 0) { throw new FisException("CHK109", new string[] { }); } IProduct curProduct; curProduct = productRep.Find(prodList[0].ProId); retLst.Add(prodList[0].Model); string sessionKey = prodList[0].ProId; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType); if (currentSession == null) { 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, "CombineCartonInDNForRCTO.xoml", "CombineCartonInDNForRCTO.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.IsComplete, false); currentSession.AddValue(Session.SessionKeys.Product, curProduct); currentSession.AddValue(Session.SessionKeys.ProdList, prodList); IList<string> productIDList = new List<string>(); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { currentSession.AddValue(Session.SessionKeys.Product, curProduct); currentSession.Exception = null; currentSession.SwitchToWorkFlow(); /*FisException ex; List<string> erpara = new List<string>(); 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; } //======================================================== ArrayList retList = new ArrayList(); ProductInfoMaintain prodInfo = new ProductInfoMaintain(); if (string.IsNullOrEmpty(curProduct.CUSTSN)) { curProduct.CUSTSN =""; } prodInfo.ProductID = curProduct.ProId; prodInfo.Sn = curProduct.CUSTSN; prodInfo.Model = curProduct.Model; //prodInfo.Station = vendorCT; IList<IProduct> proList = (List<IProduct>)currentSession.GetValue(Session.SessionKeys.ProdList); IList<string> idList = (List<string>)currentSession.GetValue(Session.SessionKeys.NewScanedProductIDList); proList = productRep.GetProductListByCartonNo(inputCartonNo); foreach (IProduct item in proList) { idList.Add(item.ProId); } currentSession.AddValue(Session.SessionKeys.ProdList, proList); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, idList); retList.Add(prodInfo); retList.Add(prodList.Count); //======================================================== return retList; } 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("(CombineCartonInDN)inputCartonNo end, uutSn:" + inputCartonNo); } }
/// <summary> /// 檢查 BlockStation /// 參數: /// </summary> public void CheckProductBlockStation(Product currentProduct, string pdLine, string editor, string Station, string Customer) { if (currentProduct.Status == null) { throw new FisException("SFC002", new string[] { currentProduct.ProId }); } IProcessRepository CurrentProcessRepository = RepositoryFactory.GetInstance().GetRepository<IProcessRepository, Process>(); string notEmpytLine = pdLine; if (string.IsNullOrEmpty(notEmpytLine) && currentProduct.Status != null) { notEmpytLine = currentProduct.Status.Line; } if (currentProduct.Status != null && string.IsNullOrEmpty(currentProduct.Status.ReworkCode)) { string firstLine = ""; if (!string.IsNullOrEmpty(notEmpytLine)) { firstLine = notEmpytLine.Substring(0, 1); } IList<ModelProcess> currentModelProcess = CurrentProcessRepository.GetModelProcessByModelLine(currentProduct.Model, firstLine); if (currentModelProcess == null || currentModelProcess.Count == 0) { //CurrentProcessRepository.CreateModelProcess(currentProduct.Model, editor, firstLine); ResolveProcess.CreateModelProcess(currentProduct.ModelObj, editor, firstLine); } } CurrentProcessRepository.SFC(notEmpytLine, Customer, Station, currentProduct.ProId, "Product"); }
/// <summary> /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO); var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); var shipDate = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.DeliveryDate).ToString(); string bomremark = (string)CurrentSession.GetValue("BomRemark"); string remark = (string)CurrentSession.GetValue("Remark"); string exception = (string)CurrentSession.GetValue("Exception"); string inFAI = (string)CurrentSession.GetValue("inFAI"); var subProdList = new List<IProduct>(); CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList); IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model# foreach (string item in prodNoList) { Product prod = new Product(item); prod.MO = prodMo.Key.ToString(); prod.Model = prodMo.Model; ProductStatus prodStatus = new ProductStatus(); prodStatus.Editor = this.Editor; prodStatus.Line = this.Line; prodStatus.StationId = this.Station; prodStatus.ProId = item; prodStatus.Status = StationStatus.Pass; prodStatus.ReworkCode = string.Empty; prod.Status = prodStatus; //ITC-1360-1337 ITC-1360-1300 prod.SetExtendedProperty("ShipDate", shipDate, this.Editor); if(!String.IsNullOrEmpty(bomremark)) prod.SetExtendedProperty("BomRemark", bomremark.ToUpper(), this.Editor); if(!String.IsNullOrEmpty(remark)) prod.SetExtendedProperty("Remark", remark.ToUpper(), this.Editor); if(!String.IsNullOrEmpty(exception)) prod.SetExtendedProperty("Exception", exception, this.Editor); if (inFAI == "Y") prod.SetExtendedProperty("FAIinFA", "Y", this.Editor); prod.SetExtendedProperty("PdLine", this.Line, this.Editor); //TODO 1. prodRepository.Add(prod, CurrentSession.UnitOfWork); subProdList.Add(prod); } IList<string> range = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); string mo = (string)CurrentSession.GetValue(Session.SessionKeys.MONO); CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "PrdId"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, range[0]); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, range[range.Count-1]); CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, mo); return base.DoExecute(executionContext); }
/// <summary> /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO); var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); var subProdList = new List<IProduct>(); CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList); IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model# string ecr = (string)CurrentSession.GetValue(Session.SessionKeys.ECR); foreach (string item in prodNoList) { Product prod = new Product(item); prod.MO = prodMo.Key.ToString(); prod.Model = prodMo.Model; ProductStatus prodStatus = new ProductStatus(); prodStatus.Editor = this.Editor; prodStatus.Line = this.Line; prodStatus.StationId = "F0"; prodStatus.ProId = item; prodStatus.Status = StationStatus.Pass; prodStatus.ReworkCode = string.Empty; prod.Status = prodStatus; if (!String.IsNullOrEmpty(ecr)) prod.SetExtendedProperty("ECR", ecr.ToUpper(), this.Editor); prodRepository.Add(prod, CurrentSession.UnitOfWork); subProdList.Add(prod); } IList<string> range = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); string mo = (string)CurrentSession.GetValue(Session.SessionKeys.MONO); CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "PrdId"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, range[0]); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, range[range.Count - 1]); CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, mo); return base.DoExecute(executionContext); }
protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO); var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); // var ecr = CurrentSession.GetValue(Session.SessionKeys.ECR).ToString(); var shipDate = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.DeliveryDate).ToString(); var sku = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.SKU).ToString(); var subProdList = new List<IProduct>(); CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList); IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#,ECR=ecr# //记录Product的状态,在ProductStatus插入记录 foreach (string item in prodNoList) { Product prod = new Product(item); // prod.ECR = ecr; prod.MO = prodMo.Key.ToString (); prod.Model = prodMo.Model; ProductStatus prodStatus = new ProductStatus(); prodStatus.Editor = this.Editor; prodStatus.Line = this.Line; prodStatus.StationId = this.Station; prodStatus.ProId = item; prodStatus.Status = StationStatus.Pass; prodStatus.ReworkCode = string.Empty; prod.Status = prodStatus; prod.SetExtendedProperty("ShipDate",shipDate,this.Editor); if (!string.IsNullOrEmpty(sku)) { prod.SetExtendedProperty("SKU", sku, this.Editor); } prodRepository.Add(prod, CurrentSession.UnitOfWork); subProdList.Add(prod); } return base.DoExecute(executionContext); }
private Delivery GetNextDelivery(Product curProduct) { IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); Delivery assignDelivery = new Delivery(); CurrentSession.AddValue("HasDN", "N"); //CDSI 机器Assign Delivery的特殊要求 //IList<IMES.FisObject.Common.Model.ModelInfo> GetModelInfoByModelAndName(string model, string name); IList<IMES.FisObject.Common.Model.ModelInfo> infoList = modelRep.GetModelInfoByModelAndName(curProduct.Model, "PO"); Model model = modelRep.Find(curProduct.Model); string cdsi = ""; cdsi = model.GetAttribute("PO"); if (cdsi != "Y") { cdsi = ""; cdsi = model.GetAttribute("ATSNAV"); if (!string.IsNullOrEmpty(cdsi)) { cdsi = "cdsi"; } } else { cdsi = "cdsi"; } CurrentSession.AddValue("CDSI", cdsi); if (cdsi == "cdsi") { if (!string.IsNullOrEmpty(curProduct.DeliveryNo)) { assignDelivery = deliveryRep.Find(curProduct.DeliveryNo); CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery); return assignDelivery; } string factoryPo = ""; //获取Product 结合的Factory Po,对于CDSI 机器如果获取不到结合的Factory Po, //需要报告错误:“CDSI AST MISSING DATA!” //SELECT @FactoryPo = Sno FROM CDSIAST NOLOCK WHERE SnoId = @ProductId AND Tp = 'FactoryPO' CdsiastInfo conf = new CdsiastInfo(); conf.snoId = curProduct.ProId; conf.tp = "FactoryPO"; IList<CdsiastInfo> cdsiList = productRep.GetCdsiastInfoList(conf); /*if (cdsiList.Count == 0) { errpara.Add(this.Key); throw new FisException("PAK140", errpara);//“CDSI AST MISSING DATA!” }*/ factoryPo = cdsiList[0].sno; IList<Delivery> dnList = deliveryRep.GetDeliveryListByModelPrefix(factoryPo, "PC", 12, "00"); //IF @Delivery = '' SELECT 'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!' if (dnList.Count == 0) { return null; } assignDelivery = dnList[0]; } else if (!curProduct.IsBT) { //a)选择的DN需要满足如下要求: //Delivery.ShipDate 大于3天前 (例如:当天为2011/9/13,那么获取的DN 的ShipDate 要大于2011/9/10) – 即ShipDate>=convert(char(10),getdate()-3,111) //Note: //ShipDate 需要转换为YYYY/MM/DD 格式显示 //Sample: 2009/05/11 //Delivery.Status = ‘00’ //Delivery.Model 长度为12 位 //Delivery.Model 前两码为’PC’ //系统自动分配另外一个DN(列表中满足条件的Delivery按照ShipDate,Qty,DeliveryNo 排序取第一个), DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); condition.Model = curProduct.Model; IList<DNForUI> dnList = deliveryRep.GetDNListByConditionWithSorting(condition); foreach (DNForUI tmp in dnList) { if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } int qty = 0; int packedQty = 0; qty = tmp.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRep.GetProductListByDeliveryNo(tmp.DeliveryNo); packedQty = productList.Count; if (packedQty + 1 > qty) { continue; } assignDelivery = deliveryRep.Find(tmp.DeliveryNo); break; } if (assignDelivery == null) { return null; } } return assignDelivery; }
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="firstSn">firstSn</param> /// <param name="custSn">custSn</param> /// <returns></returns> public ArrayList InputCartonNo(string firstCN, string CartonNo,string firstPalletNo) { logger.Debug("(PalletVerifyImpl)ScanSN start, firstSn:" + firstCN + " custSn:" + CartonNo); ArrayList retLst = new ArrayList(); FisException ex; List<string> erpara = new List<string>(); try { var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); CartonStatusInfo condition = new CartonStatusInfo(); condition.cartonNo = CartonNo; IList<CartonStatusInfo> CartonStatus = cartRep.GetCartonStatusInfo(condition); if (CartonStatus.Count == 0) { //erpara.Add("Invalid Carton No!"); erpara.Add(CartonNo); ex = new FisException("PAC001", erpara); throw ex; } IList<IProduct> productList = productRepository.GetProductListByCartonNo(CartonNo); if (productList.Count == 0) { //erpara.Add("This Carton does not be combined with Product!"); erpara.Add(CartonNo); 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 = CartonNo; 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; } if (palletNo != firstPalletNo) { //erpara.Add("This palletNo is not equal!"); erpara.Add(palletNo); erpara.Add(firstPalletNo); ex = new FisException("PAK164", erpara); throw ex; } retLst.Add(palletNo); retLst.Add(CartonNo); retLst.Add(DeliveryNo); return retLst; } catch (FisException e) { throw e; } catch (Exception e) { throw new SystemException(e.Message); } finally { logger.Debug("(PalletVerifyImpl)ScanSN end, firstSn:" + firstCN + " custSn:" + CartonNo); } }
protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var mb = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); string item = this.Key; if (mb.GetAttributeValue("Model") == null) { List<string> errpara = new List<string>(); errpara.Add(item); throw new FisException("SFC014", errpara); // Need Change error code for No PCB Mapping to Model } string model = (string)mb.GetAttributeValue("Model"); IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IList<IProduct> lstProduct = prodRepository.GetProductListByPCBID(item); if (lstProduct != null) { foreach (var product in lstProduct) { if (product.ProId != item) { List<string> erpara = new List<string>(); erpara.Add("MB"); erpara.Add(item); erpara.Add(product.ProId); var ex = new FisException("CHK009", erpara); throw ex; } } } ProductStatus prodStatus = new ProductStatus(); prodStatus.Editor = this.Editor; prodStatus.Line = this.Line; prodStatus.StationId = this.Station; prodStatus.ProId = item; prodStatus.Status = this.IsPass; //StationStatus.Pass; prodStatus.ReworkCode = string.Empty; prodStatus.Udt = DateTime.Now; Product prod = new Product(item); var currentProduct = prodRepository.GetProductByIdOrSn(item); if (currentProduct == null) { prod.MAC = mb.MAC; prod.MO = mb.SMTMO; prod.Model = model; prod.PCBID = item; prod.PCBModel = mb.Model; prod.MBECR = mb.ECR; prod.Status = prodStatus; prod.CUSTSN = mb.CustSn; prodRepository.Add(prod, CurrentSession.UnitOfWork); CurrentSession.AddValue(Session.SessionKeys.Product, prod); } else { currentProduct.MAC = mb.MAC; currentProduct.MO = mb.SMTMO; currentProduct.Model = model; currentProduct.PCBID = item; currentProduct.PCBModel = mb.Model; currentProduct.MBECR = mb.ECR; currentProduct.CUSTSN = mb.CustSn; currentProduct.UpdateStatus(prodStatus); prodRepository.Update(currentProduct, CurrentSession.UnitOfWork); CurrentSession.AddValue(Session.SessionKeys.Product, currentProduct); } return base.DoExecute(executionContext); }
///<summary> ///</summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string model = CurrentSession.GetValue(Session.SessionKeys.ModelName).ToString(); IMORepository imr = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>(); MO prodMo=null; if (IsBindMO) { string moNo = imr.GetActiveMOWithNoneLock(model); if (string.IsNullOrEmpty(moNo)) { moNo = imr.GetActiveMO(model); } if (string.IsNullOrEmpty(moNo)) { throw new FisException("CHK1025", new string[] { }); } prodMo = imr.Find(moNo); } var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList); string ecr=CurrentSession.GetValue(Session.SessionKeys.ECR)==null?"":CurrentSession.GetValue(Session.SessionKeys.ECR).ToString(); var subProdList = new List<IProduct>(); CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList); IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#,ECR=ecr# //记录Product的状态,在ProductStatus插入记录 foreach (string item in prodNoList) { Product prod = new Product(item); prod.ECR = ecr; if (IsBindMO) { prod.MO = prodMo.Key.ToString(); prod.Model = prodMo.Model; imr.AssignedMO(prodMo.MONO); } else { prod.Model = model; } ProductStatus prodStatus = new ProductStatus(); prodStatus.Editor = this.Editor; prodStatus.Line = this.Line; prodStatus.StationId = this.Station; prodStatus.ProId = item; prodStatus.Status = StationStatus.Pass; prodStatus.ReworkCode = string.Empty; prod.Status = prodStatus; prodRepository.Add(prod, CurrentSession.UnitOfWork); subProdList.Add(prod); } if (prodNoList.Count == 1) { CurrentSession.AddValue(Session.SessionKeys.Product, subProdList[0]); } return base.DoExecute(executionContext); }