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 Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Core.StlMes.Client.PlnSaleOrd.工序排产; namespace Core.StlMes.Client.PlnSaleOrd { public partial class FrmJxjh : FrmBase { private string _plineCode = ""; private string _processCode = ""; public FrmJxjh(OpeBase ob,string plineCode,string processCode) { //窗体居中 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; //取消窗体默认关闭按钮 this.ControlBox = false; this.ob = ob; _plineCode = plineCode; _processCode = processCode; InitializeComponent(); } private void FrmJxjh_Load(object sender, EventArgs e) { InitRepairType(); InitPline(); GetMaxTimeByPlineCode(); } private void InitPline() { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPline", new object[] { _processCode, "", "" }, this.ob); if (dt != null && dt.Rows.Count > 0) { comPline.DataSource = dt; comPline.ValueMember = "PLINE_CODE"; comPline.DisplayMember = "PLINE_NAME"; comPline.Value = _plineCode; } } private void InitRepairType() { DataTable dt = new DataTable(); dt.Columns.Add("RepairType"); DataRow dr1 = dt.NewRow(); dr1["RepairType"] = "检修"; dt.Rows.Add(dr1); DataRow dr2 = dt.NewRow(); dr2["RepairType"] = "停机"; dt.Rows.Add(dr2); comStyle.DataSource = dt; comStyle.DisplayMember = "RepairType"; comStyle.ValueMember = "RepairType"; } private void GetMaxTimeByPlineCode() { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.getMaxTime", new object[] { _plineCode,_processCode }, this.ob); if (dt != null && dt.Rows.Count > 0) { timeBeign.Value = dt.Rows[0]["PLAN_TIME_E"].ToString(); timeEnd.Value = dt.Rows[0]["PLAN_TIME_E"].ToString(); } } private void txtTime_ValueChanged(object sender, EventArgs e) { string planUseTime = txtTime.Value == null ? "0" : txtTime.Value.ToString().Trim(); timeEnd.Value = DateTime.Parse(timeBeign.Value.ToString()).AddHours(Double.Parse(planUseTime)).ToString("yyyy-MM-dd HH:mm:ss"); } private void buttonCancel_Click(object sender, EventArgs e) { this.Close(); } private void buttonAdd_Click(object sender, EventArgs e) { if (_plineCode.Equals("")) { MessageUtil.ShowTips("数据异常,请重新打开界面!"); return; } string plineCode = _plineCode; string plineName = comPline.Text; if (comStyle.Value == null) { MessageUtil.ShowTips("请选择检修类型!"); return; } string repairPlan = comStyle.Value.ToString(); if (txtTime.Value == null) { MessageUtil.ShowTips("请选择输入检修时间!"); return; } string useTime = txtTime.Value.ToString().Trim(); if (MessageUtil.ShowYesNoAndQuestion("是否新增检修计划?") == DialogResult.No) { return; } string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.addRepairPlan", new object[] { plineCode, plineName, repairPlan, useTime, _processCode }, ob); if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return ; } else { MessageUtil.ShowTips(param[1]); if ((bool.Parse(param[0]))) { } } } } }