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

149 lines
4.5 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;
namespace QMAPP.WinForm.Forms.Operation
{
public partial class BZDRePrintForm : Form
{
//获取服务代理
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
List<BZDConfig> _bzdConfig = null;
Product _CurrentProduct = null;
private OperationForm _parentForm;
public BZDRePrintForm(OperationForm parentForm)
{
InitializeComponent();
infolabel.Text = "";
infolabel.ForeColor = Color.Red;
_parentForm = parentForm;
}
#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;
}
if (string.IsNullOrEmpty(txtMainCode.Text))
{
infolabel.Text = "请扫描或填写装配码!";
txtMainCode.Focus();
return;
}
//*****************************
var _Product = _agent.InvokeServiceFunction<BZDRecorder2>(B9IPCService.BZDRecorderBLL_GetRecord.ToString(), new BZDRecorder2() { PRODUCTCODE = txtMainCode.Text });
if (_Product == null)
{
string BZDRule = "";
DataTable dataTable = _agent.InvokeServiceFunction<DataTable>(B9IPCService.BZDConfigBLL_GetAppConfigValue.ToString(), "BZDRule");
if (dataTable.Rows.Count > 0)
{
BZDRule = dataTable.Rows[0]["Value"].ToString();
}
if (string.IsNullOrEmpty(BZDRule))
{
MessageBox.Show("未配置总成规则!");
return;
}
string MATERIAL_CODE = cbMaterial.Text.Split('|')[0];
if (System.Text.RegularExpressions.Regex.IsMatch(txtMainCode.Text, BZDRule))
{
//添加补打记录
_agent.InvokeServiceFunction<int>(B9IPCService.BarCodeReplacementBLL_Insert.ToString(), new BarCodeReplacement() { ProductCode = txtMainCode.Text, Type = "BZD条码补打" });
_parentForm.planMATERIAL_CODE = MATERIAL_CODE;
_parentForm.processMainCode = txtMainCode.Text;
//_parentForm.cBoxVAN = false;
_parentForm.Print052QRCODE(false);
}
else
{
MessageBox.Show("条码规则不符合!");
}
}
else
MessageBox.Show("条码已存在!");
}
catch (Exception exception)
{
MessageBox.Show("打印失败!");
throw;
}
}
#endregion
#region 初始界面
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PrintForm_Load(object sender, EventArgs e)
{
_bzdConfig =
_agent.InvokeServiceFunction<List<BZDConfig>>(B9IPCService.BZDConfigBLL_GetAllList.ToString(),"");
foreach (var t in _bzdConfig)
{
t.MATERIALCODDE = t.MATERIALCODDE + "|" + t.ColorDetail;
}
LoadAssyMaterial();
}
#endregion
#region 加载总成物料
/// <summary>
/// 加载总成物料
/// </summary>
private void LoadAssyMaterial()
{
//模腔号
this.cbMaterial.DataSource = _bzdConfig;
this.cbMaterial.DisplayMember = "MATERIALCODDE";
this.cbMaterial.ValueMember = "PID";
}
#endregion
private void label2_Click(object sender, EventArgs e)
{
}
}
}