Beispiel #1
0
        private void listView4_DoubleClick(object sender, EventArgs e)
        {
            if (listView4.SelectedItems.Count != 1 || listView3.SelectedItems.Count != 1)
            {
                MessageBox.Show("请选择要删除的产品和订单");
                return;
            }
            DateTime t1 = Convert.ToDateTime(listView3.SelectedItems[0].SubItems[3].Text).Date;
            DateTime t2 = DateTime.Now.Date;

            if (DateTime.Compare(t1, t2) <= 0)
            {
                MessageBox.Show("此快递单不能修改");
                return;
            }
            string    lNo   = this.listView3.SelectedItems[0].SubItems[0].Text.ToString();
            string    wName = this.listView3.SelectedItems[0].SubItems[2].Text.ToString();
            string    pNo   = this.listView4.SelectedItems[0].SubItems[0].Text.ToString();
            string    num   = this.listView4.SelectedItems[0].SubItems[2].Text.ToString();
            Hashtable hs    = Productctrl.listDept();
            string    wNo   = (string)hs[wName];

            if (DetailCtrl.deleteDetail(lNo, pNo, num, wNo))
            {
                MessageBox.Show("删除产品成功!");
            }
            ListView3_Click(null, null);
            if (DetailCtrl.lnum(lNo) == 0)
            {
                LogisticCtrl.loadLogistic(listView3);
            }
        }
Beispiel #2
0
        public static bool deleteLogistic(string logiNo)
        {
            LogisticCtrl.recoverStock(logiNo);
            String sql = " delete from  logistic " +
                         " where lNo ='" + logiNo + "'";

            DetailCtrl.deleteDetail(logiNo);
            return(execNonQuery(sql));
        }
 private void AddLogisticsForm_Load(object sender, EventArgs e)
 {
     htWareHouse = LogisticCtrl.listWarehouse();
     comboBox1.Items.Clear();
     foreach (DictionaryEntry de in htWareHouse)
     {
         comboBox1.Items.Add((string)de.Key);
     }
     LogisticCtrl.loadProduct(null, listView1);
     LogisticCtrl.loadCompany(listView2);
     LogisticCtrl.loadReadyToChoose(listView4);
     choose.Clear();
 }
 private void Button4_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < choose.Count; i++)
     {
         ListViewItem li           = choose[i];
         string       thingsNo     = li.Text.ToString();
         string       warehouseNo  = li.SubItems[2].Text;
         string       numberWanted = li.SubItems[5].Text;
         LogisticCtrl.recoverStock(thingsNo, warehouseNo, numberWanted);
     }
     LogisticCtrl.loadReadyToChoose(listView4);
     choose.Clear();
     Button1_Click(null, null);
 }
        private void ListView4_DoubleClick(object sender, EventArgs e)
        {
            string thingsNo     = listView4.SelectedItems[0].Text.ToString();
            string warehouseNo  = listView4.SelectedItems[0].SubItems[2].Text;
            string numberWanted = listView4.SelectedItems[0].SubItems[4].Text;

            choose.Remove(listView4.SelectedItems[0]);
            LogisticCtrl.recoverStock(thingsNo, warehouseNo, numberWanted);
            LogisticCtrl.loadReadyToChoose(listView4);
            for (int i = 0; i < choose.Count; i++)
            {
                listView4.Items.Add(choose[i]);
            }
            Button1_Click(null, null);
        }
