Beispiel #1
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);
        }
Beispiel #2
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);
                }
            }
        }