using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using QM.Common; using QMAPP.FJC.Entity; using QMAPP.FJC.Entity.Basic; using QMAPP.FJC.Entity.ProduceManage; using QMAPP.ServicesAgent; using QMAPP.WinForm.Common; using QMAPP.Entity; namespace QMAPP.WinForm.Forms.SlushPlanForm { /// /// 模块编号:M12-1 /// 作 用:投料记录 /// 作 者:王庆男 /// 编写日期:2015年06月08日 /// public partial class SlushPlanEditForm : Form { ProducePlan recorder = new ProducePlan();//编辑保存实体 /// /// 新建 /// public SlushPlanEditForm() { InitializeComponent(); } /// /// 编辑 /// /// public SlushPlanEditForm(string pid) { recorder.PID = pid; InitializeComponent(); } /// /// 窗体加载 /// /// /// private void Form_Load(object sender, EventArgs e) { new KeyEvent().SetKeyToTxt(this); #region 加载编辑 //判断是否为编辑加载编辑数据 if (string.IsNullOrEmpty(recorder.PID) == false) { QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); recorder = agent.InvokeServiceFunction>(ProduceManage.ProducePlanBLL_Get.ToString(), recorder).Result; //一定是存在的物料 this.lblProType.Text = recorder.PRODUCTTYPE; this.lblMachineType.Text = recorder.MACHINENAME; this.lblDate.Text = recorder.PLANDATE.ToString("yyyy-MM-dd"); this.lblHB.Text = recorder.HB; this.lblColor.Text = recorder.COLOR; this.txtCount.Text = recorder.COMPLETECOUNT.ToString(); } #endregion } /// /// 窗体保存事件 /// /// /// private void tsbSave_Click(object sender, EventArgs e) { //窗体数据校验 string errorMessae = ErrorCheck(); if (errorMessae != "") { MessageBox.Show(errorMessae, Resource1.ConfirmTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #region 加载保存信息 recorder.COMPLETECOUNT = Convert.ToInt32(this.txtCount.Text); #endregion #region 保存 QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); DataResult result;//判断是否成功 result = agent.InvokeServiceFunction>(ProduceManage.ProducePlanBLL_Update.ToString(), recorder); //保存成功 MessageBox.Show(result.Msg); if (result.IsSuccess) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } #endregion } /// /// 窗体关闭 /// /// /// private void tsbClose_Click(object sender, EventArgs e) { this.Close(); } /// ///错误检测 /// /// private string ErrorCheck() { #region 校验 string strMessage = ""; //重量 if (this.txtCount.Text == string.Empty) { strMessage += Resource1.NumNullValidate + "\r\n"; } else { if (SysValidate.IsInt(txtCount.Text.Trim()) == false) { strMessage += Resource1.NumFormatValidate + "\r\n"; } } return strMessage; #endregion } } }