void gridViewOperation_AfterDelete(PJ_18gysbpjmx obj) { IList<PJ_18gysbpjmx> list = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_18gysbpjmx>(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); List<PJ_18gysbpjmx> list2 = new List<PJ_18gysbpjmx>(); for (int i = 0; i < list.Count; i++) { list[i].xh = i; } list2.AddRange (list); try { List<SqlQueryObject> list3 = new List<SqlQueryObject>(); if (list.Count > 0) { SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Update, list2.ToArray()); list3.Add(obj3); } MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3); RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); } catch (Exception exception) { MainHelper.ShowWarningMessageBox(exception.Message); } }
void dataBind() { PJ_18gysbpjmx temp = new PJ_18gysbpjmx(); //this.dateEdit1.DataBindings.Add("EditValue", rowData, "rq"); //this.dateEdit2.DataBindings.Add("EditValue", rowData, "CreateDate"); this.spinEdit1.DataBindings.Add("EditValue", rowData, "xh"); this.spinEdit2.DataBindings.Add("EditValue", rowData, "one"); this.spinEdit3.DataBindings.Add("EditValue", rowData, "two"); this.spinEdit4.DataBindings.Add("EditValue", rowData, "three"); this.spinEdit5.DataBindings.Add("EditValue", rowData, "whl"); this.comboBoxEdit1.DataBindings.Add("EditValue", rowData, "sbdy"); this.comboBoxEdit3.DataBindings.Add("EditValue", rowData, "fzdw"); this.comboBoxEdit4.DataBindings.Add("EditValue", rowData, "qxlb"); this.memoEdit1.DataBindings.Add("EditValue", rowData, "qxnr", false, DataSourceUpdateMode.OnPropertyChanged); // //this.lookUpEdit1.DataBindings.Add("EditValue", rowData, "OrgType"); //this.dateEdit1.DataBindings.Add("EditValue", rowData, "PSafeTime"); // this.dateEdit2.DataBindings.Add("EditValue", rowData, "DSafeTime"); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(PJ_18gysbpjmx newobj) { if (PSObj == null) return; //newobj.OrgCode = parentID; //newobj.OrgName = parentObj.OrgName; newobj.PJ_ID = PSObj.PJ_ID; newobj.CreateDate = DateTime.Now; Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin(); newobj.CreateMan = m_UserBase.RealName; }
void gridViewOperation_AfterAdd(PJ_18gysbpjmx obj) { //RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by id desc"); RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = obj.PJ_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 = obj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord); PJ_qxfl qxfj = new PJ_qxfl(); qxfj.CreateDate = PSObj.CreateDate; qxfj.CreateMan = PSObj.CreateMan; qxfj.LineID = ""; qxfj.LineName = ""; qxfj.OrgCode = PSObj.OrgCode; qxfj.OrgName = PSObj.OrgName; qxfj.qxlb = obj.qxlb; qxfj.qxly = "高压配电设备评级表"; qxfj.qxnr = obj.qxnr; qxfj.xcqx = ""; qxfj.xcr = ""; qxfj.xlqd = ""; qxfj.xsr = ""; qxfj.xssj = new DateTime(1900, 1, 1); MainHelper.PlatformSqlMap.Create<PJ_qxfl>(qxfj); LP_Record lpr = new LP_Record(); lpr.ID = "N" + lpr.CreateID(); lpr.Kind = "设备缺陷管理流程"; lpr.CreateTime = DateTime.Now.ToString(); lpr.OrgName = qxfj.OrgName; string[] strtemp = RecordWorkTask.RunNewGZPRecord(lpr.ID, "设备缺陷管理流程", MainHelper.User.UserID, false); if (strtemp[0].IndexOf("未提交至任何人") > -1) { MsgBox.ShowTipMessageBox("未提交至任何人,创建失败,请检查流程模板和组织机构配置是否正确!"); return; } DataTable recordWorkFlowData = RecordWorkTask.GetRecordWorkFlowData(lpr.ID, MainHelper.User.UserID); if (recordWorkFlowData == null) { MsgBox.ShowWarningMessageBox("出错,未找到该流程信息,请检查模板设置!"); } LP_Temple ParentTemple = RecordWorkTask.GetWorkTaskTemple(recordWorkFlowData, lpr); if (ParentTemple == null) lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, "设备缺陷管理流程"); else lpr.Number = RecordWorkTask.CreatWorkFolwNo(MainHelper.UserOrg, ParentTemple.LPID); lpr.Status = recordWorkFlowData.Rows[0]["TaskCaption"].ToString(); MainHelper.PlatformSqlMap.Create<LP_Record>(lpr); currRecord = lpr; WorkFlowData = recordWorkFlowData; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ID = mrwt.CreateID(); mrwt.ModleRecordID = qxfj.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 = qxfj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); } }
void gridViewOperation_AfterDelete(PJ_18gysbpjmx obj) { if (isWorkflowCall) { MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + obj.PJ_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() + "'"); } IList<PJ_18gysbpjmx> list = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_18gysbpjmx>(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); List<PJ_18gysbpjmx> list2 = new List<PJ_18gysbpjmx>(); for (int i = 0; i < list.Count; i++) { list[i].xh = i; } list2.AddRange(list); try { List<SqlQueryObject> list3 = new List<SqlQueryObject>(); if (list.Count > 0) { SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Update, list2.ToArray()); list3.Add(obj3); } MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3); RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); } catch (Exception exception) { MainHelper.ShowWarningMessageBox(exception.Message); } }
void gridViewOperation_AfterAdd(PJ_18gysbpjmx obj) { //RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by id desc"); RefreshData(" where PJ_ID='" + PSObj.PJ_ID + "' order by xh "); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(PJ_18gysbpjmx newobj) { if (PSObj == null) return; //newobj.OrgCode = parentID; //newobj.OrgName = parentObj.OrgName; newobj.PJ_ID = PSObj.PJ_ID; newobj.CreateDate = DateTime.Now; newobj.CreateMan = MainHelper.User.UserName; }
private void sbpj(IList<PJ_qxfl> qxlist, PJ_18gysbpjmx pjmx) { pjmx.one = 0; if (qxlist[0].qxlb == "一般缺陷") { pjmx.qxlb = qxlist[qxlist.Count - 1].qxlb; pjmx.qxnr = qxlist[qxlist.Count - 1].qxnr; if (pjmx.qxlb == "一般缺陷") { pjmx.two = 1; } else { pjmx.three = 1; pjmx.whl = 0; } } else { pjmx.qxlb = qxlist[0].qxlb; pjmx.qxnr = qxlist[0].qxnr; pjmx.three = 1; pjmx.whl = 0; } if (qxlist.Count > 1 && pjmx.two==1) { if (pjmx.sbdy.Contains("台区") && qxlist.Count==2) {//只有台区超不超过2件为1类,别的为三类 pjmx.three = 0; pjmx.two = 1; pjmx.whl = 1; } else { pjmx.two = 0; pjmx.three = 1; pjmx.whl = 0; } } }
void gridViewOperation_AfterAdd(PJ_18gysbpj obj) { IList<PS_xl> listxl = Client.ClientHelper.PlatformSqlMap.GetList<PS_xl>("where orgcode='" + btGdsList.EditValue + "'and ParentID = ''"); int bh = 0; string fzdw = parentObj.OrgName; string loginname = MainHelper.User.UserName; foreach (PS_xl pl in listxl) { bh++; //线路 PJ_18gysbpjmx pjmx = new PJ_18gysbpjmx(); pjmx.PJ_ID = obj.PJ_ID; pjmx.xh = bh; pjmx.sbdy = pl.LineName; pjmx.CreateDate = DateTime.Now; pjmx.CreateMan = MainHelper.User.UserName; pjmx.fzdw = fzdw; int line1 = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "SELECT SUM(WireLength) FROM PS_xl WHERE linevol='10' and SUBSTRING(LineCode, 1, 6) = '" + pl.LineCode + "'AND (lineKind = '一类')")); int line2 = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "SELECT SUM(WireLength) FROM PS_xl WHERE linevol='10' and SUBSTRING(LineCode, 1, 6) = '" + pl.LineCode + "'AND (lineKind = '二类')")); int line3 = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "SELECT SUM(WireLength) FROM PS_xl WHERE linevol='10' and SUBSTRING(LineCode, 1, 6) = '" + pl.LineCode + "'AND (lineKind = '三类')")); pjmx.one = line1; pjmx.two = line2; pjmx.three = line3; if ((line1 + line2 + line3) != 0) { pjmx.whl = Convert.ToDecimal((line1 + line2) / (line1 + line2 + line3)); } #region 生成缺陷 string xlsqlwhere=string.Format(" where xlid='{0}' and xcr='' order by qxlb",pl.LineID); IList<PJ_qxfl> qxlist = MainHelper.PlatformSqlMap.GetList<PJ_qxfl>(xlsqlwhere); if (qxlist.Count>0) { if (qxlist[0].qxlb=="一般缺陷") { pjmx.qxlb = qxlist[qxlist.Count - 1].qxlb; pjmx.qxnr = qxlist[qxlist.Count - 1].qxnr; } else { pjmx.qxlb = qxlist[0].qxlb; pjmx.qxnr = qxlist[0].qxnr; } } #endregion Client.ClientHelper.PlatformSqlMap.Create<PJ_18gysbpjmx>(pjmx); //台区 IList<PS_tq> listtq = Client.ClientHelper.PlatformSqlMap.GetList<PS_tq>("where SUBSTRING(xlCode, 1, 6) ='" + pl.LineCode + "'"); foreach (PS_tq pq in listtq) { bh++; pjmx = new PJ_18gysbpjmx(); pjmx.ID += bh; pjmx.xh = bh; pjmx.PJ_ID = obj.PJ_ID; pjmx.sbdy = pq.tqName + "台区"; pjmx.CreateDate = DateTime.Now; pjmx.CreateMan = loginname; pjmx.fzdw = fzdw; switch (pq.btKind) { case "一类": pjmx.one = 1; pjmx.whl = 1; break; case "二类": pjmx.two = 1; pjmx.whl = 1; break; case "三类": pjmx.three = 1; pjmx.whl = 0; break; } #region 生成缺陷 xlsqlwhere = string.Format(" where tqid='{0}' and xcr='' order by qxlb", pq.tqID); qxlist = MainHelper.PlatformSqlMap.GetList<PJ_qxfl>(xlsqlwhere); if (qxlist.Count > 0) { sbpj(qxlist,pjmx); } #endregion Client.ClientHelper.PlatformSqlMap.Create<PJ_18gysbpjmx>(pjmx); } //开关 IList<PS_kg> listkg = Client.ClientHelper.PlatformSqlMap.GetList<PS_kg>("WHERE (gtID IN(SELECT gtID FROM PS_gt WHERE (SUBSTRING(LineCode, 1, 6) = '" + pl.LineCode + "')))"); foreach (PS_kg pq in listkg) { bh++; pjmx = new PJ_18gysbpjmx(); pjmx.ID += bh; pjmx.xh = bh; pjmx.PJ_ID = obj.PJ_ID; pjmx.sbdy = pq.kgName + "开关"; pjmx.CreateDate = DateTime.Now; pjmx.CreateMan = loginname; pjmx.fzdw = fzdw; switch (pq.kgkind) { case "一类": pjmx.one = 1; pjmx.whl = 1; break; case "二类": pjmx.two = 2; pjmx.whl = 1; break; case "三类": pjmx.three = 1; pjmx.whl = 0; break; } #region 生成缺陷 xlsqlwhere = string.Format(" where kgid='{0}' and xcr='' order by qxlb", pq.kgID); qxlist = MainHelper.PlatformSqlMap.GetList<PJ_qxfl>(xlsqlwhere); if (qxlist.Count > 0) { sbpj(qxlist, pjmx); } #endregion Client.ClientHelper.PlatformSqlMap.Create<PJ_18gysbpjmx>(pjmx); } //变压器 IList<PS_tqbyq> listbyq = Client.ClientHelper.PlatformSqlMap.GetList<PS_tqbyq>("WHERE (tqID IN(SELECT tqID FROM PS_tq WHERE (SUBSTRING(tqcode, 1, 6) = '" + pl.LineCode + "')))"); foreach (PS_tqbyq pq in listbyq) { bh++; pjmx = new PJ_18gysbpjmx(); pjmx.ID += bh; pjmx.xh = bh; pjmx.PJ_ID = obj.PJ_ID; pjmx.sbdy = pq.byqName + "变压器"; pjmx.CreateDate = DateTime.Now; pjmx.CreateMan = loginname; pjmx.fzdw = fzdw; switch (pq.byqkind) { case "一类": pjmx.one = 1; pjmx.whl = 1; break; case "二类": pjmx.two = 2; pjmx.whl = 1; break; case "三类": pjmx.three = 1; pjmx.whl = 0; break; } #region 生成缺陷 xlsqlwhere = string.Format(" where byqid='{0}' and xcr='' order by qxlb", pq.byqID); qxlist = MainHelper.PlatformSqlMap.GetList<PJ_qxfl>(xlsqlwhere); if (qxlist.Count > 0) { sbpj(qxlist, pjmx); } #endregion Client.ClientHelper.PlatformSqlMap.Create<PJ_18gysbpjmx>(pjmx); } } //if (isWorkflowCall) { // WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); // mrwt.ModleRecordID = obj.PJ_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 = obj.GetType().ToString(); // mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); // mrwt.CreatTime = DateTime.Now; // MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); // MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord); //} RefreshData(" where OrgCode='" + parentID + "'"); }