天津投入产出系统后端
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.
 
 
 
 
 
 

207 lines
6.3 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Entity.BZD;
using QMAPP.Entity;
namespace QMAPP.WinForm.Forms.Operation
{
/// <summary>
///
/// </summary>
public partial class SignInfoForm : Form
{
//获取服务代理
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
List<Config> _bzdConfig = new List<Config>();
private SignInfo signInfo = new SignInfo();
private string Locs = string.Empty;
/// <summary>
///
/// </summary>
/// <param name="loc"></param>
public SignInfoForm(string loc)
{
InitializeComponent();
infolabel.Text = "";
infolabel.ForeColor = Color.Red;
Locs = loc;
PrintForm_Load();
}
#region 打印按钮
/// <summary>
/// 打印按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(cbMaterial.Text))
{
infolabel.Text = "请选择标记类型!";
cbMaterial.Focus();
return;
}
signInfo.ProductCode = txtMainCode.Text;
signInfo.WorkLoc = Locs;
signInfo.Type = cbMaterial.Text;
var T = _agent.InvokeServiceFunction<SignInfo>(B9IPCService.SignInfoBLL_GetAllListByLoc.ToString(), Locs);
if (cbMaterial.Text == T.Type)
{
if (cbMaterial.Text == "配胶")
{
infolabel.Text = "请先进行清胶,才能配胶!";
cbMaterial.Focus();
return;
}
if (cbMaterial.Text == "清胶")
{
infolabel.Text = "请先进行配胶,才能清胶!";
cbMaterial.Focus();
return;
}
}
if (cbMaterial.Text == "表皮新料" && string.IsNullOrEmpty(txtMainCode.Text))
{
infolabel.Text = "表皮新料,条码不能为空!";
cbMaterial.Focus();
return;
}
if (cbMaterial.Text == "停工&复工")
{
signInfo.SIGNDATE = dtpCREATEDATESTART.Text;
signInfo.Type = "停工";
_agent.InvokeServiceFunction<DataResult<int>>(B9IPCService.SignInfoBLL_Insert.ToString(), signInfo);
signInfo.SIGNDATE = dtpCREATEDATEEND.Text;
signInfo.Type = "复工";
_agent.InvokeServiceFunction<DataResult<int>>(B9IPCService.SignInfoBLL_Insert.ToString(), signInfo);
infolabel.Text = "保存成功!";
this.dtpCREATEDATESTART.Text = "";
this.dtpCREATEDATEEND.Text = "";
return;
}
else
{
var result = _agent.InvokeServiceFunction<DataResult<int>>(B9IPCService.SignInfoBLL_Insert.ToString(), signInfo);
if (result.Result > 0)
{
infolabel.Text = "保存成功!";
txtMainCode.Text = "";
return;
}
}
}
catch (Exception exception)
{
MessageBox.Show("提交失败!");
throw;
}
}
#endregion
#region 初始界面
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PrintForm_Load()
{
_bzdConfig.Add(new Config { PID = "配胶", MATERIALCODDE = "配胶" });
_bzdConfig.Add(new Config { PID = "清胶", MATERIALCODDE = "清胶" });
_bzdConfig.Add(new Config { PID = "表皮新料", MATERIALCODDE = "表皮新料" });
//停工时间&复工
_bzdConfig.Add(new Config { PID = "停工&复工", MATERIALCODDE = "停工&复工" });
LoadAssyMaterial();
}
#endregion
#region 加载总成物料
/// <summary>
/// 加载总成物料
/// </summary>
private void LoadAssyMaterial()
{
//模腔号
this.cbMaterial.DataSource = _bzdConfig;
this.cbMaterial.DisplayMember = "MATERIALCODDE";
this.cbMaterial.ValueMember = "PID";
}
/// <summary>
///
/// </summary>
public class Config{
/// <summary>
///
/// </summary>
public string PID { get; set; }
/// <summary>
///
/// </summary>
public string MATERIALCODDE { get; set; }
}
#endregion
/// <summary>
/// 回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)//如果输入的是回车键
{
button1_Click(sender, e);//触发button事件
}
}
private void cbMaterial_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbMaterial.Text == "停工&复工")
{
this.txtMainCode.Enabled = false;
this.dtpCREATEDATESTART.Enabled = true;
this.dtpCREATEDATEEND.Enabled = true;
this.dtpCREATEDATESTART.ShowUpDown = true;
}
else
{
this.txtMainCode.Enabled = true;
this.dtpCREATEDATESTART.Enabled = false;
this.dtpCREATEDATEEND.Enabled = false;
}
}
}
}