Ejemplo n.º 1
0
        public Bill_Master()
        {
            InitializeComponent();

            BillDataGrid.AutoGenerateColumns = false;

            partnum_txt.Leave += partnum_txt_Leave;

            mtlseq_txt.Text = GetNextSeq().ToString();

            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);

            EngWBDS.Tables["ECOOpr"].Columns.Add("FullCode", typeof(string), "OprSeq + ' - ' + OpDesc");

            ops_cbo.DataSource = EngWBDS.Tables["ECOOpr"];

            ops_cbo.DisplayMember = "FullCode";

            ops_cbo.ValueMember = "OprSeq";

            ops_cbo.SelectedValue = "10";

            BillDataGrid.DataSource = EngWBDS.Tables["ECOMtl"];

            this.FormClosing += Bill_Master_FormClosing;
        }
        public Resource_Master(string PartNumber, string Rev, string GroupID, string Operation,EngWorkBenchDataSet EngWBDS)
        {
            InitializeComponent();

            FormStart();

            partnumber_txt.Text = PartNumber;

            rev_txt.Text = Rev;

            gid_txt.Text = GroupID;

            operation_txt.Text = Operation;

            EngWB_DS = EngWBDS;

            DataView DV = EngWB_DS.Tables["ECOOpDtl"].DefaultView;

            ResourceGrid.DataSource = DV;

            MaxIndex = ResourceGrid.Rows.Count;

            for (int i = 0; i < ResourceGrid.Rows.Count; i++)
            {
                if (operation_txt.Text == ResourceGrid["OprSeq", i].Value.ToString())
                    indicies.Add(i);
            }

            DV.RowFilter = string.Format("OprSeq = " + operation_txt.Text);
        }
        public Resource_Master(string PartNumber, string Rev, string GroupID, string Operation, EngWorkBenchDataSet EngWBDS)
        {
            InitializeComponent();

            FormStart();

            partnumber_txt.Text = PartNumber;

            rev_txt.Text = Rev;

            gid_txt.Text = GroupID;

            operation_txt.Text = Operation;

            EngWB_DS = EngWBDS;

            DataView DV = EngWB_DS.Tables["ECOOpDtl"].DefaultView;

            ResourceGrid.DataSource = DV;

            MaxIndex = ResourceGrid.Rows.Count;

            for (int i = 0; i < ResourceGrid.Rows.Count; i++)
            {
                if (operation_txt.Text == ResourceGrid["OprSeq", i].Value.ToString())
                {
                    indicies.Add(i);
                }
            }

            DV.RowFilter = string.Format("OprSeq = " + operation_txt.Text);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ipGroupID">ECO Group ID</param>
        /// <param name="ipCheckOutStatus">Normally should be true</param>
        /// <returns></returns>
        public EngWorkBenchDataSet GetECORevData(string ipGroupID, bool ipCheckOutStatus)
        {
            EngWorkBench EngWB = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet ReturnMethod = EngWB.GetECORevData(ipGroupID, ipCheckOutStatus);

            EpicClose();

            return(ReturnMethod);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ipGroupID">ECO Group ID</param>
        /// <param name="ipPartNum">Part Number</param>
        /// <param name="ipRevisionNum">Revision Number</param>
        /// <param name="ipAltMethod">Normally Null string</param>
        /// <param name="ipAsOfDate">Current Date/Time</param>
        /// <param name="ipCompleteTree">Normally False</param>
        /// <param name="ipUseMEthodForParts">Normally True</param>
        /// <returns></returns>
        public EngWorkBenchDataSet GetDatasetForTree(string ipGroupID, string ipPartNum, string ipRevisionNum, string ipAltMethod, DateTime?ipAsOfDate, bool ipCompleteTree, bool ipUseMEthodForParts)
        {
            EngWorkBench EngWB = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet MethodReturned = EngWB.GetDatasetForTree(ipGroupID, ipPartNum, ipRevisionNum, ipAltMethod, ipAsOfDate, ipCompleteTree, ipUseMEthodForParts);

            EpicClose();

            return(MethodReturned);
        }
Ejemplo n.º 6
0
        public EngWorkBenchDataSet CheckOut(string ipGroupID, string ipPartNum, string ipRevisionNum, string ipAltMethod, DateTime?ipAsOfDate, bool ipCompleteTree, bool ipValidPassword, bool ipReturn, bool ipGetDatasetForTree, bool ipUseMethodForParts, out string opCheckedOutRevisionNum, out string altMethodMsg, out bool altMethodFlg)
        {
            EngWorkBench EngWB = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet ReturnMethod = EngWB.CheckOut(ipGroupID, ipPartNum, ipRevisionNum, ipAltMethod, ipAsOfDate, ipCompleteTree, ipValidPassword, ipReturn, ipGetDatasetForTree, ipUseMethodForParts, out opCheckedOutRevisionNum, out altMethodMsg, out altMethodFlg);

            EpicClose();

            return(ReturnMethod);
        }
Ejemplo n.º 7
0
        public static DataSet EngWB_DS(string GroupID, string PartNumber, string Rev)
        {
            EngWorkBench EngWB = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet EngWBDS = new EngWorkBenchDataSet();

            EngWBDS = EngWB.GetDatasetForTree(GroupID, PartNumber, Rev, "", DateTime.Today, false, false);

            return((DataSet)EngWBDS);
        }
Ejemplo n.º 8
0
        private void savebtn_Click(object sender, EventArgs e)
        {
            EngWB.Update(EngWBDS);

            EngWB.ResequenceOperations(gid_txt.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, true, true, false);

            resource_show.Enabled = true;

            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, false);

            OPDataGrid.DataSource = EngWBDS.Tables["ECOOpr"];
        }
Ejemplo n.º 9
0
        public static void ApprovePart(EngWorkBenchDataSet EngDataSet, string GroupID, string PartNumber, string Revision)
        {
            EngWorkBench EngWb = new EngWorkBench(EpicConn);

            EngDataSet = EngWb.GetDatasetForTree(GroupID, PartNumber, Revision, "", DateTime.Now, false, false);

            EngDataSet.Tables["ECORev"].Rows[0]["Approved"] = true;

            EngWb.CheckECORevApproved(true, false, EngDataSet);

            EngWb.Update(EngDataSet);

            EpicClose();
        }
Ejemplo n.º 10
0
        private bool IsAssembly()
        {
            bool retval = false;

            string currentrev = DataList.GetCurrentRev(partnum_txt.Text);

            EngWorkBenchDataSet temp = new EngWorkBenchDataSet();

            if (temp.Tables[0].Rows.Count > 0)
            {
                retval = true;
            }

            return(retval);
        }
Ejemplo n.º 11
0
        public Resource_Master(string PartNumber, string Rev, string GroupID, string Operation,EngWorkBenchDataSet EngWBDS)
        {
            InitializeComponent();

            GridRow = IndexforRes(EngWBDS, Operation);

            resource_cbo.SelectedIndexChanged -= resource_cbo_SelectedIndexChanged;

            resourcegrp_cbo.SelectedIndexChanged -= resourcegrp_cbo_SelectedIndexChanged;

            ResourceGrid.SelectionChanged -= ResourceGrid_SelectionChanged;

            ResourceGrid.AutoGenerateColumns = false;

            FormStart();

            partnumber_txt.Text = PartNumber;

            rev_txt.Text = Rev;

            gid_txt.Text = GroupID;

            operation_txt.Text = Operation;

            EngWB_DS = EngWBDS;

            DataView DV = EngWB_DS.Tables["ECOOpDtl"].DefaultView;

            DV.RowFilter = string.Format("OprSeq = " + operation_txt.Text);

            ResourceGrid.DataSource = DV;

            MaxIndex = ResourceGrid.Rows.Count;

            resource_cbo.SelectedIndexChanged += resource_cbo_SelectedIndexChanged;

            resourcegrp_cbo.SelectedIndexChanged += resourcegrp_cbo_SelectedIndexChanged;

            ResourceGrid.SelectionChanged += ResourceGrid_SelectionChanged;

            /*
            for (int i = 0; i < ResourceGrid.Rows.Count; i++)
            {
                if (operation_txt.Text == ResourceGrid["OprSeq", i].Value.ToString())
                    indicies.Add(i);
            }*/
        }
Ejemplo n.º 12
0
        private void confirm_btn_Click(object sender, EventArgs e)
        {
            EngWorkBench EngWb = new EngWorkBench(DataList.EpicConn);

            EngWorkBenchDataSet ds = new EngWorkBenchDataSet();

            ds = EngWb.GetDatasetForTree(gid_cbo.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, false);

            DataList.EpicClose();
            try
            {
                DataList.ApprovePart(gid_cbo.Text, partnumber_txt.Text, rev_txt.Text);

                DataList.CheckInPart(gid_cbo.Text, partnumber_txt.Text, rev_txt.Text);
            }
            catch (Exception ex) { MessageBox.Show("Could not check in part\n\n" + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            finally { this.Close(); }
        }
Ejemplo n.º 13
0
        private void undo_btn_Click(object sender, EventArgs e)
        {
            EngWorkBench EngWB = new EngWorkBench(DataList.EpicConn);

            EngWorkBenchDataSet EngWBDS = new EngWorkBenchDataSet();

            //string Message;

            //EngWB.CheckIn("AZ", "Test12", "C", "", null, false, true, false, false, false, "Test", out Message);

            //EngWB.CheckOut("AZ", "Test12", "A", "", null, false, false, false, false, false, out Rev, out Method, out altMethodFlg);

            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, pnum_txt.Text, rev_txt.Text, "", null, false, false);

            EngWB.UndoCheckOut(gid_txt.Text, pnum_txt.Text, rev_txt.Text, "", null, false, false, false, false, EngWBDS);

            MessageBox.Show("Complete!");
        }
Ejemplo n.º 14
0
        private void undo_btn_Click(object sender, EventArgs e)
        {
            EngWorkBench EngWB = new EngWorkBench(DataList.EpicConn);

            EngWorkBenchDataSet EngWBDS = new EngWorkBenchDataSet();

            //string Message;

            //EngWB.CheckIn("AZ", "Test12", "C", "", null, false, true, false, false, false, "Test", out Message);

            //EngWB.CheckOut("AZ", "Test12", "A", "", null, false, false, false, false, false, out Rev, out Method, out altMethodFlg);

            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, pnum_txt.Text, rev_txt.Text, "", null, false, false);

            EngWB.UndoCheckOut(gid_txt.Text, pnum_txt.Text, rev_txt.Text, "", null, false, false, false, false, EngWBDS);

            MessageBox.Show("Complete!");
        }
Ejemplo n.º 15
0
        List<int> IndexforRes(EngWorkBenchDataSet EngWB_DS, string operation)
        {
            List<int> RetVal = new List<int>();

            for (int i = 0; i < EngWB_DS.Tables["ECOOpDtl"].Rows.Count; i++)
            {
                if (EngWB_DS.Tables["ECOOpDtl"].Rows[i]["OprSeq"].ToString() == operation)
                    RetVal.Add(i);
            }

            return RetVal;
        }
Ejemplo n.º 16
0
        public static void UndoCheckOutPart(string GroupID, string PartNumber, string Revision)
        {
            EngWorkBench EngWb = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet ds = new EngWorkBenchDataSet();

            ds = EngWb.GetDatasetForTree(GroupID,PartNumber,Revision,"",DateTime.Today,false,true);

            EngWb.UndoCheckOut(GroupID, PartNumber, Revision,"", DateTime.Today, false, false, false, true, ds);
        }
Ejemplo n.º 17
0
        public static void ApprovePart(EngWorkBenchDataSet EngDataSet,string GroupID,string PartNumber, string Revision)
        {
            EngWorkBench EngWb = new EngWorkBench(EpicConn);

            EngDataSet = EngWb.GetDatasetForTree(GroupID, PartNumber, Revision, "", DateTime.Now, false, false);

            EngDataSet.Tables["ECORev"].Rows[0]["Approved"] = true;

            EngWb.CheckECORevApproved(true, false, EngDataSet);

            EngWb.Update(EngDataSet);

            EpicClose();
        }
Ejemplo n.º 18
0
        public static DataSet EngWB_DS(string GroupID, string PartNumber, string Rev)
        {
            EngWorkBench EngWB = new EngWorkBench(EpicConn);

            EngWorkBenchDataSet EngWBDS = new EngWorkBenchDataSet();

            EngWBDS = EngWB.GetDatasetForTree(GroupID,PartNumber,Rev, "", DateTime.Today, false, false);

            return (DataSet)EngWBDS;
        }
        private void refresh_btn_Click(object sender, EventArgs e)
        {
            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, false);

            OPDataGrid.DataSource = EngWBDS.Tables["ECOOpr"];
        }
        private void savebtn_Click(object sender, EventArgs e)
        {
            EngWB.Update(EngWBDS);

            EngWB.ResequenceOperations(gid_txt.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, true, true, false);

            resource_show.Enabled = true;

            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, partnumber_txt.Text, rev_txt.Text, "", DateTime.Today, false, false);

            OPDataGrid.DataSource = EngWBDS.Tables["ECOOpr"];
        }
