Exemplo n.º 1
0
        /// <summary>
        /// check CUST SN是否为空或未产生
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {          
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);

            PrintLog condition = new PrintLog();
            condition.Name = curProduct.Customer + "SNO";
            condition.BeginNo = curProduct.ProId;

            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            IList<PrintLog> printLogList = repository.GetPrintLogListByCondition(condition);

            FisException ex;
            List<string> erpara = new List<string>();
            if (printLogList.Count == 0)
            {
                erpara.Add(curProduct.ProId);
                ex = new FisException("CHK860", erpara);//此Product没有打印过,无需重印
                throw ex;
            }

            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, curProduct.Customer + "SNO");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, curProduct.ProId);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, curProduct.ProId);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, curProduct.CUSTSN);

            return base.DoExecute(executionContext);
        }
Exemplo n.º 2
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
              string LogName="";
              if(string.IsNullOrEmpty(LogType))
              {LogName= CurrentSession.GetValue(Session.SessionKeys.PrintLogName).ToString();}
              else
              { LogName=LogType;}
            var item = new PrintLog
            {
                Name = LogName,
                BeginNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogBegNo).ToString(),
                EndNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogEndNo).ToString(),
                Descr = CurrentSession.GetValue(Session.SessionKeys.PrintLogDescr).ToString(),
                Editor = this.Editor
            };
            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            repository.Add(item, CurrentSession.UnitOfWork);
            return base.DoExecute(executionContext);

        }
Exemplo n.º 3
0
        /// <summary>
        /// Write PrintLog base on PrintItemList data
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            var PrintItemList = (IList<PrintItem>)CurrentSession.GetValue(Session.SessionKeys.PrintItems);

            //0.No Print Item List do nothing
            if (PrintItemList == null || PrintItemList.Count == 0)
            {
                return base.DoExecute(executionContext);
            }
            string sn=GetBeginNo();
            if (string.IsNullOrEmpty(sn))
            {
                FisException ex = new FisException("CHK1028", new string[] {BeginAndEndNoFrom.ToString()});
                throw ex;
            }

            IPrintLogRepository PrintRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();

            foreach (PrintItem item in PrintItemList)
            {
                
                var log  = new PrintLog
                {
                    Name = item.LabelType,
                    BeginNo = sn,
                    EndNo = sn,
                    Descr = sn,
                    Station=this.Station,
                    LabelTemplate = (item.TemplateName??""),
                    Editor = this.Editor
                };

                PrintRep.Add(log, CurrentSession.UnitOfWork);
            }
           
            return base.DoExecute(executionContext);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
 
            var item = new PrintLog
                           {
                               Name = CurrentSession.GetValue(Session.SessionKeys.PrintLogName).ToString(),
                               BeginNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogBegNo).ToString(),
                               EndNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogEndNo).ToString(),
                               Descr = CurrentSession.GetValue(Session.SessionKeys.PrintLogDescr).ToString(),
                               Editor = this.Editor
                           };
            item.Station = this.Station??"";
            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            repository.Add(item, CurrentSession.UnitOfWork);
            return base.DoExecute(executionContext);
        }
