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.
195 lines
7.4 KiB
195 lines
7.4 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Configuration;
|
||
|
using System.Drawing;
|
||
|
using System.Windows.Forms;
|
||
|
using QMAPP.FJC.Entity;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.ServicesAgent;
|
||
|
using QMAPP.WinForm.Common;
|
||
|
using QMFrameWork.Common.Serialization;
|
||
|
using QMFrameWork.Data;
|
||
|
|
||
|
namespace QMAPP.WinForm.Forms.Injection
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:M11-2
|
||
|
/// 作 用:搪塑条码打印
|
||
|
/// 作 者:王庆男
|
||
|
/// 编写日期:2015年05月28日
|
||
|
///</summary>
|
||
|
public partial class SlushMoldingPrintForm : Form
|
||
|
{
|
||
|
Product searchModel = new Product();//查询条件
|
||
|
public SlushMoldingPrintForm()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
#region 窗体载入
|
||
|
|
||
|
private void Form_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
#region 绑定下拉列表
|
||
|
BasicData basicData = new BasicData();
|
||
|
//初始化控件属性
|
||
|
this.DGView.AutoGenerateColumns = false;
|
||
|
//加载搪塑设备列表
|
||
|
//this.comSlushMachine.DataSource = basicData.GetMachineInfoList(new string[] { EnumGeter.ProcessType.tangsu.GetHashCode().ToString() }, true);
|
||
|
//this.comSlushMachine.DisplayMember = "MACHINENAME";
|
||
|
//this.comSlushMachine.ValueMember = "MACHINECODDE";
|
||
|
//产品颜色
|
||
|
this.comProColor.DataSource = basicData.GetDictionaryList(EnumGeter.DictKind.COLOR.ToString());
|
||
|
this.comProColor.DisplayMember = "VALUE";
|
||
|
this.comProColor.ValueMember = "KEY";
|
||
|
#endregion
|
||
|
|
||
|
//初始化分页
|
||
|
this.pager1.Init();
|
||
|
//加载默认查询条件
|
||
|
SetSearchModel();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 绑定数据
|
||
|
|
||
|
private DataPage BindGirdData()
|
||
|
{
|
||
|
List<Product> recorders = null;//查询结果列表
|
||
|
DataPage dataPage = new DataPage();
|
||
|
//获取前台分页设置信息
|
||
|
dataPage = pager1.DataPage;
|
||
|
try
|
||
|
{
|
||
|
#region 服务查询
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
||
|
dataPage = agent.InvokeServiceFunction<DataPage>(B9BasicService.ProductBLL_GetListAndAttribute.ToString(), searchModel, dataPage);
|
||
|
recorders = JsonConvertHelper.GetDeserialize<List<Product>>(dataPage.Result.ToString());
|
||
|
#endregion
|
||
|
this.DGView.DataSource = recorders;
|
||
|
this.pager1.DataPage = dataPage;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
return dataPage;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
/// <summary>
|
||
|
/// 分页事件
|
||
|
/// </summary>
|
||
|
/// <param name="e"></param>
|
||
|
/// <returns></returns>
|
||
|
private DataPage pager1_EventPaging(Controls.EventPagingArg e)
|
||
|
{
|
||
|
return BindGirdData();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询事件
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbSearch_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
SetSearchModel();
|
||
|
this.pager1.Init();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 设置查询条件
|
||
|
/// </summary>
|
||
|
private void SetSearchModel()
|
||
|
{
|
||
|
searchModel = new Product();
|
||
|
searchModel.PRODUCTTYPE = EnumGeter.ProductType.biaopi.GetHashCode().ToString();//设置零件条码表的零件类别
|
||
|
////设备
|
||
|
//if (this.comSlushMachine.SelectedValue != null && string.IsNullOrEmpty(this.comSlushMachine.SelectedValue.ToString().Trim()) == false)
|
||
|
//{
|
||
|
// searchModel.MACHINECODDE = this.comSlushMachine.SelectedValue.ToString().Trim();
|
||
|
//}
|
||
|
//条码
|
||
|
if (string.IsNullOrEmpty(this.txtProductCode.Text.Trim()) == false)
|
||
|
{
|
||
|
searchModel.PRODUCTCODELIKE = this.txtProductCode.Text.Trim();
|
||
|
}
|
||
|
//零件颜色
|
||
|
if (this.comProColor.SelectedValue != null && string.IsNullOrEmpty(this.comProColor.SelectedValue.ToString()) == false)
|
||
|
{
|
||
|
searchModel.VAL4 = this.comProColor.SelectedValue.ToString();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 补码
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbAdd_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
SlushMoldingPrintEditForm editForm = new SlushMoldingPrintEditForm();
|
||
|
DialogResult result = editForm.ShowDialog();
|
||
|
if (result == System.Windows.Forms.DialogResult.OK)
|
||
|
{
|
||
|
this.pager1.Init();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 打印
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbPrint_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (this.DGView.SelectedRows.Count <= 0)
|
||
|
return;
|
||
|
string barCode = this.DGView.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString(); ;
|
||
|
string material = this.DGView.SelectedRows[0].Cells["Material_code"].Value.ToString(); ;
|
||
|
string type = this.DGView.SelectedRows[0].Cells["PRODUCTTYPE"].Value.ToString(); ;
|
||
|
string color = this.DGView.SelectedRows[0].Cells["color"].Value.ToString(); ;
|
||
|
//string xmlPath = @"D:/项目文件夹/FJC_CC_B9/truck/B9/ServicesCenter/WCF/EQUIPINTERFACETEST/Biaopi.xml";
|
||
|
//BarcodeLib.BarCodeGenerate generate = new BarcodeLib.BarCodeGenerate();
|
||
|
//generate.PrintBarCode(barCode, xmlPath);
|
||
|
QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
|
||
|
string hb = barCode.Substring(12, 1);
|
||
|
ll.BarCode = barCode + ",*" + material + "*" + "," + color;
|
||
|
QM.Assist.PrintUtil.LabelList2.Add(ll);
|
||
|
QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();
|
||
|
pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString
|
||
|
(), System.Configuration.ConfigurationManager.AppSettings[type +"temPath"].ToString
|
||
|
(), System.Configuration.ConfigurationManager.AppSettings[type +"dataPath"].ToString
|
||
|
());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 行序号
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void DG_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||
|
{
|
||
|
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, this.DGView.RowHeadersWidth - 4, e.RowBounds.Height);
|
||
|
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
|
||
|
}
|
||
|
|
||
|
private void btnScarp_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
if (this.DGView.SelectedRows.Count <= 0)
|
||
|
return;
|
||
|
string barCode = this.DGView.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString();
|
||
|
|
||
|
|
||
|
SlushScarpForm scarpForm = new SlushScarpForm(barCode);
|
||
|
scarpForm.ShowDialog();
|
||
|
}
|
||
|
}
|
||
|
}
|