public int Update(原始凭证 原始凭证) { string sql = "UPDATE 原始凭证 " + "SET " + " 日期 = @日期" + ", 凭证号 = @凭证号" + ", 材质 = @材质" + ", 工作令号 = @工作令号" + ", 重量 = @重量" + ", 金额 = @金额" + ", 单位 = @单位" + " WHERE id = @id"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@id", 原始凭证.Id) , new SqlParameter("@日期", ToDBValue(原始凭证.日期)) , new SqlParameter("@凭证号", ToDBValue(原始凭证.凭证号)) , new SqlParameter("@材质", ToDBValue(原始凭证.材质)) , new SqlParameter("@工作令号", ToDBValue(原始凭证.工作令号)) , new SqlParameter("@重量", ToDBValue(原始凭证.重量)) , new SqlParameter("@金额", ToDBValue(原始凭证.金额)) , new SqlParameter("@单位", ToDBValue(原始凭证.单位)) }; return(SqlHelper.ExecuteNonQuery(sql, para)); }
public 原始凭证 ToModel(SqlDataReader reader) { 原始凭证 原始凭证 = new 原始凭证(); 原始凭证.Id = (Guid)ToModelValue(reader, "id"); 原始凭证.日期 = (DateTime)ToModelValue(reader, "日期"); 原始凭证.凭证号 = (string)ToModelValue(reader, "凭证号"); 原始凭证.材质 = (string)ToModelValue(reader, "材质"); 原始凭证.工作令号 = (string)ToModelValue(reader, "工作令号"); 原始凭证.重量 = (decimal?)ToModelValue(reader, "重量"); 原始凭证.金额 = (decimal)ToModelValue(reader, "金额"); 原始凭证.单位 = (short)ToModelValue(reader, "单位"); return(原始凭证); }
// 以上是 手动增加的功能 public 原始凭证 Add(原始凭证 原始凭证) { string sql = "INSERT INTO 原始凭证 (id, 日期, 凭证号, 材质, 工作令号, 重量, 金额, 单位) VALUES (@id, @日期, @凭证号, @材质, @工作令号, @重量, @金额, @单位)"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@id", ToDBValue(原始凭证.Id)), new SqlParameter("@日期", ToDBValue(原始凭证.日期)), new SqlParameter("@凭证号", ToDBValue(原始凭证.凭证号)), new SqlParameter("@材质", ToDBValue(原始凭证.材质)), new SqlParameter("@工作令号", ToDBValue(原始凭证.工作令号)), new SqlParameter("@重量", ToDBValue(原始凭证.重量)), new SqlParameter("@金额", ToDBValue(原始凭证.金额)), new SqlParameter("@单位", ToDBValue(原始凭证.单位)), }; SqlHelper.ExecuteNonQuery(sql, para); return(原始凭证); }
public void addOut(原始凭证 mod) { Add(mod); add原始凭证转出(mod.Id.ToString()); }
private void btn_calc_Click(object sender, EventArgs e) { 原始凭证 mod = new 原始凭证(); 原始凭证DAL dal = new 原始凭证DAL(); if (txt_blje.get_value() != "0.00") { mycls._bjje = decimal.Parse(txt_blje.get_value()); } if (txt_bzf.get_value() != "0.00") { mycls._bzf = decimal.Parse(txt_bzf.get_value()); } if (txt_bzje.get_value() != "0.00") { mycls._bzj = decimal.Parse(txt_bzje.get_value()); } if (txt_clxje.get_value() != "0.00") { mycls._clxje = decimal.Parse(txt_clxje.get_value()); } if (txt_djje.get_value() != "0.00") { mycls._djje = decimal.Parse(txt_djje.get_value()); } if (txt_mhje.get_value() != "0.00") { mycls._mhje = decimal.Parse(txt_mhje.get_value()); } if (txt_ptje.get_value() != "0.00") { mycls._ptje = decimal.Parse(txt_ptje.get_value()); } if (txt_rclf.get_value() != "0.00") { mycls._rclf = decimal.Parse(txt_rclf.get_value()); } if (txt_sjf.get_value() != "0.00") { mycls._sjf = decimal.Parse(txt_sjf.get_value()); } if (txt_syje.get_value() != "0.00") { mycls._syje = decimal.Parse(txt_syje.get_value()); } if (txt_wgje.get_value() != "0.00") { mycls._wgje = decimal.Parse(txt_wgje.get_value());; } if (txt_wjgf.get_value() != "0.00") { mycls._wjgf = decimal.Parse(txt_wjgf.get_value()); } if (txt_xsptj.get_value() != "0.00") { mycls._xsptj = decimal.Parse(txt_xsptj.get_value()); } if (txt_ysf.get_value() != "0.00") { mycls._ysf = decimal.Parse(txt_ysf.get_value()); } if (txt_ysje.get_value() != "0.00") { mycls._ysje = decimal.Parse(txt_ysje.get_value()); } if (txt_zgje.get_value() != "0.00") { mycls._zgje = decimal.Parse(txt_zgje.get_value()); } if (txt_ztje.get_value() != "0.00") { mycls._ztje = decimal.Parse(txt_ztje.get_value()); } if (txt_zxfy.get_value() != "0.00") { mycls._zxfy = decimal.Parse(txt_zxfy.get_value()); } 费用分配表 mod1 = new 费用分配表(); 费用分配表DAL dal1 = new 费用分配表DAL(); if (txt_zzfy.get_value() != "0.00") { mycls._rldl = decimal.Parse(txt_rldl.get_value()); mycls._gs = mod1.工时; mycls._zhgs = mod1.折合工时; mycls._gzfl = decimal.Parse(txt_gzfl.get_value()); mycls._zzfy = decimal.Parse(txt_zzfy.get_value()); } decimal ycl = mycls._ztje + mycls._ysje + mycls._zgje + mycls._syje + mycls._djje + mycls._bjje + mycls._mhje + mycls._wgje + mycls._bzj + mycls._ptje + mycls._clxje + mycls._xsptj; decimal addfy = mycls._rldl + mycls._gzfl + mycls._zzfy + mycls._zxfy + mycls._rclf + mycls._bzf + mycls._sjf + mycls._ysf + mycls._wjgf; label1.Text = "总金额:" + (ycl + addfy) + " 其中: 原材料:" + ycl + " 其它:" + addfy; }
private void set_data(string workno, DateTime mydate, int deptcode) { 原始凭证 mod = new 原始凭证(); 原始凭证DAL dal = new 原始凭证DAL(); decimal summoney; summoney = 0; if (txt_blje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "B"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_blje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._bjje = decimal.Parse(txt_blje.get_value()); } if (txt_bzf.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "A"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_bzf.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._bzf = decimal.Parse(txt_bzf.get_value()); } if (txt_bzje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "Z"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_bzje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._bzj = mod.金额; } if (txt_clxje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "C"; // 齿轮箱 mod.重量 = 0; mod.金额 = decimal.Parse(txt_clxje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._clxje = mod.金额; } if (txt_djje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "D"; // 铸锻件 mod.重量 = decimal.Parse(txt_djsl.get_value()); mod.金额 = decimal.Parse(txt_djje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._djje = mod.金额; } if (txt_mhje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; ////if (mod.单位 == 23) mod.材质 = "H"; ////else //mod.材质 = "M"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_mhje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._mhje = mod.金额;; } if (txt_ptje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "P"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_ptje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._ptje = mod.金额; } if (txt_rclf.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "R"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_rclf.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._rclf = mod.金额; } if (txt_sjf.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "E"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_sjf.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._sjf = mod.金额; } if (txt_syje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "S"; mod.重量 = decimal.Parse(txt_sysl.get_value()); mod.金额 = decimal.Parse(txt_syje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._syje = mod.金额; } if (txt_wgje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "W"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_wgje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._wgje = mod.金额; } if (txt_wjgf.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "J"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_wjgf.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._wjgf = mod.金额; } if (txt_xsptj.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "V"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_xsptj.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._xsptj = mod.金额; } if (txt_ysf.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "F"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_ysf.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._ysf = mod.金额; } if (txt_ysje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "Y"; mod.重量 = decimal.Parse(txt_yssl.get_value()); mod.金额 = decimal.Parse(txt_ysje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._ysje = mod.金额; } if (txt_zgje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "G"; mod.重量 = decimal.Parse(txt_zgsl.get_value()); mod.金额 = decimal.Parse(txt_zgje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._zgje = mod.金额; } if (txt_ztje.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "T"; mod.重量 = decimal.Parse(txt_ztsl.get_value()); mod.金额 = decimal.Parse(txt_ztje.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._ztje = mod.金额; } if (txt_zxfy.get_value() != "0.00") { mod.Id = Guid.NewGuid(); mod.日期 = mydate; mod.凭证号 = ""; mod.单位 = (short)deptcode; mod.工作令号 = workno; mod.材质 = "X"; mod.重量 = 0; mod.金额 = decimal.Parse(txt_zxfy.get_value()); dal.Add(mod); dal.add原始凭证转出(mod.Id.ToString()); mycls._zxfy = mod.金额; } 费用分配表 mod1 = new 费用分配表(); 费用分配表DAL dal1 = new 费用分配表DAL(); if (txt_zzfy.get_value() != "0.00") { mod1.ID = Guid.NewGuid(); mod1.制造费用 = decimal.Parse(txt_zzfy.get_value()); mod1.工号 = workno; mod1.工时 = decimal.Parse(txt_gs.get_value()); mod1.折合工时 = decimal.Parse(txt_zhgs.get_value()); mod1.时间 = mydate; mod1.燃料动力 = decimal.Parse(txt_rldl.get_value()); mod1.薪酬 = decimal.Parse(txt_gzfl.get_value()); mod1.部门 = (short)deptcode; dal1.Add(mod1); mycls._rldl = mod1.燃料动力; mycls._gs = mod1.工时; mycls._zhgs = mod1.折合工时; mycls._gzfl = mod1.薪酬; mycls._zzfy = mod1.制造费用; dal1.set费用分配转出(mod1.ID.ToString()); } decimal ycl = mycls._ztje + mycls._ysje + mycls._zgje + mycls._syje + mycls._djje + mycls._bjje + mycls._mhje + mycls._wgje + mycls._bzj + mycls._ptje + mycls._clxje + mycls._xsptj; decimal addfy = mycls._rldl + mycls._gzfl + mycls._zzfy + mycls._zxfy + mycls._rclf + mycls._bzf + mycls._sjf + mycls._ysf + mycls._wjgf; summoney = ycl + addfy; 成品库房DAL dal2 = new 成品库房DAL(); dal2.insert成品库房表(workno, mydate, summoney); }
// 插入 转出数据 public void insert成品库房表_转出(成品库房表 成品库房) { // 首先插入 成品库房表中的 金额 string sql = @"insert into 成品库房表(id, 工作令号, 日期, 金额 ) values( @p0,@p1,@p2,@p3)"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("p0", 成品库房.id), new SqlParameter("p1", 成品库房.工作令号), new SqlParameter("p2", 成品库房.日期), new SqlParameter("p3", 成品库房.金额), }; SqlHelper.ExecuteNonQuery(sql, para); sql = @"insert into 成品库房转出表 values ('{0}')"; sql = string.Format(sql, 成品库房.id); SqlHelper.ExecuteNonQuery(sql); 原始凭证 mod = new 原始凭证(); 原始凭证DAL dal = new 原始凭证DAL(); mod.日期 = 成品库房.日期; mod.工作令号 = 成品库房.工作令号; if (成品库房.ty != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "I"; mod.金额 = 成品库房.ty; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.zdh != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "K"; mod.金额 = 成品库房.zdh; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.sj != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "1"; mod.金额 = 成品库房.sj; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.ys != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "2"; mod.金额 = 成品库房.ys; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.az != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "N"; mod.金额 = 成品库房.az; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.qt != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "L"; mod.金额 = 成品库房.qt; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.xsjy != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "O"; mod.金额 = 成品库房.xsjy; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } if (成品库房.gjjy != 0) { mod.Id = Guid.NewGuid(); mod.材质 = "U"; mod.金额 = 成品库房.gjjy; mod.单位 = short.Parse(dal.getSaleDeptForWorkno(成品库房.工作令号, mod.材质)); dal.addOut(mod); } }