using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using CoreFS.SA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { class DtMsc : DtBaseQcm { ControlMsc _controlMsc = null; public DtMsc(ControlMsc controlMsc) { _controlMsc = controlMsc; RegistQuery(QueryMscRJg, "QueryMscRJg"); RegistQuery(Query, "DefaultQuery"); RegistAction(Add, ActionType.Add); RegistAction(Modify, ActionType.Modify); RegistAction(Save, ActionType.Save); RegistAction(Delete, ActionType.Delete); RegistAction(Resume, ActionType.Resume); RegistAction(SubMitAudit, ActionType.SubMitAudit); RegistAction(Audit, ActionType.Audit); RegistAction(Group, ActionType.Group); RegistAction(SubMitModify, ActionType.SubMitModify); RegistAction(SubMitAuditNk, ActionType.SubMitAudit2); RegistAction(SubMitModifyNk, ActionType.SubMitModify2); } protected void Query() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; _controlMsc.DataTableMscRJg.Clear(); _controlMsc.DataTableMsc.Clear(); if (frm.ultraGrid1.ActiveRow == null) return; ArrayList list = new ArrayList(); list.Add(frm.ultraGrid1.ActiveRow.Cells["PSC"].Value.ToString()); list.Add(frm.ckbDeleteFilter.Checked ? "D" : "A"); list.AddRange(_controlMsc.Msc, _controlMsc.Msc, _controlMsc.Msc); list.Add(frm.txtMsc.Text.Trim()); list.AddRange(frm.MscUseCode, frm.MscUseCode, frm.MscUseCode); DataTable dt = null; try { dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryComMsc", new object[] { list }, frm.ob); } catch { return; } if (_controlMsc.GridMsc.ActiveRow == null) { _controlMsc.MscRow = null; _controlMsc.JgRow = null; } else { if (_controlMsc.GridMsc.ActiveRow.HasParent()) { _controlMsc.MscRow = _controlMsc.GridMsc.ActiveRow.ParentRow; _controlMsc.JgRow = _controlMsc.GridMsc.ActiveRow; } else { _controlMsc.MscRow = _controlMsc.GridMsc.ActiveRow; _controlMsc.JgRow = null; } } _controlMsc.GridMsc.BeginUpdate(); GridHelper.CopyDataToDatatable(dt, _controlMsc.DataTableMsc, true); GridHelper.RefreshAndAutoSize(_controlMsc.GridMsc); foreach (UltraGridRow row in _controlMsc.GridMsc.Rows) { _controlMsc.ControlGrid2Edit(row); row.SetValue("Zbs", "质保书模板"); row.Cells["Zbs"].Appearance.TextHAlign = Infragistics.Win.HAlign.Center; } _controlMsc.GridMsc.EndUpdate(); _controlMsc.GridMsc.UpdateData(); } protected bool Add() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; UltraGrid pscGrid = frm.ultraGrid1; pscGrid.UpdateData(); frm.ControlMsc.GridMsc.UpdateData(); UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list4 = new ArrayList(); //冶金项目参数 UltraGridRow ultRow = ultRows[0]; string strMaxMscCode = GetMaxMscCode(pscGrid.ActiveRow.Cells["PSC"].Value.ToString(), ultRow.Cells["USE_CODE"].Value.ToString(), ultRow.Cells["MSC_SEQ"].Value.ToString(), frm.ob); string strMscDesc = ultRow.Cells["MSC_DESC"].Value.ToString() == "" ? pscGrid.ActiveRow.Cells["PSC_DESC"].Value.ToString() : ultRow.Cells["MSC_DESC"].Value.ToString(); //list.Add(pscGrid.ActiveRow.Cells["PSC"].Value.ToString()); //list.Add(pscGrid.ActiveRow.Cells["PSC_DESC"].Value.ToString()); //list.Add(ultRow.Cells["USE_CODE"].Value.ToString()); //list.Add(ultRow.Cells["USE_CODE"].Text); //list.Add(strMaxMscCode); //list.Add(strMscDesc); //list.Add(frm.UserInfo.GetUserName()); list2.Add(strMaxMscCode); list2.Add(strMscDesc); list2.Add(ultRow.Cells["USE_CODE"].Value.ToString()); list2.Add(ultRow.Cells["USE_DESC"].Value.ToString()); list2.Add(ultRow.Cells["DEPARTMENT_CODE"].Value.ToString()); list2.Add(ultRow.Cells["DEPARTMENT_CODE"].Text); list2.Add(ultRow.Cells["UNIT_CODE"].Value.ToString()); list2.Add(ultRow.Cells["UNIT_CODE"].Text); list2.Add(ultRow.GetValue("UNIT_CODE_PROCESS")); list2.Add(ultRow.GetText("UNIT_CODE_PROCESS")); list2.Add(ultRow.Cells["MSC_STYLE"].Value.ToString()); list2.Add(ultRow.Cells["USER_COUNT"].Value.ToString() == "" ? "1" : ultRow.Cells["USER_COUNT"].Value.ToString()); list2.Add(ultRow.Cells["ALLOW_NK"].Value.ToString() == "" ? "1" : ultRow.Cells["ALLOW_NK"].Value.ToString()); list2.Add(ultRow.Cells["MSC_SEQ"].Value.ToString()); list2.Add(""); //引用冶金规范码描述 list2.Add(frm.UserInfo.GetUserName()); list2.Add(ultRow.Cells["MEMO"].Value.ToString()); list2.Add(ultRow.GetValue("PRODUC_HEAD")); list2.Add(ultRow.GetValue("JUDGEFLAG")); list2.Add(pscGrid.ActiveRow.Cells["PRODUCCODE"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["PRODUCNAME"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STD_CODE"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STD_NAME"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STEELCODE"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STEELNAME"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STD_STYLE"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["STD_STYLE_DESC"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["NEW_PROC_CODE"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["NEW_PROC_DESC"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["PSC"].Value.ToString()); list2.Add(pscGrid.ActiveRow.Cells["PSC_DESC"].Value.ToString()); //复制冶金规范下面的数据。 //list4.Add(strMaxMscCode); //list4.Add(ultRow.Cells["MSC_SEQ"].Value.ToString()); //list4.Add(ultRow.Cells["OLD_MSC_SEQ"].Value.ToString()); //list4.Add(frm.UserInfo.GetUserName()); try { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.insertComPscRMsc", new object[] { list, list2, list4 }, frm.ob); } catch { return false; } return true; } protected bool Modify() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; frm.ultraGrid1.UpdateData(); _controlMsc.GridMsc.UpdateData(); UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); if (ultRows.Length > 0) { UltraGridRow ultRow = ultRows[0]; list.Add(ultRow.Cells["MSC_DESC"].Value.ToString()); list.Add(ultRow.Cells["USE_CODE"].Value.ToString()); list.Add(ultRow.Cells["USE_DESC"].Value.ToString()); list.Add(ultRow.Cells["DEPARTMENT_CODE"].Value.ToString()); list.Add(ultRow.Cells["DEPARTMENT_CODE"].Text); list.Add(ultRow.Cells["UNIT_CODE"].Value.ToString()); list.Add(ultRow.Cells["UNIT_CODE"].Text); list.Add(ultRow.GetValue("UNIT_CODE_PROCESS")); list.Add(ultRow.GetText("UNIT_CODE_PROCESS")); list.Add(ultRow.Cells["MSC_STYLE"].Value.ToString()); list.Add(ultRow.Cells["USER_COUNT"].Value.ToString() == "" ? "1" : ultRow.Cells["USER_COUNT"].Value.ToString()); list.Add(ultRow.Cells["ALLOW_NK"].Value.ToString()); list.Add(ultRow.Cells["MSC_SEQ"].Value.ToString()); list.Add(""); //引用冶金规范码描述 list.Add(frm.UserInfo.GetUserName()); list.Add(ultRow.Cells["MEMO"].Value.ToString()); list.Add(ultRow.GetValue("PRODUC_HEAD")); list.Add(ultRow.GetValue("JUDGEFLAG")); list.Add(frm.ultraGrid1.ActiveRow.Cells["PRODUCCODE"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["PRODUCNAME"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STD_CODE"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STD_NAME"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STEELCODE"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STEELNAME"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STD_STYLE"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["STD_STYLE_DESC"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["NEW_PROC_CODE"].Value.ToString()); list.Add(frm.ultraGrid1.ActiveRow.Cells["NEW_PROC_DESC"].Value.ToString()); list.Add(ultRow.Cells["MSC"].Value.ToString()); } //复制冶金规范下面的数据。 //list3.Add(ultRow.Cells["MSC"].Value.ToString()); //list3.Add(ultRow.Cells["MSC_SEQ"].Value.ToString()); //list3.Add(ultRow.Cells["OLD_MSC_SEQ"].Value.ToString()); //list3.Add(frm.UserInfo.GetUserName()); try { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.updateMsc", new object[] { list, list3 }, frm.ob); } catch { return false; } return true; } protected bool Group() { throw new NotImplementedException(); } protected bool Save() { throw new NotImplementedException(); } protected bool Delete() { return ChangeMscState(ActionType.Delete); } protected bool Resume() { return ChangeMscState(ActionType.Resume); } protected bool SubMitAudit() { return ChangeMscState(ActionType.SubMitAudit); } protected bool Audit() { return ChangeMscState(ActionType.Audit); } private bool SubMitModify() { return ChangeMscState(ActionType.SubMitModify); } private bool SubMitAuditNk() { UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); string msc = ultRows[0].GetValue("MSC"); ArrayList list = new ArrayList(); list.AddRange("B", "NoValue", "", "NoValue", msc); return ChangeMscNkState(list); } public bool AuditNk() { try { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; _controlMsc.GridMsc.UpdateData(); UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); ArrayList list = new ArrayList(); if (ultRows.Length > 0) { UltraGridRow ultRow = ultRows[0]; string currentValidFlag = ultRow.GetValue("VALIDFLAG_NK"); string msc = ultRow.GetValue("MSC"); if (currentValidFlag != "B" && currentValidFlag != "E") { MessageUtil.ShowWarning("只能审核处于审核状态或者申请修改状态的冶金规范码!"); return false; } PopupAudit popupAudit = new PopupAudit(ultRow.GetValue("REMARK_NK")); DialogResult result = popupAudit.ShowDialog(); if (result == DialogResult.OK) { string validFlag = "A"; if (popupAudit.CmbAuditType.Text == "审核通过") { if (currentValidFlag == "B") { validFlag = "C"; } else { validFlag = "A"; } } else { if (currentValidFlag == "B") { validFlag = "A"; } else { validFlag = "C"; } } list.Add(validFlag); list.Add(frm.UserInfo.GetUserName()); list.Add("1"); list.Add(popupAudit.TxtMemo.Text.Trim()); list.Add(msc); } else { return false; } } else { MessageUtil.ShowWarning("请选择一条记录后再进行操作!"); } ChangeMscNkState(list); } catch { return false; } //MessageUtil.ShowTips("审核成功!"); return true; } private bool SubMitModifyNk() { UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); string msc = ultRows[0].GetValue("MSC"); ArrayList list = new ArrayList(); list.AddRange("E", "NoValue", "", "NoValue", msc); return ChangeMscNkState(list); } protected override bool CheckData(ActionType actionType, out ArrayList parm, out string msg) { parm = new ArrayList(); FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; bool checkResult = CheckMscData(actionType, out msg); if (checkResult == false) return false; return true; } protected ArrayList[] GetParms(ActionType actionType) { return new ArrayList[1]; } protected override bool IsSelectData(ActionType actionType, out string msg) { msg = ""; FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; _controlMsc.GridMsc.UpdateData(); UltraGridRow[] rows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); if (actionType == ActionType.Add || actionType == ActionType.SubMitAudit || actionType == ActionType.Audit || actionType == ActionType.SubMitModify || actionType == ActionType.SubMitAudit2 || actionType == ActionType.SubMitModify2) { if (rows.Length == 0) { msg = "请勾选一条冶金规范后,再进行操作!"; return false; } } else if (actionType == ActionType.Modify || actionType == ActionType.Delete || actionType == ActionType.Resume) { if (rows.Length == 0) { return false; } } return true; } private bool ChangeMscState(ActionType actionType) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; _controlMsc.GridMsc.UpdateData(); UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); string validFlag = ""; string strActionType = Enum.GetName(typeof(ActionType), actionType); switch (actionType) { case ActionType.Delete: validFlag = "D"; break; case ActionType.Resume: validFlag = "A"; break; case ActionType.SubMitAudit: validFlag = "B"; break; case ActionType.Audit: validFlag = "C"; break; case ActionType.SubMitModify: validFlag = "E"; break; } ArrayList list = new ArrayList(); ArrayList list3 = new ArrayList(); if (ultRows.Length > 0) { UltraGridRow ultRow = ultRows[0]; list.Add(validFlag); list.Add(ultRow.Cells["MSC"].Value.ToString()); list.Add(frm.UserInfo.GetUserName()); list.Add(strActionType); } try { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.deleteOrResumeMsc", new object[] { list, list3 }, frm.ob); } catch { return false; } return true; } public bool Audit2() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; _controlMsc.GridMsc.UpdateData(); UltraGridRow[] ultRows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); ArrayList list = new ArrayList(); ArrayList list3 = new ArrayList(); if (ultRows.Length > 0) { UltraGridRow ultRow = ultRows[0]; string currentValidFlag = ultRow.GetValue("VALIDFLAG"); if (currentValidFlag != "B" && currentValidFlag != "E") { MessageUtil.ShowWarning("只能审核处于审核状态或者申请修改状态的冶金规范码!"); return false; } PopupAudit popupAudit = new PopupAudit(ultRow.GetValue("REMARK")); DialogResult result = popupAudit.ShowDialog(); if (result == DialogResult.OK) { string msc = ultRow.GetValue("MSC"); string validFlag = "A"; if (popupAudit.CmbAuditType.Text == "审核通过") { if (currentValidFlag == "B") { validFlag = "C"; } else { validFlag = "A"; } } else { if (currentValidFlag == "B") { validFlag = "A"; } else { validFlag = "C"; } } list.Add(validFlag); list.Add(msc); list.Add(frm.UserInfo.GetUserName()); list.Add("Audit"); list3.Add(popupAudit.TxtMemo.Text.Trim()); list3.Add(msc); } else { return false; } } else { MessageUtil.ShowWarning("请选择一条记录后再进行操作!"); } try { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.deleteOrResumeMsc", new object[] { list, list3 }, frm.ob); } catch { return false; } //MessageUtil.ShowTips("审核成功!"); return true; } private bool ChangeMscNkState(ArrayList list) { try { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.updateMscNkFlg", new object[] { list }, _controlMsc.FrmProPscMsc2.ob); } catch { return false; } return true; } private bool CheckMscData(ActionType actionType, out string msg) { msg = ""; FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; UltraGridRow[] rows = GridHelper.GetRowsWithKey(_controlMsc.GridMsc, new string[] { "CHK" }, new string[] { "True" }); if (rows.Length == 0) { return true; } string msc = rows[0].GetValue("MSC"); string psc = frm.ultraGrid1.GetActiveRowValue("PSC"); string alpha = rows[0].GetValue("USE_CODE"); string alphaDesc = rows[0].GetValue("USE_DESC"); string oldAlpha = rows[0].GetValue("OLD_USE_CODE"); string allowNk = rows[0].GetValue("ALLOW_NK"); if (actionType == ActionType.Add && msc != "") { msg = "系统已存在该冶金规范码[" + msc + "],请确认后再进行操作!"; //MessageUtil.ShowWarning(); rows[0].Cells["MSC"].Activate(); return false; } if (actionType == ActionType.Modify && msc == "") { //MessageUtil.ShowWarning("系统不存在该记录,请确认后再进行操作!"); msg = "系统不存在该记录,请确认后再进行操作!"; rows[0].Activate(); return false; } //管理员和制造部标准科的人有所有权限,技术中心科技协调部的人员有指派技术中心对应的科室的权限。 其他都 //只能操作自己科室的数据。 if (actionType == ActionType.Modify && rows[0].GetValue("UNIT_CODE") != CoreUserInfo.UserInfo.GetDeptid() && CoreUserInfo.UserInfo.GetDeptid() != "002001001004" && CoreUserInfo.UserInfo.GetUserID() != "admin" && CoreUserInfo.UserInfo.GetUserID() != "99999999") { //if (rows[0].GetValue("DEPARTMENT_CODE") != "002001007" || CoreUserInfo.UserInfo.GetDeptid() != "002001007006") //{ // msg = "该冶金规范是[" + rows[0].GetText("UNIT_CODE") + "]科室维护的,您没有权限!"; // rows[0].Activate(); // return false; //} } //DataRow mscRow = GetComMscByPk(msc); //if (mscRow != null) //{ // if (allowNk != mscRow["ALLOW_NK"].ToString() && CoreUserInfo.UserInfo.GetUserID() != "admin" && CoreUserInfo.UserInfo.GetUserID() != "99999999") // { // msg = "您没有修改是否内控的权限!"; // rows[0].Cells["ALLOW_NK"].Activate(); // return false; // } //} //if (actionType == ActionType.Modify && rows[0].Cells["OLD_USE_CODE"].Value.ToString() == "" // && alpha != "") //{ // //MessageUtil.ShowWarning("标准冶金规范不能修改为Alpha冶金规范!"); // msg = "标准冶金规范不能修改为Alpha冶金规范!"; // rows[0].Activate(); // return false; //} if ((actionType == ActionType.Add || actionType == ActionType.Modify) && oldAlpha != alpha && isExistAlpha(frm, psc, alpha)) { msg = "该产品规范中已包含用途码[" + alphaDesc + "]!"; rows[0].SetCellActive("USE_DESC"); return false; } if (actionType == ActionType.Delete && msc == "") { //MessageUtil.ShowWarning("系统不存在该记录,请确认后再进行操作!"); msg = "系统不存在该记录,请确认后再进行操作!"; rows[0].Activate(); return false; } if (actionType == ActionType.Resume && msc == "") { //MessageUtil.ShowWarning("系统不存在该记录,请确认后再进行操作!"); msg = "系统不存在该记录,请确认后再进行操作!"; rows[0].Activate(); return false; } if (rows[0].Cells["MSC_STYLE"].Value.ToString() == "") { //MessageUtil.ShowWarning("规范类型不能为空!"); msg = "规范类型不能为空!"; rows[0].Cells["MSC_STYLE"].Activate(); return false; } if (rows[0].GetValue("USER_COUNT").ToString() != "-1" && rows[0].GetValue("USER_COUNT").ToString() != "0" && rows[0].GetValue("USER_COUNT").ToString() != "1") { msg = "冶金规范使用次数只能是-1、0、1这三种情况!"; rows[0].Cells["USER_COUNT"].Activate(); return false; } if (alpha == "" && rows[0].Cells["MSC_SEQ"].Value.ToString() != "") { //MessageUtil.ShowWarning("不带Alpha项的冶金规范,不能引用标准冶金规范!"); msg = "请选择一条用途码!"; rows[0].Cells["USE_DESC"].Activate(); return false; } if (actionType == ActionType.Add) { int stdMscCount = _controlMsc.GridMsc.Rows.AsQueryable().Where("MSC = '" + psc.PadRight(13, '0').Replace('P', 'M') + "'").Count(); if (stdMscCount != 0 && rows[0].Cells["MSC_SEQ"].Value.ToString() == "") { //MessageUtil.ShowWarning("没有有效状态的标准冶金规范可以引用,维护带Alpha项冶金规范失败!"); msg = "没有有效状态的标准冶金规范可以引用,维护冶金规范失败!"; rows[0].Cells["MSC_SEQ"].Activate(); return false; } } if (actionType == (ActionType.Add | ActionType.Modify)) { if (rows[0].GetValue("DEPARTMENT_CODE") == "") { MessageUtil.ShowWarning("请选择管理部门!"); rows[0].SetCellActive("DEPARTMENT_CODE"); return false; } else if (rows[0].GetValue("UNIT_CODE") == "") { MessageUtil.ShowWarning("请选择交付标准管理科室!"); rows[0].SetCellActive("UNIT_CODE"); return false; } else if (rows[0].GetValue("UNIT_CODE_PROCESS") == "") { MessageUtil.ShowWarning("请选择工艺标准管理科室!"); rows[0].SetCellActive("UNIT_CODE_PROCESS"); return false; } } if (rows[0].Cells["USE_CODE"].Value.ToString() == "") { int count = 0; foreach (UltraGridRow row in _controlMsc.GridMsc.Rows) { if (row.Cells["MSC"].Value.ToString() == rows[0].Cells["MSC"].Value.ToString()) continue; if (row.Cells["MSC"].Value.ToString() != "" && row.Cells["OLD_USE_CODE"].Value.ToString() == "") { count++; } } if (count > 0) { //MessageUtil.ShowWarning("产品规范下只能维护一条标准冶金规范!"); msg = "产品规范下只能维护一条标准冶金规范!"; rows[0].Activate(); return false; } } if (actionType == ActionType.Resume) { if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "B") { //MessageUtil.ShowWarning("审核状态下的记录不能进行恢复操作!"); msg = "审核状态下的记录不能进行恢复操作!"; rows[0].Activate(); return false; } else if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "C") { //MessageUtil.ShowWarning("已生效的记录不能进行恢复操作!"); msg = "已生效的记录不能进行恢复操作!"; rows[0].Activate(); return false; } } if (actionType == ActionType.SubMitAudit) { if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "D") { //MessageUtil.ShowWarning("请先恢复后再进行操作!"); msg = "请先恢复后再进行操作!"; rows[0].Activate(); return false; } else if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "C") { //MessageUtil.ShowWarning("已生效的记录不能进行提交审核操作!"); msg = "已生效的记录不能进行提交审核操作!"; rows[0].Activate(); return false; } else if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "E") { msg = "申请修改的记录不能进行提交审核操作!"; rows[0].Activate(); return false; } } if (actionType == ActionType.SubMitModify) { if (rows[0].GetValue("VALIDFLAG") != "C") { msg = "只能申请修改已生效的数据!"; rows[0].Activate(); return false; } } if (actionType == ActionType.Audit) { if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "A") { //MessageUtil.ShowWarning("请先提交审核后再进行审核操作!"); msg = "请先提交审核后再进行审核操作!"; rows[0].Activate(); return false; } else if (rows[0].Cells["VALIDFLAG"].Value.ToString() == "D") { //MessageUtil.ShowWarning("请先恢复后再进行操作!"); msg = "请先恢复后再进行操作!"; rows[0].Activate(); return false; } } if (actionType == ActionType.SubMitModify2) { if (rows[0].GetValue("VALIDFLAG_NK") != "C") { msg = "只能申请修改已生效的数据!"; rows[0].Activate(); return false; } } if (actionType == ActionType.SubMitAudit2) { if (rows[0].GetValue("VALIDFLAG_NK") != "A") { msg = "只能提交审核录入状态的数据!"; rows[0].Activate(); return false; } } //if (actionType == ActionType.Delete) //{ // //string isDeleteMscMsg = IsDeleteMsc(msc); // //if (isDeleteMscMsg != "") // //{ // // msg = isDeleteMscMsg; // // rows[0].Activate(); // // return false; // //} //} string departmentCode = ClsBaseInfo.GetDepartIdBySectionId( CoreFS.SA06.CoreUserInfo.UserInfo.GetDeptid(), frm.ob); if (departmentCode == "002001007" && rows[0].Cells["DEPARTMENT_CODE"].Value.ToString() != "002001007") { msg = "技术中心所属人员,不能修改管理部门!"; rows[0].SetCellActive("DEPARTMENT_CODE"); return false; } string mscStyle = rows[0].GetValue("MSC_STYLE"); if (actionType == ActionType.SubMitAudit && IsCompleteMsc(msc, mscStyle, out msg) == false) { return false; } return true; } private void QueryMscRJg() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; string psc = frm.ultraGrid1.ActiveRow.Cells["PSC"].Value.ToString(); ArrayList list = new ArrayList(); list.Add(_controlMsc.Msc); list.Add(psc); list.Add(_controlMsc.FrmProPscMsc2.ckbDeleteFilter.Checked ? "A" : "D"); list.Add(frm.txtMsc.Text.Trim()); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryJG", new object[] { list }, frm.ob); GridHelper.CopyDataToDatatable(dt, _controlMsc.DataTableMscRJg, true); GridHelper.RefreshAndAutoSize(_controlMsc.GridMsc); } private static string GetMaxMscCode(string psc, string useCode, string mscSeq, OpeBase ob) { ArrayList list = new ArrayList(); DataTable dt = null; list.Add(psc); list.Add(psc); list.Add(psc); dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryMaxMscCode", new object[] { list }, ob); //if (useCode == "") //{ // list.Add(psc); // list.Add(psc); // list.Add(psc); // dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryMaxMscCode", // new object[] { list }, ob); //} //else //{ // list.Add(mscSeq); // list.Add(mscSeq); // list.Add(mscSeq); // dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryMscAlphaCode", // new object[] { list }, ob); //} if (dt == null) { return ""; } else { return dt.Rows[0][0].ToString(); } } private bool IsCompleteMsc(string msc, string mscStyle, out string msg) { // 4 12 msg = ""; FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.isCompleteMsc", new object[] { msc }, frm.ob); DataTable dt2 = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.isCompleteMsc2", new object[] { msc }, frm.ob); DataRow[] drs = dt.Select("CNT = '0'"); DataRow[] drs2 = dt2.Select("CNT = '0'"); if (mscStyle == "A" || mscStyle == "B") { if (drs.Length > 0) { msg = "冶金规范不完整,请维护" + drs[0]["TYPE"].ToString(); return false; } else if (drs2.Length > 0) { msg = "冶金规范不完整,请维护" + drs2[0]["TYPE"].ToString(); return false; } } else { if (drs.Length > 0) { if (mscStyle != "D" || drs[0]["TYPE"].ToString() != "钢种") { msg = "冶金规范不完整,请维护" + drs[0]["TYPE"].ToString(); return false; } } } return true; } private bool isExistAlpha(FrmProPSCMSC2 frm, string psc, string alpha) { ArrayList list = new ArrayList(); list.AddRange(psc, alpha); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.isExistAlpha", new object[] { list }, frm.ob); if (dt.Rows[0][0].ToString() == "0") { return false; } return true; } private string IsDeleteMsc(string msc) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.isDeleteMsc", new object[] { msc }, frm.ob); foreach (DataRow dr in dt.Rows) { if (dr["CNT"].ToString() != "0") { return "请先作废冶金规范下面的" + dr["NAME"].ToString() + "后再进行操作!"; } } return ""; } public string GetProductName() { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; string productCode = frm.ultraGrid1.GetActiveRowValue("PRODUCCODE"); ArrayList list = new ArrayList(); list.Add(productCode); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryProductType", new object[] { list }, frm.ob); if (dt.Rows.Count == 0) { MessageUtil.ShowWarning("未找到产品码中的品名,带出规范类型失败!"); return null; } else { return dt.Rows[0]["PRODUC_TYPE"].ToString(); } } public void SaveImgPath(string path) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; string msc = _controlMsc.ultraGrid2.GetActiveRowValue("MSC"); ArrayList list = new ArrayList(); list.AddRange(path, msc); ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.saveMscImg", new object[] { list }, frm.ob); } public string QueryImgPath(string msc) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; ArrayList list = new ArrayList(); list.Add(msc); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryMscImg", new object[] { list }, frm.ob); return dt.Rows[0][0].ToString(); } public string[] QueryUnitCodeByPsc(string psc) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryUnitCodeByPsc", new object[] { psc }, frm.ob); string[] strs = new string[] { "", "" }; if (dt.Rows.Count > 0) { strs[0] = dt.Rows[0]["UNIT_CODE"].ToString(); strs[1] = dt.Rows[0]["DEPARTMENT_CODE"].ToString(); } return strs; } public bool IsExistStdMsc(string psc) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.queryIsExistStdMsc", new object[] { psc }, frm.ob); if (dt.Rows[0][0].ToString() != "0") { return true; } return false; } public string GetStdStyle(string psc) { FrmProPSCMSC2 frm = _controlMsc.FrmProPscMsc2; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.getStdStyle", new object[] { psc }, frm.ob); if (dt.Rows.Count > 0) { return dt.Rows[0][0].ToString(); } else { return "G"; } } public DataRow GetComMsc0(string psc) { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.getComMsc0", new object[] { psc }, _controlMsc.FrmProPscMsc2.ob); if (dt.Rows.Count > 0) { return dt.Rows[0]; } else { return null; } } public DataRow GetComMscByPk(string msc) { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.getComMscByPk", new object[] { msc }, _controlMsc.FrmProPscMsc2.ob); if (dt.Rows.Count > 0) { return dt.Rows[0]; } else { return null; } } /// /// 删除制程向下钢种 /// /// /// /// public static void DeletePlineGrade(string msc, string mscPline, string grade, OpeBase ob) { ServerHelper.SetData("com.steering.pss.qcm.CoreFrmProPSCMSC2.deletePlineGrade", new object[] { msc, mscPline, grade }, ob); } } }