示例#1
0
文件: Make.cs 项目: tpc707494/C-Erp
 private bool editLD()
 {
     try
     {
         var a = db.Queryable <T_PFmain>().Where(it => it.danhao == editImgLDH.Tag.ToString()).First();
         if (a == null || a.sta != editLblStaLD.Text)
         {
             int num2 = (int)MessageBox.Show((IWin32Window)this, "本小样配方已不存在或状态发生改变!请核查!", "提示");
             return(false);
         }
         a.kehu     = lblTxt1.txt.Text;
         a.shazhong = lblTxt4.txt.Text;
         a.sehao    = lblTxt6.txt.Text;
         a.dingdan  = lblTxt2.txt.Text;
         a.yanse    = lblTxt3.txt.Text;
         a.dayang   = lblTxt5.txt.Text;
         a.peifang  = ClsLogUser.XinMing;
         a.beizhu   = lblTxt7.txt.Text;
         a.riqiSave = new DateTime();
         a.editrec  = a.editrec + DateTime.Now.ToString("yy-MM-dd HH:mm") + ClsLogUser.XinMing + "修改。";
         db.Deleteable <T_PFdata>().Where(it => it.danhao == a.danhao).ExecuteCommand();
         for (int index = 0; index < dgvEX1.RowCount; ++index)
         {
             T_PFdata b = new T_PFdata()
             {
                 danhao        = a.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>(b).ExecuteCommand();
         }
         return(true);
     }
     catch (Exception ex)
     {
         int num = (int)MessageBox.Show((IWin32Window)this, ex.Message + "\r\n\r\n   修改失败,请核查原因再试一次!", "提示");
         return(false);
     }
 }
示例#2
0
文件: frmCL.cs 项目: tpc707494/C-Erp
 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();
                     }
                 }
             }
         }
     }
 }
示例#3
0
文件: Make.cs 项目: tpc707494/C-Erp
 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);
     }
 }