Beispiel #1
0
        public List <Wip> ListaMaquinaProceso(int proceso)
        {
            List <Wip> lista = new List <Wip>();
            Conexion   con   = new Conexion();
            SqlCommand cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Wip_ListMaquina";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Area", "Encuadernacion");
                cmd.Parameters.AddWithValue("@proceso", proceso);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Wip wp = new Wip();
                    wp.Maquina    = reader["Maquina"].ToString();
                    wp.ID_Control = reader["CodigoMaquina"].ToString();
                    lista.Add(wp);
                }
                con.CerrarConexion();
            }
            return(lista);
        }
        protected void txtCodigo_TextChanged(object sender, EventArgs e)
        {
            string codigo = txtCodigo.Text;
            Wip    wip    = wipControl.BuscarPallet_Wip(codigo);

            if (wip.OT != null)
            {
                DivMensaje.Visible = false;
                lblOT.Text         = wip.OT;
                lblNombreOT.Text   = wip.NombreOT;
                txtcantidad.Text   = wip.PliegosImpresos.ToString();
                txtPeso.Text       = wip.PesoPallet.ToString();
                btnGuardar.Visible = true;
                pnlDetalle.Visible = true;
                DivMensaje.Visible = false;
                txtcantidad.Focus();
            }
            else
            {
                btnGuardar.Visible = false;
                pnlDetalle.Visible = false;
                DivMensaje.Visible = true;
                DivMensaje.Attributes.Add("style", "background-color:Red");
                Image1.ImageUrl      = "../../Images/cross.png";
                lblMensaje.ForeColor = Color.White;
                lblMensaje.Text      = "Codigo de Pallet Incorrecto.";
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            string Codigo   = txtCodigo.Text.Trim();
            int    Cantidad = Convert.ToInt32(txtcantidad.Text.Trim());
            double Peso     = Convert.ToDouble(txtPeso.Text.Trim());
            Wip    wip      = wipControl.BuscarPallet_Wip(Codigo);

            if (wipControl.UpdatePallet(Codigo, Cantidad, Peso, lblNombre.Text))
            {
                if (wip.EstadoPallet == 6)
                {
                    EnvioCorreo("Sunipac", lblNombre.Text, Codigo);
                }
                else if (wip.EstadoPallet == 7)
                {
                    EnvioCorreo("Despacho Servico Externo", lblNombre.Text, Codigo);
                }
                Response.Redirect("Ajustar_Pallet.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
            }
            else
            {
                DivMensaje.Visible = true;
                DivMensaje.Attributes.Add("style", "background-color:Red");
                Image1.ImageUrl      = "../../Images/cross.png";
                lblMensaje.ForeColor = Color.White;
                lblMensaje.Text      = "Error al Conectar al Servidor.";
            }
        }
Beispiel #4
0
        /// <summary>
        /// Stores the point specified by (screenX, screenY) coordinates in the data structure.<br/>
        /// Determines the curve it belongs to according to the nearest last point of the curves existing.<br/>
        /// </summary>
        /// <param name="screenX"></param>
        /// <param name="screenY"></param>
        /// <param name="time">time in ms</param>
        public void AddInput(double screenX, double screenY, double distToWall, long time)
        {
            // transform screen coordinates
            double x;
            double y;

            adaptCoordinates(screenX, screenY, out x, out y);

            // update current position
            this.curX       = x;
            this.curY       = y;
            this.distToWall = distToWall;
            Boolean wasDrawing = this.isDrawing;

            this.isDrawing = distToWall < LIMIT_DIST_FOR_DRAWING;

            // check if there is a line to continue
            if (wasDrawing)
            {
                Wip w = curves.ElementAt(curves.Count - 1);
                if (time - w.time < DELTA_TIME && isPointWithinRange(x, y, w.lastPoint()))
                {
                    completeLine(w, x, y, time);
                    return;
                }
            }

            // new line
            insertNewLine(x, y, time);
        }
Beispiel #5
0
        public Wip BuscarWip_ControlPorCodigo(string Codigo, string TipoMaquina = "", string Usuario = "")
        {
            Wip        wip = new Wip();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Wip_Buscar_ControlPorCodigo";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Codigo", Codigo);
                cmd.Parameters.AddWithValue("@TipoMovil", TipoMaquina);
                cmd.Parameters.AddWithValue("@Usuario", Usuario);

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    wip.ID_Control     = reader["ID_Control"].ToString();
                    wip.Fecha_Creacion = Convert.ToDateTime(reader["Fecha_Creacion"].ToString());
                    wip.NombreOT       = reader["NombreOT"].ToString();
                    wip.OT             = reader["OT"].ToString();
                    wip.Usuario        = reader["Usuario_Creador"].ToString();
                    wip.Ubicacion      = reader["Ubicacion"].ToString();
                    wip.Posicion       = reader["Posicion"].ToString();
                    wip.ProxProceso    = reader["Prox_Proceso"].ToString();
                }
            }
            return(wip);
        }
