private void barExplorYear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridtable == null) return; IList<PJ_clcrkd> datalist = new List<PJ_clcrkd>(); foreach (DataRow dr in gridtable.Rows) { PJ_clcrkd pc = new PJ_clcrkd(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName.IndexOf("wpjz") < 0 && dc.ColumnName.IndexOf("xh") < 0 && dr[dc.ColumnName].ToString() != string.Empty) pc.GetType().GetProperty(dc.ColumnName).SetValue(pc, dr[dc.ColumnName], null); } datalist.Add(pc); } //fys.strType = " and (type = '工程材料入库单' or type = '工程材料入库单原始库存') "; //fys.StrSQL = "select distinct ssgc from PJ_clcrkd where (type = '工程材料入库单' or type = '工程材料入库单原始库存') "; //if (fys.ShowDialog() == DialogResult.OK) //{ ExportSCTZEdit etdjh = new ExportSCTZEdit(); etdjh.ExportExcel(datalist); //} }
private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //IList<PJ_clcrkd> datalist = gridView1.DataSource as IList<PJ_clcrkd>; if (gridtable == null) return; IList<PJ_clcrkd> datalist = new List<PJ_clcrkd>(); foreach (DataRow dr in gridtable.Rows) { PJ_clcrkd pc = new PJ_clcrkd(); foreach (DataColumn dc in gridtable.Columns) { if (dc.DataType.FullName.IndexOf("wpjz") < 0) pc.GetType().GetProperty(dc.ColumnName).SetValue(pc, dr[dc.ColumnName], null); } datalist.Add(pc); } frmProjectSelect fys = new frmProjectSelect(); //fys.strType = " and (type = '工程材料入库单' or type = '工程材料入库单原始库存') "; //fys.StrSQL = "select distinct ssgc from PJ_clcrkd where (type = '工程材料入库单' or type = '工程材料入库单原始库存') "; //if (fys.ShowDialog() == DialogResult.OK) //{ ExportSCTZEdit etdjh = new ExportSCTZEdit(); etdjh.ExportExcel(datalist); //} }
private void gridView1_DoubleClick(object sender, EventArgs e) { if (gridView1.FocusedRowHandle < -1) return; PJ_clcrkd rowdata = gridView1.GetFocusedRow() as PJ_clcrkd; rowdata = ClientHelper.PlatformSqlMap.GetOneByKey<PJ_clcrkd>(rowdata.ID); frmFCLCKSingleXZ frm = new frmFCLCKSingleXZ(); frm.RowData = new PJ_clcrkd(); ConvertHelper.CopyTo<PJ_clcrkd>(rowdata, (PJ_clcrkd)frm.RowData); ((PJ_clcrkd)frm.RowData).Remark = ""; IList<PJ_clcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc "); if (pnumli.Count == 0) ((PJ_clcrkd)frm.RowData).num = "FSCCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1); else { ((PJ_clcrkd)frm.RowData).num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) + 1); } ((PJ_clcrkd)frm.RowData).ckdate = DateTime.Now; double i = 0; if (frm.ShowDialog() == DialogResult.OK) { PJ_clcrkd ckd = new PJ_clcrkd(); ConvertHelper.CopyTo<PJ_clcrkd>(rowdata, ckd); ckd.ID = ckd.CreateID(); System.Collections.IList mclist = ClientHelper.PlatformSqlMap.GetList("SelectOneInt", "select sum(cast(kcsl as float) ) from PJ_clcrkd where (type = '非生产物资入库单' or type = '非生产物资入库单单原始库存')" + " and wpmc='" + rowdata.wpmc + "' " + " and ssgc='" + rowdata.ssgc + "' " + " and wpgg='" + rowdata.wpgg + "' "); if (mclist[0] != null) i = Convert.ToDouble(mclist[0].ToString()); double cktemp = Convert.ToDouble(frm.ReturnData.cksl); double zkc = Convert.ToDouble(i); // i = Client.ClientHelper.PlatformSqlMap.GetRowCount //<PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' "); ckd.num = frm.ReturnData.num; ckd.type = comboBoxEdit6.Text; ckd.Remark = frm.ReturnData.Remark; ckd.yt = frm.ReturnData.yt; ckd.ssxm = frm.ReturnData.ssxm; ckd.lqdw = frm.ReturnData.lqdw; ckd.ghdw = frm.ReturnData.ghdw; ckd.ckdate = DateTime.Now; if (cktemp >= Convert.ToDouble(rowdata.kcsl)) { ckd.cksl = rowdata.kcsl; ckd.zkcsl = (zkc - Convert.ToDouble(rowdata.kcsl)).ToString(); cktemp = cktemp - Convert.ToDouble(rowdata.kcsl); ckd.kcsl = "0"; rowdata.kcsl = "0"; ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(rowdata); } else { ckd.cksl = cktemp.ToString(); ckd.zkcsl = (zkc - cktemp).ToString(); rowdata.kcsl = (Convert.ToDouble(rowdata.kcsl) - cktemp).ToString(); ckd.kcsl = rowdata.kcsl; cktemp = 0; ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(rowdata); } ckd.lyparent = rowdata.ID; zkc = Convert.ToDouble(ckd.zkcsl); Thread.Sleep(new TimeSpan(100000));//0.1毫秒 if (isWorkflowCall) { MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.ID + "' and RecordID='" + currRecord.ID + "'" + " and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'" + " and WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "'" + " and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'" + " and WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "'"); } ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd); if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = ckd.ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = ckd.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); } ucclck1.inidata(); //simpleButton2_Click(sender, e); } }
void gridViewOperation_AfterAdd(PJ_clcrkd newobj) { if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = newobj.ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = newobj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); } }
private void simpleButton1_Click(object sender, EventArgs e) { frmFCLCKXZ frm = new frmFCLCKXZ(); frm.strType = comboBoxEdit5.Text; if (clccktemp == null) clccktemp = new PJ_clcrkd(); clccktemp.cksl = "0"; clccktemp.wpgg = ""; //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount // <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc "); //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1); IList<PJ_clcrkd> pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc "); if (clccktemp.num == "") { if (pnumli.Count == 0) clccktemp.num = "FSCCK" + DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 1); else { clccktemp.num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) + 1); } } else { if (pnumli.Count > 0) { if ((Convert.ToDecimal(clccktemp.num.Replace("FSCCK", ""))) - (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", ""))) > 1) { clccktemp.num = "FSCCK" + (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "") + 1)); } } } frm.strNum = clccktemp.num; frm.RowData = new PJ_clcrkd(); ((PJ_clcrkd)frm.RowData).ckdate = DateTime.Now; if (frm.ShowDialog() == DialogResult.OK) { string ssgc = " and 1=1 ", wpgg = " and 1=1 ", wpmc = " and 1=1 "; double isum = 0; ssgc = " and ssgc='" + frm.ReturnData.ssgc + "' "; wpmc = " and wpmc='" + frm.ReturnData.wpmc + "' "; wpgg = " and wpgg='" + frm.ReturnData.wpgg + "' "; isum =Convert.ToDouble( frm.ReturnData.cksl); string strsql = " where (type = '" + comboBoxEdit5.Text + "' or type = '" + comboBoxEdit5.Text + "原始库存') " + ssgc + wpmc + wpgg + " and cast(kcsl as float)>0 order by cast( indate as datetime) "; IList<PJ_clcrkd> datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd> (strsql); double cktemp = isum; double zkc = Convert.ToDouble(frm.ReturnData.zkcsl); IList<PJ_clcrkd> ckdatalist = new List<PJ_clcrkd>(); decimal num = 0; pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc "); if (pnumli.Count == 0) num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0)); else { num = (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", ""))); } foreach (PJ_clcrkd pc in datalist) { PJ_clcrkd ckd =new PJ_clcrkd() ; ConvertHelper.CopyTo<PJ_clcrkd>(pc, ckd); ckd.ID = ckd.CreateID(); //int i = Client.ClientHelper.PlatformSqlMap.GetRowCount // <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' order by id desc "); //frm.strNum = DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", i + 1); //ckd.num = "FSCCK" + (num + 1); ckd.num = clccktemp.num; ckd.type = comboBoxEdit6.Text; ckd.Remark = frm.ReturnData.Remark; ckd.yt = pc.yt; ckd.ssxm = pc.ssxm; ckd.lqdw = frm.ReturnData.lqdw; ckd.ckdate = DateTime.Now; if (cktemp >= Convert.ToDouble(pc.kcsl)) { ckd.cksl = pc.kcsl; ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString(); cktemp = cktemp - Convert.ToDouble(pc.kcsl); pc.kcsl = "0"; //ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc); } else { ckd.cksl = cktemp.ToString(); ckd.zkcsl = (zkc - cktemp).ToString(); pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString(); cktemp = 0; //ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc); } ckd.lyparent = pc.ID; zkc = Convert.ToDouble(ckd.zkcsl); Thread.Sleep(new TimeSpan(100000));//0.1毫秒 //ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd); ckdatalist.Add(ckd); if (cktemp<1) break; //num=(num + 1); } frmFCLCKXZShow frmshow = new frmFCLCKXZShow(); frmshow.DataList = ckdatalist; if (frmshow.ShowDialog() == DialogResult.OK) { cktemp = isum; zkc = Convert.ToDouble(frm.ReturnData.zkcsl); pnumli = Client.ClientHelper.PlatformSqlMap.GetListByWhere <PJ_clcrkd>(" where id like '" + DateTime.Now.ToString("yyyyMMdd") + "%' and type='" + comboBoxEdit6.Text + "' "); if (pnumli.Count == 0) num = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMdd") + string.Format("{0:D4}", 0)); else { num = (Convert.ToDecimal(pnumli[0].num.Replace("FSCCK", "")) ); } datalist = ClientHelper.PlatformSqlMap.GetListByWhere<PJ_clcrkd> (strsql); foreach (PJ_clcrkd pc in datalist) { PJ_clcrkd ckd = new PJ_clcrkd(); ConvertHelper.CopyTo<PJ_clcrkd>(pc, ckd); ckd.ID = ckd.CreateID(); //ckd.num = "FSCCK" + (num + 1); ckd.num = clccktemp.num; ckd.type = comboBoxEdit6.Text; ckd.Remark = frm.ReturnData.Remark; ckd.lqdw = frm.ReturnData.lqdw; ckd.ghdw = frm.ReturnData.ghdw; ckd.yt = frm.ReturnData.yt; ckd.ssxm = frm.ReturnData.ssxm; ckd.ckdate = DateTime.Now; if (cktemp >= Convert.ToDouble(pc.kcsl)) { ckd.cksl = pc.kcsl; ckd.zkcsl = (zkc - Convert.ToDouble(pc.kcsl)).ToString(); cktemp = cktemp - Convert.ToDouble(pc.kcsl); pc.kcsl = "0"; ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc); } else { ckd.cksl = cktemp.ToString(); ckd.zkcsl = (zkc - cktemp).ToString(); pc.kcsl = (Convert.ToDouble(pc.kcsl) - cktemp).ToString(); cktemp = 0; ClientHelper.PlatformSqlMap.Update<PJ_clcrkd>(pc); } ckd.lyparent = pc.ID; zkc = Convert.ToDouble(ckd.zkcsl); Thread.Sleep(new TimeSpan(100000));//0.1毫秒 if (isWorkflowCall) { MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + ckd.ID + "' and RecordID='" + currRecord.ID + "'" + " and WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'" + " and WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "'" + " and WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'" + " and WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "'"); } ClientHelper.PlatformSqlMap.Create<PJ_clcrkd>(ckd); if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = ckd.ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = ckd.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); } if (cktemp < 1) break; //num = (num + 1); } ucclck1.inidata(); simpleButton1_Click(sender, e); //simpleButton2_Click(sender, e); } } }