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 FrmCL : FrmBase
{
///
/// 产线
///
private string _plineCode;
///
/// 工序
///
private string _processCode;
private string _jsonStr;
private string _username;
public FrmCL(string plineCode, string processCode, String jsonStr,string username,OpeBase ob)
{
//窗体居中
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
//取消窗体默认关闭按钮
this.ControlBox = false;
this.ob = ob;
_plineCode = plineCode;
_processCode = processCode;
_jsonStr = jsonStr;
_username = username;
InitializeComponent();
}
private void FrmCL_Load(object sender, EventArgs e)
{
InitRepairType();
InitPline();
GetMaxTimeByPlineCode();
comStyle.ValueMember = "承揽";
}
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);
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 buttonAdd_Click(object sender, EventArgs e)
{
string plineCode = comPline.Value == null ? "" : comPline.Value.ToString();
string plineName = comPline.Text;
if (plineCode.Equals(""))
{
MessageUtil.ShowWarning("请选择承揽产线!");
return;
}
if (plineCode.Equals(_plineCode))
{
MessageUtil.ShowWarning("不能承揽给本产线!");
return;
}
if (comStyle.Value == null)
{
MessageUtil.ShowTips("请选择检修类型!");
return;
}
string repairType = comStyle.Value.ToString();
if (txtTime.Value == null)
{
MessageUtil.ShowTips("请输入承揽耗时!");
return;
}
string useHour = txtTime.Value.ToString().Trim();
string memo = txtMemo.Text.Trim();
if (memo.Equals(""))
{
MessageUtil.ShowTips("请输入备注!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否新增承揽?") == DialogResult.No)
{
return;
}
string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.addCL", new object[] { _jsonStr, plineCode,
plineName, repairType, useHour,
_username, memo, _processCode }, ob);
if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return; }
else
{
MessageUtil.ShowTips(param[1]);
if ((bool.Parse(param[0])))
{
}
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}