Beispiel #6
0
        static void UpdateNextProcess(ProductProcess ProductProcess, int Accepted, WebApplication5Context db)
        {
            ProductProcess NextProductProcess = db.ProductProcesses.FirstOrDefault(q => q.Product.Code == ProductProcess.Product.Code && q.Order == ProductProcess.Order + 1);

            if (NextProductProcess != null)
            {
                //gets the next productprocess
                Wip nextw = db.Wips.FirstOrDefault <Wip>(e => e.ProductProcess.ID == NextProductProcess.ID);
                if (nextw == null)
                {
                    nextw = new Wip();
                    nextw.ProductProcess = NextProductProcess;
                    nextw.Input          = Accepted;
                    nextw.UpdatedAt      = DateTime.Now;
                    db.Wips.Add(nextw);
                }
                else
                {
                    db.Entry(nextw).State = EntityState.Modified;
                    nextw.UpdatedAt       = DateTime.Now;
                    //adds the previous accepter quantity
                    nextw.Input = nextw.Input + Accepted;
                }
            }
        }
Beispiel #7
0
        protected void txtCodigo_TextChanged(object sender, EventArgs e)
        {
            string codigo = txtCodigo.Text;
            Wip    wip    = wipControl.BuscarWip_ControlPorCodigo(codigo, "Movil", lblNombre.Text);

            if (wip.OT != null)
            {
                lblOT.Text         = wip.OT.ToUpper();
                lblNombreOT.Text   = wip.NombreOT;
                pnlDetalle.Visible = true;
                string[] str = wipControl.UbicacionSugLibre(wip.OT).Split(',');
                lblRecomendacion.Text = str[1];
                lblRecomUbi.Text      = str[0];
                btnGuardar.Visible    = true;
            }
            else
            {
                DivMensaje.Visible = true;
                DivMensaje.Attributes.Add("style", "background-color:Red");
                lblMensaje.Text      = "Error de Codigo. Vuelva a Intentarlos";
                lblMensaje.ForeColor = System.Drawing.Color.White;
                Image1.ImageUrl      = "../../Images/cross.png";
            }
            txtUbicacion.Focus();
        }
Beispiel #8
0
        public static void Calculate(ProductProcess ProductProcess, int Produced, int Rejected, WebApplication5Context db)
        {
            Wip w = db.Wips.FirstOrDefault <Wip>(q => q.ProductProcess.ID == ProductProcess.ID);

            if (w == null)
            {
                w = new Wip();

                w.ProductProcess = ProductProcess;
                w.Input          = Produced;
                w.Accepted       = Produced - Rejected;
                w.Rejected       = Rejected;
                w.UpdatedAt      = DateTime.Now;
                db.Wips.Add(w);
                UpdateNextProcess(ProductProcess, w.Accepted, db);
            }
            else
            {
                db.Entry(w).State = EntityState.Modified;
                w.ProductProcess  = ProductProcess;
                if (Produced <= w.Input)
                {
                    w.Input     = w.Input - Produced;
                    w.Accepted  = Produced - Rejected;
                    w.Rejected  = Rejected;
                    w.UpdatedAt = DateTime.Now;
                    UpdateNextProcess(ProductProcess, w.Accepted, db);
                }
            }
        }
