public static void Click_TransferP2(string QtyReal, string TargetCwar, string TargetLoca)
        {
            Ent_twhcol130131 MyObj131Base = (Ent_twhcol130131)HttpContext.Current.Session["MyPalletTwhcol13"];

            MyObj131Base.PAIDS_URLS.Clear();
            MyObj131Base.PAIDS.Clear();

            Ent_twhcol020 objWhcol020 = new Ent_twhcol020();

            objWhcol020.tbl  = "";
            objWhcol020.clot = MyObj131Base.LOT == string.Empty ? " " : MyObj131Base.LOT;
            objWhcol020.sqnb = MyObj131Base.PAID;
            objWhcol020.mitm = MyObj131Base.ITEM;
            objWhcol020.dsca = Transfers.DescripcionItem(objWhcol020.mitm);
            //objWhcol020.cwor = MyObj131Base.CWAR;  //JC 180522 La bodega no es la correcta.
            objWhcol020.cwor = MyObj131Base.CWAA;
            objWhcol020.loor = MyObj131Base.LOCA; //JC 180522 La ubicacion no es la correcta.
            objWhcol020.cwde = TargetCwar;
            objWhcol020.lode = TargetLoca;

            objWhcol020.qtdl = Convert.ToDouble(QtyReal);
            objWhcol020.cuni = MyObj131Base.UNIT;
            objWhcol020.user = HttpContext.Current.Session["user"].ToString();

            Transfers.InsertarTransferencia(objWhcol020);
            //JC 22032022 Ajuste cantidad final
            //_idaltwhcol131.Actualizartwhcol131CantEstado(MyObj131Base.PAID, 9, (Convert.ToDecimal(QtyReal) - Convert.ToDecimal(MyObj131Base.QTYS)));
            _idaltwhcol131.Actualizartwhcol131CantEstado(MyObj131Base.PAID, 9, (Convert.ToDecimal(MyObj131Base.QTYT) - Convert.ToDecimal(QtyReal)));
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            lblError.Text   = String.Empty;
            lblConfirm.Text = String.Empty;
            var qtdl = double.Parse(txtQuantity.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat);
            var orno = txtWorkOrder.Text.Trim().ToUpper();
            var pono = hdfPONO.Value.Trim().ToUpper();
            var clot = loteitem;
            var item = txtItem.Text.Trim().ToUpper();
            var cwar = hdfCWAR.Value.Trim().ToUpper();

            if (qtdl <= 0)
            {
                lblError.Text = mensajes("quantityhigher");
                return;
            }

            var consultaRegistro = _idaltticol080.findRecordByOrnoPonoItem(ref orno, ref pono, ref item, ref strError).Rows;

            Ent_tticol080 data080 = new Ent_tticol080()
            {
                orno    = orno,
                pono    = Convert.ToInt32(pono),
                item    = item,
                cwar    = cwar,
                qune    = Convert.ToDecimal(qtdl),
                logn    = HttpContext.Current.Session["user"].ToString(),
                proc    = 2,
                refcntd = 0,
                refcntu = 0,
                clot    = clot,
                oorg    = "4",
                pick    = 2
            };

            if (consultaRegistro.Count > 0)
            {
                var validateUpdate = _idaltticol080.updateRecordRollAnnounce(ref data080, ref strError);

                if (validateUpdate)
                {
                    _idaltticol022.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                    _idaltticol022.ActualizarCantidadRegistroTicol222(0, txtRollNumber.Text.Trim());
                    _idaltticol042.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                    _idaltticol042.ActualizarCantidadRegistroTicol242(0, txtRollNumber.Text.Trim());
                    _idaltwhcol131.Actualizartwhcol131CantEstado(txtRollNumber.Text.Trim(), 9, 0);
                    lblError.Text          = String.Empty;
                    lblConfirm.Text        = mensajes("msjupdate");
                    trItem.Visible         = false;
                    trQuantity.Visible     = false;
                    txtWorkOrder.ReadOnly  = false;
                    txtRollNumber.ReadOnly = false;
                    txtRollNumber.Text     = String.Empty;
                    txtWorkOrder.Text      = String.Empty;
                    btnConsultar.Visible   = true;
                    btnRegister.Visible    = false;
                }
                else
                {
                    lblError.Text = mensajes("errorupdt");
                    return;
                }
            }
            else
            {
                List <Ent_tticol080> lista = new List <Ent_tticol080>();
                lista.Add(data080);
                var isTag = String.Empty;

                var validaInsert = _idaltticol080.insertarRegistro(ref lista, ref strError, ref isTag);
                _idaltticol022.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                _idaltticol022.ActualizarCantidadRegistroTicol222(0, txtRollNumber.Text.Trim());
                _idaltticol042.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                _idaltticol042.ActualizarCantidadRegistroTicol242(0, txtRollNumber.Text.Trim());
                _idaltwhcol131.Actualizartwhcol131CantEstado(txtRollNumber.Text.Trim(), 9, 0);
                if (validaInsert > 0)
                {
                    lblError.Text          = String.Empty;
                    lblConfirm.Text        = mensajes("msjsave");
                    trItem.Visible         = false;
                    trQuantity.Visible     = false;
                    txtWorkOrder.ReadOnly  = false;
                    txtRollNumber.ReadOnly = false;
                    txtRollNumber.Text     = String.Empty;
                    txtWorkOrder.Text      = String.Empty;
                    btnConsultar.Visible   = true;
                    btnRegister.Visible    = false;
                }
                else
                {
                    lblError.Text = mensajes("errorsave");
                    return;
                }
            }
        }
