Esempio n. 1
0
        private void refView(List <T_PFmain> getAll)
        {
            dgvEX1.Rows.Clear();
            for (var i = 0; i < getAll.Count; i++)
            {
                T_PFmain dataRowCollection = getAll[i];
                int      index             = dgvEX1.Rows.Add();
                dgvEX1.Rows[index].Tag            = dataRowCollection.SN;
                dgvEX1.Rows[index].Cells[0].Value = dataRowCollection.danhao;

                dgvEX1.Rows[index].Cells[1].Value  = dataRowCollection.kehu;
                dgvEX1.Rows[index].Cells[2].Value  = dataRowCollection.shazhong;
                dgvEX1.Rows[index].Cells[3].Value  = dataRowCollection.sehao;
                dgvEX1.Rows[index].Cells[4].Value  = dataRowCollection.yanse;
                dgvEX1.Rows[index].Cells[5].Value  = dataRowCollection.dingdan;
                dgvEX1.Rows[index].Cells[6].Value  = dataRowCollection.riqiSave; //.ObjToString("yyyy-MM-dd HH:mm:ss");
                dgvEX1.Rows[index].Cells[7].Value  = dataRowCollection.peifang;
                dgvEX1.Rows[index].Cells[8].Value  = dataRowCollection.riqiShen; //.ObjToString("yyyy-MM-dd HH:mm:ss");
                dgvEX1.Rows[index].Cells[9].Value  = dataRowCollection.fuhe;
                dgvEX1.Rows[index].Cells[10].Value = dataRowCollection.dayang;
                dgvEX1.Rows[index].Cells[11].Value = dataRowCollection.beizhu;
                dgvEX1.Rows[index].Cells[mainColSta.Name].Value = dataRowCollection.sta;
                dgvEX1.Rows[index].Cells[13].Value = dataRowCollection.SN;
            }
            dgvEX1.HeJi();
        }
Esempio n. 2
0
        private void setInput(T_PFmain a, List <T_PFdata> b)
        {
            lblTxt1.txt.Text = a.kehu;
            lblTxt2.txt.Text = a.dingdan;
            lblTxt3.txt.Text = a.yanse;
            lblTxt4.txt.Text = a.shazhong;
            lblTxt5.txt.Text = a.dayang;
            lblTxt6.txt.Text = a.sehao;
            lblTxt7.txt.Text = a.beizhu;
            for (var i = 0; i < b.Count; i++)
            {
                var t_PFdata = b[i];
                int index    = dgvEX1.Rows.Add();
                dgvEX1.Rows[index].Cells[0].Value = t_PFdata.gongxu;
                dgvEX1.Rows[index].Cells[1].Value = t_PFdata.ranliao;
                dgvEX1.Rows[index].Cells[2].Value = t_PFdata.bili;
                dgvEX1.Rows[index].Cells[3].Value = t_PFdata.biliDW;
                dgvEX1.Rows[index].Cells[4].Value = t_PFdata.yaoqiu;
                dgvEX1.Rows[index].Cells[5].Value = t_PFdata.SN;
            }
            string code = a.danhao;

            setPict(code);
            editLblStaLD.Text = a.sta;
            if (this.editLblStaLD.Text == leibie.staPF.未审核.ToString())
            {
                editBtnSH.Text           = "审核";
                this.editBtnSH.Enabled   = true;
                this.editBtnEdit.Enabled = true;
                this.editBtnDel.Enabled  = true;
                this.editBtnPrn.Enabled  = false;
            }
            else
            {
                this.editBtnSH.Text      = "消审";
                this.editBtnSH.Enabled   = true;
                this.editBtnPrn.Enabled  = true;
                this.editBtnDel.Enabled  = false;
                this.editBtnEdit.Enabled = false;
            }
            this.bsShowMain.DataSource = (object)a;
            this.bsShowData.DataSource = (object)b;
        }
