예제 #1
0
        //public void InputProdId(string floor, string pdLine, string prodId, string editor, string stationId, string customerId)
        public ArrayList InputProdId(string floor, string pdLine, string customerSn, string editor, string stationId, string customerId, string pre_model)
        {
            logger.Debug("(_AssignWHLocation)InputProdId start, floor:" + floor + " pdLine:" + pdLine + " customerSn:" + customerSn + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            ArrayList this_array_list_return = new ArrayList();
            FisException ex;
            List<string> erpara = new List<string>();
            //string sessionKey = prodId;
            try
            {
                var currentProduct = CommonImpl.GetProductByInput(customerSn, CommonImpl.InputTypeEnum.CustSN);
                if (currentProduct.ProId == "")
                {
                    throw new FisException("CHK020", new string[] { customerSn });
                }

                if ((pre_model.Length > 0) && (currentProduct.Model != pre_model))
                {
                    throw new FisException("CHK252", new string[] { });
                }

                string sessionKey = currentProduct.ProId;
                string this_model = currentProduct.Model;
                string this_line = currentProduct.Status.Line;
                Session Session = SessionManager.GetInstance.GetSession(sessionKey, TheType);

                
                if (Session == null)
                {
                    Session = new Session(sessionKey, TheType, editor, stationId, pdLine, customerId);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();

                    wfArguments.Add("Key", sessionKey); // key must be prodId.
                    wfArguments.Add("Station", stationId);
                    wfArguments.Add("CurrentFlowSession", Session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customerId);
                    wfArguments.Add("SessionType", TheType);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(stationId, "AssignWHLocation.xoml", null, out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    Session.AddValue("_product_line", this_line);
                    Session.AddValue(Session.SessionKeys.Floor, floor);
                    Session.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(Session))
                    {
                        Session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }


                    //Release The XXX: 2012.04.24 LiuDong
                    try
                    {
                        Session.WorkflowInstance.Start();
                        Session.SetHostWaitOne();
                    }
                    finally
                    {
                        IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                        productRepository.ReleaseLockByTransThread("BTLoc", (Guid)Session.GetValue<Guid>(Session.SessionKeys.lockToken_Loc));
                    }
                    //Release The XXX: 2012.04.24 LiuDong


                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }
                               
                //check workflow exception
                if (Session.Exception != null)
                {
                    if (Session.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        Session.ResumeWorkFlow();
                    }
                    throw Session.Exception;
                }

                //if (hasDealWithOneFKU == false) hasDealWithOneFKU = true;
                this_array_list_return.Add(customerSn); // customerId
                this_array_list_return.Add(sessionKey); // ProdId
                this_array_list_return.Add(this_model); // model
                PakBtLocMasInfo CurrentLocation = (PakBtLocMasInfo)Session.GetValue(Session.SessionKeys.WHLocationObj);
                this_array_list_return.Add(CurrentLocation.snoId);
                //this_array_list_return.Add(CurrentLocation.cmbQty);//locQty);

                var currentRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
                SnoDetBtLocInfo condition = new SnoDetBtLocInfo();
                /*
                condition.snoId = currentProduct.ProId;
                //condition.sno = CurrentLocation.snoId;
                //condition.status = "In";
                 */
                //modified into following
                condition.sno = CurrentLocation.snoId;
                condition.status = "In";

                IList<SnoDetBtLocInfo> nGotSnoDetBtLocInfoList = currentRepository.GetSnoDetBtLocInfosByCondition(condition);
                int x = 0;

                foreach (SnoDetBtLocInfo node in nGotSnoDetBtLocInfoList)
                {
                    if ((node.sno == CurrentLocation.snoId) && (node.status == "In"))
                    {
                        x++;
                    }
                }

                this_array_list_return.Add(x);

                return this_array_list_return;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                logger.Debug("(_AssignWHLocation)InputProdId end, floor:" + floor + " pdLine:" + pdLine + " customerSn:" + customerSn + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            }
        }
예제 #2
0
        /// <summary>
        /// Delivery 分配原则
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            IPalletRepository CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            SnoDetBtLocInfo condition = new SnoDetBtLocInfo();
            condition.snoId = curProduct.ProId;
            IList<string> listSno = CurrentRepository.GetSnoListFromSnoDetBtLoc(condition);


            SnoDetBtLocInfo setValue = new SnoDetBtLocInfo();
            setValue.status = "Out";
            setValue.editor = this.Editor;
            setValue.udt = DateTime.Now;
            SnoDetBtLocInfo setCondition = new SnoDetBtLocInfo();
            setCondition.snoId = curProduct.ProId;
            //CurrentRepository.UpdateSnoDetBtLoc(setValue, setCondition);
            CurrentRepository.UpdateSnoDetBtLocDefered(CurrentSession.UnitOfWork, setValue, setCondition);
            
            foreach (string tmp in listSno)
            {

                SnoDetBtLocInfo conditionTemp = new SnoDetBtLocInfo();
                conditionTemp.sno = tmp;
                conditionTemp.status = "In";

                int cmbqty = CurrentRepository.GetCountOfSnoIdFromSnoDetBtLoc(conditionTemp);


                PakBtLocMasInfo setPakValue2 = new PakBtLocMasInfo();
                PakBtLocMasInfo setPakCondition2 = new PakBtLocMasInfo();
                setPakValue2.cmbQty = cmbqty;
                setPakCondition2.snoId = tmp;
                //CurrentRepository.UpdatePakBtLocMas(setPakValue2, setPakCondition2);
                  CurrentRepository.UpdatePakBtLocMasDefered(CurrentSession.UnitOfWork, setPakValue2, setPakCondition2);
                if (cmbqty == 0)
                {
                    PakBtLocMasInfo setPakValue = new PakBtLocMasInfo();
                    PakBtLocMasInfo setPakCondition = new PakBtLocMasInfo();
                    setPakValue.status = "OPEN";
                    setPakValue.model = "Other";
                    setPakCondition.snoId = tmp;
                    //CurrentRepository.UpdatePakBtLocMas(setPakValue, setPakCondition);
                    CurrentRepository.UpdatePakBtLocMasDefered(CurrentSession.UnitOfWork, setPakValue, setPakCondition);
                }

            }
            return base.DoExecute(executionContext);
        }
예제 #3
0
        /// <summary>
        /// InsertSnoDetBTLoc
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //从Session里取得Product对象
            Product CurrentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            string this_line = (string)CurrentSession.GetValue("_product_line");

            //从Session里取得PakBtLocMasInfo对象
            PakBtLocMasInfo CurrentLocation = (PakBtLocMasInfo)CurrentSession.GetValue(Session.SessionKeys.WHLocationObj);

            var currentRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            SnoDetBtLocInfo newSnoDetBT = new SnoDetBtLocInfo();
            newSnoDetBT.cpqsno = CurrentProduct.CUSTSN;
            newSnoDetBT.editor = Editor;
            newSnoDetBT.pdLine = this_line; //Line;
            newSnoDetBT.sno = CurrentLocation.snoId;
            newSnoDetBT.snoId = CurrentProduct.ProId;
            newSnoDetBT.status = Status;
            newSnoDetBT.tp = Tp;
            newSnoDetBT.cdt= System.DateTime.Now;
            newSnoDetBT.udt = newSnoDetBT.cdt;
            currentRepository.InsertSnoDetBtLocInfoDefered(CurrentSession.UnitOfWork, newSnoDetBT);

            return base.DoExecute(executionContext);
        }
