예제 #1
0
        public ArrayList InputFirstCustSn(string firstSn, string line, string editor, string station, string customer,string floor)
        {
            logger.Debug("(CombineCartonInDN)InputFirstCustSn start, custsn:" + firstSn + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retLst = new ArrayList();
            try
            {
                CheckQCStatus(firstSn);
                string sessionKey = firstSn;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                if (currentSession == null)
                {
                    currentSession = 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", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.AddValue(ExtendSession.SessionKeys.IsSameStation, false);     
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "CombineCartonInDN.xoml", "CombineCartonInDN.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentSession.AddValue(Session.SessionKeys.CustSN, firstSn);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.AddValue(Session.SessionKeys.Floor,floor);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                Product product = (Product)currentSession.GetValue(Session.SessionKeys.Product);
              
                S_BSam_Product sProduct = new S_BSam_Product();

                sProduct.CustomerSN = product.CUSTSN;
                sProduct.ProductID = product.ProId;
                sProduct.Model = product.Model;
                sProduct.Location = (string)product.GetAttributeValue("CartonLocation") ?? "";
                //(string)CurrentSession.GetValue("AllowUnpackCode") ?? "";
                Carton carton=(Carton)  currentSession.GetValue(Session.SessionKeys.Carton);
                S_BSam_Carton sCarton=new S_BSam_Carton();
                sCarton.CartonSN=carton.CartonSN;
                sCarton.ActualQty=carton.Qty.ToString();
                sCarton.FullQty=carton.FullQty.ToString();
                sCarton.PalletNo=carton.PalletNo;
                // IList<AvailableDelivery> selectedDNList = new List<AvailableDelivery>();
              //  CurrentSession.AddValue(ExtendSession.SessionKeys.AvailableDNList, selectedDNList);
                IList<AvailableDelivery> avaiDNLst = (IList<AvailableDelivery>)currentSession.GetValue(ExtendSession.SessionKeys.AvailableDNList);
                List<S_BSam_DN> sLstDN = new List<S_BSam_DN>();
                foreach (AvailableDelivery aDN in avaiDNLst)
                {
                    S_BSam_DN sDN = new S_BSam_DN();
                    sDN.DeliveryNo = aDN.DeliveryNo;
                    sDN.Model = aDN.Model;
                    sDN.ShipDate = aDN.ShipDate.ToString("yyyy-MM-dd") ;
                    sDN.Qty = aDN.Qty.ToString();
                    sDN.RemainQty = aDN.RemainQty.ToString();
                    sLstDN.Add(sDN);
                }

                retLst.Add(sProduct);
                retLst.Add(sCarton);
                retLst.Add(sLstDN);
                return retLst;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                //logger.Debug("(CombineCartonInDN)InputFirstSN, firstSn:" + firstSn );
            }


        }
예제 #2
0
        public ArrayList InputFirstCustSn(string firstSn, string line, string editor, string station, string customer,string floor)
        {
            logger.Debug("(CombineCartonInDN_BIRCH)InputFirstCustSn start, custsn:" + firstSn + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retLst = new ArrayList();
            try
            {
                CheckQCStatus(firstSn);
                string sessionKey = firstSn;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                if (currentSession == null)
                {
                    currentSession = 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", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.AddValue(ExtendSession.SessionKeys.IsSameStation, false);     
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "CombineCartonInDN_BIRCH.xoml", "CombineCartonInDN_BIRCH.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentSession.AddValue(Session.SessionKeys.CustSN, firstSn);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.AddValue(Session.SessionKeys.Floor,floor);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                Product product = (Product)currentSession.GetValue(Session.SessionKeys.Product);
                currentSession.AddValue("FirstModelInCombineCarton", product.Model);
                S_BSam_Product sProduct = new S_BSam_Product();

                sProduct.CustomerSN = product.CUSTSN;
                sProduct.ProductID = product.ProId;
                sProduct.Model = product.Model;
                sProduct.Location = (string)product.GetAttributeValue("CartonLocation") ?? "";
                sProduct.DeliveryNo = product.DeliveryNo;
                //(string)CurrentSession.GetValue("AllowUnpackCode") ?? "";
                Carton carton=(Carton)  currentSession.GetValue(Session.SessionKeys.Carton);
                S_BSam_Carton sCarton=new S_BSam_Carton();
                sCarton.CartonSN=carton.CartonSN;
                sCarton.ActualQty=carton.Qty.ToString();
                sCarton.FullQty=carton.FullQty.ToString();
                sCarton.PalletNo=carton.PalletNo;
                // IList<AvailableDelivery> selectedDNList = new List<AvailableDelivery>();
              //  CurrentSession.AddValue(ExtendSession.SessionKeys.AvailableDNList, selectedDNList);
                IList<AvailableDelivery> avaiDNLst = (IList<AvailableDelivery>)currentSession.GetValue(ExtendSession.SessionKeys.AvailableDNList);
                List<S_BSam_DN> sLstDN = new List<S_BSam_DN>();
                foreach (AvailableDelivery aDN in avaiDNLst)
                {
                    S_BSam_DN sDN = new S_BSam_DN();
                    sDN.DeliveryNo = aDN.DeliveryNo;
                    sDN.Model = aDN.Model;
                    sDN.ShipDate = aDN.ShipDate.ToString("yyyy-MM-dd") ;
                    sDN.Qty = aDN.Qty.ToString();
                    sDN.RemainQty = aDN.RemainQty.ToString();
                    sLstDN.Add(sDN);
                }
                bool isMRP = CheckIsMRP(product.DeliveryNo);
                string templatename = "";
                if (isMRP)
                {
                    IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
                    IList<string> docnumList = repPizza.GetDocSetNumListFromPakDashPakComnByLikeInternalID(product.DeliveryNo.Substring(0, 10));
                    //SELECT @templatename = XSL_TEMPLATE_NAME 	FROM [PAK.PAKRT] WHERE DOC_CAT = @doctpye AND DOC_SET_NUMBER = @doc_set_number
                    if (docnumList.Count > 0)
                    {
                        IList<string> tempList = repPizza.GetXslTemplateNameListFromPakDashPakComnByDocCatAndDocSetNumer("Box Ship Label_Over Pack_Gift Box", docnumList[0]);
                        if (tempList.Count > 0)
                            templatename = tempList[0];
                    }
                }
                int qtyPerCarton=0;
                if (avaiDNLst.Count > 0)
                {
                    qtyPerCarton = avaiDNLst[0].QtyPerCarton;
                }
                retLst.Add(sProduct);
                retLst.Add(sCarton);
                retLst.Add(sLstDN);
                retLst.Add(qtyPerCarton);
                retLst.Add(isMRP);
                retLst.Add(templatename);
            //    retLst.Add(product.DeliveryNo);
                return retLst;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                //logger.Debug("(CombineCartonInDN)InputFirstSN, firstSn:" + firstSn );
            }


        }