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

3 years ago
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
{
2 years ago
/// <summary>
///
/// </summary>
3 years ago
public partial class SignInfoForm : Form
{
//获取服务代理
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
2 years ago
List<Config> _bzdConfig = new List<Config>();
2 years ago
private SignInfo signInfo = new SignInfo();
3 years ago
2 years ago
private string Locs = string.Empty;
2 years ago
/// <summary>
///
/// </summary>
2 years ago
/// <param name="loc"></param>
public SignInfoForm(string loc)
3 years ago
{
InitializeComponent();
infolabel.Text = "";
infolabel.ForeColor = Color.Red;
2 years ago
Locs = loc;
PrintForm_Load();
3 years ago
}
#region 打印按钮
/// <summary>
/// 打印按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
try
{
2 years ago
if (string.IsNullOrWhiteSpace(cbMaterial.Text))
{
infolabel.Text = "请选择标记类型!";
cbMaterial.Focus();
return;
}
3 years ago
2 years ago
signInfo.ProductCode = txtMainCode.Text;
2 years ago
signInfo.WorkLoc = Locs;
2 years ago
signInfo.Type = cbMaterial.Text;
3 years ago
2 years ago
var T = _agent.InvokeServiceFunction<SignInfo>(B9IPCService.SignInfoBLL_GetAllListByLoc.ToString(), Locs);
3 years ago
2 years ago
if (cbMaterial.Text == T.Type)
3 years ago
{
2 years ago
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();
2 years ago
return;
3 years ago
}
2 years ago
2 years ago
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;
}
}
3 years ago
}
catch (Exception exception)
{
2 years ago
MessageBox.Show("提交失败!");
3 years ago
throw;
}
}
#endregion
2 years ago
3 years ago
#region 初始界面
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2 years ago
private void PrintForm_Load()
3 years ago
{
2 years ago
_bzdConfig.Add(new Config { PID = "配胶", MATERIALCODDE = "配胶" });
_bzdConfig.Add(new Config { PID = "清胶", MATERIALCODDE = "清胶" });
_bzdConfig.Add(new Config { PID = "表皮新料", MATERIALCODDE = "表皮新料" });
2 years ago
//停工时间&复工
_bzdConfig.Add(new Config { PID = "停工&复工", MATERIALCODDE = "停工&复工" });
3 years ago
LoadAssyMaterial();
}
#endregion
#region 加载总成物料
/// <summary>
/// 加载总成物料
/// </summary>
private void LoadAssyMaterial()
{
//模腔号
this.cbMaterial.DataSource = _bzdConfig;
this.cbMaterial.DisplayMember = "MATERIALCODDE";
this.cbMaterial.ValueMember = "PID";
}
2 years ago
/// <summary>
///
/// </summary>
public class Config{
/// <summary>
///
/// </summary>
public string PID { get; set; }
/// <summary>
///
/// </summary>
public string MATERIALCODDE { get; set; }
}
3 years ago
#endregion
2 years ago
/// <summary>
/// 回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtCode_KeyDown(object sender, KeyEventArgs e)
3 years ago
{
2 years ago
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;
}
3 years ago
}
}
}