예제 #1
0
파일: ManRepair.cs 프로젝트: xiaofengtan/-
        private void cbx_type_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Model.Paper_Store> Allp     = Model.Paper_Store.GetAllPaperList();
            List <Model.NameType>    allpaper = new List <Model.NameType>();

            for (int i = 0; i < Allp.Count; i++)
            {
                if (Allp[i].TypeId.ToString() == cbx_type.SelectedValue.ToString())
                {
                    bool           exit = false;
                    Model.NameType nt   = new Model.NameType {
                        Id = Allp[i].PaperId, Name = Allp[i].Kg.ToString()
                    };
                    for (int j = 0; j < allpaper.Count; j++)
                    {
                        if (nt.Name == allpaper[j].Name)
                        {
                            exit = true;
                            break;
                        }
                    }
                    if (!exit)
                    {
                        allpaper.Add(nt);
                    }
                }
            }
            Common.BindCombox(cbxkg, allpaper);
            cbxkg.SelectedItem = 0;
        }
예제 #2
0
 private void comb_ProcessType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comb_ProcessType.SelectedIndex >= 0)
     {
         Model.NameType nt = (Model.NameType)comb_ProcessType.SelectedItem;
         Common.BindCombox(comb_Process, Model.Process.GetNameListByTypeId(nt.Id));
     }
 }
예제 #3
0
파일: Common.cs 프로젝트: xiaofengtan/-
 public static void BindCombox(ComboBox cbx, List <Model.NameType> list)
 {
     Model.NameType[] mylist = new Model.NameType[list.Count];
     list.CopyTo(mylist);
     cbx.DataSource    = mylist;
     cbx.DisplayMember = "Name";
     cbx.ValueMember   = "Id";
     //cbx.SelectedIndex = -1;
 }
예제 #4
0
 private void comb_Process_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (op != null)
     {
         Model.NameType nt = (Model.NameType)comb_Process.SelectedItem;
         text_processnum.Text = op.GetProcessNum(nt.Id).ToString();
         label_Unit.Text      = op.GetProcessNumUnit(nt.Id);
     }
 }
예제 #5
0
파일: Common.cs 프로젝트: xiaofengtan/-
 public static void BindCombox(ComboBox cbx, List <Model.NameType> list)
 {
     if (list != null)
     {
         Model.NameType[] mylist = new Model.NameType[list.Count];
         list.CopyTo(mylist);
         cbx.DataSource    = mylist;
         cbx.DisplayMember = "Name";
         cbx.ValueMember   = "Id";
         return;
     }
     cbx.DataSource = null;
 }
예제 #6
0
파일: ManRepair.cs 프로젝트: xiaofengtan/-
        private void cbxkg_SelectedIndexChanged(object sender, EventArgs e)
        {
            Model.NameType        nt2      = (Model.NameType)cbx_type.SelectedItem;
            List <Model.NameType> Allp     = Model.Paper_Store.GetListByType(nt2.Id);
            List <Model.NameType> allpaper = new List <Model.NameType>();

            Model.NameType nt = (Model.NameType)cbxkg.SelectedItem;

            if (nt != null)
            {
                for (int i = 0; i < Allp.Count; i++)
                {
                    if (nt.Name == Allp[i].CodeId.ToString())
                    {
                        Model.NameType nt1 = new Model.NameType {
                            Id = Allp[i].Id, Name = Allp[i].Name
                        };
                        allpaper.Add(nt1);
                    }
                }
                Common.BindCombox(comboBox2, allpaper);
            }
        }
예제 #7
0
파일: total.cs 프로젝트: xiaofengtan/-
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string code = textBox1.Text;

            if (code.Length > 0 && AllPaper != null)
            {
                DataRow[] drs = AllPaper.Select("PaperCode like '%" + code + "%'");
                if (drs.Length > 0)
                {
                    comboBox1.DataSource = null;
                    List <Model.NameType> paperlist = new List <Model.NameType>();
                    for (int i = 0; i < drs.Length; i++)
                    {
                        Model.NameType nt = new Model.NameType()
                        {
                            Id = int.Parse(drs[i]["PaperId"].ToString()), Name = drs[i]["PaperName"].ToString()
                        };
                        paperlist.Add(nt);
                    }
                    Common.BindCombox(comboBox1, paperlist);
                }
            }
        }
