示例#1
0
        /// <summary>
        /// 更新Model的标准重量
        /// </summary>
        public void SetModelWeight(string model, decimal weight, string editor)
        {
            logger.Debug("(RCTOWeight)SetModelWeight start, Model:" + model);

            try
            {
                IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                bool need1000 = partRep.GetConstValueTypeList("RCTOModelWeightUnit").Where(x => x.value == model.Trim()).Any();
                if (need1000)
                {
                    weight = Math.Round(weight * 1000, 2);
                }
                weight = Math.Round(weight, 2);
                IMES.FisObject.PAK.StandardWeight.ModelWeight mw=mvRepository.Find(model);
                //if (mvRepository.Find(model) != null)
                if (mw!=null)
                {
                    ModelWeightInfo cond = new ModelWeightInfo();
                    ModelWeightInfo item = new ModelWeightInfo();

                    cond.model = model;

                    item.model = model;
                    item.unitWeight = weight;
                    item.editor = editor;
                    item.remark = mw.UnitWeight.ToString();
                    item.sendStatus = "";

                    mvRepository.UpdateModelWeight(item, cond);
                }
                else
                {
                    IMES.FisObject.PAK.StandardWeight.ModelWeight item = new IMES.FisObject.PAK.StandardWeight.ModelWeight();
                    item.Model = model;
                    item.SendStatus = "";
                    item.Remark = "New";
                    item.UnitWeight = weight;
                    item.CartonWeight = 0;
                    item.Editor = editor;
                    UnitOfWork uow = new UnitOfWork();
                    mvRepository.Add(item, uow);
                    uow.Commit();
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(RCTOWeight)SetModelWeight end, Model:" + model);
            }
        }
示例#2
0
        public void SaveModelWeightItemAndHold(ModelWeightDef item, IList<string> lstPrdID, string holdStation, string defectCode)
        {
            try
            {

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                //看取得的数据是否有, 防止update的是空记录,但[PAK_SkuMasterWeight_FIS]中加入了记录
                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(item.Model);
                //if (modelWeight == null || modelWeight.Rows.Count == 0)
                //{
                //    //该Model尚无标准重量,请先去称重。
                //    List<string> erpara = new List<string>();
                //    erpara.Add(item.Model);
                //    FisException ex;
                //    ex = new FisException("PAK123", erpara);
                //    throw ex;
                //}
                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    item.UnitWeight = "0.00";
                }
                else
                {
                    item.UnitWeight = modelWeight.Rows[0][1].ToString();
                }

                IPizzaRepository itemRepositoryPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository>();

                ModelWeightInfo setValue = new ModelWeightInfo();
                setValue.unitWeight = Decimal.Parse(item.UnitWeight);
                setValue.sendStatus = "";
                setValue.remark = "";
                setValue.editor = item.Editor;

                setValue.udt = DateTime.Now;

                ModelWeightInfo condition = new ModelWeightInfo();
                condition.model = item.Model;

                PakSkuMasterWeightFisInfo pakSkuMasterWeight = new PakSkuMasterWeightFisInfo();
                pakSkuMasterWeight.model = item.Model;
                pakSkuMasterWeight.weight = setValue.unitWeight;                
                pakSkuMasterWeight.cdt = setValue.udt;

                UnitOfWork uow = new UnitOfWork();
                itemRepositoryModelWeight.UpdateModelWeightDefered(uow, setValue, condition);
                itemRepositoryPizza.DeletetPakSkuMasterWeightFisByModelDefered(uow, item.Model);
                itemRepositoryPizza.InsertPakSkuMasterWeightFisDefered(uow, pakSkuMasterWeight);
                HoldProductByProductList(lstPrdID, item, uow,holdStation);
             
             //void WriteHoldCodeDefered(IUnitOfWork uow, IList<string> productIDList, TestLog log, IList<string> defectList);
                TestLog testLog = new TestLog(0, "", "", "", "HOLD", TestLog.TestLogStatus.Fail, "", "HOLD", "", "", item.Editor, "HOLD", DateTime.Now);
                IProductRepository prodyctRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                IList<string> defectLst = new List<string>();
                defectLst.Add(defectCode);
                prodyctRep.WriteHoldCodeDefered(uow, lstPrdID, testLog, defectLst);
                uow.Commit();

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
        
        }
示例#3
0
        /// <summary>
        /// 保存修改的ModelWeight
        /// </summary>
        /// <param name="item">item</param>
        /// <returns></returns>
        public void SaveModelWeightItem(ModelWeightDef item)
        {

            try
            {

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                //看取得的数据是否有, 防止update的是空记录,但[PAK_SkuMasterWeight_FIS]中加入了记录
                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(item.Model);
                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    //该Model尚无标准重量,请先去称重。
                    List<string> erpara = new List<string>();
                    erpara.Add(item.Model);
                    FisException ex;
                    ex = new FisException("PAK123", erpara);
                    throw ex;
                }

                IPizzaRepository itemRepositoryPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository>();

                ModelWeightInfo setValue = new ModelWeightInfo();
                setValue.unitWeight = Decimal.Parse(item.UnitWeight);
                setValue.editor = item.Editor;
                setValue.udt = DateTime.Now;

                ModelWeightInfo condition = new ModelWeightInfo();
                condition.model = item.Model;

                PakSkuMasterWeightFisInfo pakSkuMasterWeight = new PakSkuMasterWeightFisInfo();
                pakSkuMasterWeight.model = item.Model;
                pakSkuMasterWeight.weight = setValue.unitWeight;
                pakSkuMasterWeight.cdt = setValue.udt;

                UnitOfWork uow = new UnitOfWork();
                itemRepositoryModelWeight.UpdateModelWeightDefered(uow, setValue, condition);
                itemRepositoryPizza.DeletetPakSkuMasterWeightFisByModelDefered(uow, item.Model);
                itemRepositoryPizza.InsertPakSkuMasterWeightFisDefered(uow, pakSkuMasterWeight);
                uow.Commit();

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
        }