示例#1
0
        private ArrayList GetMBNoList(string beginNo, string endNo)
        {
            FisException ex;
            string strSQL = "select PCBNo, SMTMO from PCB where PCBNo between @beginNo and @endNo";
            List<string> relLst = new List<string>();
            List<string> _111Lst = new List<string>();
            SqlParameter paraName = new SqlParameter("@beginNo", SqlDbType.VarChar, 32);
            paraName.Direction = ParameterDirection.Input;
            paraName.Value = beginNo;
            SqlParameter paraName2 = new SqlParameter("@endNo", SqlDbType.VarChar, 32);
            paraName2.Direction = ParameterDirection.Input;
            paraName2.Value = endNo;
            SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionString_GetData,
                                      System.Data.CommandType.Text,
                                      strSQL, paraName, paraName2);
            var mbModelRepository = (IMBModelRepository)RepositoryFactory.GetInstance().GetRepository<IMBModelRepository, IMBModel>();
            MBRepository mbRepository = new MBRepository();
            IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo();
            bool bFirst = true;
            bool bCheckPass = true;
            string STMMO = "";
            List<string> erpara = new List<string>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    if (bFirst)
                    {
                        STMMO = dr["SMTMO"].ToString();
                        bFirst = false;
                        erpara.Add(STMMO);
                    }
                    else
                    {
                        if (STMMO != dr["SMTMO"].ToString())
                        {
                            bCheckPass = false;
                            erpara.Add(dr["SMTMO"].ToString());
                            break;
                        }
                    }
                  relLst.Add(dr[0].ToString());
                  mbInfo = mbRepository.GetMBInfo(dr[0].ToString());
                  MBModel model = (MBModel)mbModelRepository.Find(mbInfo._111LevelId);
                  _111Lst.Add(mbInfo._111LevelId);
                }
            
            }

            if (!bCheckPass)
            {
                ex = new FisException("SFC012",erpara);
                throw ex;
            }
            ArrayList retrunValue = new ArrayList();
            retrunValue.Add(relLst);
            retrunValue.Add(_111Lst);
            return retrunValue;
        
        }
示例#2
0
        public void Reprint(
       string startMBSNo,
       string endMBSNo,
       string reason,
       string editor, string stationId, string customerId)
        {
            logger.Debug("(MBLabelReprint)Reprint start, startMBSno:" + startMBSNo + "endMBSno:" + endMBSNo + " Reason:" + reason + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);

            FisException ex;
            List<string> erpara = new List<string>();
            IList<PrintItem> printList;
            try
            {
                string sessionKey = startMBSNo;
                int Qty = Convert.ToInt32(endMBSNo) - Convert.ToInt32(startMBSNo) + 1;
                Session Session = SessionManager.GetInstance.GetSession(sessionKey, theType);

                if (Session == null)
                {
                    Session = new Session(sessionKey, theType, editor, stationId, "", customerId);

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

                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", stationId);
                    wfArguments.Add("CurrentFlowSession", Session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("Customer", customerId);
                    wfArguments.Add("SessionType", theType);

                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(stationId, "002MBLabelReprint.xoml", null, out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);


                    //WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("002MBLabelReprint.xoml", null, wfArguments);
                    MBRepository mbRepository = new MBRepository();
                    IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo();
                    mbInfo = mbRepository.GetMBInfo(startMBSNo);


                    Session.AddValue(Session.SessionKeys.Qty, Qty);
                    Session.AddValue(Session.SessionKeys.DateCode, "");
                    Session.AddValue(Session.SessionKeys.motherOrChild, "0");
                    Session.AddValue(Session.SessionKeys.MBMONO, mbInfo.SMTMOId);
                    Session.AddValue(Session.SessionKeys.ModelName, mbInfo._111LevelId);
                    //  Session.AddValue(Session.SessionKeys.PrintItems, printItems);

                    //MB mb = new MB();
                    //mb.Model = _111;

                    var mbModelRepository = (IMBModelRepository)RepositoryFactory.GetInstance().GetRepository<IMBModelRepository, IMBModel>();
                    MBModel model = (MBModel)mbModelRepository.Find(mbInfo._111LevelId);

                    Session.AddValue(Session.SessionKeys.MBCode, model.Mbcode);
                    Session.AddValue(Session.SessionKeys.MBType, model.Type);

                    Session.SetInstance(instance);
                    //for generate MB no

                    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;
                }

                var MBNOList = (IList<string>)Session.GetValue(Session.SessionKeys.MBNOList);

                // startProdIdAndEndProdId = MBNOList;
                //startProdIdAndEndProdId.add(MBNOList[0]);
                //startProdIdAndEndProdId.Add(MBNOList[MBNOList.Count - 1]);

                IList<PrintItem> returnList = this.getPrintList(Session);
                // return returnList;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(MBLabelReprint)Reprint start, startMBSno:" + startMBSNo + "endMBSno:" + endMBSNo + " Reason:" + reason + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);

            }


        }