예제 #8
0
        private void cbxkg_SelectedIndexChanged(object sender, EventArgs e)
        {
            //DataRow[] drs=AllPaper.Select(" TypeId= ' "+(cbx_type.SelectedIndex+1).ToString()+"'");
            //List<Model.NameType> allpaper = new List<Model.NameType>();
            List <Model.Paper_Store> Allp     = Model.Paper_Store.GetAllPaperList();
            List <Model.NameType>    allpaper = new List <Model.NameType>();

            Model.NameType nt = (Model.NameType)cbxkg.SelectedItem;
            if (nt != null)
            {
                for (int i = 0; i < Allp.Count; i++)
                {
                    if (nt.Name == Allp[i].Kg.ToString())
                    {
                        Model.NameType nt1 = new Model.NameType {
                            Id = Allp[i].PaperId, Name = Allp[i].PaperName
                        };
                        allpaper.Add(nt1);
                    }
                }
                Common.BindCombox(comboBox1, allpaper);
            }
        }
예제 #9
0
 private void cbx_producter_type_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbx_producter_type.SelectedIndex >= 0)
     {
         Model.NameType nt   = (Model.NameType)cbx_producter_type.SelectedItem;
         int            page = 2;
         if (nt.Id <= 1)
         {
             page = 4;
         }
         if (nt.Id == 2)
         {
             page = 8;
         }
         if (nt.Id >= 5)
         {
             page = 1;
         }
         text_Page_Num.Text = page.ToString();
         ProductTypeId      = nt.Id - 1;
         Common.BindCombox(comb_ProcessType, Model.ProcessType.GetNameList(ProductTypeId));
     }
 }
예제 #10
0
        private void button6_Click(object sender, EventArgs e)
        {
            Model.NameType nt   = (Model.NameType)comb_Process.SelectedItem;
            int            pnum = 0;

            if (op == null)
            {
                MessageBox.Show("请先添加产品!");
                return;
            }
            if (nt != null && int.TryParse(text_processnum.Text, out pnum))
            {
                if (!op.AddProcess(nt.Id, pnum))
                {
                    MessageBox.Show("添加工艺失败!");
                    return;
                }
                else
                {
                    BindView();
                }
            }
        }
예제 #11
0
파일: ManRepair.cs 프로젝트: xiaofengtan/-
        private void button9_Click(object sender, EventArgs e)
        {
            if (comboBox2.SelectedItem == null)
            {
                MessageBox.Show("请先选择目标纸张!");
                return;
            }
            if (comboBox3.SelectedItem == null)
            {
                MessageBox.Show("请先选择要修改的纸张!");
                return;
            }

            int num = 0;

            if (!int.TryParse(textBox1.Text, out num))
            {
                MessageBox.Show("请先输入要修改的纸张的数量!");
                return;
            }
            Model.NameType  SelectedPaper = (Model.NameType)comboBox2.SelectedItem;
            Model.Paper_Out OutPaper      = (Model.Paper_Out)comboBox3.SelectedItem;

            Model.Paper_Store NewPaper = Model.Paper_Store.GetPaperById(SelectedPaper.Id);

            if (MaterialList != null)
            {
                Model.P_MaterialList2 pm2 = MaterialList[comboBox2.SelectedIndex];
                pm2.StandName = SelectedPaper.Name;
                pm2.StandId   = SelectedPaper.Id;
                pm2.UnitPrice = NewPaper.UnitPrice;
                pm2.Price     = (int)Math.Round(OutPaper.Money, 0);
                pm2.Num       = OutPaper.Num;
                if (DataSource.ORMHelper.UpdateModelById <Model.P_MaterialList2>(pm2) == 0)
                {
                    DialogResult dr = MessageBox.Show("订单信息修改失败,确认是否继续修改出入库记录!", "确认", MessageBoxButtons.YesNo);
                    if (dr != DialogResult.Yes)
                    {
                        return;
                    }
                }
            }
            //读出新的纸张和老的纸张;
            //如果已经出库,还要修改出库记录,及库存记录;
            if (!NoOut)
            {
                Model.Paper_Store OldPaper = Model.Paper_Store.GetPaperById(OutPaper.PaperId);
                //修改相关记录;
                OldPaper.Num       += OutPaper.Num;
                OldPaper.Money     += OutPaper.Money;
                NewPaper.Num       -= num;
                OutPaper.Num        = num;
                OutPaper.Money      = NewPaper.TaxiPrice * num;
                NewPaper.TaxiMoney -= OutPaper.Money;
                OutPaper.PaperId    = NewPaper.PaperId;
                OutPaper.PaperName  = NewPaper.PaperName;
                OutPaper.Price      = NewPaper.TaxiPrice;

                if (Model.Paper_Out.Update(OutPaper) < 1)
                {
                    MessageBox.Show("修改出库记录失败,确认后退出!");
                    return;
                }
                if (Model.Paper_Store.Update(OldPaper) + Model.Paper_Store.Update(NewPaper) == 2)
                {
                    MessageBox.Show("修改出库记录及库存数据成功,确认后退出!");
                }
            }
        }