Beispiel #9
0
        //Wip Persist
        internal static void WriteUnpegHistory(Wip item, string reason, FabStep mainStep)
        {
            Outputs.UnpegHistory hist = new Outputs.UnpegHistory();

            hist.VERSION_NO      = ModelContext.Current.VersionNo;
            hist.FACTORY_ID      = item.FACTORY_ID;
            hist.AREA_ID         = Constants.NULL_ID;
            hist.SHOP_ID         = item.SHOP_ID;
            hist.LOT_ID          = item.LOT_ID;
            hist.UNPEG_REASON    = reason;
            hist.REMAIN_QTY      = item.GLASS_QTY;
            hist.PRODUCT_ID      = item.PRODUCT_ID;
            hist.PRODUCT_VERSION = item.PRODUCT_VERSION;

            hist.PROCESS_ID = item.PROCESS_ID;
            hist.STEP_ID    = item.STEP_ID;

            if (mainStep != null)
            {
                hist.PROCESS_ID = mainStep.ProcessID;
                hist.STEP_ID    = mainStep.StepID;
            }

            hist.LOT_QTY    = item.PANEL_QTY;
            hist.HOLD_CODE  = item.HOLD_CODE;
            hist.LOT_STATUS = item.LOT_STATUS;

            hist.OWNER_TYPE = item.OWNER_TYPE;

            hist.WIP_PROCESS_ID = item.PROCESS_ID;
            hist.WIP_STEP_ID    = item.STEP_ID;
            hist.WIP_STATE      = item.LOT_STATUS;

            OutputMart.Instance.UnpegHistory.Add(hist);
        }
Beispiel #10
0
        /// <summary>
        /// </summary>
        /// <param name="entity"/>
        /// <returns/>
        public bool OnAfterLoad_Wip(Wip entity)
        {
            MicronBETestProduct product = FindHelper.FindProduct(entity.PRODUCT_ID);

            if (product == null)
            {
                return(false);
            }

            MicronBETestProcess process = FindHelper.FindProcess(entity.PROCESS_ID);

            if (process == null)
            {
                return(false);
            }

            MicronBETestWipInfo wipInfo = new MicronBETestWipInfo();

            wipInfo.LotID   = entity.LOT_ID;
            wipInfo.LineID  = entity.LINE_ID;
            wipInfo.Product = product;
            wipInfo.Process = process;

            wipInfo.UnitQty      = Convert.ToDouble(entity.LOT_QTY);
            wipInfo.InitialStep  = process.FindStep(entity.STEP_ID);
            wipInfo.CurrentState = FindHelper.FindLotState(entity.LOT_STATE);


            InputMart.Instance.MicronBETestWipInfo.Add(wipInfo.InitialStep.StepID, wipInfo);


            return(false);
        }
Beispiel #11
0
        public Wip BuscarPallet_Wip(string Codigo)
        {
            Wip        wip = new Wip();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Wip_BuscarPallet";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Codigo", Codigo);

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    wip.ID_Control      = reader["ID_Control"].ToString();
                    wip.NombreOT        = reader["NombreOT"].ToString();
                    wip.OT              = reader["OT"].ToString();
                    wip.Ubicacion       = reader["Ubicacion"].ToString();
                    wip.Posicion        = reader["Posicion"].ToString();
                    wip.PesoPallet      = Convert.ToDouble(reader["Peso_Pallet"].ToString());
                    wip.PliegosImpresos = Convert.ToInt32(reader["Pliegos_Impresos"].ToString());
                    wip.EstadoPallet    = Convert.ToInt32(reader["Estado_Pallet"].ToString());
                    wip.Tiraje          = Convert.ToInt32(reader["Total_Tiraje"].ToString());
                    wip.Pliego          = reader["Pliego"].ToString();
                    wip.Maquina         = reader["Maquina_Origen"].ToString();
                    wip.ProxProceso     = reader["Prox_Proceso"].ToString();
                }
            }
            return(wip);
        }
Beispiel #12
0
        private void insertNewLine(double x, double y, long time)
        {
            List <Point> line = new List <Point>();

            line.Add(new Point(x, y));
            Wip w = new Wip(line, time);

            curves.Enqueue(w);
        }
