Example #1
0
        public void dgload(string Manuorderid, string ManuId)
        {
            ManudataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            string sql = "select zhuananId as 专案编码, Productname as 品名, producttype as 箱式," +
                         "materialname as 纸板名称 ,plength as 长,pwide as 宽,pheight as 高,unit as 单位,Bomsize as 用料," +
                         "allMaterialQuantity as 张数 from T_manus where orderid= '" + Manuorderid + "'";

            ManudataGridView1.DataSource =
                dbexe.getdataset(sql, "T_manus").Tables[0];
            ManudataGridView1.EnableHeadersVisualStyles               = false;
            ManudataGridView1.ColumnHeadersDefaultCellStyle.Font      = new Font("宋体", 11, FontStyle.Bold);
            ManudataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSlateGray;
            ManudataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            databaseexe databaseexe = new databaseexe();

            textBoxSaleID.Text = Manuorderid;
            textBoxManuId.Text = ManuId;
            string CusidQuery = "select distinct(Cusid) from T_allsale where orderid='" + Manuorderid + "'";
            string da         = databaseexe.getTopselect(CusidQuery, "Cusid");

            textBoxCusid.Text = da;
            string CusShortQuery = "select CusShort from T_Customer where Cusid='" + da + "'";

            textBoxCusshort.Text = databaseexe.getTopselect(CusShortQuery, "CusShort");
            string OrderDateQuery = "select distinct(orderDate) from T_allSale where Orderid='" + Manuorderid + "'";

            textBoxOrderdate.Text = databaseexe.getTopselect(OrderDateQuery, "OrderDate");
            string DeliveryDateQuery = "select distinct(Deliverytime) from T_allSale where orderid='" + Manuorderid + "'";

            textBoxDeliveryDate.Text = databaseexe.getTopselect(DeliveryDateQuery, "deliverytime");
        }