예제 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int ptype = cbx_producter_type.SelectedIndex + 1;;
                PLen     = int.Parse(text_Product_Len.Text);
                PWidth   = int.Parse(text_Product_width.Text);
                num      = int.Parse(text_producter_Num.Text);
                PageNum  = int.Parse(text_Page_Num.Text);
                ColorNum = 0;

                if (checkBox2.Checked)
                {
                    ColorNum = 0;
                }
                else
                {
                    if (checkBox_c1.Checked)
                    {
                        ColorNum++;
                    }
                    if (checkBox_y1.Checked)
                    {
                        ColorNum++;
                    }
                    if (checkBox_k1.Checked)
                    {
                        ColorNum++;
                    }
                    if (checkBox_m1.Checked)
                    {
                        ColorNum++;
                    }
                }

                op             = new OrderPart(ptype, PLen, PWidth, num);
                op.PaperSource = checkBox_PaperSource.Checked;
                op.ColorNum    = ColorNum;
                op.PageNum     = PageNum;
                Model.NameType nt = (Model.NameType)comb_Paper.SelectedItem;
                op.PaperName = nt;
                if (op.MakePart())
                {
                    //检查页面数量的合法性;尤其是书本的开本和页数的关系;避免后面的计算出错

                    //checkPageNum()
                    Model.Paper_Store paper = Model.Paper_Store.GetPaperById(nt.Id);
                    Model.Rectange    bp    = new Model.Rectange(paper.Length, paper.Height);
                    if (op.ProductType < 0)
                    {
                        MessageBox.Show("录入有错误,请重新检查输入项!");
                        return;
                    }
                    else
                    {
                        List <Model.NameType> needproces = Model.Process.GetProductProcess(ProductTypeId);
                        if (needproces != null)
                        {
                            foreach (Model.NameType nt1 in needproces)
                            {
                                Model.PartItem pi = new Model.PartItem();
                                pi.PartType = 8;
                                pi.PartName = "必选工艺";
                                pi.Name     = nt1.Name;
                                pi.Id       = nt1.Id;
                                pi.Num      = num;
                                pi.Price    = 0;
                                pi.Money    = Model.C_ProcessPrice.GetProcessPrice(nt1.Id, num);
                                op.AllItem.Add(pi);
                                //op.AddProcess(nt1.Id);
                            }
                        }
                        text_len.Text           = op.Ps.Length.ToString();
                        text_width.Text         = op.Ps.Width.ToString();
                        text_kaidu.Text         = op.Ps.Kaidu.ToString();
                        text_needPaperNum1.Text = op.Part.PaperNum.ToString();
                        textBox_PsNum1.Text     = op.AllPSnum.ToString();
                        textBox1.Text           = op.AllPsSet.ToString();
                        text_lostnum.Text       = op.Part.PaperExtend.ToString();
                        textBox2.Text           = op.AllPrintNum.ToString();
                        BindView();
                    }
                }
            }
            catch
            {
                MessageBox.Show("录入有错误,请重新检查输入项!");
                return;
            }
        }