Beispiel #13
0
        private void completeLine(Wip w, double x, double y, long time)
        {
            // TODO: move w at the top of the window if handling drawing several lines at the same time

            Point lastPoint = w.lastPoint();

            // --- check that this is not the same point as the previous one
            if (lastPoint.x == x && lastPoint.y == y)
            {
                lastPoint.IncreaseSize();
                return;
            }

            // --- check that X coordinate is not a change of direction

            if (w.direction == NO_DIRECTION)
            {
                if (x > lastPoint.x)
                {
                    w.direction = LEFT_TO_RIGHT;
                }
                else
                {
                    w.direction = RIGHT_TO_LEFT;
                }
            }
            else if ((w.direction == LEFT_TO_RIGHT && x < lastPoint.x) || (w.direction == RIGHT_TO_LEFT && x > lastPoint.x))
            {
                // if change of direction, begin a new line
                insertNewLine(x, y, time);
                return;
            }

            // add the new point ...
            // --- if the three last points are aligned: remove the current last point before adding the new one
            Point  lastBoPoint = w.lastBoPoint();
            double coef1       = (double)(y - lastBoPoint.y) / (double)(x - lastBoPoint.x);
            double coef2       = (double)(lastPoint.y - lastBoPoint.y) / (double)(lastPoint.x - lastBoPoint.x);

            if (Math.Abs(1 - coef1 / coef2) < 0.05)
            {
                w.line.Remove(lastPoint);
            }

            Point newPoint = new Point(x, y);

            if (w.direction == LEFT_TO_RIGHT || w.direction == NO_DIRECTION)
            {
                w.line.Add(newPoint);
            }
            else
            {
                w.line.Insert(0, newPoint);
            }
        }
Beispiel #14
0
        private bool IsUnpredictWip(Wip item)
        {
            string shopID = item.SHOP_ID;

            ICollection <UnpredictWip> stepList;

            if (InputMart.Instance.UnpredictWips.TryGetValue(UnpredictType.STEP, out stepList))
            {
                if (IsMatched_UnpredictWip(stepList, shopID, item.STEP_ID))
                {
                    return(true);
                }
            }

            ICollection <UnpredictWip> lotList;

            if (InputMart.Instance.UnpredictWips.TryGetValue(UnpredictType.LOT, out lotList))
            {
                if (IsMatched_UnpredictWip(lotList, shopID, item.LOT_ID))
                {
                    return(true);
                }
            }

            ICollection <UnpredictWip> cstList;

            if (InputMart.Instance.UnpredictWips.TryGetValue(UnpredictType.CASSETTE, out cstList))
            {
                if (IsMatched_UnpredictWip(cstList, shopID, item.BATCH_ID))
                {
                    return(true);
                }
            }

            ICollection <UnpredictWip> ownerIDList;

            if (InputMart.Instance.UnpredictWips.TryGetValue(UnpredictType.OWNER_ID, out ownerIDList))
            {
                if (IsMatched_UnpredictWip(ownerIDList, shopID, item.OWNER_ID))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #15
0
        internal static void WriteLoadWipError(string key, Wip item, ErrLevel errLevel, string reason, string detail)
        {
            key = string.Format("Load Wip:{0}", key);

            WriteIf(key,
                    ErrCategory.PERSIST,
                    errLevel,
                    item.FACTORY_ID,
                    item.SHOP_ID,
                    item.LOT_ID,
                    item.PRODUCT_ID,
                    item.PRODUCT_VERSION,
                    item.PROCESS_ID,
                    item.EQP_ID,
                    item.STEP_ID,
                    reason,
                    detail);
        }
        protected void txtCodigo_TextChanged(object sender, EventArgs e)
        {
            string codigo = txtCodigo.Text;
            Wip    wip    = wipControl.BuscarWip_ControlPorCodigo(codigo, "Pistola", Session["Usuario"].ToString());

            if (wip.ProxProceso != null)
            {
                lblOT.Text         = wip.OT;
                lblNombreOT.Text   = wip.NombreOT;
                btnGuardar.Visible = true;
                pnlDetalle.Visible = true;
                DivMensaje.Visible = false;
            }
            else
            {
                DivMensaje.Visible = true;
                DivMensaje.Attributes.Add("style", "background-color:Red");
                Image1.ImageUrl      = "../../Images/cross.png";
                lblMensaje.ForeColor = Color.White;
                lblMensaje.Text      = "Codigo de Pallet Incorrecto.";
            }
        }
        public Wip ListaMaquinaENC(string Codigo, int Procedimiento)
        {
            Wip        wp  = new Wip();
            Conexion   con = new Conexion();
            SqlCommand cmd = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "[Wip_ListMaquina_LecturaMetrics]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Codigo", Codigo);
                cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    wp.Maquina    = reader["NombreMaquina"].ToString();
                    wp.ID_Control = reader["CodigoMaquina"].ToString();
                }
                con.CerrarConexion();
            }
            return(wp);
        }