Exemplo n.º 5
0
        public ArrayList Reprint(string prodid, string reason, string line, string editor, string station, string customer, IList<PrintItem> printItems)
        {
            ArrayList retrunValue = new ArrayList();
            FisException ex;
            List<string> erpara = new List<string>();
            try
            {
                IPrintLogRepository printLogRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository>();
                PrintLog condition = new PrintLog();
                condition.Name = printItems[0].LabelType;
                condition.BeginNo = prodid;
                IList<PrintLog> printLogList = printLogRepository.GetPrintLogListByCondition(condition);
                if (printLogList.Count == 0)
                {
                    throw new FisException("CHK270",new string[]{});
                }

                logger.Debug("(EEPLabelPrint)Reprint start, ProdId:" + prodid + " line:" + line + " editor:" + editor + " customerId:" + customer);
                string sessionKey = prodid;
                Session Session = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                if (Session == null)
                {
                    Session = new Session(sessionKey, Session.SessionType.Product, editor, station, line, customer);
                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", Session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "EEPLabelRePrintl.xoml", string.Empty, out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    Session.AddValue(Session.SessionKeys.PrintItems, printItems);
                    Session.AddValue(Session.SessionKeys.Reason, reason);
                    Session.AddValue(Session.SessionKeys.PrintLogName, printItems[0].LabelType);
                    Session.AddValue(Session.SessionKeys.PrintLogBegNo, prodid);
                    Session.AddValue(Session.SessionKeys.PrintLogEndNo, prodid);
                    Session.AddValue(Session.SessionKeys.PrintLogDescr, prodid);
                    Session.SetInstance(instance);
                    if (!SessionManager.GetInstance.AddSession(Session))
                    {
                        Session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                    Session.WorkflowInstance.Start();
                    Session.SetHostWaitOne();
                }
                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 (prodid.Length != 9)
                { 
                    Product tempProduct = (Product)Session.GetValue(Session.SessionKeys.Product);
                    if (!string.IsNullOrEmpty(tempProduct.CUSTSN))
                    {
                        prodid = tempProduct.ProId;
                    }
                }
                
                IList<PrintItem> returnList = (IList<PrintItem>)Session.GetValue(Session.SessionKeys.PrintItems);
                retrunValue.Add(prodid);
                retrunValue.Add(returnList);
                return retrunValue;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(EEPLabelPrint)Reprint end, ProdId:" + prodid + " line:" + line + " editor:" + editor + " customerId:" + customer);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// IMES_PAK..Delivery.Status = '87'
        /// </summary>
        /// <param name="line">line</param>
        /// <param name="editor">editor</param>
        /// <param name="station">station</param>
        /// <param name="customer">customer</param>
        /// <param name="DN">DN</param>
        /// <param name="custSN">custSN</param>
        /// <param name="coaSN">coaSN</param>
        /// <param name="printItems"></param> 
        public ArrayList UpdateDeliveryStatusAndPrint(string line, string editor, string station, string customer, string DN, string custSN, string coaSN, IList<PrintItem> printItems)
        {
            ArrayList retList = new ArrayList();
            string keyStr = "";
            try 
            {
                if (null == line)
                {
                    line = "";
                }
                if (null == station)
                {
                    station = "";
                }
                if (null == editor)
                {
                    editor = "";
                }
                if (null == customer)
                {
                    customer = "";
                }
                var currentProduct = CommonImpl.GetProductByInput(custSN, CommonImpl.InputTypeEnum.CustSN);
                if (null == currentProduct)
                {
                    List<string> errpara = new List<string>();

                    errpara.Add(custSN);
                    throw new FisException("SFC002", errpara);
                }
                Delivery reDelivery = currentRepository.Find(DN);
                
                S_RowData_Product productInfo = GetProductOnly(custSN);
                string sessionKey = custSN;
                keyStr = sessionKey;
                Session 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, "CombineCOAandDNAndPrint.xoml", "combinecoaanddnandprint.rules", out wfName, out rlName);
                WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                currentSession.AddValue(Session.SessionKeys.COASN, coaSN);
                if (currentProduct.IsBT)
                {
                    currentSession.AddValue(Session.SessionKeys.IsBT, true);
                }
                else
                {
                    currentSession.AddValue(Session.SessionKeys.IsBT, false);
                }
                if (productInfo.isCDSI == "true")
                {
                    currentSession.AddValue(Session.SessionKeys.Pno, productInfo.isFactoryPo);
                }
                currentSession.AddValue(Session.SessionKeys.CustSN, custSN);
                currentSession.AddValue(Session.SessionKeys.DeliveryNo, DN);
                currentSession.AddValue(Session.SessionKeys.Product, currentProduct);
                currentSession.AddValue(Session.SessionKeys.Delivery, reDelivery);
                currentSession.AddValue(Session.SessionKeys.ReturnStation, "1");
                currentSession.AddValue(Session.SessionKeys.IsComplete, true);
                currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                
                currentSession.SetInstance(instance);
                if (!SessionManager.GetInstance.AddSession(currentSession))
                {
                    currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                    
                }
                currentSession.WorkflowInstance.Start();
                currentSession.SetHostWaitOne();
                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                IUnitOfWork uow = new UnitOfWork();
                var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
                if (currentProduct != null)
                {
                    var item = new PrintLog
                    {
                        Name = "PIZZA Label-1",
                        BeginNo = custSN,
                        EndNo = custSN,
                        Descr = "",
                        Editor = editor
                    };
                    repository.Add(item, uow);
                }
                if (currentProduct.IsBT)
                {
                    var item = new PrintLog
                    {
                        Name = "BT COO Label",
                        BeginNo = custSN,
                        EndNo = custSN,
                        Descr = "",
                        Editor = editor
                    };
                    repository.Add(item, uow);
                }
               
                string DNTemp = (string)currentSession.GetValue(Session.SessionKeys.DeliveryNo);
                logger.Debug("(_CombineCOAandDN)UpdateDeliveryStatus DNTemp:" + DNTemp);
                logger.Debug("(_CombineCOAandDN)UpdateDeliveryStatus DN:" + DN);
                string QCIs = "noqcis";
                if (DN != DNTemp)
                {
                    QCIs = QCIs + "#@$#" + DNTemp;
                }
                IList<PrintItem> printList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);

                //Model 的第10,11码是”29” 或者”39” 的产品是出货日本的产品;否则,是非出货日本的产品
                string jpmodel = currentProduct.Model.Substring(9, 2);
                bool jpflag = false;
                if (jpmodel == "29" || jpmodel == "39")
                {
                    jpflag = true;
                    var item = new PrintLog
                    {
                        Name = "PIZZA Label-2",
                        BeginNo = custSN,
                        EndNo = custSN,
                        Descr = "",
                        Editor = editor
                    };
                    repository.Add(item, uow);
                }
                uow.Commit();
                retList.Add(printList);
                retList.Add(jpflag);
                retList.Add(QCIs);
                return retList;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                Session sessionDelete = SessionManager.GetInstance.GetSession(keyStr, SessionType);
                if (sessionDelete != null)
                {
                    SessionManager.GetInstance.RemoveSession(sessionDelete);
                }
                logger.Debug("(_CombineCOAandDN)UpdateDeliveryStatusAndPrint end, DN:" + DN);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            var CurrentMB = (MB)session.GetValue(Session.SessionKeys.MB);
            string moNo = CurrentMB.SMTMO;
            string model = CurrentMB.Model;
            string custSn = string.Empty;
            string custVer = string.Empty;
            string cvsn = string.Empty;
            string uuid = string.Empty;

            bool IsRCTO = false;
            if (session.GetValue(Session.SessionKeys.IsRCTO) != null)
            {
                IsRCTO = (bool)session.GetValue(Session.SessionKeys.IsRCTO);
            }
            string CheckCode = session.GetValue(Session.SessionKeys.CheckCode) as string;

            string dateCode = session.GetValue(Session.SessionKeys.DCode) as string;
            string ecr = session.GetValue(Session.SessionKeys.ECR) as string;
            string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string;

            var MACList = (IList<string>)session.GetValue(Session.SessionKeys.MACList);
            var MBCTList = (IList<string>)session.GetValue(Session.SessionKeys.MBCTList);
            var EEPList = (IList<string>)session.GetValue(Session.SessionKeys.EEPList);

            var NewMBSnList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>;

            var MBNOList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>;
            if (IsRCTO && CheckCode !="R") {
                MBNOList = session.GetValue(Session.SessionKeys.RCTOChildMBSnList) as List<string>;
            }
            var MBObjectList = new List<IMB>();
            session.AddValue(Session.SessionKeys.MBList, MBObjectList);

            IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            IPrintLogRepository LogRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            bool hasPCBVer = false;
            if (session.GetValue(ExtendSession.SessionKeys.HasPCBVer) != null)
            {
                hasPCBVer = (bool)session.GetValue(ExtendSession.SessionKeys.HasPCBVer);
                if (hasPCBVer)
                {
                    custVer = (string)session.GetValue(ExtendSession.SessionKeys.PCBVer);
                }
            }
            for (int i = 0; i < MBNOList.Count; i++)
            {

                string mac = string.Empty;
                if (MACList != null)
                {
                    mac = MACList[i];
                }
                MB mb = new MB(MBNOList[i], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                MBStatus mbStatus = new MBStatus(MBNOList[i], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);
                mb.MBStatus = mbStatus;

                if (IsRCTO && CheckCode != "R")
                {
                    IMES.FisObject.PCA.MB.MBInfo RCTOChangeInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "RCTOChange", NewMBSnList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(RCTOChangeInfo);
                }

                if (EEPList != null)
                {
                    IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "EEPROM", EEPList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(eepInfo);
                }

                if (MBCTList != null)
                {
                    IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "MBCT", MBCTList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(mbctInfo);
                    FruDetInfo newFruDet = new FruDetInfo();
                    newFruDet.sno = MBCTList[i];
                    newFruDet.snoId = mb.Sn;
                    newFruDet.tp = "VC";
                    newFruDet.editor = Editor;
                    newFruDet.cdt = DateTime.Now;
                    newFruDet.udt = newFruDet.cdt;
                    mbRepository.InsertFruDetInfoDefered(session.UnitOfWork, newFruDet);

                    MBLog newCTLog = new MBLog(0, mb.Sn, mb.Model, "SH", 1, "SA SHIPPING LABEL", Editor, DateTime.Now);
                    mb.AddLog(newCTLog);
                }

                if (session.GetValue("IsPilotMOCheck") != null && (bool)session.GetValue("IsPilotMOCheck"))
                {
                    string pilotmo = (string)session.GetValue(Session.SessionKeys.PilotMoNo);
                    mb.SetExtendedProperty(ConstName.PCBInfo.PilotMo, pilotmo, this.Editor);                    
                }
                mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, mb.Sn, this.Editor);
               

                MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now);
                mb.AddLog(newLog);
                mbRepository.Add(mb, session.UnitOfWork);
                MBObjectList.Add(mb);

                var item = new PrintLog
                {
                    Name = session.GetValue(Session.SessionKeys.PrintLogName).ToString(),
                    BeginNo = MBNOList[i],
                    EndNo = MBNOList[i],
                    Descr = session.GetValue(Session.SessionKeys.PrintLogDescr).ToString(),
                    Editor = this.Editor
                };
                LogRepository.Add(item, session.UnitOfWork);
                
                IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo();
                items.InfoType = ConstName.PCBInfo.ChildMBSN;
                items.InfoValue = mb.Sn;
                items.Editor = this.Editor;
                CurrentMB.AddMBInfo(items);
            }

            return base.DoExecute(executionContext);
        }
Exemplo n.º 8
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            Product CurrentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);

            if (CurrentProduct != null)
            {
                string prodid = CurrentProduct.ProId;
                bool bFlag = false;
                string name = "";
                if (String.IsNullOrEmpty(PrintLogName))
                {
                    name = "WWAN Label Print";
                    bFlag = repository.CheckExistPrintLogByLabelNameAndDescr(name, prodid);
                    if (!bFlag)
                    {
                        bFlag = repository.CheckExistPrintLogByLabelNameAndDescr(name, CurrentProduct.CUSTSN);
                    }
                }
                else
                {
                    name = PrintLogName;
                    if (name == "PrdId")//Travel Card Reprint
                    {
                        bFlag = repository.CheckExistPrintLogByLabelNameAndDescr(name, CurrentProduct.MO);
                    }
                    else if (name == "WWAN Label Print")//ITCNDCheck Reprint
                    {
                        bFlag = repository.CheckExistPrintLogByLabelNameAndDescr(name, prodid);
                        if (!bFlag)
                        {
                            bFlag = repository.CheckExistPrintLogByLabelNameAndDescr(name, CurrentProduct.CUSTSN);
                        }
                    }
                }

                if (!bFlag)
                {   //printLog
                    CurrentSession.AddValue(Session.SessionKeys.MaintainAction, "1");
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(prodid);
                    ex = new FisException("CHK844", erpara);
                    throw ex;
                }
                else
                {   //ReprintLog
                    if (name == "PrdId")
                    {
                        PrintLog cond = new PrintLog();
                        cond.Name = name;
                        cond.Descr = CurrentProduct.MO;
                        IList<PrintLog> list = new List<PrintLog>();
                        list = repository.GetPrintLogListByCondition(cond);
                        bool bFind = false;
                        foreach(PrintLog temp in list)
                        {
                            string beg = temp.BeginNo;
                            string end = temp.EndNo;

                            if((prodid.Substring(0, 3) == beg.Substring(0, 3)) && 
                                (prodid.Substring(0, 3) == end.Substring(0, 3)))
                            {
                                if ((Convert.ToInt64(prodid.Substring(3, 6)) >= Convert.ToInt64(beg.Substring(3, 6))) &&
                                    (Convert.ToInt64(prodid.Substring(3, 6)) <= Convert.ToInt64(end.Substring(3, 6))))
                                {
                                    bFind = true;
                                    break;
                                }
                            }
                        }
                        if (bFind == false)
                        {
                            FisException ex;
                            List<string> erpara = new List<string>();
                            erpara.Add(prodid);
                            ex = new FisException("CHK843", erpara);
                            throw ex;
                        }
                        string reason = (string)CurrentSession.GetValue(Session.SessionKeys.Reason);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogName, name);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.Reason, reason);
                        CurrentSession.AddValue(Session.SessionKeys.MaintainAction, "0");

                        IProductRepository ip = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                        string sLine = "";
                        ProductStatusInfo statusInfo = ip.GetProductStatusInfo(prodid);
                        if (statusInfo.pdLine != null)
                        {
                            sLine = statusInfo.pdLine;
                        }
                        CurrentSession.AddValue(Session.SessionKeys.LineCode, sLine);
                        CurrentSession.AddValue(Session.SessionKeys.ProductIDOrCustSN, prodid);
                    }
                    else if (name == "WWAN Label Print")
                    {
                        string reason = (string)CurrentSession.GetValue(Session.SessionKeys.Reason);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogName, name);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, prodid);
                        CurrentSession.AddValue(Session.SessionKeys.Reason, reason);
                        CurrentSession.AddValue(Session.SessionKeys.MaintainAction, "0");

                        IProductRepository ip = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                        string sLine = "";
                        ProductStatusInfo statusInfo = ip.GetProductStatusInfo(prodid);
                        if (statusInfo.pdLine != null)
                        {
                            sLine = statusInfo.pdLine;
                        }
                        CurrentSession.AddValue(Session.SessionKeys.LineCode, sLine);
                        CurrentSession.AddValue(Session.SessionKeys.ProductIDOrCustSN, this.Key);
                    }
                }
            }

            return base.DoExecute(executionContext);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            ActivityCommonImpl utl = ActivityCommonImpl.Instance;
            IMB parentMB = utl.IsNull<IMB>(session, Session.SessionKeys.MB);
          
            IList<String> sbSNList = session.GetValue(ExtendSession.SessionKeys.SmallBoardSNList) as IList<string>;

            if (sbSNList == null || sbSNList.Count == 0)
            {
                return base.DoExecute(executionContext);
            }


            IList<String> smallBoardPartNoList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardPartNoList) as IList<string>;
            IList<String> smallBoardECRList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardECRList) as IList<string>;

            string moNo = parentMB.SMTMO;            
            string custSn = string.Empty;
            string custVer = string.Empty;
            string cvsn = parentMB.Sn;
            string uuid = string.Empty;
             string mac = string.Empty;
            string dateCode = session.GetValue(Session.SessionKeys.DCode) as string;
            //string ecr = session.GetValue(Session.SessionKeys.ECR) as string;
            //string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string;

            var sbMBList = new List<IMB>();
            session.AddValue(ExtendSession.SessionKeys.SmallBoardMBList, sbMBList);

            IMBRepository mbRep = utl.mbRep;

            IPrintLogRepository LogRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            int index=0;    
            foreach (string sn in sbSNList)
            {
                string model = smallBoardPartNoList[index];
                string[] ecrList = smallBoardECRList[index].Split(GlobalConstName.SlashChar);
                string ecr = ecrList[0];
                string iecVer = ecrList[1];
                string[] sbSN = sn.Split(GlobalConstName.SlashChar);
                MB mb = new MB(sbSN[0], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                MBStatus mbStatus = new MBStatus(sbSN[0], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);
                mb.MBStatus = mbStatus;   

                MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now);
                mb.AddLog(newLog);
                if (this.IsSplitMB)
                {
                    mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, sbSN[1], this.Editor);
                }
                else
                {
                    mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, parentMB.Sn, this.Editor);
                }
                mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, parentMB.Sn, this.Editor);
                mb.SetExtendedProperty(ConstName.PCBInfo.IsSmallBoard, ConstName.Letter.Y, this.Editor);
                mbRep.Add(mb, session.UnitOfWork);
                sbMBList.Add(mb);

                var item = new PrintLog
                {
                    Name = PrintLogName,
                    BeginNo = sn,
                    EndNo = sn,
                    Station = this.Station,
                    Cdt = DateTime.Now,
                    LabelTemplate = string.Empty,
                    Descr =string.Format(PrintLogDescr,mb.Sn, sbSN[1], sbSN[0])  ,
                    Editor = this.Editor
                };

                LogRep.Add(item, session.UnitOfWork);
                
                IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo();
                items.InfoType = ConstName.PCBInfo.ChildMBSN;
                items.InfoValue = mb.Sn;
                items.Editor = this.Editor;
                parentMB.AddMBInfo(items);
                index++;
            }

            return base.DoExecute(executionContext);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 执行逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IList<PrintItem> resultPrintItemList = new List<PrintItem>();
            Session session =CurrentSession;
            var printItemList = (IList<PrintItem>)session.GetValue(Session.SessionKeys.PrintItems);

            ILabelTypeRepository lblTypeRepository = RepositoryFactory.GetInstance().GetRepository<ILabelTypeRepository, LabelType>();
            PrintUtility resolvePrintTemplate = null;
            if (printItemList != null && printItemList.Count > 0)  //無LabelType時不做檢查及報錯
            {
                Nullable<bool> hasExceptStation = null; 
                for (int i = 0; i < printItemList.Count; i++)
                {
                    PrintItem tempPrintItem = printItemList[i];
                    #region decide template logical
                    if (tempPrintItem.PrintMode == Bat)
                    {
                        PrintTemplate newTemplate = lblTypeRepository.GetPrintTemplate(tempPrintItem.TemplateName);
                        if (newTemplate != null)
                        {
                            //if (IsReprint)
                            //{
                            //    tempPrintItem.Piece = 1;
                            //}
                            //else
                            //{
                            tempPrintItem.Piece = newTemplate.Piece;
                            //}
                            tempPrintItem.SpName = newTemplate.SpName;
                            resultPrintItemList.Add(tempPrintItem);
                        }
                        else if (NotExistException)
                        {
                            //var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                            //FisException ex;
                            //List<string> erpara = new List<string>();
                            //erpara.Add(tempPrintItem.TemplateName);
                            //ex = new FisException("CHK064", erpara);
                            //logger.Error(ex.mErrmsg, ex);
                            //throw ex;
                            if (!hasExceptStation.HasValue)
                            {
                                hasExceptStation = checkExceptStation();
                            }
                            if (!hasExceptStation.Value)
                            {
                                throw new FisException("CHK064", new string[] { tempPrintItem.LabelType + "/" + tempPrintItem.TemplateName });
                            }
                        }
                       

                    }
                    else if (tempPrintItem.PrintMode == Template)
                    {
                        if (resolvePrintTemplate == null)
                        {
                            resolvePrintTemplate = new PrintUtility(session, ModelName(session), MONO(session), Dn(session), PartNo(session), Customer);
                        }
                        PrintTemplate newTemplate = resolvePrintTemplate.GetPrintTemplate(tempPrintItem.LabelType, tempPrintItem.RuleMode, tempPrintItem.PrintMode);
                        //PrintTemplate newTemplate = lblTypeRepository.GetPrintTemplate(tempPrintItem.LabelType, ModelName, MONO, Dn, PartNo, tempPrintItem.RuleMode,Customer);
                        if (newTemplate != null)
                        {
                            //if (IsReprint)
                            //{
                            //    tempPrintItem.Piece = 1;
                            //}
                            //else
                            //{
                            tempPrintItem.Piece = newTemplate.Piece;
                            //}
                            tempPrintItem.TemplateName = newTemplate.TemplateName;
                            tempPrintItem.Layout = newTemplate.Layout;
                            resultPrintItemList.Add(tempPrintItem);
                        }
                        else if (NotExistException)
                        {
                            //var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                            //FisException ex;
                            //List<string> erpara = new List<string>();
                            //erpara.Add(tempPrintItem.LabelType);
                            //ex = new FisException("CHK065", erpara);
                            //logger.Error(ex.mErrmsg, ex);
                            //throw ex;
                            if (!hasExceptStation.HasValue)
                            {
                                hasExceptStation = checkExceptStation();
                            }

                            if (!hasExceptStation.Value)
                            {
                                throw new FisException("CHK065", new string[] { tempPrintItem.LabelType });
                            }
                        }                       

                    }
                    else if (tempPrintItem.PrintMode == Bartender ||
                              tempPrintItem.PrintMode == BartenderSrv)
                    {
                        //PrintTemplate newTemplate = lblTypeRepository.GetPrintTemplate(tempPrintItem.TemplateName);
                        if (resolvePrintTemplate == null)
                        {
                            resolvePrintTemplate = new PrintUtility(session, ModelName(session), MONO(session), Dn(session), PartNo(session), Customer);
                        }
                        PrintTemplate newTemplate = resolvePrintTemplate.GetPrintTemplate(tempPrintItem.LabelType, tempPrintItem.RuleMode, tempPrintItem.PrintMode);
                        if (newTemplate != null)
                        {
                            //if (IsReprint)
                            //{
                            //    tempPrintItem.Piece = 1;
                            //}
                            //else
                            //{
                            tempPrintItem.Piece = newTemplate.Piece;
                            //}
                            tempPrintItem.TemplateName = newTemplate.TemplateName;
                            tempPrintItem.SpName = newTemplate.SpName;
                            resultPrintItemList.Add(tempPrintItem);
                        }
                        else if (NotExistException)
                        {
                           // var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                            //FisException ex;
                            //List<string> erpara = new List<string>();
                            //erpara.Add(tempPrintItem.TemplateName);
                            //ex = new FisException("CHK064", erpara);
                            ////logger.Error(ex.mErrmsg, ex);
                            //throw ex;
                            if (!hasExceptStation.HasValue)
                            {
                                hasExceptStation = checkExceptStation();
                            }

                            if (!hasExceptStation.Value)
                            {
                                throw new FisException("CHK065", new string[] { tempPrintItem.LabelType });
                            }
                        }
                    }
                    #endregion
                }

                if (resultPrintItemList.Count == 0 & !NotExistException)
                {
                    //var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                    //FisException ex;
                    //List<string> erpara = new List<string>();
                    //ex = new FisException("CHK065",new string[]{""});
                    ////logger.Error(ex.mErrmsg, ex);
                    //throw ex;
                    if (!hasExceptStation.HasValue)
                    {
                        hasExceptStation = checkExceptStation();
                    }

                    if (!hasExceptStation.Value)
                    {
                        throw new FisException("CHK065", new string[] { string.Join(",", printItemList.Select(x => x.LabelType + "/" + x.TemplateName).ToArray()) });
                    }         
                }

                session.AddValue(Session.SessionKeys.PrintItems, resultPrintItemList);

                #region write print log
                if (this.IsWritePrintLog && resultPrintItemList != null && resultPrintItemList.Count > 0)
                {
                    ActivityCommonImpl utl = ActivityCommonImpl.Instance;
                    var rep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
                    var reprintRep = RepositoryFactory.GetInstance().GetRepository<IReprintLogRepository, ReprintLog>();
                    string descrMsg= "Line:{0} PrintMode:{1} SPName:{2} Pieces:{3}";
                    string reasonMsg = "Template:{0}";
                    string begNo = utl.GetPrintLogBegNoValue(session, this.PrintLogBegNo, this.SessionBegNoName);
                    string endNo = utl.GetPrintLogEndNoValue(session,this.SessionEndNoName);
                    begNo = begNo ?? session.Key;
                    endNo = endNo ?? session.Key;
                    foreach (PrintItem item in resultPrintItemList)
                    {
                        if (this.IsReprint)
                        {
                            var log = new ReprintLog
                            {
                                LabelName = item.LabelType,
                                BegNo = begNo,
                                EndNo =endNo,
                                Descr = string.Format(descrMsg,
                                                                    this.Line?? "",
                                                                    item.PrintMode.ToString(),
                                                                    item.SpName,
                                                                    item.Piece.ToString()),
                                Reason = session.GetValue(Session.SessionKeys.Reason) as string ,
                                Editor = this.Editor
                            };
                            if (string.IsNullOrEmpty(log.Reason))
                            {
                                log.Reason = string.Format(reasonMsg, item.TemplateName);
                            }
                            else
                            {
                                log.Reason = log.Reason +" "+ string.Format(reasonMsg, item.TemplateName);
                            }
                            reprintRep.Add(log, session.UnitOfWork);
                        }
                        else
                        {
                            var log = new PrintLog
                            {
                                LabelTemplate = item.TemplateName,
                                Station = this.Station,
                                Name = item.LabelType,
                                BeginNo = begNo,
                                EndNo = endNo,
                                Descr = string.Format(descrMsg,
                                                                    this.Line ?? "",
                                                                    item.PrintMode.ToString(),
                                                                    item.SpName,
                                                                    item.Piece.ToString()),
                                Editor = this.Editor
                            };

                            rep.Add(log, session.UnitOfWork);
                        }
                    }
                }
                #endregion
            }
            //Vincent disable code don't Change printitem object or not
            //else
            //{
            //   // var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //    FisException ex;
            //    List<string> erpara = new List<string>();
            //    ex = new FisException("CHK066", erpara);
            //   // logger.Error(ex.mErrmsg, ex);
            //    throw ex;
            //}
            return base.DoExecute(executionContext);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 產生Carton NO號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        { 
            string ctno = (string)CurrentSession.GetValue("CTNO");
            int qty = (int)CurrentSession.GetValue("QTY");
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //获取Part.PartNo 和 Part.Descr
            //条件:Part.PartNo = PartInfo.PartNo and PartInfo.InfoValue=Left([CT No],5)
            //限制:Top 1
            //若Part.PartNo不存在,则报错:“错误的CT No”

            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            PartInfo cond = new PartInfo();
            cond.PN = ctno.Substring(0, 5);
            IList<PartInfo> partList = partRep .GetPartInfoList(cond);                 
            PartInfo partinfo = partList[0];
            IPart part = partRep.Find(partinfo.PN);
                

            //Generate New CT No
            //方法:原[CT No] + 流水码
            //数量:Qty
            //流水码规则:
            //3位
            //31进制:0123456789BCDFGHJKLMNPQRSTVWXYZ
            //从000开始
            // 若为’ZZZ’,则报错:“流水号已用完”
            //[CT No]为前缀,若[CT No]改变,则流水码从000开始
            try
            {
                string newCtno = "";
                string maxnum = "";
                string prestr = "";
                bool addflag = false;
    
                prestr = ctno;
                // 自己管理事务开始
                //SqlTransactionManager.Begin();
                //IUnitOfWork uof = new UnitOfWork();//使用自己的UnitOfWork

                //从NumControl中获取流水号
                //GetMaxNumber
                INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                MathSequenceWithCarryNumberRule marc = new MathSequenceWithCarryNumberRule(3, "0123456789BCDFGHJKLMNPQRSTVWXYZ");

                NumControl maxObj = numControl.GetMaxNumberObj("CTNO", prestr + "{0}");
                if (maxObj != null)
                    maxnum = maxObj.Value;

                if (string.IsNullOrEmpty(maxnum))
                {
                    maxnum = "000";
                    addflag = true;
                }
                else
                {

                    string numstr = maxnum.Substring(maxnum.Length - 3);
                    long diff = marc.CalculateDifference(numstr,"ZZZ");
                    if (numstr.ToUpper() == "ZZZ" || diff < qty)
                    {
                        FisException fe = new FisException("CHK867", new string[] { });   //流水号已满!
                        throw fe;
                    }

                    numstr = marc.IncreaseToNumber(numstr, 1);
                    maxnum = numstr;
                }

                newCtno = ctno + maxnum.ToUpper();

                NumControl item = null;// new NumControl();
                if (addflag)
                {
                    item = new NumControl();
                    item.NOType = "CTNO";
                    item.Value = newCtno;
                    item.NOName = "";
                    item.Customer = "HP";
                }
                else
                {
                    item = maxObj;
                    item.Value = newCtno;
                }

                int count = 1;
                IPrintLogRepository printRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
                IList<string> ctnoList = new List<string>(); 
                while(count <= qty)
                {
                    ctnoList.Add(item.Value);
                    numControl.SaveMaxNumber(item, addflag);

                    //Insert PartSN
                    //IECSN:产生的18位CT No
                    //IECPn:Step2中获取的Part.PartNo
                    //PartType:Step2中获取的Part.Descr
                    //VendorSN:输入的15码的[CT No]
                    IPartSnRepository partsnRep = RepositoryFactory.GetInstance().GetRepository<IPartSnRepository, PartSn>();
                    //PartSn(string iecSn, string iecPn, string type, string vendorSn, string vendorDCode, string vCode, string pn151, string editor, string dateCode);
                    PartSn partSn = new PartSn(newCtno, part.PN, part.Descr,ctno,"","","",this.Editor,"");
                    partsnRep.Add(partSn,CurrentSession.UnitOfWork);

                    //Insert PrintLog
                    //Name=’RCTO CT Label’
                    //BegNo=Begin [CT No]
                    //EndNo=End [CT No]
                    //Descr=[Qty]
                    var log = new PrintLog
                    {
                        Name = "RCTO CT Label",
                        BeginNo = newCtno,
                        EndNo = newCtno,
                        Descr = Convert.ToString(qty),
                        Editor = this.Editor
                    };
                    printRep.Add(log, CurrentSession.UnitOfWork);

                    //get next
                    count++;
                    addflag = false;
                    maxnum = marc.IncreaseToNumber(maxnum, 1);
                    newCtno = ctno + maxnum.ToUpper();
                    item = maxObj;
                    item.Value = newCtno;
                }             
                //uof.Commit();  //立即提交UnitOfWork更新NumControl里面的最大值
                //SqlTransactionManager.Commit();//提交事物,释放行级更新锁 
             
                CurrentSession.AddValue("CTNOList", ctnoList);
                
            }
            catch (Exception)
            {
                //SqlTransactionManager.Rollback();
                throw;
            }
            finally
            {
                //SqlTransactionManager.Dispose();
                //SqlTransactionManager.End();
            }
            
            return base.DoExecute(executionContext);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 产生Asset SN
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currenProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            var Custsn = (string)CurrentSession.GetValue(Session.SessionKeys.CustSN);

            PrintLog condition = new PrintLog();
            condition.Name = "AT";
            condition.BeginNo = currenProduct.ProId;
            //ITC-1360-1619, Jessica Liu, 2012-4-9
            //condition.Descr = "ATSN3";
            //ITC-1413-0012, Jessica Liu, 2012-6-21
            //condition.Descr = "ATSN";

            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            IList<PrintLog> printLogList = repository.GetPrintLogListByCondition(condition);

            //FisException ex;
            List<string> erpara = new List<string>();
            if (printLogList.Count == 0)
            {
                erpara.Add(Custsn);
                throw new FisException("CHK206", erpara);
            }
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, currenProduct.ProId);

            //ITC-1413-0012, Jessica Liu, 2012-6-15
            /*
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, printLogList[0].EndNo);

            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "AT");
            
            //ITC-1360-1619, Jessica Liu, 2012-4-9
            //CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, "ATSN3");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, "ATSN");
            */
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, currenProduct.ProId);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "AT");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, printLogList[0].EndNo);

            return base.DoExecute(executionContext);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 获取DCode
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
            IPizzaRepository pizzaRep = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
            ICOAStatusRepository coaRep = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();
            IPrintLogRepository printLogRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();

            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            Delivery curDn = (Delivery)CurrentSession.GetValue(Session.SessionKeys.Delivery);
            string pizzaID = (string)CurrentSession.GetValue(Session.SessionKeys.PizzaID);
            string coaSN = (string)CurrentSession.GetValue(Session.SessionKeys.COASN);
            string curEditor = "";
            string curStation = "";

            if (!string.IsNullOrEmpty(this.Editor))
            {
                curEditor = this.Editor;
            }
            if (!string.IsNullOrEmpty(this.Station))
            {
                curStation = this.Station;
            }

            if (!curProduct.IsBT)
            {
                //Update Product – Combine DN
                //Product.DeliveryNo – Delivery No (from UI)
                bool bindFlag = false;
                curProduct.DeliveryNo = curDn.DeliveryNo;
                Delivery newDn = null;
                IList<string> proList = new List<string>();
                proList.Add(curProduct.ProId);
                bindFlag = productRep.BindDN(curDn.DeliveryNo, proList, curDn.Qty);
                while (!bindFlag)
                {
                    newDn = GetNextDelivery(curProduct);
                    if (newDn == null)
                    {
                        FisException fe = new FisException("PAK103", new string[] { });   //没找到可分配的delivery
                        throw fe;
                    }
                    else
                    {
                        bindFlag = productRep.BindDN(newDn.DeliveryNo, proList, newDn.Qty);
                    }
                }
                if (newDn != null)
                {
                    curDn = newDn;
                    curProduct.DeliveryNo = curDn.DeliveryNo;
                    CurrentSession.AddValue(Session.SessionKeys.Delivery, curDn);
                }

                int dvQty = productRep.GetCombinedQtyByDN(curDn.DeliveryNo);
                if (dvQty == curDn.Qty)
                {
                    curDn.Status = "87";
                    deliveryRep.Update(curDn, CurrentSession.UnitOfWork);
                }
            }

            //3.	如果有绑定COA,则需要完成如下操作
            //a)	Insert Product_Part - Combine COA 
            //b)	Update COAStatus - Update COA Status
            //      COAStatus.Status = 'A1'
            //c)	Insert COALog – Insert COA Log
            //      COASN – COA
            //      Line – 当前绑定的Customer S/N
            //      Station – 'A1'
            if (!string.IsNullOrEmpty(coaSN))
            {
                ProductPart coaPart = (ProductPart)CurrentSession.GetValue("COAPart");
                IPart bomPart = (IPart)CurrentSession.GetValue("COABOMPart");
                COAStatus reCOA = coaRep.Find(coaSN);

                IProductPart bindPart = new ProductPart();
                bindPart.ProductID = curProduct.ProId;
                bindPart.PartID = bomPart.PN;
                bindPart.PartSn = coaSN;
                bindPart.Cdt = DateTime.Now;
                bindPart.BomNodeType = "P1";
                bindPart.PartType = bomPart.Type;
                bindPart.CustomerPn = bomPart.CustPn;
                bindPart.Editor = curEditor;
                bindPart.Station = curStation;
                bindPart.CheckItemType = "";
                bindPart.Iecpn = "";
                curProduct.AddPart(bindPart);

                reCOA.Status = "A1";
                reCOA.Editor = curEditor;
                coaRep.UpdateCOAStatusDefered(CurrentSession.UnitOfWork, reCOA);

                COALog newItem = new COALog();
                newItem.COASN = coaSN;
                newItem.LineID = curProduct.CUSTSN;
                newItem.Editor = Editor;
                newItem.StationID = "A1";
                newItem.Tp = "";
                coaRep.InsertCOALogDefered(CurrentSession.UnitOfWork, newItem);
            }

            //7.Insert IMES_PAK..Pizza / IMES_PAK..PizzaStatus / 
            //IMES_PAK..Pizza.MMIID = ''
            //IMES_PAK..PizzaStatus.Station = '00'

            Pizza CurrentPizza = new Pizza();
            PizzaStatus currentPizzaStatus = new PizzaStatus();

            currentPizzaStatus.Editor = this.Editor;
            if (null == this.Line)
            {
                currentPizzaStatus.LineID = "";
            }
            else
            {
                currentPizzaStatus.LineID = this.Line;
            }
            currentPizzaStatus.PizzaID = pizzaID;
            currentPizzaStatus.StationID = "00";

            CurrentPizza.PizzaID = pizzaID;
            CurrentPizza.MMIID = "";
            CurrentPizza.Status = currentPizzaStatus;

            pizzaRep.Add(CurrentPizza, CurrentSession.UnitOfWork);

            //8.Update Product – Combine Pizza Id
            //Product.PizzaID – Pizza ID         
            curProduct.PizzaID = pizzaID;
            productRep.Update(curProduct, CurrentSession.UnitOfWork);

            //Model 的第10,11码是”29” 或者”39” 的产品是出货日本的产品;否则,是非出货日本的产品
            string jpmodel = curProduct.Model.Substring(9, 2);
            bool jpflag = false;

            if (jpmodel == "29" || jpmodel == "39")
            {
                jpflag = true;
            }

            //IMES_GetData..PrintLog
            var item = new PrintLog
            {
                Name = "PIZZA Label-1",
                BeginNo = curProduct.CUSTSN,
                EndNo = curProduct.CUSTSN,
                Descr = "PIZZA Label-1",
                Editor = this.Editor
            };

            printLogRep.Add(item, CurrentSession.UnitOfWork);

            //出货日本在列印列印Pizza Label 后,还需要列印Japan Pizza Label 
            if (jpflag)
            {
                var jitem = new PrintLog
                {
                    Name = "PIZZA Label-2",
                    BeginNo = curProduct.CUSTSN,
                    EndNo = curProduct.CUSTSN,
                    Descr = "PIZZA Label-2",
                    Editor = this.Editor
                };
                printLogRep.Add(jitem, CurrentSession.UnitOfWork);
            }
            if (curProduct.IsBT)
            {
                var btitem = new PrintLog
                {
                    Name = "BT COO Label",
                    BeginNo = curProduct.CUSTSN,
                    EndNo = curProduct.CUSTSN,
                    Descr = "BT COO Label",
                    Editor = this.Editor
                };
                printLogRep.Add(btitem, CurrentSession.UnitOfWork);
            }
            CurrentSession.AddValue("JPFlag", jpflag);

            return base.DoExecute(executionContext);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 检查MBSN是否正确
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string mbSno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN);

            PrintLog condition = new PrintLog();
            condition.Name = "RCTO MB Label";
            condition.BeginNo = mbSno;

            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            IList<PrintLog> printLogList = repository.GetPrintLogListByCondition(condition);

            List<string> erpara = new List<string>();
            //ITC-1428-0010, Jessica Liu, 2012-9-7
            if (printLogList == null || printLogList.Count == 0)
            {
                erpara.Add(mbSno);
                throw new FisException("CHK904", erpara);      //错误的MBSN
            }

            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "RCTO MB Label");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, mbSno);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, mbSno);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, "Reprint");

            return base.DoExecute(executionContext);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 根据BegNo,EndNo,Name获取PrintLog对象
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            FisException ex;
            List<string> erpara = new List<string>();
            
            CurrentSession.AddValue(Session.SessionKeys.isPassStationLog,false);

            var iPrintRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            IList<PrintLog> PrintLogList = new List<PrintLog>();

            if (string.IsNullOrEmpty(this.PrintLogName))
            {
                FisException fe = new FisException("PAK031", new string[] { });  //请输入PrintLogName!
                throw fe;
            }

            string key = "";
            switch (PrintNoType)
            {
                case TypeEnum.MB:
                    key = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN);
                    break;
                case TypeEnum.Product:
                    Product currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product));
                    key = currentProduct.ProId;
                    break;
                case TypeEnum.CustSN:
                    key = (string)CurrentSession.GetValue(Session.SessionKeys.CustSN);
                    break;
                case TypeEnum.Pallet:
                    if (((Pallet)CurrentSession.GetValue(Session.SessionKeys.Pallet)) != null)
                    {
                        Pallet currentPallet = ((Pallet)CurrentSession.GetValue(Session.SessionKeys.Pallet));
                        key = currentPallet.PalletNo;
                    }
                    else key = (string)CurrentSession.GetValue(Session.SessionKeys.PalletNo);
                    break;
                default:
                    break;
            }

            Boolean exitFlag = false;
            if (!string.IsNullOrEmpty(this.PrintLogName) && !string.IsNullOrEmpty(this.BegNo) && !string.IsNullOrEmpty(this.EndNo))
            {
                PrintLog condition = new PrintLog();
                condition.BeginNo = this.BegNo;
                condition.EndNo = this.EndNo;
                condition.Name = this.PrintLogName;

                PrintLogList = iPrintRepository.GetPrintLogListByCondition(condition);
               
                if (PrintLogList.Count > 0)
                {
                    exitFlag = true;
                }
            }

            else if (!string.IsNullOrEmpty(key))
            {
                PrintLogList = iPrintRepository.GetPrintLogListByRange(key);
                if (PrintLogList.Count > 0)
                {
                    foreach (PrintLog iprlog in PrintLogList)
                    {
                        if (iprlog.Name == this.PrintLogName)
                        {
                            exitFlag = true;
                            break;
                        }
                    }
                }
            }

            if (!exitFlag)
            {
                 erpara.Add(this.PrintLogName);
                 erpara.Add(key);
                 ex = new FisException("SFC019", erpara);    //没有该%1 的打印记录,请确认该序号%2 是否正确!
                 throw ex;
            }

            
            CurrentSession.AddValue(Session.SessionKeys.isPassStationLog, true);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogList, PrintLogList);
            
            return base.DoExecute(executionContext);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 產生CustomerSN號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        {
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            IProductRepository ipr = RepositoryFactory.GetInstance().GetRepository< IProductRepository, IProduct>();

            
        
            string custSn = string.Empty;
   
            custSn = CurrentSession.GetValue(Session.SessionKeys.CustSN).ToString();
            ////Check new CustSN is existing or not
            //var testProduct = ipr.GetProductByCustomSn(custSn);
            //if (testProduct != null)
            //{
            //    List<string> param = new List<string>();
            //    param.Add(custSn);
            //    throw new FisException("GEN046", param);
            //}
             
            ////Check new CustSN is existing or not



            product.CUSTSN = custSn;
         
            ipr.Update(product, CurrentSession.UnitOfWork);
            // For Write Print Log........
          
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName,this.Customer + "SNO");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo,custSn);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo,custSn);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr,CurrentSession.GetValue(Session.SessionKeys.ModelName));


            var item = new  PrintLog
            {
                Name = CurrentSession.GetValue(Session.SessionKeys.PrintLogName).ToString(),
                BeginNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogBegNo).ToString(),
                EndNo = CurrentSession.GetValue(Session.SessionKeys.PrintLogEndNo).ToString(),
                Descr = CurrentSession.GetValue(Session.SessionKeys.PrintLogDescr).ToString(),
                Editor = this.Editor
            };
            var repository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            repository.Add(item, CurrentSession.UnitOfWork);
          


            return base.DoExecute(executionContext);
        }