Ejemplo n.º 21
0
        private bool IsAssembly()
        {
            bool retval = false;

            string currentrev = DataList.GetCurrentRev(partnum_txt.Text);

            EngWorkBenchDataSet temp = new EngWorkBenchDataSet();

            if (temp.Tables[0].Rows.Count > 0)
                    retval = true;

            return retval;
        }
Ejemplo n.º 22
0
        private void reseq_btn_Click(object sender, EventArgs e)
        {
            try
            {
                EngWB.Update(EngWBDS);

                EngWB.ResequenceMaterials(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, Properties.Settings.Default.mtlreqtype, false, false, false);

                EngWB.Update(EngWBDS);

                EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);
            }
            catch { }
        }
Ejemplo n.º 23
0
        private void removebtn_Click(object sender, EventArgs e)
        {
            BillDataGrid.SelectionChanged -= BillDataGrid_SelectionChanged;

            try
            {
                if (partnum_txt.Text != "")
                    SaveChanges();

                int rowindex = BillDataGrid.CurrentCellAddress.Y;

                EngWBDS.Tables["ECOMtl"].Rows[rowindex].Delete();

                SaveChanges();
            }
            catch
            {
                MessageBox.Show("An error occured removing an item from the bill of materials.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //Get New Datatree
                EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);

                BillDataGrid.DataSource = EngWBDS.Tables["ECOMtl"];

                if (BillDataGrid.Rows.Count == 0)
                    removebtn.Enabled = false;

                EnableItemDetails();

                BillDataGrid.SelectionChanged += BillDataGrid_SelectionChanged;
        }
Ejemplo n.º 24
0
        private void newbtn_Click(object sender, EventArgs e)
        {
            addraw.Enabled = true;

            try
            {
                BillDataGrid.ClearSelection();

                SaveChanges();

                EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);

                BillDataGrid.DataSource = EngWBDS.Tables["ECOMtl"];

                //Add new line item
                EngWB.GetNewECOMtl(EngWBDS, gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "");

                int rowindex = BillDataGrid.Rows.Count - 1;

                BillDataGrid.ClearSelection();

                BillDataGrid.CurrentCell = BillDataGrid.Rows[rowindex].Cells[0];

                qty_num.Value = 1;

                ops_cbo.SelectedIndex = 0;

                partnum_txt.Text = "";

                desc_txt.Text = "";

                PullAsAsm_chk.Checked = false;

                ViewAsAsm_chk.Checked = false;

                EngWBDS.Tables["ECOMtl"].Rows[rowindex]["RelatedOperation"] = ops_cbo.SelectedValue;

                EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["OpDesc"] = EngWBDS.Tables["ECOOpr"].Rows[ops_cbo.SelectedIndex]["OpDesc"];

                EngWBDS.Tables["ECOMtl"].Rows[rowindex]["QtyPer"] = 1;

                EngWBDS.Tables["ECOMtl"].Rows[rowindex]["ViewAsAsm"] = false;

                EngWBDS.Tables["ECOMtl"].Rows[rowindex]["UOMCode"] = uom_cbo.Text;

                EngWBDS.Tables["ECOMtl"].Rows[rowindex]["PullAsAsm"] = false;

                EnableItemDetails();
            }
            catch { }

            EnableItemDetails();
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Retrieves and Updates bill of materials
        /// </summary>
        /// <param name="BillItems"></param>
        /// <param name="BillQty"></param>
        private void Setbill(List<BillItem>Bill)
        {
            List<bool> FindItemEpicor = new List<bool>();

            List<bool> FindItemSldWrks = new List<bool>();

            List<BillItem> AddBack = new List<BillItem>();

            List<string> AddBack_Opts = new List<string>();

            List<string> AddBack_Ops = new List<string>();

            List<string> AddBack_Uom = new List<string>();

            #region Locate items

            //See if the part exists in the SolidWorks data
            for (int i = 0; i < Bill.Count; i++)
            {FindItemSldWrks.Add(false);}

            //See if the part exists in the Epicor data
            for (int i = 0; i < EngWBDS.Tables["ECOMtl"].Rows.Count; i++)
            {
                FindItemEpicor.Add(false);

                BillItem Item = new BillItem();

                Item.PartNumber = EngWBDS.Tables["ECOMtl"].Rows[i]["MtlPartNum"].ToString();

                Item.Qty = EngWBDS.Tables["ECOMtl"].Rows[i]["QtyPer"].ToString();

                AddBack.Add(Item);

                //AddBack.Add(EngWBDS.Tables["ECOMtl"].Rows[i]["MtlPartNum"].ToString());

                //AddBack_Qty.Add(EngWBDS.Tables["ECOMtl"].Rows[i]["QtyPer"].ToString());

                AddBack_Ops.Add(EngWBDS.Tables["ECOMtl"].Rows[i]["RelatedOperation"].ToString());

                AddBack_Uom.Add(EngWBDS.Tables["ECOMtl"].Rows[i]["UOMCode"].ToString());
            }

            for (int i = 0; i < Bill.Count; i++)
            {
                for (int j = 0; j < EngWBDS.Tables["ECOMtl"].Rows.Count; j++)
                {
                    string DS_val = EngWBDS.Tables["ECOMtl"].Rows[j]["MtlPartNum"].ToString();

                    if (DS_val == Bill[i].PartNumber)
                        FindItemSldWrks[i] = true;
                }
            }

            for (int i = 0; i < EngWBDS.Tables["ECOMtl"].Rows.Count; i++)
            {
                for (int j = 0; j < Bill.Count; j++)
                {
                    if (EngWBDS.Tables["ECOMtl"].Rows[i]["MtlPartNum"].ToString() == Bill[j].PartNumber)
                        FindItemEpicor[i] = true;
                }
            }
            #endregion

            #region Determine what needs to be saved

            AddBack = SafeParts(AddBack, AddBack_Ops,AddBack_Uom, out AddBack_Opts, out AddBack_Ops, out AddBack_Uom);

            #endregion

            #region Delete Missing Items
            for (int i = EngWBDS.Tables["ECOMtl"].Rows.Count - 1; i > -1; i--)
            {
                if (!FindItemEpicor[i])
                {
                    //Remove items
                    EngWBDS.Tables["ECOMtl"].Rows[i].Delete();

                    EngWB.Update(EngWBDS);

                    EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);
                }
            }
            #endregion

            int rowmod = EngWBDS.Tables["ECOMtl"].Rows.Count;

            #region Add missing items

            try
            {
                for (int i = 0; i < Bill.Count; i++)
                {
                    if (!FindItemSldWrks[i])
                    {
                        try
                        {
                            //rowmod = EngWBDS.Tables["ECOMtl"].Rows.Count;
                            //Add item
                            EngWB.GetNewECOMtl(EngWBDS, gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "");

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count-1]["MtlPartNum"] = Bill[i].PartNumber;

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count-1]["QtyPer"] = Bill[i].Qty;

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count-1]["RelatedOperation"] = ops_cbo.SelectedValue;

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["OpDesc"] = EngWBDS.Tables["ECOOpr"].Rows[ops_cbo.SelectedIndex]["OpDesc"];

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["PullAsAsm"] = false;

                            if (DataList.GetType(Bill[i].PartNumber) == "Purchased")
                                EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["ViewAsAsm"] = false;
                            else
                                EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["ViewAsAsm"] = true;

                            partnum_txt.Text = Bill[i].PartNumber;

                            DataTable ds = DataList.PartUOM(partnum_txt.Text);

                            uom_cbo.DataSource = ds;

                            uom_cbo.DisplayMember = "UOMCode";

                            uom_cbo.ValueMember = "UOMCode";

                            uom_cbo.SelectedIndex = 0;

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["UOMCode"] = uom_cbo.SelectedValue;

                            decimal qty_val = decimal.Parse(Bill[i].Qty);

                            EngWBDS.Tables["ECOMtl"].Rows[EngWBDS.Tables["ECOMtl"].Rows.Count - 1]["QtyPer"] = qty_val;

                            EngWB.Update(EngWBDS);

                            EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);
                        }
                        catch { }
                    }
                }
            }
            catch  { }
            #endregion

            #region Add Saved items

            try
            {
                for (int i = 0; i < AddBack.Count; i++)
                {
                    rowmod = EngWBDS.Tables["ECOMtl"].Rows.Count;
                    //Add item
                    EngWB.GetNewECOMtl(EngWBDS, gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "");

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["MtlPartNum"] = AddBack[i];

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["QtyPer"] = AddBack[i].Qty;

                    //EngWBDS.Tables["ECOMtl"].Rows[rowmod]["QtyPer"] = AddBack_Qty[i];

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["RelatedOperation"] = AddBack_Ops[i];

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["OpDesc"] = EngWBDS.Tables["ECOOpr"].Rows[ops_cbo.SelectedIndex]["OpDesc"];

                    char[] opts = AddBack_Opts[i].ToCharArray();

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["ViewAsAsm"] = (opts[0] == '1' ? true : false);

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["PullAsAsm"] = (opts[1] == '1' ? true : false);

                    partnum_txt.Text = AddBack[i].PartNumber;

                    DataTable ds = DataList.PartUOM(partnum_txt.Text);

                    uom_cbo.DataSource = ds;

                    uom_cbo.DisplayMember = "UOMCode";

                    uom_cbo.ValueMember = "UOMCode";

                    uom_cbo.SelectedIndex = 0;

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["UOMCode"] = AddBack_Uom[i];

                    uom_cbo.Text = AddBack_Uom[i];

                    decimal qty_val = decimal.Parse(AddBack[i].Qty);

                    //decimal qty_val = decimal.Parse(AddBack_Qty[i]);

                    EngWBDS.Tables["ECOMtl"].Rows[rowmod]["QtyPer"] = qty_val;

                    EngWB.Update(EngWBDS);

                    EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);
                }
            }
            catch{}

            #endregion

            #region Update per line
            for (int i = 0; i < Bill.Count; i++)
            {
                for (int j = 0; j < EngWBDS.Tables["ECOMtl"].Rows.Count; j++)
                {
                    EngWBDS.Tables["ECOMtl"].Rows[j]["OpDesc"] = EngWBDS.Tables["ECOOpr"].Rows[((int.Parse(EngWBDS.Tables["ECOMtl"].Rows[j]["RelatedOperation"].ToString())/10)-1)]["OpDesc"];

                    string EpicValue = EngWBDS.Tables["ECOMtl"].Rows[j]["MtlPartNum"].ToString();

                    string _BillItem = Bill[i].PartNumber;

                    decimal EpicQty = decimal.Parse(EngWBDS.Tables["ECOMtl"].Rows[j]["QtyPer"].ToString());

                    decimal _BillQty = decimal.Parse(Bill[i].Qty);

                    if (EpicValue == _BillItem && EpicQty != _BillQty)
                    {
                        EngWBDS.Tables["ECOMtl"].Rows[j]["QtyPer"] = Bill[i].Qty;
                    }
                }
            }
            #endregion

            try
            {
                EngWB.Update(EngWBDS);

                EngWB.ResequenceMaterials(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, Properties.Settings.Default.mtlreqtype, false, false, false);

                EngWBDS = EngWB.GetDatasetForTree(gid_txt.Text, parent_txt.Text, parentrev_txt.Text, "", null, false, false);

                BillDataGrid.DataSource = EngWBDS.Tables["ECOMtl"];

                EnableItemDetails();

            }
            catch { }
        }