Ejemplo n.º 1
0
    private void BindPrdGrv(S_BSam_Product sProduct)
    {
        string[] header = productTableHeader.Split(',');
        DataTable dt = new DataTable();
        int k = 0;
        foreach (string s in header)
        {
            dt.Columns.Add(s, Type.GetType("System.String"));
            grvProduct.Columns[k].HeaderText = s;
            k++;
        }
        DataRow newRow ;
        newRow = dt.NewRow();
        newRow["Product ID"] = sProduct.ProductID;
        newRow["Custromer SN"] = sProduct.CustomerSN;
        newRow["Model"] = sProduct.Model;
        newRow["DeliveryNo"] = sProduct.DeliveryNo;
        newRow["Location"] = sProduct.Location;
 
        dt.Rows.Add(newRow);
        for (int i = 0; i < initProductTableRowsCount - 1;i++ )
        {
            newRow = dt.NewRow();
            newRow["Product ID"] = "";
            newRow["Custromer SN"] = "";
            newRow["Model"] = "";
            newRow["Location"] = "";
            dt.Rows.Add(newRow);

        }
        grvProduct.DataSource = dt;
        grvProduct.DataBind();
        IniGrvWidth();
    
    
    }
Ejemplo n.º 2
0
        public ArrayList InputCustSn(string firstSn, string custSn)
        {
            ArrayList retLst = new ArrayList();
            logger.Debug("(CombineCartonInDN)InputCustSn start, first custsn:" + firstSn + " custsn:" + custSn);
            try
            {
                // IMES.FisObject.FA.Product.IProduct
                FisException ex;
                List<string> erpara = new List<string>();
                string sessionKey = firstSn;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                CheckQCStatus(firstSn);

                if (currentSession == null)
                { 
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK021", erpara);
                    throw ex;
                }
                else
                {
                 
                    IMES.FisObject.FA.Product.IProduct product = CommonImpl.GetProductByInput(custSn, CommonImpl.InputTypeEnum.CustSN);
                    if (product==null)
                    {
                        erpara.Add(custSn);
                        ex = new FisException("CHK152", erpara);    //this Customer SN %1 is invalid , please rescan!
                        throw ex;
                    }
                    currentSession.AddValue(Session.SessionKeys.Product, product);
                    currentSession.Exception = null;
                    currentSession.SwitchToWorkFlow();

                    if (currentSession.Exception != null)
                    {
                        if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                        {
                            currentSession.ResumeWorkFlow();
                        }
                        throw currentSession.Exception;
                    }
                    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") ?? "";
                    retLst.Add(sProduct);
                    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 );
            }

        }
Ejemplo n.º 3
0
        public ArrayList InputCustSn(string custSn, string line, string editor, string station, string customer,string weight)
        {
            logger.Debug("(CartonWeight)InputFirstCustSn start, custsn:" + custSn + "pdLine:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();
            try
            {

                string sessionKey = custSn;
               // CheckQCStatus(custSn);
                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.CustSN, custSn);
                    currentSession.AddValue(ExtendSession.SessionKeys.ActualCartonWeight, decimal.Parse(weight));
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "CartonWeight.xoml", "CartonWeight.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

           
                    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;
                }
                Carton carton = (Carton)currentSession.GetValue(Session.SessionKeys.Carton);
                IList<IMES.FisObject.FA.Product.IProduct> prodList = currentSession.GetValue(Session.SessionKeys.ProdList) as IList<IMES.FisObject.FA.Product.IProduct>;
                string boxid = carton.BoxId;
                ArrayList retLst = new ArrayList();
                retLst.Add(carton.CartonSN);
                string dnNo = prodList[0].DeliveryNo;
                IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                Delivery dnObj= deliveryRep.Find(dnNo);
                string flag = (string)dnObj.GetExtendedProperty("Flag");
                if (!string.IsNullOrEmpty(flag) && flag== "N")
                { retLst.Add(boxid); }
                else
                { retLst.Add(""); }
               
                retLst.Add(carton.Model);
             
                object obj = currentSession.GetValue(Session.SessionKeys.StandardWeight);
                string w = "";
                if (obj != null)
                { w = obj.ToString(); }
                retLst.Add(w);//Standard Weight
                List<string> prdLst = new List<string>();
               
                List<S_BSam_Product> lstSprd = new List<S_BSam_Product>();
                foreach (IMES.FisObject.FA.Product.IProduct product in prodList)
                {
                    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") ?? "";
                    lstSprd.Add(sProduct);
                }
                retLst.Add(lstSprd);
                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 );
            }


        }
Ejemplo n.º 4
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 );
            }


        }
Ejemplo n.º 5
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 );
            }


        }