Beispiel #18
0
 public void AddMatchWip(Wip wip)
 {
     this.MatchWips.Add(wip);
 }
Beispiel #19
0
        /// <summary>
        /// </summary>
        /// <param name="entity"/>
        /// <returns/>
        public bool OnAfterLoad_Wip(Wip entity)
        {
            try
            {
                entity.LOT_ID             = UtilityHelper.Trim(entity.LOT_ID);
                entity.LINE_ID            = UtilityHelper.Trim(entity.LINE_ID);
                entity.STEP_ID            = UtilityHelper.Trim(entity.STEP_ID);
                entity.PROCESS_ID         = UtilityHelper.Trim(entity.PROCESS_ID);
                entity.PRODUCT_ID         = UtilityHelper.Trim(entity.PRODUCT_ID);
                entity.PRODUCT_NAME       = UtilityHelper.Trim(entity.PRODUCT_NAME);
                entity.HOLD_CODE          = UtilityHelper.Trim(entity.HOLD_CODE);
                entity.LOT_STATE          = UtilityHelper.Trim(entity.LOT_STATE);
                entity.EQP_ID             = UtilityHelper.Trim(entity.EQP_ID);
                entity.ASM_RESERVATION_ID = UtilityHelper.Trim(entity.ASM_RESERVATION_ID);

#if DEBUG
                if (entity.LOT_ID.StartsWith("BF8QK4N.5X"))
                {
                    Console.WriteLine();
                }

                if (entity.PRODUCT_ID == "BF8QK4N.5X")
                {
                    Console.WriteLine();
                }
#endif

                ProductDetail productDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.PRODUCT_ID);
                Mozart.SeePlan.Simulation.EntityState state = FindHelper.FindLotState(entity.LOT_STATE, entity.HOLD_CODE, entity.EQP_ID);

                if (productDetail == null)
                {
                    WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID,
                                                        entity.LOT_ID, entity.PRODUCT_ID, string.Empty, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProductMaster", string.Empty, "Wip");

                    WriteHelper.WriteUnpeg(entity, string.Empty, false, state, UnpegReason.MASTER_DATA, "Cannot find ProductMaster");
                    return(false);
                }

                MicronBEAssyProcess process = productDetail.Process;

                MicronBEAssyBEStep step = process.FindStep(entity.STEP_ID) as MicronBEAssyBEStep;

                if (step == null)
                {
                    WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID,
                                                        entity.LOT_ID, entity.PRODUCT_ID, productDetail.DesignID, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProcessStep", string.Format("PROCESS_ID : {0}", productDetail.Process.ProcessID), "Wip");

                    WriteHelper.WriteUnpeg(entity, productDetail.DesignID, false, state, UnpegReason.MASTER_DATA, "Cannot find ProcessStep");
                    return(false);
                }

                string  unpegReason = string.Empty;
                Product product     = FindHelper.FindWipProduct(entity, process, step, state, out unpegReason);

                if (product == null)
                {
                    WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID,
                                                        entity.LOT_ID, entity.PRODUCT_ID, productDetail.DesignID, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProcessStep", string.Format("PROCESS_ID : {0}", productDetail.Process.ProcessID), "Wip");

                    WriteHelper.WriteUnpeg(entity, productDetail.DesignID, false, state, UnpegReason.MASTER_DATA, unpegReason);
                    return(false);
                }

                MicronBEAssyWipInfo wipInfo = new MicronBEAssyWipInfo();
                wipInfo.LotID   = entity.LOT_ID;
                wipInfo.Product = product;
                wipInfo.Process = process;

                wipInfo.UnitQty      = (double)entity.LOT_QTY;
                wipInfo.InitialStep  = process.FindStep(entity.STEP_ID);
                wipInfo.CurrentState = state;
                wipInfo.LineID       = entity.LINE_ID;

                InputMart.Instance.MicronBEAssyWipInfo.Add(wipInfo.InitialStep.StepID, wipInfo);

                return(false);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(false);
            }
        }