예제 #4
0
        private void updatePakBtLocMas(IPalletRepository palletRep, string productId)
        {
           

            SnoDetBtLocInfo condition = new SnoDetBtLocInfo();
            condition.snoId = productId;
            IList<string> listSno = palletRep.GetSnoListFromSnoDetBtLoc(condition);
            if (listSno != null && listSno.Count > 0)
            {
                SnoDetBtLocInfo setValue = new SnoDetBtLocInfo();
                setValue.status = "Out";
                setValue.editor = this.Editor;
                setValue.udt = DateTime.Now;
                SnoDetBtLocInfo setCondition = new SnoDetBtLocInfo();
                setCondition.snoId = productId;
                palletRep.UpdateSnoDetBtLocDefered(CurrentSession.UnitOfWork, setValue, setCondition);

                foreach (string tmp in listSno)
                {

                    SnoDetBtLocInfo conditionTemp = new SnoDetBtLocInfo();
                    conditionTemp.sno = tmp;
                    conditionTemp.status = "In";

                    int cmbqty = palletRep.GetCountOfSnoIdFromSnoDetBtLoc(conditionTemp);


                    PakBtLocMasInfo setPakValue2 = new PakBtLocMasInfo();
                    PakBtLocMasInfo setPakCondition2 = new PakBtLocMasInfo();
                    setPakValue2.cmbQty = cmbqty;
                    if (cmbqty == 0)
                    {
                        setPakValue2.status = "Open"; //release location
                        setPakValue2.model = "Other";
                    }
                    setPakCondition2.snoId = tmp;
                    palletRep.UpdatePakBtLocMasDefered(CurrentSession.UnitOfWork, setPakValue2, setPakCondition2);
                }
            }
        }