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

130 lines
4.7 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace QMAPP.WinForm.Forms.Query
{
public partial class ProductInfo : Form
{
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
public ProductInfo()
{
InitializeComponent();
dgvOutRecord.AutoGenerateColumns = false;
dgvInRecord.AutoGenerateColumns = false;
dgvPartList.AutoGenerateColumns = false;
dgvReplateRecord.AutoGenerateColumns = false;
}
private void btnQuery_Click(object sender, EventArgs e)
{
QueryProduct();
}
private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Enter)//如果输入的是回车键
{
return;
}
QueryProduct();
}
private void ResetContainer()
{
tplBasicInfo.Visible = false;
tlpShipInfo.Visible = false;
lblNoShipRecord.Visible = false;
//groupBox1.Visible = false;
gbOutRecord.Visible = false;
gbInRecord.Visible = false;
//groupBox4.Visible = false;
gbReplaceRecord.Visible = false;
plEmpty.Visible = false;
}
private void QueryProduct()
{
if (string.IsNullOrEmpty(txtBarcode.Text))
{
txtBarcode.Focus();
return;
}
ResetContainer();
Entity.DataResult<FJC.Entity.Operation.ProductFullInfo> result
= _agent.InvokeServiceFunction<Entity.DataResult<FJC.Entity.Operation.ProductFullInfo>>("ProductBLL_GetProductAllInfo", txtBarcode.Text);
if (result.IsSuccess)
{
var info = result.Result;
tplBasicInfo.Visible = true;
lblBarcode.Text = string.IsNullOrEmpty(result.Result.ProductBasicInfo.MAINCODE) ? result.Result.ProductBasicInfo.PRODUCTCODE : result.Result.ProductBasicInfo.MAINCODE;
lblCompleteTime.Text = result.Result.ProductBasicInfo.CREATEDATE.ToString("yyyy-MM-dd HH:mm:ss");
lblLastWorkcellName.Text = result.Result.ProductBasicInfo.WORKCELL_CODE;
lblMaterialCode.Text = result.Result.ProductBasicInfo.MATERIAL_CODE;
lblMaterialName.Text = result.Result.ProductBasicInfo.MATERIAL_NAME;
lblMaterialAttribute.Text = result.Result.ProductBasicInfo.MATERIAL_ATTRIBUTE;
lblOutFlag.Text = result.Result.ProductBasicInfo.OUTFLAGNAME;
lblStatus.Text = result.Result.ProductBasicInfo.STATUSNAME;
lblUsingStatus.Text = result.Result.ProductBasicInfo.USINGSTATENAME;
lblUsingCount.Text = result.Result.ProductBasicInfo.USINGCOUNT.ToString();
lblCapacity.Text = result.Result.ProductBasicInfo.CAPACITY.ToString();
dgvPartList.DataSource = info.PartList.OrderByDescending(p=>p.CREATEDATE).ToList();
if (info.ProductOutRecord.Count > 0)
{
gbOutRecord.Visible = true;
dgvOutRecord.DataSource = info.ProductOutRecord;
}
if (info.ProductInRecord.Count > 0)
{
gbInRecord.Visible = true;
dgvInRecord.DataSource = info.ProductInRecord;
}
if (info.ShipmentInfo != null)
{
tlpShipInfo.Visible = true;
lblScandate.Text = info.ShipmentInfo.SCANDATE.ToString("yyyy-MM-dd HH:mm:ss");
lblVIN.Text = info.ShipmentInfo.VIN;
lblVWSEQ.Text = info.ShipmentInfo.VWSEQ;
lblKIN.Text = info.ShipmentInfo.KIN;
}
else
{
lblNoShipRecord.Visible = true;
}
if (info.CodeReplaceRecord.Count > 0)
{
gbReplaceRecord.Visible = true;
dgvReplateRecord.DataSource = info.CodeReplaceRecord;
}
txtBarcode.Text = "";
txtBarcode.Focus();
}
else
{
plEmpty.Visible = true;
lblMessage.Text = result.Msg;
txtBarcode.SelectAll();
txtBarcode.Focus();
}
}
private void ProductInfo_Load(object sender, EventArgs e)
{
ResetContainer();
}
}
}