Esempio n. 3
0
 private void CLstart()
 {
     if (this.dgvData.CurrentRow.Index < 0)
     {
         this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
         this.TSsound.Play();
         frmError frmError = new frmError("当前称料行不存在!请再次查询!");
         int      num      = (int)frmError.ShowDialog((IWin32Window)this);
         frmError.Close();
     }
     else
     {
         //DBpf dbpf = new DBpf(Settings.Default.DBconn);
         //T_PFmain tPfmain = dbpf.T_PFmain.Where<T_PFmain>((Expression<Func<T_PFmain, bool>>)(a => a.danhao == this.txtLDH.Text)).SingleOrDefault<T_PFmain>();
         T_PFmain tPfmain = db.Queryable <T_PFmain>()
                            .Where(a => a.danhao == this.txtLDH.Text)
                            .First();
         if (tPfmain == null || tPfmain.sta != "已审核")
         {
             //dbpf.Dispose();
             this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
             this.TSsound.Play();
             frmError frmError = new frmError("料单未审核或不存在!请再次查询!");
             int      num      = (int)frmError.ShowDialog((IWin32Window)this);
             frmError.Close();
         }
         else
         {
             //T_PFdata tPfdata = dbpf.T_PFdata.Where<T_PFdata>((Expression<Func<T_PFdata, bool>>)(a => a.SN == (long)this.dgvData.CurrentRow.Cells[this.colSN.Name].Value)).SingleOrDefault<T_PFdata>();
             T_PFdata tPfdata = db.Queryable <T_PFdata>()
                                .Where(a => a.SN == (long)this.dgvData.CurrentRow.Cells[this.colSN.Name].Value)
                                .First();
             if (tPfdata == null || tPfdata.ranliao != this.dgvData.CurrentRow.Cells[this.colRL.Name].Value.ToString())
             {
                 //dbpf.Dispose();
                 this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
                 this.TSsound.Play();
                 frmError frmError = new frmError("料单数据发生了改变!请再次查询!");
                 int      num      = (int)frmError.ShowDialog((IWin32Window)this);
                 frmError.Close();
             }
             else
             {
                 Decimal num1 = new Decimal(0);
                 Decimal num2;
                 if (this.txtLDH.Text.StartsWith("LD") || this.txtLDH.Text.Length == 10 && this.txtLDH.Text.StartsWith("8"))
                 {
                     num2 = tPfdata.yongliang;
                     if (tPfdata.yongliangDW == "Kg" || tPfdata.yongliangDW == "L")
                     {
                         num2 *= new Decimal(1000);
                     }
                 }
                 else
                 {
                     num2 = tPfdata.JLyongliang;
                     if (tPfdata.JLyongliangDW == "Kg" || tPfdata.JLyongliangDW == "L")
                     {
                         num2 *= new Decimal(1000);
                     }
                 }
                 if (num2 != (Decimal)this.dgvData.CurrentRow.Cells[this.colYL.Name].Value)
                 {
                     //dbpf.Dispose();
                     this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
                     this.TSsound.Play();
                     frmError frmError = new frmError("料单数据发生了改变!请再次查询!");
                     int      num3     = (int)frmError.ShowDialog((IWin32Window)this);
                     frmError.Close();
                 }
                 else
                 {
                     //dbpf.Dispose();
                     if (this.dgvData.CurrentRow.Cells[this.colCL.Name].FormattedValue.ToString() != "" && Convert.ToDecimal(this.dgvData.CurrentRow.Cells[this.colCL.Name].FormattedValue.ToString()) > new Decimal(0))
                     {
                         this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
                         this.TSsound.Play();
                         this.lblTS.Visible = false;
                         frmTS        frmTs        = new frmTS(this.CLrl, this.CLcheng, this.CLdeng, "该染料已称过,再称一次吗!!!", "“确认”再称一次", "“清除”取消称料", Keys.Back);
                         DialogResult dialogResult = frmTs.ShowDialog((IWin32Window)this);
                         frmTs.Close();
                         this.lblTS.Visible = true;
                         if (dialogResult != DialogResult.OK)
                         {
                             return;
                         }
                     }
                     if (this.CLcheng < 0)
                     {
                         this.TSsound.SoundLocation = Application.StartupPath + "\\Sound\\error.wav";
                         this.TSsound.Play();
                         frmError frmError = new frmError("无法找到合适的称,请核对!");
                         int      num3     = (int)frmError.ShowDialog((IWin32Window)this);
                         frmError.Close();
                     }
                     else
                     {
                         if (!this.plcCL.OpenDeng(this.CLdeng))
                         {
                             this.plcCL.OpenDeng(this.CLdeng);
                         }
                         this.staCL         = frmCL.enumSta.称料正在;
                         this.CLerrTPcount  = 0;
                         this.CLokCount     = 0;
                         this.CLallowKey    = false;
                         this.lblTPerr.Text = "";
                         this.CLzero();
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
 private bool Save()
 {
     if (editImgLDH.Image == null || editImgLDH.Tag == null)
     {
         int num = (int)MessageBox.Show((IWin32Window)this, "生成单号失败,请检查!!!", "提示");
         return(false);
     }
     try
     {
         T_PFmain entity = new T_PFmain()
         {
             leibie     = leibie.enumPFLB.小样单.ToString(),
             danhao     = this.editImgLDH.Tag.ToString(),
             ganghao    = "",
             JLci       = 0,
             shazhong   = lblTxt4.txt.Text,
             guige      = "",
             pihao      = "",
             kehu       = lblTxt1.txt.Text,
             dingdan    = lblTxt2.txt.Text,
             sehao      = lblTxt6.txt.Text,
             yanse      = lblTxt3.txt.Text,
             jihao      = "",
             shuiliang  = new Decimal(0),
             zhongliang = new Decimal(0),
             jiagong    = "",
             yewuyuan   = "",
             dayang     = lblTxt5.txt.Text,
             zhuche     = "",
             peifang    = ClsLogUser.XinMing,
             fuhe       = "",
             mishu      = new Decimal(0),
             kezhong    = "0",
             danjia     = new Decimal(0),
             beizhu     = lblTxt7.txt.Text,
             riqiSave   = new DateTime?(DateTime.Now),
             riqiShen   = new DateTime?(),
             riqiCheng  = new DateTime?(),
             JLciHJ     = 0,
             sta        = leibie.staPF.未审核.ToString(),
             editrec    = DateTime.Now.ToString("yy-MM-dd HH:mm") + ClsLogUser.XinMing + "建立。"
         };
         var d = db.Insertable <T_PFmain>(entity).ExecuteCommand();
         for (int index = 0; index < dgvEX1.RowCount; ++index)
         {
             T_PFdata a = new T_PFdata()
             {
                 danhao        = entity.danhao,
                 gongxu        = dgvEX1.Rows[index].Cells[0].FormattedValue.ToString(),
                 ranliao       = dgvEX1.Rows[index].Cells[1].FormattedValue.ToString(),
                 ranliaoBZ     = "",
                 bili          = dgvEX1.Rows[index].Cells[2].FormattedValue.ToString() == "" ? new Decimal(0) : Convert.ToDecimal(dgvEX1.Rows[index].Cells[2].FormattedValue.ToString()),
                 biliDW        = dgvEX1.Rows[index].Cells[3].FormattedValue.ToString(),
                 yaoqiu        = dgvEX1.Rows[index].Cells[4].FormattedValue.ToString(),
                 yongliang     = new Decimal(0),
                 yongliangDW   = "",
                 JLbili        = new Decimal(0),
                 JLyongliang   = new Decimal(0),
                 JLyongliangDW = "",
                 SNld          = -1L
             };
             var e = db.Insertable <T_PFdata>(a).ExecuteCommand();
         }
         return(true);
     }
     catch (Exception ex)
     {
         int num = (int)MessageBox.Show((IWin32Window)this, ex.Message + "\r\n\r\n   保存失败,请核查原因再试一次!", "提示");
         return(false);
     }
 }