Beispiel #3
0
        public static string Click_Transfer(string QtyReal, string Paids, string TargetCwar, string TargetLoca)
        {
            Ent_twhcol130131 MyObj131Base = (Ent_twhcol130131)HttpContext.Current.Session["MyPalletTwhcol13"];

            MyObj131Base.PAIDS_URLS.Clear();
            MyObj131Base.PAIDS.Clear();
            Ent_twhcol130131 MyObj      = (Ent_twhcol130131)MyObj131Base.clone();
            Double           qtyReal    = Convert.ToDouble(QtyReal);
            Double           QtyPallets = Convert.ToDouble(Paids.Trim() == string.Empty ? "1" : Paids.Trim());
            Double           Parcials   = qtyReal / QtyPallets;
            Decimal          QUANTITY   = 0;
            //int CantPalletsComp = Convert.ToInt32(Parcials);
            double CantPalletsComp = Math.Truncate(Parcials);
            double CantParcPallets = Parcials - CantPalletsComp;

            if (CantParcPallets == 0)
            {
                CantParcPallets = 0;
            }
            else
            {
                CantParcPallets = 1;
            }
            int    inserts                = 0;
            int    consecutivoPalletID    = 0;
            int    QUANTITYAUX_COMPLETADA = 0;
            Factor MyConvertionFactor     = new Factor {
            };

            if (MyObj131Base.UNIT != "PLT")
            {
                MyConvertionFactor = FactorConversion(MyObj131Base.ITEM, MyObj131Base.UNIT, "PLT");
                QUANTITY           = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((QUANTITY * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((QUANTITY * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB);
            }

            for (int i = 0; i < CantPalletsComp; i++)
            {
                DataTable DTPalletContinue = twhcol130DAL.PaidMayorwhcol131(MyObj131Base.ORNO);
                string    SecuenciaPallet  = "001";
                if (DTPalletContinue.Rows.Count > 0)
                {
                    foreach (DataRow item in DTPalletContinue.Rows)
                    {
                        consecutivoPalletID = Convert.ToInt32(item["T$PAID"].ToString().Trim().Substring(10, 3)) + 1;
                        if (consecutivoPalletID.ToString().Length == 1)
                        {
                            SecuenciaPallet = "00" + consecutivoPalletID;
                        }
                        if (consecutivoPalletID.ToString().Length == 2)
                        {
                            SecuenciaPallet = "0" + consecutivoPalletID;
                        }
                        if (consecutivoPalletID.ToString().Length == 3)
                        {
                            SecuenciaPallet = consecutivoPalletID.ToString();
                        }
                    }
                }
                MyObj.PAID = MyObj131Base.ORNO + "-" + SecuenciaPallet;
                MyObj.CWAR = TargetCwar;
                MyObj.LOCA = TargetLoca;
                MyObj.QTYS = QtyPallets.ToString();
                MyObj.QTYC = QtyPallets.ToString();
                MyObj.DATE = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.DATR = DateTime.Now.ToString("dd/MM/yyyy").ToString();;
                MyObj.DATL = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.DATP = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.LOGN = HttpContext.Current.Session["user"].ToString();
                MyObj.LOGT = " ";
                MyObj.CWAA = TargetCwar;
                MyObj.LOAA = TargetLoca;
                MyObj.QTYA = QtyPallets.ToString();
                MyObj.QTYAS.Add(MyObj.QTYA);
                MyObj.PAIDS.Add(MyObj.PAID);
                MyObj.PAID_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.PAID + "&code=Code128&dpi=96";
                MyObj.PAIDS_URLS.Add(MyObj.PAID_URL);
                MyObj.ORNO_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.ORNO + "&code=Code128&dpi=96";
                MyObj.ITEM_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.ITEM + "&code=Code128&dpi=96";
                MyObj.CLOT_URL = MyObj.LOT.ToString().Trim() != "" ? UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.CLOT + "&code=Code128&dpi=96" : "";
                //MyObj.QTYC_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.QTYC.ToString("0.0000").Trim().ToUpper() + "&code=Code128&dpi=96";
                MyObj.UNIC_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.UNIC.ToString().Trim().ToUpper() + "&code=Code128&dpi=96";
                string StrError = string.Empty;
                if (twhcol130DAL.Insertartwhcol131(MyObj, ref StrError))
                {
                    inserts++;
                }
            }
            for (int p = 0; p < CantParcPallets; p++)
            {
                DataTable DTPalletContinue = twhcol130DAL.PaidMayorwhcol131(MyObj131Base.ORNO);
                string    SecuenciaPallet  = "001";
                if (DTPalletContinue.Rows.Count > 0)
                {
                    foreach (DataRow item in DTPalletContinue.Rows)
                    {
                        consecutivoPalletID = Convert.ToInt32(item["T$PAID"].ToString().Trim().Substring(10, 3)) + 1;
                        if (consecutivoPalletID.ToString().Length == 1)
                        {
                            SecuenciaPallet = "00" + consecutivoPalletID;
                        }
                        if (consecutivoPalletID.ToString().Length == 2)
                        {
                            SecuenciaPallet = "0" + consecutivoPalletID;
                        }
                        if (consecutivoPalletID.ToString().Length == 3)
                        {
                            SecuenciaPallet = consecutivoPalletID.ToString();
                        }
                    }
                }
                MyObj.PAID = MyObj131Base.ORNO + "-" + SecuenciaPallet;
                MyObj.CWAR = TargetCwar;
                MyObj.LOCA = TargetLoca;
                MyObj.QTYS = (qtyReal - (CantPalletsComp * QtyPallets)).ToString();
                MyObj.QTYC = (qtyReal - (CantPalletsComp * QtyPallets)).ToString();
                MyObj.DATE = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.DATR = DateTime.Now.ToString("dd/MM/yyyy").ToString();;
                MyObj.DATL = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.DATP = DateTime.Now.ToString("dd/MM/yyyy").ToString();
                MyObj.LOGN = HttpContext.Current.Session["user"].ToString();
                MyObj.LOGT = " ";
                MyObj.CWAA = TargetCwar;
                MyObj.LOAA = TargetLoca;
                MyObj.QTYA = (qtyReal - (CantPalletsComp * QtyPallets)).ToString();
                MyObj.QTYAS.Add(MyObj.QTYA);
                MyObj.PAIDS.Add(MyObj.PAID);
                MyObj.PAID_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.PAID + "&code=Code128&dpi=96";
                MyObj.PAIDS_URLS.Add(MyObj.PAID_URL);
                MyObj.ORNO_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.ORNO + "&code=Code128&dpi=96";
                MyObj.ITEM_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.ITEM + "&code=Code128&dpi=96";
                MyObj.CLOT_URL = MyObj.LOT.ToString().Trim() != "" ? UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.CLOT + "&code=Code128&dpi=96" : "";
                //MyObj.QTYC_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.QTYC.ToString("0.0000").Trim().ToUpper() + "&code=Code128&dpi=96";
                MyObj.UNIC_URL = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + MyObj.UNIC.ToString().Trim().ToUpper() + "&code=Code128&dpi=96";
                string StrError = string.Empty;
                if (twhcol130DAL.Insertartwhcol131(MyObj, ref StrError))
                {
                    inserts++;
                }
            }
            if (inserts == CantPalletsComp + CantParcPallets)
            {
                Ent_twhcol020 objWhcol020 = new Ent_twhcol020();
                objWhcol020.tbl  = "";
                objWhcol020.clot = MyObj131Base.LOT == string.Empty ? " " : MyObj131Base.LOT;
                objWhcol020.sqnb = MyObj131Base.PAID;
                objWhcol020.mitm = MyObj131Base.ITEM;
                objWhcol020.dsca = Transfers.DescripcionItem(objWhcol020.mitm);
                objWhcol020.cwor = MyObj131Base.CWAR;
                objWhcol020.loor = MyObj131Base.LOCA;
                objWhcol020.cwde = TargetCwar;
                objWhcol020.lode = TargetLoca;

                objWhcol020.qtdl = Convert.ToDouble(qtyReal);
                objWhcol020.cuni = MyObj131Base.UNIT;
                objWhcol020.user = HttpContext.Current.Session["user"].ToString();

                Transfers.InsertarTransferencia(objWhcol020);
                _idaltwhcol131.Actualizartwhcol131CantEstado(MyObj131Base.PAID, 9, (Convert.ToDecimal(QtyReal) - Convert.ToDecimal(MyObj131Base.QTYS)));
            }
            return(JsonConvert.SerializeObject(MyObj));
        }