Beispiel #20
0
        internal static Product FindWipProduct(Wip entity, MicronBEAssyProcess process, MicronBEAssyBEStep step, Mozart.SeePlan.Simulation.EntityState state, out string unpegReason)
        {
            Product product = null;

            unpegReason = string.Empty;

#if DEBUG
            if (entity.PRODUCT_ID == "264153")
            {
                Console.WriteLine();
            }

            if (entity.PRODUCT_ID == "264157")
            {
                Console.WriteLine();
            }
#endif
            int daThroughtCnt = step.DaThroughCount;

            if (step.StepGroup == Constants.DieAttach && state != EntityState.RUN)
            {
                daThroughtCnt = daThroughtCnt - 1;//DA 대기중인 재공은 DA를 진행하지 않은 상태로 판단
            }

            Product wipProduct = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID);

            if (wipProduct is MicronBEAssyProduct)
            {
                product = wipProduct;
            }
            else if (wipProduct != null && wipProduct is AssyMcpProduct && daThroughtCnt >= 1)
            {
                AssyMcpProduct mcpProduct = wipProduct as AssyMcpProduct;

                if (daThroughtCnt == mcpProduct.MaxSequence)
                {
                    product = mcpProduct;
                }
                else
                {
                    AssyMcpPart midPart = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID, true, true, daThroughtCnt) as AssyMcpPart;

                    if (midPart != null)
                    {
                        product = midPart;
                    }

#if DEBUG
                    if (midPart == null)
                    {
                        Console.WriteLine();
                    }
#endif
                }
            }
            else
            {
                //임시로직 - 로직이 정해지먼 재정의 해야함.
                //초기화시 CompSeq가 확정된 Part를 찾을 수 없기 때문에 대표로 Part를 하나 찾아서 정의를 해야함.
                ICollection <AssyMcpPart> products = FindHelper.FindAssyInParts(entity.LINE_ID, entity.PRODUCT_ID);

                if (products != null && products.Count > 0)
                {
                    product = products.ElementAt(0);
                }
            }

            if (product == null)
            {
                if (step.StepID == Constants.LOTSRECEIVED)
                {
                    unpegReason = "Cannot find McpBom or ProductRoute";
                }
                else
                {
                    unpegReason = "Cannot find McpBom";
                }
            }

            return(product);
        }
