You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.2 KiB
144 lines
4.2 KiB
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
|
|
{
|
|
/// <summary>
|
|
/// 模块编号:M12-1
|
|
/// 作 用:投料记录
|
|
/// 作 者:王庆男
|
|
/// 编写日期:2015年06月08日
|
|
///</summary>
|
|
public partial class SlushPlanEditForm : Form
|
|
{
|
|
ProducePlan recorder = new ProducePlan();//编辑保存实体
|
|
|
|
/// <summary>
|
|
/// 新建
|
|
/// </summary>
|
|
public SlushPlanEditForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="pid"></param>
|
|
public SlushPlanEditForm(string pid)
|
|
{
|
|
recorder.PID = pid;
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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<DataResult<ProducePlan>>(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
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体保存事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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<int> result;//判断是否成功
|
|
|
|
result = agent.InvokeServiceFunction<DataResult<int>>(ProduceManage.ProducePlanBLL_Update.ToString(), recorder);
|
|
|
|
//保存成功
|
|
MessageBox.Show(result.Msg);
|
|
if (result.IsSuccess)
|
|
{
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体关闭
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsbClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
|
|
///<summary>
|
|
///错误检测
|
|
///</summary>
|
|
///<returns></returns>
|
|
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
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|