Example #1
0
        public void Save(object part_unit, object part_owner, string station, string key)
        {
            if (part_unit == null)
            {
                throw new ArgumentNullException();
            }
            if (part_owner == null)
            {
                throw new ArgumentNullException();
            }
            string sn = ((PartUnit)part_unit).Sn;
            Session session = SessionManager.GetInstance.GetSession(key, Session.SessionType.Product);
            if (session == null)
            {
                throw new InstanceNotFoundException("Can not get Session instance from SessionManager!");
            }
            var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
            Material materialobj = materialRep.Find(sn);
            if (materialobj == null)
            {
                var material = new Material();
                material.MaterialCT = sn;
                material.MaterialType = ((PartUnit)part_unit).ValueType;
                material.Stage = "RCTO";
                material.Model = ((PartUnit)part_unit).Pn;
                material.Line = session.Line;
                material.Status = session.Station;
                material.PreStatus = "";
                material.PizzaID = key;
                material.QCStatus = "1";
                material.Editor = session.Editor;
                material.ShipMode = ((PartUnit)part_unit).ItemType;
                material.Cdt = DateTime.Now;
                material.Udt = DateTime.Now;
                materialRep.Add(material, session.UnitOfWork);
            }
            else
            {
                materialobj.Editor = session.Editor;
                materialobj.Cdt = DateTime.Now;
                materialobj.Udt = DateTime.Now;
                materialobj.QCStatus = (Convert.ToInt32(materialobj.QCStatus) + 1).ToString();
                materialRep.Update(materialobj, session.UnitOfWork);
            }
           
            materialRep.AddMultiMaterialLogDefered(session.UnitOfWork,
                                                           new List<string> { sn },
                                                              "TestKP",
                                                              "RCTO",
                                                               session.Line,
                                                                "",
                                                                session.Station,
                                                                 key,
                                                                 session.Editor);



           
           
        }
Example #2
0
        public void Save(string input, string pdline, string model, string location, string obligation,string remark,string state, string customer, string editor)
        {
            logger.Debug("Save start, MBSno:" + input);
            try
            {
                var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
                IUnitOfWork uof = new UnitOfWork();
                Material material = new Material();

                material.MaterialCT = input;
                material.MaterialType = "XRay";
                material.Model = model;
                material.Line = pdline;
                material.DeliveryNo = state;
                material.PalletNo = location;
                material.CartonSN = obligation;
                material.PreStatus = "XRay";
                material.Status = "1";
                material.ShipMode = remark;
                material.Editor = editor;
                material.Cdt = DateTime.Now;
                material.Udt = DateTime.Now;
                
                materialRep.Add(material, uof);
                uof.Commit();
            }
            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(" InputMB end, MBSno:" + input);
            }

        }
Example #3
0
        /// <summary>
        /// Get Product Object and Put it into Session.SessionKeys.Product
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
           

            var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
            string deliveryNo = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
            Delivery dn = null;
            if (string.IsNullOrEmpty(deliveryNo))
            {
                dn = (Delivery)CurrentSession.GetValue(Session.SessionKeys.Delivery);
                if (dn != null)
                {
                    deliveryNo = dn.DeliveryNo;
                }
            }

            string palletNo = (string)CurrentSession.GetValue(Session.SessionKeys.PalletNo);
            string cartonSN = (string)CurrentSession.GetValue(Session.SessionKeys.CartonSN);
            string modelName = (string)CurrentSession.GetValue(Session.SessionKeys.ModelName);
            string materialType = (string)CurrentSession.GetValue(Session.SessionKeys.MaterialType);
            if (materialType == null)
            {
                throw new FisException("CQCHK0006", new string[] { Session.SessionKeys.MaterialType });
            }

            string shipMode = (string)CurrentSession.GetValue(Session.SessionKeys.ShipMode) ?? "";
            string materialStage = (string)CurrentSession.GetValue("MaterialStage") ?? "";
            if (IsSingleCT)
            {
                string materialCT =(string)CurrentSession.GetValue(Session.SessionKeys.MaterialCT);
                if (materialCT==null)
                {
                    throw new FisException("CQCHK0006", new string[] { Session.SessionKeys.MaterialCT });
                }
                Material material = new Material();

                material.MaterialCT = materialCT;
                material.MaterialType = materialType;
                material.Model = modelName;
                material.Line = this.Line;
                material.DeliveryNo = deliveryNo;
                material.PalletNo = palletNo;
                material.CartonSN = cartonSN;
                material.PreStatus = "";
                material.Status = this.Station;
                material.ShipMode = shipMode;
                material.Editor = this.Editor;
                material.Cdt = DateTime.Now;
                material.Udt = DateTime.Now;             
                materialRep.Add(material, CurrentSession.UnitOfWork);
                CurrentSession.AddValue(Session.SessionKeys.Material, material);
            }
            else
            {
                IList<string> materialCTList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.MaterialCTList);
                if (materialCTList == null || materialCTList.Count == 0)
                {
                    throw new FisException("CQCHK0006", new string[] { Session.SessionKeys.MaterialCTList });
                }
                materialRep.AddMultiMaterialCTDefered(CurrentSession.UnitOfWork, materialCTList,
                                                                             materialType,"",materialStage,this.Line,"",this.Station,
                                                                             modelName,deliveryNo,palletNo,cartonSN,
                                                                             "",shipMode,this.Editor);
             
            }      

           
            return base.DoExecute(executionContext);
        }
Example #4
0
        public void Save(string input, string loc,string editor)
        {
            var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
            Material material = materialRep.Find(input);
            if (material != null)
            {
                logger.Debug("Save start, CT:" + input);
                try
                {
                    IUnitOfWork uof = new UnitOfWork();
                    Material material1 = materialRep.Find(input);

                    material1.MaterialCT = input;
                    material1.MaterialType = "FIXTure";
                    material1.Line = "";
                    material1.PreStatus = "FIXTure";
                    material1.PalletNo = loc;
                    material1.Editor = editor;
                    material1.Status = "In";
                    material1.Cdt = DateTime.Now;
                    material1.Udt = DateTime.Now;
                    materialRep.Update(material1, uof);
                    uof.Commit();
                }
                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(" InputCT end, CT:" + input);
                }
            }
            else
            {
                logger.Debug("Save start, CT:" + input);
                try
                {
                    IUnitOfWork uof = new UnitOfWork();
                    Material material1 = new Material();

                    material1.MaterialCT = input;
                    material1.MaterialType = "FIXTure";
                    material1.PreStatus = "FIXTure";
                    material1.PalletNo = loc;
                    material1.Editor = editor;
                    material1.Status = "In";
                    material1.Cdt = DateTime.Now;
                    material1.Udt = DateTime.Now;
                    materialRep.Add(material1, uof);
                    uof.Commit();
                }
                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(" InputCT end, CT:" + input);
                }
            }
        }