Beispiel #6
0
        private void ListView3_DoubleClick(object sender, EventArgs e)
        {
            DateTime t1 = Convert.ToDateTime(listView3.SelectedItems[0].SubItems[3].Text).Date;
            DateTime t2 = DateTime.Now.Date;

            if (DateTime.Compare(t1, t2) <= 0)
            {
                MessageBox.Show("此快递单不能修改");
                return;
            }
            String logiNo = listView3.SelectedItems[0].Text.ToString();

            LogisticCtrl.deleteLogistic(logiNo);
            LogisticCtrl.loadLogistic(listView3);
            DetailCtrl.loadDetail(listView4, null);
            MessageBox.Show("已删除");
        }
        private void Button2_Click(object sender, EventArgs e)
        {
            if (choose.Count == 0)
            {
                MessageBox.Show("请你添加商品");
                return;
            }
            string addressee   = textBox1.Text;
            string logiNo      = textBox4.Text;
            string time        = textBox2.Text;
            string warehouseNo = chooseWNo;
            string address_in  = textBox3.Text;

            if (logiNo == "" || time == "" || addressee == "" || address_in == "")
            {
                MessageBox.Show("请完整填写信息");
                return;
            }
            Logistic temp = new Logistic(logiNo, companyNo, warehouseNo, time, addressee, address_in);

            if (LogisticCtrl.saveLogistic(temp) == false)
            {
                MessageBox.Show("添加快递单出错");
                return;
            }
            for (int i = 0; i < choose.Count; i++)
            {
                Detail.Detail detail = new Detail.Detail(logiNo, choose[i].SubItems[0].Text, choose[i].SubItems[5].Text);
                if (DetailCtrl.saveDetail(detail) == false)
                {
                    LogisticCtrl.recoverStock(choose[i].SubItems[0].Text, warehouseNo, choose[i].SubItems[5].Text);
                    MessageBox.Show("添加快递流水出错");
                    return;
                }
            }
            choose.Clear();
            Button4_Click(null, null);
            MessageBox.Show("添加成功");
            return;
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            string warehouseNo = (string)htWareHouse[comboBox1.Text];

            LogisticCtrl.loadProduct(warehouseNo, listView1);
        }
        private void Button3_Click(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count != 1)
            {
                MessageBox.Show("请你指定一种商品");
                return;
            }
            if (this.listView2.SelectedItems.Count != 1)
            {
                MessageBox.Show("请你指定一家快递公司");
                return;
            }
            string numberWanted = textBox5.Text;

            if (numberWanted == "")
            {
                MessageBox.Show("请输入商品数量");
                return;
            }
            string thingsNo    = listView1.SelectedItems[0].Text.ToString();
            string warehouseNo = listView1.SelectedItems[0].SubItems[2].Text;
            string totalNumber = listView1.SelectedItems[0].SubItems[4].Text;

            if (int.Parse(numberWanted) > int.Parse(totalNumber))
            {
                MessageBox.Show("该商品数量不够");
                return;
            }
            if (choose.Count == 0)
            {
                chooseWNo = warehouseNo;
                companyNo = listView2.SelectedItems[0].Text.ToString();
            }
            else if (chooseWNo != warehouseNo)
            {
                MessageBox.Show("本订单只能选择一个发货地址");
                return;
            }
            else if (companyNo != listView2.SelectedItems[0].Text.ToString())
            {
                MessageBox.Show("本订单只能选择一家快递公司");
                return;
            }
            string number = (-int.Parse(numberWanted) + int.Parse(totalNumber)).ToString();

            if (LogisticCtrl.updateStock(thingsNo, warehouseNo, number) == false)
            {
                MessageBox.Show("加入失败");
                return;
            }
            int p = Productctrl.searchprice(thingsNo);

            for (int i = 0; i < choose.Count; i++)
            {
                if (thingsNo == choose[i].SubItems[0].Text)
                {
                    ListViewItem listItem1 = choose[i];
                    listItem1.SubItems[5].Text = (int.Parse(choose[i].SubItems[5].Text) + int.Parse(numberWanted)).ToString();
                    listItem1.SubItems[6].Text = (int.Parse(choose[i].SubItems[5].Text) * p).ToString();
                    LogisticCtrl.loadReadyToChoose(listView4);
                    for (int j = 0; j < choose.Count; j++)
                    {
                        listView4.Items.Add(choose[j]);
                    }
                    Button1_Click(null, null);
                    return;
                }
            }
            ListViewItem li = new ListViewItem();//形成一个表项

            li.SubItems.Clear();
            li.SubItems[0].Text = thingsNo;                               //设置第一列
            li.SubItems.Add(listView1.SelectedItems[0].SubItems[1].Text); //其余的列
            li.SubItems.Add(warehouseNo);                                 //其余的列
            li.SubItems.Add(listView1.SelectedItems[0].SubItems[3].Text); //其余的列
            li.SubItems.Add(listView2.SelectedItems[0].SubItems[1].Text); //其余的列
            li.SubItems.Add(numberWanted);                                //其余的列
            string price = (int.Parse(numberWanted) * p).ToString();

            //string cost = int.Parse(this.listView2.SelectedItems[0].SubItems[2].Text).ToString();
            //string totalcost = (int.Parse(price) + int.Parse(cost)).ToString();
            li.SubItems.Add(price);
            //li.SubItems.Add(cost);
            //li.SubItems.Add(totalcost);
            listView4.Items.Add(li);
            choose.Add(li);
            Button1_Click(null, null);
        }
Beispiel #10
0
 private void ChangeLogisticForm_Load(object sender, EventArgs e)
 {
     LogisticCtrl.loadLogistic(listView3);
 }