Beispiel #21
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ////******************************************************************CODIGO INICIAL *****************************************************************************
            //string Codigo = txtCodigo.Text.Trim();
            //string Ubicacion = txtUbicacion.Text.Trim().ToUpper();
            //List<Wip> wp = wipControl.ListaMaquinaProceso(0);
            //string CodigosMachine = ",";
            //foreach (Wip w in wp)
            //{
            //    CodigosMachine = CodigosMachine + w.ID_Control + ",";
            //}
            ////Asignar ubicacion en Encuadernacion
            //int n = CodigosMachine.IndexOf(Ubicacion);
            //if (n > 0)
            //{
            //    if (wipControl.ConsumirPorEnc(Codigo, Ubicacion, lblNombre.Text))
            //    {
            //        Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
            //    }
            //}
            ////Asignar ubicacion en Servicio Externo
            //else if (Ubicacion == "SE002" || Ubicacion == "DSE01" || Ubicacion == "TD001" || Ubicacion == "DD003")
            //{
            //    string proceso = "";
            //    if (wipControl.ConsumirPorServicioExterno(Codigo, Ubicacion, lblNombre.Text, proceso))
            //    {
            //        if (Ubicacion == "SE002")
            //        {
            //            proceso = "Sunipac";
            //            EnvioCorreo(Ubicacion, lblNombre.Text, Codigo, proceso);
            //        }
            //        else if (Ubicacion == "DSE01")
            //        {
            //            proceso = "Despacho Servicio Externo";
            //            EnvioCorreo(Ubicacion, lblNombre.Text, Codigo, proceso);
            //        }
            //        else if (Ubicacion == "TD001")
            //        {
            //            proceso = "Taller Digital";
            //        }
            //        else if (Ubicacion == "DD003")
            //        {
            //            proceso = "Directo Despacho";
            //        }
            //        Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
            //    }
            //}
            ////Asignar Ubicacion en rack
            //else if (Ubicacion != "TD001" && Ubicacion != "ENC01" && Ubicacion != "SE002" && Ubicacion != "DSE01")
            //{
            //    List<Wip> wp2 = wipControl.ListaMaquinaProceso(1);
            //    if (wp2.Count(o => o.Maquina == Ubicacion) > 0)
            //    {
            //        if (wipControl.AsignarUbicacionPallet(Codigo, Ubicacion, lblNombre.Text))
            //        {
            //            Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
            //        }
            //    }
            //}
            try
            {
                string Codigo = txtCodigo.Text.Trim(); string Ubicacion = txtUbicacion.Text.Trim().ToUpper(); string CodigoMetrics = "";

                CodigoMetrics = wlm.ListaMaquinaProceso(Ubicacion, 1);
                if (CodigoMetrics != "0" && CodigoMetrics != "UNICO")
                {
                    //Asignar Ubicacion en rack
                    if (CodigoMetrics != "TD001" && CodigoMetrics != "ENC01" && CodigoMetrics != "SE002" && CodigoMetrics != "DSE01")
                    {
                        if (wipControl.AsignarUbicacionPallet(Codigo, CodigoMetrics, lblNombre.Text))
                        {
                            Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
                        }
                    }
                }
                //Asignar ubicacion en Servicio Externo
                else if (Ubicacion == "SE002" || Ubicacion == "DSE01" || Ubicacion == "TD001" || Ubicacion == "DD003")
                {
                    string proceso = "";
                    if (wipControl.ConsumirPorServicioExterno(Codigo, Ubicacion, lblNombre.Text, proceso))
                    {
                        if (Ubicacion == "SE002")
                        {
                            proceso = "Sunipac";
                            EnvioCorreo(Ubicacion, lblNombre.Text, Codigo, proceso);
                        }
                        else if (Ubicacion == "DSE01")
                        {
                            proceso = "Despacho Servicio Externo";
                            EnvioCorreo(Ubicacion, lblNombre.Text, Codigo, proceso);
                        }
                        else if (Ubicacion == "TD001")
                        {
                            proceso = "Taller Digital";
                        }
                        else if (Ubicacion == "DD003")
                        {
                            proceso = "Directo Despacho";
                        }
                        Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
                    }
                }
                //Ubicacion Maquinas ENC
                else
                {
                    Wip w2 = wlm.ListaMaquinaENC(Ubicacion, 2);
                    if (w2 != null)
                    {
                        if (wipControl.ConsumirPorEnc(Codigo, w2.ID_Control, lblNombre.Text))
                        {
                            Response.Redirect("Asignar_Ubicacion.aspx?id=" + lblNombre.Text + "&tipo=" + lblTipo.Text);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string popupScript = "<script language='JavaScript'> alert('" + ex.ToString() + "');' </script>";
                Page.RegisterStartupScript("PopupScript", popupScript);
            }
        }
Beispiel #22
0
        public bool EnvioCorreo(string Destino, string Usuario, string Codigo, string Proceso)
        {
            if (Destino == "SE002")
            {
                Destino = "Sunipac";
            }
            else if (Destino == "DSE01")
            {
                Destino = "Despacho Servico Externo";
            }
            /* Carga de PAra la base de Datos*/
            /*-------------------------MENSAJE DE CORREO----------------------*/
            Wip wip = wipControl.BuscarPallet_Wip(Codigo);

            //Creamos un nuevo Objeto de mensaje
            System.Net.Mail.MailMessage mmsg = new System.Net.Mail.MailMessage();

            //Direccion de correo electronico a la que queremos enviar el mensaje
            //mmsg.To.Add("*****@*****.**");
            if (Destino == "Sunipac")
            {
                mmsg.To.Add("*****@*****.**");
            }
            else if (Destino == "Despacho Servico Externo")
            {
                mmsg.To.Add("*****@*****.**");
            }
            //mmsg.To.Add("*****@*****.**");
            //Nota: La propiedad To es una colección que permite enviar el mensaje a más de un destinatario

            //Asunto
            mmsg.Subject         = "Destino " + Destino + " OT: " + wip.OT + " Pliego: " + wip.Pliego;
            mmsg.SubjectEncoding = System.Text.Encoding.UTF8;

            //Direccion de correo electronico que queremos que reciba una copia del mensaje
            //mmsg.Bcc.Add("*****@*****.**"); //Opcional
            DateTime hoy   = DateTime.Now;
            string   fecha = hoy.ToString("dd/MM/yyyy HH:mm");

            string[] str = fecha.Split('/');
            string   dia = str[0];
            string   mes = str[1];
            string   año = str[2];

            //año = año.Substring(0, 4);
            //string hora = hoy.ToLongTimeString();

            //Cuerpo del Mensaje
            mmsg.Body =
                "<table style='width:80%;'>" +
                "<tr>" +
                "<td>" +
                "<img src='http://intranet.qgchile.cl/images/Logo color lateral.jpg' width='267px'  height='67px' />" +
                //"<img src='//"<img src='http://www.qg.com/la/es/images/QG_Tagline_sp.jpg' />" +' />" +
                "&nbsp;</td>" +
                "</tr>" +
                "</table>" +
                //termino cargar logo
                "<div style='border-color:Black;border-width:3px;border-style:solid;'>" +
                "<table style='width:80%;'>" +
                "<tr>" +
                "<td style='width:194px;'>" +
                "&nbsp;</td>" +
                "<td colspan='3'>" +
                "&nbsp;</td>" +
                "</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                "OT Nro.: </td>" +
                "<td>" + wip.OT.ToUpper() + "</td>" +
                "<td  style='width:194px;'>" +
                "Nombre OT: </td>" +
                "<td>" + wip.NombreOT + "</td>" +
                "</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                " Tiraje OT:</td>" +
                "<td colspan='3'>" + wip.Tiraje.ToString("N0").Replace(",", ".") + "</td>" +
                "</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                " Fecha:</td>" +
                "<td colspan='3'>" + dia + "/" + mes + "/" + año + "</td>" +
                "</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                "Creador Por:</td>" +

                "<td colspan='3'>" + Usuario +
                "</td>" +
                "</tr>" +
                "</table>" +
                "<br />" +
                "</div>" +
                "<table style='width:80%;'><tr>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Proveedor</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Codigo Pallet</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Pliego</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Pliego Imp.</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Maquina</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Proceso</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' align='center'>Peso Pallet</td>" +
                "</tr>" +
                "<tr>" +
                "<td style='border:1px solid #5D8CC9;'>" + Destino + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + Codigo + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + wip.Pliego + "</td>" +
                "<td style='border:1px solid #5D8CC9;' align='right'>" + wip.PliegosImpresos.ToString("N0").Replace(",", ".") + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + wip.Maquina + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + Proceso + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + wip.PesoPallet + "</td>" +
                "</tr></table>";

            mmsg.BodyEncoding = System.Text.Encoding.UTF8;
            mmsg.IsBodyHtml   = true; //Si no queremos que se envíe como HTML

            //Correo electronico desde la que enviamos el mensaje
            mmsg.From = new System.Net.Mail.MailAddress("*****@*****.**");//"*****@*****.**");


            /*-------------------------CLIENTE DE CORREO----------------------*/

            //Creamos un objeto de cliente de correo
            System.Net.Mail.SmtpClient cliente = new System.Net.Mail.SmtpClient();

            //Hay que crear las credenciales del correo emisor
            cliente.Credentials =
                new System.Net.NetworkCredential("*****@*****.**", "SI2013.");

            //Lo siguiente es obligatorio si enviamos el mensaje desde Gmail

            /*
             * cliente.Port = 587;
             * cliente.EnableSsl = true;
             */
            cliente.Host = "mail.aimpresores.cl";
            /*-------------------------ENVIO DE CORREO----------------------*/

            try
            {
                //Enviamos el mensaje
                cliente.Send(mmsg);
                return(true);
                //Label1.Text = "enviado correctamente";
            }
            catch (System.Net.Mail.SmtpException ex)
            {
                return(false);
                //Aquí gestionamos los errores al intentar enviar el correo
                //Label1.Text = "error al enviar el correo";
            }
        }
Beispiel #23
0
        private string CheckMainProcessID(string factoryID, string shopID, string productID, string stepID, Wip wip, string where, ref bool hasError)
        {
            var proc = BopHelper.FindProcess2(productID, stepID);

            if (proc == null)
            {
                hasError = true;

                ErrHist.WriteIf(where + proc,
                                ErrCategory.PERSIST,
                                ErrLevel.WARNING,
                                factoryID,
                                shopID,
                                Constants.NULL_ID,
                                productID,
                                Constants.NULL_ID,
                                Constants.NULL_ID,
                                Constants.NULL_ID,
                                stepID,
                                "NOT FOUND MAIN_PROCESS",
                                string.Format("Table:{0}", where)
                                );

                return(null);
            }

            return(proc.ProcessID);
        }