using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Format; namespace Core.StlMes.Client.SaleOrder.Dialog { public partial class frmDesignDept : FrmBase { private String _ordLnPk; private OpeBase _ob; private DataRow _dr; public frmDesignDept(OpeBase ob, String ordLnPk) { this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; _ob = ob; _ordLnPk = ordLnPk; InitializeComponent(); } private void frmDesignDept_Load(object sender, EventArgs e) { getMscDept(); InitCombo(); } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Save": DoSave(); break; case "Cancel": this.Close(); break; default: break; } } private void InitCombo() { ClsBaseInfo.FillDepartment(ultraComboEditor1, _ob, false); if (_dr != null) { ultraComboEditor1.Value = _dr["DEPARTMENT_CODE"].ToString(); } } private void DoSave() { if (ultraComboEditor1.Value == null) { MessageUtil.ShowWarning("请选择管理部门"); return; } if (ultraComboEditor2.Value == null) { MessageUtil.ShowWarning("请选择交付标准管理科室"); return; } if (ultraComboEditor3.Value == null) { MessageUtil.ShowWarning("请选择工艺标准管理科室"); return; } SlmOrdDesignDeptEntity deptEntity = new SlmOrdDesignDeptEntity(); deptEntity.DeptCode = ultraComboEditor1.Value.ToString().Trim(); deptEntity.DeptDesc = ultraComboEditor1.Text.Trim(); deptEntity.DelivyDeptCode = ultraComboEditor2.Value.ToString().Trim(); deptEntity.DelivyDeptDesc = ultraComboEditor2.Text.Trim(); deptEntity.TechDeptCode = ultraComboEditor3.Value.ToString().Trim(); deptEntity.TechDeptDesc = ultraComboEditor3.Text.Trim(); deptEntity.OrdLnPk = _ordLnPk; deptEntity.UserName = UserInfo.GetUserName(); String jsonStr = JSONFormat.Format(deptEntity); if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.sale.order.CoreDesignDept"; ccp.MethodName = "saveDept"; ccp.ServerParams = new object[] { jsonStr }; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Close(); } private void ultraComboEditor1_ValueChanged(object sender, EventArgs e) { ClsBaseInfo.FillSectionByDepartId(ultraComboEditor1.Value.ToString(), ultraComboEditor2, _ob, false); if (_dr != null) { ultraComboEditor2.Value = _dr["UNIT_CODE"].ToString(); } ClsBaseInfo.FillSectionByDepartId(ultraComboEditor1.Value.ToString(), ultraComboEditor3, _ob, false); if (_dr != null) { ultraComboEditor3.Value = _dr["UNIT_CODE_PROCESS"].ToString(); } } /// /// 查询管理科室 /// /// 合同行号 /// private void getMscDept() { DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreDesignDept.getMscDept", new Object[] { _ordLnPk }, _ob); if (dt != null && dt.Rows.Count > 0) { _dr = dt.Rows[0]; } else { _dr = null; } } } }