using System;
using System.Text;
using System.Collections.Generic;
using System.Windows.Forms;
using QM.Common;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMAPP.WinForm.Common;
using QMAPP.Entity;
using QMAPP.FJC.BLL.Basic;
using QMFrameWork.Data;
using QMFrameWork.Common.Serialization;
using System.Linq;
using QMAPP.WinForm.Forms.Operation;
using System.IO.Ports;
using System.Management;
using System.Threading;
using QMAPP.MD.Entity.Bucket;
namespace QMAPP.WinForm.Forms.Injection
{
///
/// 模块编号:M11-2
/// 作 用:搪塑条码打印
/// 作 者:王庆男
/// 编写日期:2015年05月28日
///
public partial class SlushMoldingPrintForOldNewForm : Form
{
///
/// 车型,A:B9车型,B:Q5车型
///
public string CarType { set; get; }
List moldConfigList;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
///
/// 称重记录
///
public List List_tSWeighRecores = new List();
private string _cfgSlushMolding = null;// 称重区间
///
/// 新建
///
public SlushMoldingPrintForOldNewForm()
{
InitializeComponent();
_cfgSlushMolding = GetAppConfigValue("SlushMolding");
btnCommSend.Enabled = true;
serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived);
frmMain_Load();
moldConfigList = new List();
}
///
/// 窗体初始化
///
private void InitForm()
{
//预留方法,用于B9\Q5功能差异
}
///
/// 窗体加载
///
///
///
private void Form_Load(object sender, EventArgs e)
{
InitForm();
DataPage dataPage = new DataPage();
//获取前台分页设置信息
dataPage.PageIndex = 1;
dataPage.PageSize = 100;
//获取可用的配置信息
MoldConfig searchModel = new MoldConfig() { STATUS = 1 };
dataPage = agent.InvokeServiceFunction(B9BasicService.MoldConfigBLL_GetList.ToString(), searchModel);
List recorders = null;
recorders = JsonConvertHelper.GetDeserialize>(dataPage.Result.ToString());
recorders = recorders.OrderBy(o => o.INDEXVALUE).ToList();
moldConfigList = recorders;
#region 绑定下拉列表
BasicData basicData = new BasicData();
//加载搪塑设备列表
//this.comMachineCode.DataSource = basicData.GetMachineInfoList(new string[] { EnumGeter.ProcessType.tangsu.GetHashCode().ToString() }, true);
//this.comMachineCode.DisplayMember = "MACHINENAME";
//this.comMachineCode.ValueMember = "MACHINECODDE";
//this.comMachineCode.SelectedIndex = 1;
//this.comMachineCode.Enabled = false;
var machinelist = basicData.GetMachineInfoAndModelList(new string[] { }, true);
this.comMachineCode.DataSource = machinelist;
this.comMachineCode.DisplayMember = "MACHINENAME";
this.comMachineCode.ValueMember = "MACHINECODDE";
if (ClientContext.MachineInfo != null && !string.IsNullOrEmpty(ClientContext.MachineInfo.PID))
{
this.comMachineCode.SelectedValue = ClientContext.MachineInfo.MACHINECODDE;
//this.lblLock.Visible = false;
this.LockType(false);
}
else
{
//this.lblLock.Visible = false;
this.LockType(false);
}
//颜色
this.comColor.DataSource = basicData.GetDictionaryList(EnumGeter.DictKind.COLOR.ToString());
this.comColor.DisplayMember = "VALUE";
this.comColor.ValueMember = "KEY";
this.comColor.SelectedValue = "1";
//this.comColor.Enabled = false;
////AB腔
this.comPosition.DataSource = basicData.GetDictionaryList(EnumGeter.DictKind.CAVITYTYPE.ToString());
this.comPosition.DisplayMember = "VALUE";
this.comPosition.ValueMember = "KEY";
//this.comPosition.SelectedIndex = 0;
//this.comPosition.Enabled = false;
#endregion
//加工日期
if (string.IsNullOrEmpty(this.dtpDate.Text))
{
this.dtpDate.Text = DateTime.Now.ToString();
}
SetMouldStation();
#region 打印模板拷贝
PrintTempleCopyClass printClass = new PrintTempleCopyClass();
printClass.CopyPrintTemple("SlushMoldingPrintForOldForm");
#endregion
}
#region 设置模架号
///
///
///
private void SetMouldStation()
{
this.cBoxModelCode.DisplayMember = "VALUE";
this.cBoxModelCode.ValueMember = "KEY";
List