Ejemplo n.º 1
0
        private void buttonChoose_Click(object sender, EventArgs e)
        {
            try
            {
                databaseexe databaseexe = new databaseexe();
                string      PurId       = ChooseProductGridView1.CurrentRow.Cells[1].Value.ToString();
                dataValue.CurrentQuantity = ChooseProductGridView1.CurrentRow.Cells[5].Value.ToString();
                string SupShort   = comboBox1.Text.ToString();
                string SupidQuery = "select Supid from T_Supplier where SupShort='" + SupShort + "'";
                string Supid      = databaseexe.getTopselect(SupidQuery, "Supid");
                string sql1       = "insert into T_MaterialIn (Matinid,PurId,Supid,MatinDate,MatDate,MatinPerson) values('" + MatInID + "','" + PurId + "','" + Supid + "','" + Matindate + "','" + Matdate + "','" + MatPerson + "')";
                dbexe.sqlcmd(sql1);
                string sql = "select SupShort as 供方,purid as 采购序号,MaterialName as 纸板名称,bomsize as 规格,PurchaseQuantity as 采购数量,MatQuantity as 进料数量,(purchaseQuantity-matquantity)as 未进数量,PurchaseDate as 订货日期,deliverydate as 交货日期 from T_Matin2 where id is null and purid is not null and  purchaseQuantity <> '0' and Supshort ='" + SupShort + "' or id  in(select max(id) from T_Matin2 group by Purid having max(id)is not null ) and  purchaseQuantity <> '0' and Supshort ='" + SupShort + "'";

                DataTable Datatable;
                Datatable = dbexe.getdataset(sql, "T_MATin2").Tables[0];
                for (int i = 0; i < Datatable.Rows.Count; i++)
                {
                    if (Datatable.Rows[i]["进料数量"].ToString() == "")
                    {
                        Datatable.Rows[i]["进料数量"] = "0";
                        Datatable.Rows[i]["未进数量"] = Datatable.Rows[i]["采购数量"];
                    }
                }
                ChooseProductGridView1.DataSource = Datatable;

                string QuantityRefresh = "update T_Matin3 set MatQuantity='" + dataValue.CurrentQuantity + "'where matinid='" + MatInID + "'and purid='" + PurId + "'";
                dbexe.sqlcmd(QuantityRefresh);


                frmMaterialInOrder4 f1 = (frmMaterialInOrder4)this.Owner;
                f1.dgload(Supid, MatInID, PurId);
                //f1.dgload2(PurId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void buttonSaveNew_Click(object sender, EventArgs e)
        {
            frmMaterialInOrder4 frmsub = new frmMaterialInOrder4();

            frmsub.Show();
        }