Example #2
0
        private void buttonChoose_Click(object sender, EventArgs e)
        {
            try
            {
                databaseexe databaseexe = new databaseexe();


                string ZhuanAnid        = PurchaseOrderdataGridView2.CurrentRow.Cells[0].Value.ToString();
                string PurchaseQuantity = PurchaseOrderdataGridView2.CurrentRow.Cells[5].Value.ToString();

                string BomidQuery = "select bomid from T_pur where zhuananid='" + ZhuanAnid + "'";
                string bomid      = databaseexe.getTopselect(BomidQuery, "bomid");
                string priceQuery = "Select materialprice from T_BOMPRICE where bomid='" + bomid + "'and Supid='" + Supid + "'";
                string price      = databaseexe.getTopselect(priceQuery, "materialprice");
                string sql1       = "insert into T_purchaseOrder (purchaseid,purchasequantity,zhuananid,price,supid) values('" + PurchaseId + "','" + PurchaseQuantity + "','" + ZhuanAnid + "','" + price + "','" + Supid + "')";
                dbexe.sqlcmd(sql1);

                /*string sql = "select zhuananid as 专案编号,CusShort as 客户,productName as 品名,materialName as 纸板名称,bomsize as 规格, allMaterialQuantity-matstock as 欠料数量 from T_pur where purchaseid is null and manuid is not null ";
                 * dbexe.sqlcmd(sql);*/
                string sql2 = "select zhuananid as 专案编号,CusShort as 客户,productName as 品名,materialName as 纸板名称,bomsize as 规格, allMaterialQuantity-matstock as 欠料数量 from T_pur where purchaseid is null and manuid is not null ";

                // dbexe.getdataset(sql2, "T_pur").Tables[0];
                DataTable Datatable;

                Datatable = dbexe.getdataset(sql2, "T_pur").Tables[0];
                for (int i = 0; i < Datatable.Rows.Count; i++)
                {
                    if (int.Parse(Datatable.Rows[i]["欠料数量"].ToString()) < 0)
                    {
                        Datatable.Rows[i]["欠料数量"] = "0";
                    }
                }

                PurchaseOrderdataGridView2.DataSource = Datatable;

                /*string[] arr;
                 * arr = databaseexe.getMultiData(sql, "id");
                 * for (int i = 0; i < arr.Length; i++)
                 * {
                 *
                 *
                 *  //string AllMaterialQuery = " Select unitquantity*orderquantity as a from T_manus where ZhuanAnID = '" + arr[i].ToString() + "'";
                 *  //string AllMaterialQuantity = databaseexe.getTopselect(AllMaterialQuery, "a");
                 *  //string PurchaseQuantity="update T_PurchaseOrder set purchasequantity='"+PurchaseOrderdataGridView2.CurrentRow.Cells[5].Value.ToString()+"'where zhuananid= '"+ZhuanAnid+"'";
                 *
                 * }*/

                frmPurchaseAdd4 f1 = (frmPurchaseAdd4)this.Owner;
                f1.dgload(PurchaseId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void frmOrderDetail2_Load(object sender, EventArgs e)
        {
            //float.Parse(length)

            string typeid = "select typeid from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxTypeid.Text = databaseexe.getTopselect(typeid, "typeid");

            string unit = "select unit from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxUnit.Text = databaseexe.getTopselect(unit, "unit");


            string deliveryDateQuery = "select deliverytime from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxDeliveryTime.Text = databaseexe.getTopselect(deliveryDateQuery, "deliverytime");

            string quantity = "select orderquantity from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxQuantity.Text = databaseexe.getTopselect(quantity, "orderquantity");
            string unitPrice = "select price from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxunitPrice.Text = databaseexe.getTopselect(unitPrice, "price");
            string materialid = "select materialid from T_allsale where id ='" + textBoxId.Text + "'";

            textBoxMaterialId.Text = databaseexe.getTopselect(materialid, "materialid");
            string yinshuaQuery = "select yingshua from T_allsale where id='" + textBoxId.Text + "'";

            yinshuaQuery = databaseexe.getTopselect(yinshuaQuery, "yingshua");
            string zhanjiaoQuery = "select zhanjiao from T_allsale where id='" + textBoxId.Text + "'";

            zhanjiaoQuery = databaseexe.getTopselect(zhanjiaoQuery, "zhanjiao");
            string dadingQuery = "select dading from T_allsale where id ='" + textBoxId.Text + "'";

            dadingQuery = databaseexe.getTopselect(dadingQuery, "dading");
            if (yinshuaQuery.Equals("true"))
            {
                checkBox1.Checked = true;
            }
            if (zhanjiaoQuery.Equals("true"))
            {
                checkBox2.Checked = true;
            }
            if (dadingQuery.Equals("true"))
            {
                checkBox3.Checked = true;
            }
            try
            { textBoxPrice.Text = (float.Parse(textBoxunitPrice.Text) * float.Parse(textBoxQuantity.Text)).ToString(); }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        public string orderGenerator(string cusid)
        {
            string orderid = null;
           
             string sql = " select top 1 * from T_allsale where cusid ='" + cusid + "' order by number desc";
            databaseexe databaseexe = new databaseexe();
            int number;
            string judge = databaseexe.getTopselect(sql, "number");
            if (judge == null) {
                number = 0;
            }
            else {
                number = int.Parse(judge);
            }
            
            number = number + 1;
             orderid = number.ToString();
            for (int i = 0; i <(8- number.ToString().Length); i++) {

                orderid = "0" + orderid;
            }
            orderid = cusid + orderid;

            JObject jsonObject = new JObject();
            jsonObject["number"] = number;
            jsonObject["orderid"] = orderid;
            var json = jsonObject.ToString();
            return json;
        }
Example #5
0
        private void ProductIndataGridView1_CellEndEdit_1(object sender, DataGridViewCellEventArgs e)
        {
            string zhuananid    = ProductIndataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
            string changestring = ProductIndataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

            try
            {
                databaseexe databaseexe = new databaseexe();
                //string QuantityNow = ClientdataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
                //int CurrentQuantity = int.Parse(QuantityNow) + int.Parse(changestring);

                string QuantityQuery   = "select sum(proinquantity) as a from T_productin group by zhuananID having sum(proinquantity)is not null and zhuananID='" + zhuananid + "'";
                string lastQuantity    = databaseexe.getTopselect(QuantityQuery, "a");
                int    CurrentQuantity = int.Parse(lastQuantity) + int.Parse(changestring);
                string sql             = "update T_productIn set proinquantity ='" + changestring + "',proquantity ='" + CurrentQuantity + "'where zhuananid ='" + zhuananid + "'and proinid='" + textBoxProductInId.Text.ToString() + "'";
                databaseexe.sqlcmd(sql);
                // dgload2(purid);
                string MatStock = "Update T_fixpro set Stock=Stock+'" + changestring + "' where id=(select pid from T_alls where id='" + zhuananid + "')";
                dbexe.sqlcmd(MatStock);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #6
0
        private void comboBoxMultiColumnsClientid_TextChanged(object sender, EventArgs e)
        {
            string      sql         = "select cusShort from T_Customer where cusid='" + comboBoxMultiColumnsClientid.Text.Trim() + "'";
            databaseexe databaseexe = new databaseexe();
            string      da          = databaseexe.getTopselect(sql, "Cusshort");

            textBoxClientName.Text = da;
        }
Example #7
0
        private void frmBomAdd3_Load(object sender, EventArgs e)
        {
            string      BomidQuery  = "select top 1 bomid from t_bom order by bomid desc ";
            databaseexe databaseexe = new databaseexe();
            string      Bomid       = databaseexe.getTopselect(BomidQuery, "bomid");

            Bomid              = (int.Parse(Bomid) + 1).ToString();
            textBoxBoid1.Text  = Bomid;
            textBoxProId.Text  = dataValue.Bomid;
            textBoxLength.Text = dataValue.Bomlength;
            textBoxWide.Text   = dataValue.BomWide;
            textBoxHeight.Text = dataValue.Bomheight;
            string    productid = textBoxProId.Text.Trim();
            string    sql       = "select productName from T_bomall where id ='" + productid + "'";
            DataTable de        =
                dbexe.getdataset(sql, "T_bomall").Tables[0];

            for (int i = 0; i < de.Rows.Count; i++)
            {
                DataRow dc = de.Rows[i];
                textBoxProductName.Text = dc["productname"].ToString();
            }
            string    sql1 = "select quantity from T_bomall where id ='" + productid + "'";
            DataTable da   =
                dbexe.getdataset(sql1, "T_bomall").Tables[0];

            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dz = da.Rows[i];
                textBoxProQuantity.Text = dz["quantity"].ToString();
            }

            string    sql4 = "select MaterialId from T_material";
            DataTable dk   =
                dbexe.getdataset(sql4, " T_Material").Tables[0];

            for (int i = 0; i < dk.Rows.Count; i++)
            {
                DataRow dc = dk.Rows[i];
                BomNamecomboBox1.Items.Add(dc["materialID"]);
            }

            if (dk.Rows.Count > 0)
            {
                BomNamecomboBox1.SelectedIndex = -1;
            }

            string    sql5 = "select materialName from T_material where materialid='" + BomNamecomboBox1.Text.ToString() + "'";
            DataTable dm   =
                dbexe.getdataset(sql5, "T_material").Tables[0];

            for (int i = 0; i < dm.Rows.Count; i++)
            {
                DataRow dc = dm.Rows[i];
                textBoxBomname1.Text = dc["materialname"].ToString();
            }
        }
Example #8
0
        public string MatinGenerator()
        {
            string      sql         = "select top 1 matinId from t_MaterialIn order by id desc";
            databaseexe databaseexe = new databaseexe();
            string      lastid      = databaseexe.getTopselect(sql, "matinid");
            int         result      = int.Parse(lastid) + 1;

            return(result.ToString());
        }
Example #9
0
        public string proInGenerator()
        {
            string      sql         = "select top 1 ProinID from t_ProductIn order by id desc";
            databaseexe databaseexe = new databaseexe();
            string      lastid      = databaseexe.getTopselect(sql, "Proinid");
            int         result      = int.Parse(lastid) + 1;

            return(result.ToString());
        }
Example #10
0
        private void buttonCheck_Click(object sender, EventArgs e)
        {
            string OrderId     = textBoxOrderid.Text.ToString();
            string CheckTime   = DateTime.Now.ToShortDateString();
            string checkperson = dataValue.StaffName;
            string sql         = "update T_OrderSale set status ='已审核',checktime ='" + CheckTime + "',checkperson='" + checkperson + "' where orderid='" + OrderId + "'";

            dbexe.sqlcmd(sql);
            string      statusQuery = "select distinct(status) from T_ordersale where orderid='" + OrderId + "'";
            databaseexe databaseexe = new databaseexe();
            string      da          = databaseexe.getTopselect(statusQuery, "status");

            textBoxStatus.Text = da;
            string CheckDateQuery = "select distinct(checktime) from T_ordersale where orderid='" + OrderId + "'";
            string dc             = databaseexe.getTopselect(CheckDateQuery, "checktime");

            textBoxCheckDate.Text = dc;
            string checkPersonQuery = "select distinct(checkperson) from T_ordersale where orderid='" + OrderId + "'";
            string db = databaseexe.getTopselect(checkPersonQuery, "checkperson");

            textBoxCheckPerson.Text = db;
        }
Example #11
0
        private void frmSaleModify2_Load(object sender, EventArgs e)
        {
            string deliveryDateQuery = "select distinct(deliverytime ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            DeliveryTimePicker2.Text = databaseexe.getTopselect(deliveryDateQuery, "deliverytime");
            string OrderDateQuery = "select distinct(orderdate ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            OrderdateTimePicker1.Text = databaseexe.getTopselect(OrderDateQuery, "orderdate");
            string InDateQuery = "select distinct(indate ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            textBoxInDate.Text = databaseexe.getTopselect(InDateQuery, "indate");
            string OrderpersonQuery = "select distinct(orderperson ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            textBoxOderperson.Text = databaseexe.getTopselect(OrderpersonQuery, "orderperson");
            string CusidQuery = "select distinct(Cusid ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            textBoxClientID.Text = databaseexe.getTopselect(CusidQuery, "cusid");
            string CusShortQuery = "select distinct(Cusshort ) from T_Customer where cusid ='" + textBoxClientID.Text.Trim() + "'";

            textBoxClientName.Text = databaseexe.getTopselect(CusShortQuery, "cusShort");
            string StatusQuery = "select distinct(status ) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            textBoxStatus.Text = databaseexe.getTopselect(StatusQuery, "status");
            SaledataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            string checkQuery = "select distinct(checkTime) from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            textBoxCheckDate.Text = databaseexe.getTopselect(checkQuery, "checktime");
            string checkPersonQuery = "select distinct(checkperson) from T_ordersale where orderid='" + textBoxOrderid.Text.Trim() + "'";
            string db = databaseexe.getTopselect(checkPersonQuery, "checkperson");

            textBoxCheckPerson.Text = db;


            string sql = "select  id as 专案编码,productNAME as 品名,productType as 箱式,materialname as 纸板材料,PLength as 长,Pwide as 宽,Pheight as 高,unit as 单位, Price as 单价 ,orderquantity as 订购数量 from T_allsale where orderid ='" + textBoxOrderid.Text.Trim() + "'";

            SaledataGridView1.DataSource =
                dbexe.getdataset(sql, "T_allsale").Tables[0];
            SaledataGridView1.EnableHeadersVisualStyles               = false;
            SaledataGridView1.ColumnHeadersDefaultCellStyle.Font      = new Font("宋体", 11, FontStyle.Bold);
            SaledataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSlateGray;
            SaledataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
        }
Example #12
0
        public Boolean getMultiMatIn(string PurId)
        {
            string      sql         = "select id from T_matin where purid ='" + PurId + "'";
            databaseexe databaseexe = new databaseexe();
            string      result      = databaseexe.getTopselect(sql, "id");

            if (result == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #13
0
        public frmFixAdd(DataGridViewRow dgvr1, string id, string tid, string quantity)
        {
            InitializeComponent();
            dgvr = dgvr1;
            getValue();
            clientID = id;
            typeId   = tid;
            Quantity = quantity;

            string      tidquery    = "select typeid from T_FixPRO where id ='" + typeId + "'";
            databaseexe databaseexe = new databaseexe();

            tid = databaseexe.getTopselect(tidquery, "typeid");
            string mIdQuery = "select materialID from T_FixPRO where id ='" + typeId + "'";

            MaterialId          = databaseexe.getTopselect(mIdQuery, "materialId");
            comboBoxTypeID.Text = tid;

            string MnameQuery = "select materialID from T_MATERIAL where id ='" + MaterialId + "'";

            comboBoxMaterialID.Text = databaseexe.getTopselect(MnameQuery, "materialID");
            string PriceQuery = "select price from T_fixpro where id ='" + textBoxFixId.Text + "'";

            textBoxPrice.Text = databaseexe.getTopselect(PriceQuery, "price");

            string yinshuaQuery = "select yingshua from T_fixPRO where id='" + textBoxFixId.Text + "'";

            yinshuaQuery = databaseexe.getTopselect(yinshuaQuery, "yingshua");
            string zhanjiaoQuery = "select zhanjiao from T_fixPRO where id='" + textBoxFixId.Text + "'";

            zhanjiaoQuery = databaseexe.getTopselect(zhanjiaoQuery, "zhanjiao");
            string dadingQuery = "select dading from T_fixPRO where id ='" + textBoxFixId.Text + "'";

            dadingQuery = databaseexe.getTopselect(dadingQuery, "dading");
            if (yinshuaQuery.Equals("true"))
            {
                checkBox1.Checked = true;
            }
            if (zhanjiaoQuery.Equals("true"))
            {
                checkBox2.Checked = true;
            }
            if (dadingQuery.Equals("true"))
            {
                checkBox3.Checked = true;
            }
        }
Example #14
0
        private void buttonModify_Click(object sender, EventArgs e)
        {
            try
            {
                typeid = FixProductGridView1.CurrentRow.Cells[0].Value.ToString();
                string QuantityQuery = "select quantity from T_fixpro where id ='" + typeid + "'";
                string Quantity      = databaseexe.getTopselect(QuantityQuery, "quantity");

                frmFixAdd frmsub = new frmFixAdd(FixProductGridView1.CurrentRow, Id, typeid, Quantity);

                frmsub.Show();
                frmsub.buttonSave.Enabled    = true;
                frmsub.buttonSaveNew.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #15
0
        private void DeliverydataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string zhuananid    = DeliverydataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
            string changestring = DeliverydataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            string deliveryId   = textBoxDeliveryID.Text.ToString();

            try
            {
                databaseexe databaseexe = new databaseexe();
                //string QuantityNow = ClientdataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
                //int CurrentQuantity = int.Parse(QuantityNow) + int.Parse(changestring);

                string QuantityQuery   = "select sum(deliveryoutquantity) as a from T_deliveryOut group by zhuananID having sum(deliveryoutquantity)is not null and zhuananID='" + zhuananid + "'";
                string lastQuantity    = databaseexe.getTopselect(QuantityQuery, "a");
                int    CurrentQuantity = int.Parse(lastQuantity) + int.Parse(changestring);
                string sql             = "update T_deliveryOut set deliveryoutquantity ='" + changestring + "',deliveryquantity ='" + CurrentQuantity + "'where zhuananid ='" + zhuananid + "'and deliveryid='" + textBoxDeliveryID.Text.ToString() + "'";
                databaseexe.sqlcmd(sql);
                this.BeginInvoke(new MethodInvoker(() => {//异步处理
                    string sql1 = "select CusShort as 客户,zhuananid as 专案编号,productName as 品名,productType as 箱式,materialName as 纸板名称,plength as 长,pwide as 宽,pheight as 高,unit as 单位,deliveryoutquantity as 出货数量,price as 单价,(deliveryOutquantity*price) as 金额 from T_DelOut where deliveryid='" + deliveryId + "'";

                    //DeliverydataGridView1.DataSource =

                    //dbexe.getdataset(sql1, "T_delout").Tables[0];
                    //string sql = "select CusShort as 客户,zhuananid as 专案编号,Orderid as 订单号,productName as 品名,producttYPE as 箱式,plength as 长,pwide as 宽,pheight as 高,unit as 单位,materialName as 纸板名称,orderquantity as 订单数量, deliveryquantity as 已送数量,(orderquantity-deliveryquantity)as 未送数量,deliverytime as 交货日期 from T_delout where id is null and zhuananid is not null or id  in(select max(id) from T_delout group by zhuananid having max(id)is not null )";

                    DataTable Datatable;
                    Datatable = dbexe.getdataset(sql1, "T_DelOut").Tables[0];

                    DeliverydataGridView1.DataSource = Datatable;
                }));
                this.BeginInvoke(new MethodInvoker(() => {
                    string MatStock = "Update T_fixpro set Stock=Stock-'" + changestring + "' where id=(select pid from T_alls where id='" + zhuananid + "')";
                    dbexe.sqlcmd(MatStock);
                }));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #16
0
        public void dgload(string supid, string matinid, string purid)
        {
            textBoxProductInId.Text = matinid;

            //textBoxSup.Text = supid;
            string      SupShortQuery = "select SupShort from t_Supplier where Supid='" + supid + "'";
            databaseexe databaseexe   = new databaseexe();

            textBoxSup.Text = databaseexe.getTopselect(SupShortQuery, "Supshort");
            MaterialIndataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            string sql = "select purid as 采购序号,Supshort as 供方,MaterialName as 纸板,bomsize as 规格,MatQuantity as 数量,price as 单价,MatQuantity*price as 金额 from T_Matin2 where Matinid='" + matinid + "'";



            DataTable datatable = dbexe.getdataset(sql, "T_matin2").Tables[0];

            for (int i = 0; i < datatable.Rows.Count; i++)
            {
                datatable.Rows[i]["数量"] = "0";
            }
            MaterialIndataGridView1.DataSource = datatable;
            MaterialIndataGridView1.EnableHeadersVisualStyles               = false;
            MaterialIndataGridView1.ColumnHeadersDefaultCellStyle.Font      = new Font("宋体", 9, FontStyle.Bold);
            MaterialIndataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSlateGray;
            MaterialIndataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;

            string quantityNow = dataValue.CurrentQuantity;

            ClientdataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            string sql1 = "select Zhuananid as 专案编号,CusShort as 客户,ProductName as 品名,purchaseQuantity as 采购数量,Matquantity as 入仓数量 from T_matin3  where matinid = '" + textBoxProductInId.Text.ToString() + "'";

            ClientdataGridView1.DataSource =

                dbexe.getdataset(sql1, "T_matin3").Tables[0];
            ClientdataGridView1.EnableHeadersVisualStyles               = false;
            ClientdataGridView1.ColumnHeadersDefaultCellStyle.Font      = new Font("宋体", 9, FontStyle.Bold);
            ClientdataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSlateGray;
            ClientdataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
        }
Example #17
0
        public string deliveryGenerator()
        {
            DateTime dt = DateTime.Now;
            //string year = dt.Year.ToString();
            //string month = dt.Month.ToString();

            /*if (month.Length < 2) {
             *  month = "0" + month;
             * }
             * string day = dt.Day.ToString();
             * if (day.Length < 2)
             * {
             *  day = "0" + day;
             * }*/
            string      count           = "";                                                            //声明新生成的送货单号
            string      deliveryidQuery = "select top 1 deliveryid from t_deliveryout order by id desc"; //查询数据库中最后一个送货单号
            databaseexe databaseexe     = new databaseexe();
            string      lastid          = databaseexe.getTopselect(deliveryidQuery, "deliveryid");
            string      lastidDate      = lastid.Substring(0, 6);                                             //截取最后一个送货单号的日期yyyyMM
            string      lastidSEQ       = lastid.Substring(6);                                                //截取最后流水号
            DateTime    dateTime        = DateTime.ParseExact(lastidDate, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
            int         result          = CompanyDate(dateTime.ToString(), DateTime.Now.ToShortDateString()); //比较今天和最后一个送货单号的时间

            if (result == 1 || result == 0)
            {
                count = "001";
            }
            else
            {
                int _count = int.Parse(lastidSEQ) + 1;
                for (int i = 0; i < 3 - _count.ToString().Length; i++)
                {
                    count = count + "0";
                }
                count = count + _count.ToString();
            }
            string code = DateTime.Now.ToString("yyyyMM") + count;//最后组成送货单

            return(code);
        }
Example #18
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);
            }
        }
Example #19
0
        public void getValue()
        {
            textBoxFixId.Text        = dgvr.Cells[0].Value.ToString();
            textBoxProductName.Text  = dgvr.Cells[1].Value.ToString();
            textBoxTypeNAME.Text     = dgvr.Cells[2].Value.ToString();
            textBoxMaterialName.Text = dgvr.Cells[3].Value.ToString();
            textBoxLength.Text       = dgvr.Cells[4].Value.ToString();
            textBoxWide.Text         = dgvr.Cells[5].Value.ToString();
            textBoxHeight.Text       = dgvr.Cells[6].Value.ToString();
            textBoxUnit.Text         = dgvr.Cells[7].Value.ToString();
            string CusIDQuery = "select Cusid from T_fixPRO where id ='" + textBoxFixId.Text.Trim() + "'";

            textBoxClientID.Text = databaseexe.getTopselect(CusIDQuery, "cusid");
            string CusNAMEQuery = "select Cusshort from T_Customer where Cusid ='" + textBoxClientID.Text.Trim() + "'";

            textBoxClientShort.Text = databaseexe.getTopselect(CusNAMEQuery, "cusshort");
            string Fatherid = "select fatherid from T_fixPRO where id ='" + textBoxFixId.Text.Trim() + "'";

            textBoxFixMaiNId.Text = databaseexe.getTopselect(Fatherid, "fatherid");
            string memo = "select memo from T_fixPRO where id ='" + textBoxFixId.Text.Trim() + "'";

            textBoxMemo.Text = databaseexe.getTopselect(memo, "memo");

            string yinshuaQuery = "select yingshua from T_fixPRO where id='" + textBoxFixId.Text + "'";

            yinshuaQuery = databaseexe.getTopselect(yinshuaQuery, "yingshua");
            string zhanjiaoQuery = "select zhanjiao from T_fixPRO where id='" + textBoxFixId.Text + "'";

            zhanjiaoQuery = databaseexe.getTopselect(zhanjiaoQuery, "zhanjiao");
            string dadingQuery = "select dading from T_fixPRO where id ='" + textBoxFixId.Text + "'";

            dadingQuery = databaseexe.getTopselect(dadingQuery, "dading");
            if (yinshuaQuery.Equals("true"))
            {
                checkBox1.Checked = true;
            }
            if (zhanjiaoQuery.Equals("true"))
            {
                checkBox2.Checked = true;
            }
            if (dadingQuery.Equals("true"))
            {
                checkBox3.Checked = true;
            }
        }
Example #20
0
        private void buttonSaveNew_Click(object sender, EventArgs e)
        {
            try
            {
                string      FixID        = textBoxFixId.Text.Trim();
                string      CusID        = textBoxClientID.Text.Trim();
                string      ProductName  = textBoxProductName.Text.Trim();
                string      typeId       = comboBoxTypeID.Text.Trim();
                string      TypeName     = textBoxTypeNAME.Text.Trim();
                string      unit         = textBoxUnit.Text.Trim();
                string      materialID   = comboBoxMaterialID.Text.Trim();
                string      materialName = textBoxMaterialName.Text.Trim();
                string      Plength      = textBoxLength.Text.Trim();
                string      Pwide        = textBoxWide.Text.Trim();
                string      Pheight      = textBoxHeight.Text.Trim();
                string      quantity     = textBoxQuantity.Text.Trim();
                string      memo         = textBoxMemo.Text.Trim();
                string      price        = textBoxPrice.Text.Trim();
                Boolean     yinshua      = checkBox1.Checked;
                Boolean     zhanjiao     = checkBox2.Checked;
                Boolean     dading       = checkBox3.Checked;
                string      MidQuery     = "select ID from T_MATERIAL where materialid ='" + materialID + "'";
                databaseexe databaseexe  = new databaseexe();
                string      id           = databaseexe.getTopselect(MidQuery, "ID");
                string      sql          = "update T_FixPRO set typeId='" + typeId + "',ProductName ='" + ProductName + "',productType='" + TypeName + "',materialId='" + id + "',MaterialName='" + materialName + "',Plength='" + Plength + "',Pwide='" + Pwide + "',Pheight='" + Pheight + "',unit='" + unit + "',quantity='" + quantity + "',price='" + price + "',memo='" + memo + "'where Id='" + FixID + "'";
                dbexe.sqlcmd(sql);

                if (yinshua.Equals(true))
                {
                    string sql2 = "update T_fixPRO set yingshua ='true' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql2);
                }
                if (zhanjiao.Equals(true))
                {
                    string sql3 = "update T_fixPRO set zhanjiao ='true' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql3);
                }
                if (dading.Equals(true))
                {
                    string sql4 = "update T_fixPRO set dading ='true' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql4);
                }
                if (yinshua.Equals(false))
                {
                    string sql5 = "update T_fixPRO set yingshua ='false' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql5);
                }
                if (zhanjiao.Equals(false))
                {
                    string sql6 = "update T_fixPRO set zhanjiao ='false' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql6);
                }
                if (dading.Equals(false))
                {
                    string sql7 = "update T_fixPRO set dading ='false' where id='" + FixID + "'";
                    dbexe.sqlcmd(sql7);
                }
                MessageBox.Show("数据保存成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #21
0
        private void buttonSaveNew_Click(object sender, EventArgs e)
        {
            //frmFixAdd frmsub = new frmFixAdd();
            //frmsub.buttonPairSearch.Enabled = true;

            try
            {
                string  CusID        = textBoxClientID.Text.Trim();
                string  FatherId     = textBoxFixMaiNId.Text.Trim();
                string  fittingName  = textBoxProductName.Text.Trim();
                string  typeId       = comboBoxTypeID.Text.Trim();
                string  TypeName     = textBoxTypeNAME.Text.Trim();
                string  unit         = textBoxUnit.Text.Trim();
                string  materialID   = comboBoxMaterialID.Text.Trim();
                string  materialName = textBoxMaterialName.Text.Trim();
                string  Flength      = textBoxLength.Text.Trim();
                string  Fwide        = textBoxWide.Text.Trim();
                string  Fheight      = textBoxHeight.Text.Trim();
                string  quantity     = textBoxQuantity.Text.Trim();
                string  memo         = textBoxMemo.Text.Trim();
                string  price        = textBoxPrice.Text.Trim();
                Boolean yinshua      = checkBox1.Checked;
                Boolean zhanjiao     = checkBox2.Checked;
                Boolean dading       = checkBox3.Checked;
                //string sql = "insert into T_fixbox (cusID,productname,producttype,materialname,plength,pwide,pheight,unit,quantity,price,memo) values
                string      MidQuery    = "select ID from T_MATERIAL where materialid ='" + materialID + "'";
                databaseexe databaseexe = new databaseexe();
                string      id          = databaseexe.getTopselect(MidQuery, "ID");
                string      sql         = "insert into T_fixpro (CusId,productNAME,typeid,producttype,materialId,MaterialName,plength,pwide,pheight,unit,quantity,fatherid,memo,price) values ('" + CusID + "','" + fittingName + "','" + typeId + "','" + TypeName + "','" + id + "','" + materialName + "','" + Flength + "','" + Fwide + "','" + Fheight + "','" + unit + "','" + quantity + "','" + FatherId + "','" + memo + "','" + price + "')";


                /*string sql = "update T_Customer set CusShort='" + CusShort + "',CusName='" + CusName + "',CusTelephone='" + CusTel + "',CusFax='" + CusFax + "',CusAdress='" + CusAdress + "',CusPerson='" + CusPerson + "',CusBank='" + CusBank + "',CusAccount='" + CusAccount + "',CusMemo='" + CusMemo + "'where CusId='" + CusId + "'";*/
                dbexe.sqlcmd(sql);
                string      sql1         = "select  top 1 id from T_fixpro order by id DESC ";
                databaseexe databaseexe2 = new databaseexe();
                string      newid        = databaseexe2.getTopid(sql1);



                if (yinshua.Equals(true))
                {
                    string sql2 = "update T_fixpro set yingshua ='true' where id='" + newid + "'";
                    dbexe.sqlcmd(sql2);
                }
                if (zhanjiao.Equals(true))
                {
                    string sql3 = "update T_fixpro set zhanjiao ='true' where id='" + newid + "'";
                    dbexe.sqlcmd(sql3);
                }
                if (dading.Equals(true))
                {
                    string sql4 = "update T_fixpro set dading ='true' where id='" + newid + "'";
                    dbexe.sqlcmd(sql4);
                }
                MessageBox.Show("数据保存成功!");

                string      sql5         = "select  top 1 id from T_fixpro order by id DESC ";
                databaseexe databaseexe3 = new databaseexe();
                textBoxFixId.Text = databaseexe2.getTopid(sql5);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #22
0
        private void buttonChoose_Click(object sender, EventArgs e)
        {
            try
            {
                ManuGenarator manu = new ManuGenarator();
                dataValue.ManuSaleid = SaleOrderdataGridView1.CurrentRow.Cells[0].Value.ToString();
                string      ManuOrderid = dataValue.ManuSaleid;
                string      ManuId      = manu.manuGenerator(ManuOrderid);
                string      sql         = " Select id from t_ordersale where orderid ='" + ManuOrderid + "'order by id asc";
                databaseexe databaseexe = new databaseexe();
                string[]    arr;
                arr = databaseexe.getMultiData(sql, "id");
                for (int i = 0; i < arr.Length; i++)
                {
                    string AllMaterialQuery    = " Select unitquantity*orderquantity as a from T_manus where ZhuanAnID = '" + arr[i].ToString() + "'";
                    string AllMaterialQuantity = databaseexe.getTopselect(AllMaterialQuery, "a");
                    string sql1 = "insert into T_manuOrder (manuid,allmaterialquantity,saleid,zhuananid) values('" + ManuId + "','" + AllMaterialQuantity + "','" + ManuOrderid + "','" + arr[i].ToString() + "')";
                    dbexe.sqlcmd(sql1);
                }

                frmManuOrderAdd3 f1 = (frmManuOrderAdd3)this.Owner;
                f1.dgload(ManuOrderid, ManuId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            /*string orderQuantity = SaleOrderdataGridView1.CurrentRow.Cells[10].Value.ToString();
             * string Uniqueid = SaleOrderdataGridView1.CurrentRow.Cells[1].Value.ToString();
             * string unitQuantityQuery = "select unitquantity from T_manus where zhuananid ='" + Uniqueid + "'";
             * databaseexe databaseexe = new databaseexe();
             * string UnitQuantity = databaseexe.getTopselect(unitQuantityQuery, "unitquantity");
             *
             * AutoCount autoCount = new AutoCount();
             * string MaterialAll = autoCount.MaterialCount(orderQuantity,UnitQuantity);
             *
             * //frmManuOrderAdd3 frmsub = new frmManuOrderAdd3(SaleOrderdataGridView1.CurrentRow);
             * //frmsub.Show();
             *
             *
             * /* string Orderid = dataValue.saleid;
             * frmOrderSaleNew2 frmsub = new frmOrderSaleNew2(Orderid);
             * frmOrderSaleNew2.FrmOrderSaleNew2.dgload(Orderid);
             * this.Close();*/
            //string Orderid = dataValue.saleid;

            /* dataValue.ManuSaleid = SaleOrderdataGridView1.CurrentRow.Cells[0].Value.ToString();
             * string ManuOrderid = dataValue.ManuSaleid;
             * Select id  from t_ordersale
             *
             * string sql = "insert into T_manuOrder (manuid,saleid,allMaterialQuantity) values ('" + ManuId + "','"+ManuOrderid+ "','"+MaterialAll+"')";
             * dbexe.sqlcmd(sql);
             * MessageBox.Show("数据添加成功!");*/

            //frmManuOrderAdd3 frmManuOrderAdd3 = new frmManuOrderAdd3(ManuOrderid);


            // frmManuOrderAdd3.FrmManuOrderAdd3.dgload(ManuOrderid);



            this.Close();
            MessageBox.Show("数据添加成功!");
        }