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;
using QM.Account;
using DCS.Common;
using Model;
using QM.Assist;
using DCS.Place;
using QMAPP.FJC.Entity.Operation;
using QMAPP.Entity;
using QMAPP.MD.Entity;
using QMAPP.FJC.Entity.Basic;
namespace QMAPP.WinForm.Forms.DisPatch
{
///
/// 工位终端FIS发货效验功能
/// 创建时间:2012-11-12
/// 创 建 人:pxbibm
/// H1:modified by sun g.q. on 20130330
/// 1)隐藏了rb_hx 和rb_dx,全部根据pFisType判断,生产线的设置使用按钮进行设置;
/// 2)增加 CreatePastecardNo(String lineNo)代替CreatePastecardNo(),贴车单流水号,根据生产线代码生成;
/// 3)校准功能进行了bug修改;
/// 4)20190325移植了成都DCS发运功能,同时保留原有发运,校验信息通过零件规则表判断//gzf。
/// 5)20190325成都存在东西厂情况,且未来要货可能都混线生产,现场操作者要讲求快速切换发货,将单选按钮恢复,且用此过滤发货计划。--gzf
///
public partial class FrmPlace : Form
{
#region 常量
private const string DISPLAY_NAME = "工位终端";
private DataTable dt = null;
private DataTable dtmat = null;
private DataTable dtpro = null;
private BindingSource bs;
private bool setRedBackgroudFlag = false;//设置第一次设置背景颜色校验标识
//获取服务代理
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
List _barcodeRules = null;
public delegate void myMethodDelegate();
#endregion
#region 变量
public string a = "1";
DateTime _dt = DateTime.Now;
//2016-01-07 增加车架的1号位置的扫描校验
private string placeFirstPosition = ""; //1号码标识
private DateTime placeFirstPositionTime = DateTime.MinValue;//获取1号码的时间
int BarcodeTime = 10000;
///
/// 指令二次确认
///
string _CMDConfirm = "";
public string WORKCENTER_CODE = "";//工作重心参数
public string ProMaterial = "";//扫描产品物料信息
#endregion
#region 界面初始化
public FrmPlace()
{
InitializeComponent();
_barcodeRules = _agent.InvokeServiceFunction>("BarcodeRulesBLL_GetListForSend");
}
#endregion
#region 绑定DataGridView
///
/// 绑定DataGridView
///
private DataTable BindDataGridView()
{
#region
return null;
#endregion
}
#endregion
#region 字段
//主键
private string strFiskey;
//大众顺序号
private string strvwseq;
//车身号
private string strkin;
//底盘号
private string strvin;
//零件号
private string strprodno;
//总成描述
private string strcarsetdesc_cn;
//上线时间
private string strcp5a;
//车型
private string strlineno;
//扫描状态
private string strscanstat;
int nfindex = 0;
//int ncsindex = 0;
//int rowindex = 0;
///
/// NF贴车单明细列表
///
List nflist = null;
///
/// NCS贴车单明细列表
///
List ncslist = null;
///
/// NF贴车单主键
///
string nfpastcardkey = "";
///
/// 当前guidview行号
///
int dgvrowindex = 0;
///
/// 正确的声音文件路径
///
private string okSoundPath = null;
public string pFisType = "";
///
/// 错误的声音文件路径
///
private string errorSoundPath = null;
#endregion
#region FIS数据列Post
///
/// FIS数据列Post
///
///
///
private void dgvMATChange_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
#region
try
{
if (dgvMATChange.Rows.Count > 0)
{
e.Graphics.DrawString((e.RowIndex + 1).ToString(), dgvMATChange.RowHeadersDefaultCellStyle.Font,
new SolidBrush(dgvMATChange.RowHeadersDefaultCellStyle.ForeColor),
e.RowBounds.Location.X + 15, e.RowBounds.Y + 5);
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
lberror.Text = ex.Message;
}
#endregion
}
#endregion
#region 获取混线,单线FIS数据
///
/// 获取混线,单线FIS数据
///
///
public void GetInitData()
{
#region
try
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable tbl = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetList.ToString(), pFisType, WORKCENTER_CODE);
//tbl.Columns["PRODNO"].SetOrdinal(5);
tbl.Columns["VIN"].SetOrdinal(3);
tbl.AcceptChanges();
if (tbl.Rows.Count <= 0)
{
DataTable dt = (DataTable)dgvMATChange.DataSource;
if (dt != null)
{
dt.Rows.Clear();
}
}
else
{
dgvMATChange.DataSource = tbl;
}
setRedBackgroudFlag = false;
SetRowColor();
computenfncs();
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
lberror.Text = ex.Message;
}
finally
{
}
#endregion
}
#endregion
#region 获取EPasteDetailsCard数据
///
///
///
public void GetInitData2()
{
try
{
dgvNF.DataSource = new List();
nfpastecard = null;
nflist = null;
nfindex = 0;
dgvrowindex = 0;
setRedBackgroudFlag = false;
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
lberror.Text = ex.Message;
}
finally
{
}
}
#endregion
#region 设置FIS数据颜色
///
/// 设置FIS数据颜色
///
private void SetRowColor()
{
if (setRedBackgroudFlag == true)
{
//return;
}
//底盘号
int vinNumber = 0;
int lastVinNumber = 0;
int num = 0;
int defaultNum = Convert.ToInt32(QMAPP.WinForm.Common.LocalSetting.Settings["ShowDataCount", "4"]);
for (int i = 0; i < this.dgvMATChange.Rows.Count; i++)
{
// vinNumber = Convert.ToInt32(dgvMATChange.Rows[i].Cells["VIN"].Value.ToString().Substring(10, 7));
vinNumber = Convert.ToInt32(dgvMATChange.Rows[i].Cells["REQUESTID"].Value.ToString());
//2016-01-21 wangqingnan 如果行变色则不重新刷颜色
var fispid=dgvMATChange.Rows[i].Cells[PID.Name].Value.ToString();
if (nflist != null && nflist.Exists(p => p.FIS_KEY == fispid))
{
this.dgvMATChange.Rows[i].Cells[clscanstate.Name].Value = "1";
}
if (this.dgvMATChange.Rows[i].Cells[clscanstate.Name].Value.ToString() == "1")
{
this.dgvMATChange.Rows[i].DefaultCellStyle.BackColor = Color.White;
continue;
}
//2016-01-21 wangqingnan 如果行变色则不重新刷颜色
//int defaultNum = Convert.ToInt32(QM.Config.CustomConfig.GetItem("ShowDataCount"));
if (num == 0)
{
this.dgvMATChange.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
if ((i + 1) % defaultNum == 0)
{
num = 1;
}
}
else
{
this.dgvMATChange.Rows[i].DefaultCellStyle.BackColor = Color.YellowGreen;
if ((i + 1) % defaultNum == 0)
{
num = 0;
}
}
//2016-10-31 闫永刚 如果出现该底盘号与上一条底盘号间断的情况,
//设置当前底盘号的颜色为红色
if (lastVinNumber > 0)
{
//if ((vinNumber - lastVinNumber) > 1)
//DQZhang 优化FIS断号颜色显示9999-0001
if (Math.Abs(vinNumber - lastVinNumber) > 1 && Math.Abs(vinNumber - lastVinNumber) != 9998)
{
this.dgvMATChange.Rows[i - 1].DefaultCellStyle.BackColor = Color.Red;
this.dgvMATChange.Rows[i].DefaultCellStyle.BackColor = Color.Red;
setRedBackgroudFlag = true;
}
}
lastVinNumber = vinNumber;
}
if (dgvMATChange.RowCount > 0)
{
dgvMATChange.FirstDisplayedScrollingRowIndex = nfindex - nfindex % 4;
}
dgvMATChange.Refresh();
dgvMATChange.ClearSelection();
txtCode.Focus();
}
#endregion
#region 设置版面的显示与隐藏(无用)
///
/// 设置版面的显示与隐藏
///
private void SetShowData()
{
//"隐藏了rb_hx 和rb_dx,全部根据pFisType判断,生产线的设置使用按钮进行设置"
//02为单线
if (pFisType == "02")
{
//gbGeneralData.Visible = false;
}
else
{
//gbGeneralData.Visible = true;
//gbGeneralData.Dock = DockStyle.Bottom;
}
}
#endregion
#region 处理扫描条码框设置焦点
///
/// 处理扫描条码框设置焦点
///
private void ArragetxtCode()
{
txtCode.Text = string.Empty;
//Activates the control.
txtCode.Select();
//Sets input focus to the control.
txtCode.Focus();
}
#endregion
#region 加载画面
///
/// 加载画面
///
///
///
private void FrmElevateRequest_Load(object sender, EventArgs e)
{
try
{
timeRefew.Enabled = true;
//UserBuffer.Interval = CtlApp.GetInterval(QM.Config.CustomConfig.GetItem("RefreshTime"));
UserBuffer.Interval = CtlApp.GetInterval(QMAPP.WinForm.Common.LocalSetting.Settings["RefreshTime","20"]);
timeRefew.Interval = UserBuffer.Interval;
//BarcodeTime = int.Parse(QM.Config.CustomConfig.GetItem("BarcodeTime"));
//BarcodeTime = int.Parse(QMAPP.WinForm.Common.LocalSetting.Settings["BarcodeTime","1"]);
okSoundPath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"] + "Sound\\" + PlaySoundConst.strSoundOk;
errorSoundPath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"] + "Sound\\" + PlaySoundConst.strSoundNg;
//隐藏了rb_hx 和rb_dx,全部根据pFisType判断,生产线的设置使用按钮进行设置;
//pFisType = "01";
//pFisType = QM.Config.CustomConfig.GetItem("FlashProCode");
//pFisType = QMAPP.WinForm.Common.LocalSetting.Settings["FlashProCode","01"];
pFisType = QMAPP.WinForm.Common.LocalSetting.Settings["FlashProCode", ""];
if (!string.IsNullOrEmpty(pFisType))
{
if (pFisType.Equals("01"))
{
rb_dx.Checked = true;
}
else
{
rb_dx.Checked = true;
}
}
//发运信息直接用单选按钮过滤,工作中心字段用作打印功能格式使用
//WORKCENTER_CODE = QMAPP.WinForm.Common.LocalSetting.Settings["PlantNameConfig", ""];
WORKCENTER_CODE = "IPFY" + pFisType;
//发运框设置
InitContainer();
GetInitData();
SetShowData();
//computenfncs();//lable1原有copy代码 这个功能注释掉了 崔法宝-20170905调整
dgvMATChange.ClearSelection();
dgvNF.AutoGenerateColumns = false;
SetPastNOConfirm(0);
GetLastPastCard();
//lblLastPastNO.Text = "";
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
lberror.Text = ex.Message;
}
finally
{
ArragetxtCode();
dgvMATChange.ClearSelection();
}
}
#endregion
#region 获取上一条发运单信息
///
/// 获取上一条发运单信息
///
private void GetLastPastCard()
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
var lastpastcard= agent.InvokeServiceFunction("FrmPlaceBLL_GetLastPastCard", WORKCENTER_CODE);
if (lastpastcard != null)
{
lblLastPastNO.Text = lastpastcard.PASTECARDNO;
}
}
#endregion
#region 设置贴车单确认状态
///
/// 设置贴车单确认状态
///
/// 0:未确认 1:确认OK 2:确认失败
private void SetPastNOConfirm(int state)
{
switch (state)
{
case 0:
{
pbPastNoConfirmed.Enabled = false;
pbPastNoConfirmed.Image = global::QMAPP.WinForm.Resource1.help;
break;
}
case 1:
{
pbPastNoConfirmed.Enabled = true;
pbPastNoConfirmed.Image = global::QMAPP.WinForm.Resource1.ok;
break;
}
case 2:
{
pbPastNoConfirmed.Enabled = false;
pbPastNoConfirmed.Image = global::QMAPP.WinForm.Resource1.cancel;
break;
}
default:
{
pbPastNoConfirmed.Enabled = false;
pbPastNoConfirmed.Image = global::QMAPP.WinForm.Resource1.stop;
break;
}
}
}
#endregion
#region 贴车单查询功能
///
/// 贴车单查询功能
///
///
///
private void btnSearch_Click(object sender, EventArgs e)
{
FrmItemList frm = new FrmItemList();
frm.ShowDialog();
txtCode.Focus();
}
#endregion
#region 实现效验功能
///
/// 实现效验功能
///
///
///
private void btnJZ_Click(object sender, EventArgs e)
{
try
{
if (MessageBox.Show("您确实要做FIS校准跳过功能吗?", "校准提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
if (nfindex > 0)
{
MessageBox.Show("发运已开始扫描无法进行FIS校准!", "校准提示");
return;
}
if (dgvMATChange.Rows.Count > 0)
{
int i = dgvMATChange.CurrentRow.Index;
string strvwseq = dgvMATChange.Rows[i].Cells["REQUESTID"].Value.ToString();
//上线时间
string strCP5A = dgvMATChange.Rows[i].Cells["CP5A"].Value.ToString();
//BllFisOrder bllFisOrder = new BllFisOrder();
//bllFisOrder.UpdateFisOrder(strvwseq, strCP5A);
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_UpdateFisOrder.ToString(), strvwseq, strCP5A, WORKCENTER_CODE);
GetInitData();
}
}
}
catch (Exception ex)
{
}
finally
{
txtCode.Focus();
}
}
#endregion
#region 获取FIS数据
///
/// 获取FIS数据
///
///
///
private void btnGetFisData_Click(object sender, EventArgs e)
{
if (dgvNF.Rows.Count == 0)
{
GetInitData();
//computenfncs();
}
}
#endregion
#region 手动刷新
///
/// 手动刷新
///
///
///
private void btnRef_Click(object sender, EventArgs e)
{
GetInitData();
}
#endregion
#region 创建贴车单号
//EPasteCard nfpastecard = null;
///
/// 创建贴车单号
/// 贴车单号的规则生成贴车单号,格式为“FB”(2位)+日期(8位,20121008)+流水号(4位);
///
///
private string CreatePastecardNo()
{
#region
//BllFisOrder bllFisOrder = new BllFisOrder();
string strdate = DateTime.Now.ToString("yyyyMMdd");
// DataTable tbl = bllFisOrder.GetPastecardNo(DateTime.Now.ToShortDateString());
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable tbl = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetPastecardNo.ToString(), DateTime.Now.ToShortDateString());
string strindex = tbl.Rows[0][0].ToString().PadLeft(4, '0');
string pastecardno = string.Format("FB{0}{1}", strdate, strindex);
return pastecardno;
#endregion
}
#endregion
#region 创建贴车单号(外来)
///
/// 创建贴车单号
/// 贴车单号的规则生成贴车单号,格式为“生产线代码”(2位)+日期(8位,20121008)+流水号(4位);
/// 20190329--贴车单号的规则生成贴车单号,格式为“生产线代码”(工作中心)+日期(8位,20121008)+流水号(4位)
///
///
private string CreatePastecardNo(String lineNo)
{
#region
String prefix = lineNo;
//BllFisOrder bllFisOrder = new BllFisOrder();
//2016-10-30闫永刚获取贴车单号修改
// DataTable dt = bllFisOrder.GetPastecardIndex();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
//DataTable dt = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetPastecardIndex.ToString());
DataTable dt = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetDaspssteCarIndexByPlanName.ToString(), prefix);
string PASTECARDNO = "";
string OLD_PASTECARDNO = "";
string NEW_PASTECARDNO = "";
if (dt.Rows.Count == 0)
{
PASTECARDNO =lineNo+ DateTime.Now.ToString("yyyyMMdd") + "0001";
nfpastecard.PASTECARDNO = PASTECARDNO;
int delResult = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_InsertDaspssteCarIndexByPlanName.ToString(), nfpastecard);
}
else
{
foreach (DataRow dr in dt.Rows)
{
//OLD_PASTECARDNO = dr["PASTECARDNO"].ToString();
//int Addvalue = Convert.ToInt32(OLD_PASTECARDNO.Substring(OLD_PASTECARDNO.Length - 1, 1)) + 1;
//NEW_PASTECARDNO = OLD_PASTECARDNO.Substring(lineNo.Length, OLD_PASTECARDNO.Length - lineNo.Length - 1) + Addvalue.ToString();
//20190314
PASTECARDNO = dr["PASTECARDNO"].ToString();
if ((Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString().Length < 4)
{
int num = 4 - (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString().Length;
string value = (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString();
string sumValue = "";
for (var i = 0; i < num; i++)
{
sumValue = sumValue + "0";
}
if (PASTECARDNO.Substring(lineNo.Length, PASTECARDNO.Length - lineNo.Length - 4).ToString() == DateTime.Now.ToString("yyyyMMdd"))
{
PASTECARDNO = PASTECARDNO.Substring(lineNo.Length, PASTECARDNO.Length - lineNo.Length - 4) + sumValue + value;
}
else
{
PASTECARDNO = DateTime.Now.ToString("yyyyMMdd") + "0001";
}
}
else
{
if (PASTECARDNO.Substring(lineNo.Length, 8).ToString() == DateTime.Now.ToString("yyyyMMdd"))
{
PASTECARDNO = PASTECARDNO.Substring(lineNo.Length, PASTECARDNO.Length - lineNo.Length - 2) + (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString();
}
else
{
PASTECARDNO = DateTime.Now.ToString("yyyyMMdd") + "0001";
}
}
//nfpastecard.PASTECARDNO = PASTECARDNO;
//nfpastecard.OPERATOR = ClientContext.LoginInfo.UserName.ToString();
}
PASTECARDNO = lineNo + PASTECARDNO;
}
return PASTECARDNO;
#region XXX
//string pasteCardIndex = "";
//DateTime updateTime;
//foreach (DataRow dr in dt.Rows)
//{
// string lineNoRow = dr["PASTECARDNO"].ToString().Substring(0, 2);
// if (lineNo == lineNoRow)
// {
// pasteCardIndex = dr["PASTECARDNO"].ToString();
// updateTime = Convert.ToDateTime(dr["PASTECARDDATE"]);
// }
//}
//string strdate = DateTime.Now.ToString("yyyyMMdd");
//string strindex = "";
//if (pasteCardIndex.Substring(2, 8) == strdate)
//{
// strindex = (Convert.ToInt32(pasteCardIndex.Substring(10, 4)) + 1).ToString().PadLeft(4, '0');
//}
//else
//{
// strindex = "0001";
//}
//原来获取贴车单方式
//string strdate = DateTime.Now.ToString("yyyyMMdd");
//DataTable tbl = bllFisOrder.GetPastecardNo(DateTime.Now.ToShortDateString(), prefix);
//string strindex = tbl.Rows[0][0].ToString().PadLeft(4, '0');
//string pastecardno = string.Format("{0}{1}{2}", prefix, strdate, strindex);
//return pastecardno;
#endregion
#endregion
}
#endregion
#region 删除已经打印过的贴车单FIS列表
///
/// 删除已经打印过的贴车单FIS列表
///
///
///
private void DGVRemoveRow(List pnflist, ref List pnflist2)
{
#region
if (pnflist2 != null)
{
for (int rowindex = 0; rowindex < pnflist2.Count; rowindex++)
{
string tempfiskey2 = pnflist2[rowindex].FIS_KEY;
for (int rowindex1 = 0; rowindex1 < dgvMATChange.Rows.Count; rowindex1++)
{
string tempFiskey1 = dgvMATChange.Rows[rowindex1].Cells["clFiskey"].Value.ToString();
if (tempFiskey1 == tempfiskey2)
{
DataGridViewCellStyle ds = new DataGridViewCellStyle();
ds.BackColor = Color.Green;
this.dgvMATChange.Rows[rowindex1].DefaultCellStyle = ds;
//当删除了满6个的记录后,另一个数据集的行号需要重新排列。
dgvMATChange.Rows[rowindex1].Cells[clscanstate.Name].Value = "1";
pnflist2[rowindex].DGVROWINDEX = rowindex1;
break;
}
}
}
}
#endregion
}
#endregion
#region NF贴车单手动打印功能
///
/// NF贴车单手动打印功能
///
///
///
private void btnPrint_NF_Click(object sender, EventArgs e)
{
#region
bool isprint = false;
try
{
if (nflist != null)
{
if (MessageBox.Show("您确定要提交并且打印数据吗?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
//当点击了确定,则会执行删除操作
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable tbl = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetDaspssteCarIndexByPlanName.ToString(), nfpastecard.PLANTNAME.ToString());
if (tbl.Rows.Count > 0)
{
nfpastecard.PASTECARDNO = tbl.Rows[0][0].ToString();
}
else
{
MessageBox.Show("无法打印!");
}
EFailLog log = new EFailLog();
log.TID = Guid.NewGuid().ToString();
log.FCT_DATE = DateTime.Now;
log.FCT_NO = nfpastecard.PASTE_CARD_KEY;
log.FCT_OPER = UserBuffer.UserCode;
log.FCT_OPERTYPE = 1;
log.FCT_REASON = "NF手动打印贴车单操作";
nfpastecard.FailLog = log;
string strprodtype = "";
//#region "隐藏了rb_hx 和rb_dx,全部根据pFisType判断,生产线的设置使用按钮进行设置"
if (pFisType == "01")
{
strprodtype = "( 混 )";
}
else if (pFisType == "02")
{
strprodtype = "( 单 )";
}
//提交数据处理
foreach (DataRow dr in tbl.Rows)
{
string PASTECARDNO = dr["PASTECARDNO"].ToString();
if (PASTECARDNO.Substring(2, 8).ToString() == DateTime.Now.ToString("yyyyMMdd"))
{
if ((Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString().Length < 4)
{
int num = 4 - (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString().Length;
string value = (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString();
string sumValue = "";
for (var i = 0; i < num; i++)
{
sumValue = sumValue + "0";
}
if (PASTECARDNO.Substring(2, PASTECARDNO.Length - 6).ToString() == DateTime.Now.ToString("yyyyMMdd"))
{
PASTECARDNO = PASTECARDNO.Substring(2, PASTECARDNO.Length - 6) + sumValue + value;
}
else
{
PASTECARDNO = DateTime.Now.ToString("yyyyMMdd") + "0001";
}
}
else
{
if (PASTECARDNO.Substring(2, PASTECARDNO.Length - 6).ToString() == DateTime.Now.ToString("yyyyMMdd"))
{
PASTECARDNO = PASTECARDNO.Substring(2, PASTECARDNO.Length - 6) + (Convert.ToInt32(PASTECARDNO.Substring(PASTECARDNO.Length - 4, 4)) + 1).ToString();
}
else
{
PASTECARDNO = DateTime.Now.ToString("yyyyMMdd") + "0001";
}
}
}
else
{
PASTECARDNO = DateTime.Now.ToString("yyyyMMdd") + "0001";
}
nfpastecard.PASTECARDNO = PASTECARDNO;
nfpastecard.OPERATOR = ClientContext.LoginInfo.UserName.ToString();
// nfpastecard.
}
int rowindex = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_AddNewPasteCard.ToString(), nfpastecard);
// 打印处理
FrmCarCardPrintShow frm = new FrmCarCardPrintShow(nfpastecard, strprodtype, "手动");
frm.Owner = this;
frm.ShowDialog();
isprint = frm.isprint;
}
//if (isprint)
//{
// nfpastecard.DetailsCardlist = nflist;
// nfindex = 0;
// // BllFisOrder bllFisOrder = new BllFisOrder();
// //int strindex = bllFisOrder.AddPasteCard(nfpastecard);
// //QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
// int strindex = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_AddNewPasteCard.ToString(), nfpastecard);
// PrintPasteCard prin = new PrintPasteCard();
// prin.Print(strindex, nfpastecard, strprodtype);
// GetInitData();
// DGVRemoveRow(nflist, ref ncslist);
// nflist = new List();
// dgvNF.DataMember = null;
// dgvNF.DataSource = nflist;
// //computenfncs();
//}
}
else
{
MessageBox.Show("无打印数据!");
}
}
catch (Exception ex)
{
}
finally
{
if (isprint)
{
nflist = null;
txtCode.Focus();
//2016-01-07 增加1号位校验 - 清空1号位
this.placeFirstPosition = "";
this.placeFirstPositionTime = DateTime.MinValue;
//2016-01-07 增加1号位校验
}
}
#endregion
}
#endregion
#region 打印1号位的条码
///
/// 打印1号位的条码
///
///
///
private void btnFirstPlace_Click(object sender, EventArgs e)
{
this.dgvMATChange.Rows[0].DefaultCellStyle.BackColor = Color.White;
#region 打印
DCS.Common.PrintCode printFun = new DCS.Common.PrintCode();
//执行打印
printFun.PinrtFirstPlaceHU();
#endregion
}
#endregion
#region 判断当前扫描过的数据集合中是否有相同条码
EPasteCard ncspastecard = null;
///
/// 判断当前扫描过的数据集合中是否有相同条码
/// 与右侧列表中校验,条码是否扫描过
///
/// 扫描的条码
private bool CheckDataSet(string strbarcode)
{
String teshucode = getTeShuBarcode(barcodeidentification);
if (nfpastecard != null)
{
foreach (EPasteDetailsCard pe in nfpastecard.DetailsCardlist)
{
if (teshucode == strbarcode)
{
continue;
}
if (strbarcode == pe.SANBARCODE)
{
Alert("条码重复:已扫描过的条码,不可以重复扫描。");
ArragetxtCode();
return false;
}
}
}
if (ncspastecard != null)
{
foreach (EPasteDetailsCard pe2 in ncspastecard.DetailsCardlist)
{
if (teshucode == strbarcode)
{
continue;
}
if (strbarcode == pe2.SANBARCODE)
{
Alert("条码重复:已扫描过的条码,不可以重复扫描。");
ArragetxtCode();
return false;
}
}
}
return true;
}
#endregion
#region 创建NF的贴车单以及明细(外来件)
///
/// 创建NF的贴车单以及明细(NF开头)
///
private void CreateNFPaste__()
{
#region
if (nfindex == 0)
{
nflist = new List();
nfpastcardkey = Guid.NewGuid().ToString();
nfpastecard = new EPasteCard();
nfpastecard.DetailsCardlist = new List();
nfpastecard.PASTE_CARD_KEY = nfpastcardkey;
nfpastecard.PLANTNAME = WORKCENTER_CODE.ToString();
nfpastecard.PASTECARDNO = "";
nfpastecard.PRODUCTIONNAME = pFisType;
nfpastecard.PASTECARDDATE = DateTime.Now.ToString();
nfpastecard.OPERATOR = UserBuffer.UserCode;
nfpastecard.CREATETIME = DateTime.Now.ToString();
}
EPasteDetailsCard pastdetail = new EPasteDetailsCard();
pastdetail.PASTEDETAILED_CARD_KEY = Guid.NewGuid().ToString();
pastdetail.FIS_KEY = strFiskey;
pastdetail.PASTE_CARD_KEY = nfpastcardkey;
pastdetail.SANBARCODE = txtCode.Text.ToString();
pastdetail.SCANDATE = DateTime.Now.ToString();
pastdetail.PRODNO = strprodno;
pastdetail.CARSETDESC_CN = strcarsetdesc_cn;
pastdetail.VIN = strvin;
pastdetail.VWSEQ = strvwseq;
pastdetail.CP5A = strcp5a;
pastdetail.DGVROWINDEX = dgvrowindex;
pastdetail.LINENO = strlineno;
nfpastecard.DetailsCardlist.Add(pastdetail);
nflist.Add(pastdetail);
dgvNF.DataMember = null;
dgvNF.DataSource = nflist;
strprodno = "";
nfindex++;
int setdefaultSum = Convert.ToInt32(QMAPP.WinForm.Common.LocalSetting.Settings["ShowDataCount", ""]);
if (nfindex == setdefaultSum)
{
EFailLog log = new EFailLog();
log.TID = Guid.NewGuid().ToString();
log.FCT_DATE = DateTime.Now;
log.FCT_NO = nfpastecard.PASTE_CARD_KEY;
log.FCT_OPER = UserBuffer.UserCode;
log.FCT_OPERTYPE = 1;
log.FCT_REASON = "NF贴车单自动打印操作";
//nfpastecard.PLANTNAME = WORKCENTER_CODE.ToString();
nfpastecard.OPERATOR = ClientContext.LoginInfo.UserName.ToString();
nfpastecard.PASTECARDNO = CreatePastecardNo(WORKCENTER_CODE.ToString());
nfpastecard.DetailsCardlist = nflist;
nfpastecard.FailLog = log;
nfindex = 0;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
int rowindex = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_AddPasteCard.ToString(), nfpastecard);
//BllFisOrder bllFisOrder = new BllFisOrder();
//int rowindex = bllFisOrder.AddPasteCard(nfpastecard);
PrintPasteCard prin = new PrintPasteCard();
string strprodtype = "";
//#region "隐藏了rb_hx 和rb_dx,全部根据pFisType判断,生产线的设置使用按钮进行设置"
if (pFisType == "01")
{
strprodtype = "( 混 )";
}
else if (pFisType == "02")
{
strprodtype = "( 单 )";
}
prin.Print(rowindex, nfpastecard, strprodtype);
ClearContainer();
GetInitData();
DGVRemoveRow(nflist, ref ncslist);
dgvNF.DataSource = new List();
nfpastecard = null;
nflist = null;
nfindex = 0;
dgvrowindex = 0;
computenfncs();
GetLastPastCard();
SetPastNOConfirm(0);
//2016-01-07 增加1号位校验 - 清空1号位
this.placeFirstPosition = "";
this.placeFirstPositionTime = DateTime.MinValue;
//2016-01-07 增加1号位校验
}
#endregion
}
#endregion
#region 计算NF,NCS数量
///
/// 计算NF,NCS数量
///
private void computenfncs()
{
//BindingSource bin = (BindingSource)dgvMATChange.DataSource;
//DataTable tbl = (DataTable)dgvMATChange.DataSource;
//DataRow[] nfrows = tbl.Select("LINENO='NF'");
//DataRow[] ncsrows = tbl.Select("LINENO='NCS'");
//DataRow[] ncsnfrows = tbl.Select("LINENO='NCSNF'");
//DataRow[] ncsgprows = tbl.Select("LINENO='NCSGP'");
//lblCount.Text = "NCS: " + ncsrows.Length + " NF: " + nfrows.Length + " NCSNF: " + ncsnfrows.Length + " NCSGP: " + ncsgprows.Length;
DataTable tbl = (DataTable)dgvMATChange.DataSource;
DataRow[] nfrows = tbl.Select("LINENO='NCSNFPA'");
DataRow[] ncsrows = tbl.Select("LINENO='PA311'");
DataRow[] ncsnfrows = tbl.Select("LINENO='A SUV'");
//DataRow[] ncsgprows = tbl.Select("LINENO='NCSGP'");
lblCount.Text = "NCSNFPA: " + nfrows.Length + " " + " PA311: " + ncsrows.Length + " " + " A SUV: " + ncsnfrows.Length;
}
#endregion
#region NF仪表板校验
///
/// NF仪表板校验
///
///
///
private bool CheckRule(string scanbarcode)
{
try
{
int temprowindex = 0;
int nflistCount = 0;
if (nflist != null && nflist.Count > 0)
{
nflistCount = nflist.Count;
}
int ncslistCount = 0;
if (ncslist != null && ncslist.Count > 0)
{
ncslistCount = ncslist.Count;
}
temprowindex = nflistCount + ncslistCount;
strprodno = dgvMATChange.Rows[temprowindex].Cells["PRODNO"].Value.ToString();
DataTable tbl = GetSparepartsinfo(scanbarcode);
if (tbl.Rows.Count > 0)
{
barcodeidentification = tbl.Rows[0]["BARCODEIDENTIFICATION"].ToString();
}
else
{
Alert("条码错误:无法根据条码识别零件号");
}
if (tbl.Rows.Count > 0)
{
//零件号
string strkhprodno = tbl.Rows[0]["CUSTOMERSPAREPARTS"].ToString();
string templineno = tbl.Rows[0]["CODENAME"].ToString();
if (strkhprodno.ToUpper().Replace(" ", "").Contains(strprodno.ToUpper().Replace(" ", "")))
{
DGVCurrontRow(strprodno, "NF", temprowindex);
return true;
}
else
{
Alert("条码错误:扫描的条码与FIS中的零件不符。");
return false;
}
}
else
{
Alert("条码错误:无法根据条码识别零件号。");
return false;
}
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable dtother = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetOhterCode.ToString(), scanbarcode);
DataTable dtrule = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetRule.ToString(), strprodno, scanbarcode.Substring(0, 3));
if (dtother.Rows.Count <= 0)
{
Alert("条码匹配错误:该下护板在上工位未进行绑定扫描!");
ArragetxtCode();
return false;
}
int sended = Convert.ToInt32(dtother.Rows[0]["SENDED"]);
if (sended == 1)
{
Alert("该下护板已经发货!");
ArragetxtCode();
return false;
}
if (dtrule.Rows.Count <= 0)
{
Alert("条码匹配错误:车型校验规则不存在。");
ArragetxtCode();
return false;
}
List barCodeList = new List();
string[] listother = dtother.Rows[0][0].ToString().Split(' ');
for (int i = 0; i < listother.Length; i++)
{
if (string.IsNullOrEmpty(listother[i]) == false)
{
barCodeList.Add(listother[i]);
}
}
barCodeList.Add(scanbarcode.Substring(0, 3));
//获取所有的规则条码
List ruleList = new List();
foreach (DataRow dr in dtrule.Rows)
{
ruleList.Add(dr["OTHERCODE"].ToString());
}
bool checkResult = true;
string errorBarcode = "";
foreach (string str in barCodeList)
{
if (ruleList.Contains(str) == false)
{
checkResult = false;
errorBarcode = str;
break;
}
}
if (checkResult == false)
{
Alert(errorBarcode + "与零件号" + strprodno + "的类型不匹配!");
ArragetxtCode();
return false;
}
DGVCurrontRow(strprodno, "NF", temprowindex);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
private void Alert(string message, bool openConfirmDialog = true)
{
PlaySound.PlaySounds.Play(@errorSoundPath);
lberror.Text = message;
if (openConfirmDialog
&& string.Equals(QMAPP.WinForm.Common.LocalSetting.Settings["AlertConfirmEnable", "0"], "1"))
{
Common.frmAlertConfirm alertconfirm = new Common.frmAlertConfirm(message, "CD85010800");
alertconfirm.StartPosition = FormStartPosition.CenterScreen;
alertconfirm.ShowDialog();
}
}
#endregion
#region 与FIS数据匹配
///
/// 与FIS数据匹配
///
private void FISDataCompare(string Code,Product product)
{
int temprowindex = 0;
int nflistCount = 0;
if (nflist != null && nflist.Count > 0)
{
nflistCount = nflist.Count;
}
int ncslistCount = 0;
if (ncslist != null && ncslist.Count > 0)
{
ncslistCount = ncslist.Count;
}
temprowindex = nflistCount + ncslistCount;
strprodno = dgvMATChange.Rows[temprowindex].Cells["PRODNO"].Value.ToString();
string pstrprodcno = strprodno;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
//2.判断成品
//Product statusRuslt = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetProductByAssembleCode.ToString(), Code);
if (product.MATERIAL_CODE != pstrprodcno)
{
SetContainerItem(nfindex, false);
Alert("扫描的成品零件号与FIS零件号不符!");
txtCode.Text = "";
txtCode.Focus();
return;
}
DataTable tblbarcode = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_ExistBarcode.ToString(), BarcodeTime, Code);
if (tblbarcode.Rows.Count == 0)
{
for (; temprowindex < dgvMATChange.Rows.Count; temprowindex++)
{
//主键
strFiskey = dgvMATChange.Rows[temprowindex].Cells["PID"].Value.ToString();
//大众顺序号
strvwseq = dgvMATChange.Rows[temprowindex].Cells["REQUESTID"].Value.ToString();
//零件号
strprodno = dgvMATChange.Rows[temprowindex].Cells["PRODNO"].Value.ToString();
//总成描述
strcarsetdesc_cn = dgvMATChange.Rows[temprowindex].Cells["CARSETDESC_CN"].Value.ToString();
//上线时间
strcp5a = dgvMATChange.Rows[temprowindex].Cells["CP5A"].Value.ToString();
//车型
strlineno = dgvMATChange.Rows[temprowindex].Cells["LINENO"].Value.ToString();
//车身号
strkin = dgvMATChange.Rows[temprowindex].Cells["KIN"].Value.ToString();
//底盘号
strvin = dgvMATChange.Rows[temprowindex].Cells["VIN"].Value.ToString();
//工作中心
WORKCENTER_CODE = dgvMATChange.Rows[temprowindex].Cells[dgvWorkcenter.Name].Value.ToString();
//扫描状态
strscanstat = dgvMATChange.Rows[temprowindex].Cells[clscanstate.Name].Value.ToString();
dgvrowindex = temprowindex;
if (strscanstat == "0")
{
strprodno = strprodno.ToString().Trim();
pstrprodcno = pstrprodcno.ToString().Trim();
//if (strprodno == pstrprodcno)
if (pstrprodcno.ToUpper().Replace(".", "").Contains(strprodno.ToUpper().Replace(".", "")))
{
this.dgvMATChange.Rows[temprowindex].DefaultCellStyle.BackColor = Color.White;
dgvMATChange.Rows[temprowindex].Cells[clscanstate.Name].Value = "1";
break;
}
else
{
SetContainerItem(nfindex, false);
Alert("条码错误:条码的零件号与FIS队列零件号不符合。");
break;
}
}
else
{
SetContainerItem(nfindex, false);
Alert("条码错误:条码已扫描或车型不符合。");
break;
}
}
}
else
{
Alert("扫描条码重复,请重新扫描。");
}
SetContainerItem(nfindex, true);
CreateNFPaste(Code,product);
if (dgvMATChange.RowCount > 0)
{
dgvMATChange.FirstDisplayedScrollingRowIndex = nfindex - nfindex % 4;
}
lberror.Text = "";
}
#endregion
#region 扫描条码时触发事件
/////
///// 扫描条码时触发事件
/////
/////
///// 崔法宝20170906
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
string inputstring = "";
try
{
if (e.KeyCode != Keys.Enter)
{
return;
}
inputstring = txtCode.Text.ToUpper();
this.lberror.Text = null;
#region 使用登录码快速切换用户
//使用登录码快速切换用户
if (System.Text.RegularExpressions.Regex.IsMatch(txtCode.Text, "^<\\w+::\\w+>$"))
{
var ret = ClientContext.CodeLogin(txtCode.Text);
if (string.Equals(ret, "登录成功!"))
{
ClientContext.SetUserAuth(this);
}
lberror.Text = ret;
ArragetxtCode();
return;
}
if (System.Text.RegularExpressions.Regex.IsMatch(txtCode.Text.ToUpper(), "^>CMD:\\w+$"))//扫描输入为指令码
{
ExcuteCMDCode();
txtCode.Text = "";
txtCode.Focus();
return;
}
_CMDConfirm = "";
#endregion
#region 原校验
string PastNOConfirmEnable = QMAPP.WinForm.Common.LocalSetting.Settings["PastNOConfirmEnable", "0"];
if (System.Text.RegularExpressions.Regex.IsMatch(txtCode.Text.ToUpper(), "^" + WORKCENTER_CODE + "\\w+$"))//扫描输入为贴车单号
{
if (string.Equals("1", PastNOConfirmEnable)) //贴车单确认功能开启
{
GetLastPastCard();
if (string.Equals(txtCode.Text.ToUpper(), lblLastPastNO.Text.ToUpper()))
{
lberror.Text = "前车贴车单号确认完成!";
SetPastNOConfirm(1);
ArragetxtCode();
return;
}
else
{
lberror.Text = "前车贴车单号确认失败!";
SetPastNOConfirm(2);
ArragetxtCode();
return;
}
}
else
{
lberror.Text = "贴车单号确认功能未开启,无需扫描贴车单号!";
SetPastNOConfirm(0);
ArragetxtCode();
return;
}
}
if (string.Equals("1", PastNOConfirmEnable)) //贴车单确认功能开启
{
if (!pbPastNoConfirmed.Enabled)
{
Alert("请先扫描前车贴车单号进行贴车单确认!");
ArragetxtCode();
return;
}
}
#endregion
#region fis区是否有记录
if (dgvMATChange.Rows.Count == 0)
{
Alert("FIS区域没有数据,请获取数据后再扫描!");
ArragetxtCode();
return;
}
#endregion
#region 一号位校验是否扫描校验
//2016-01-07 增加1号位校验
if (this.dgvNF.Rows.Count == 0) //第一个码必须先扫描1号位
{
string placeCode = txtCode.Text.Trim();
if (placeCode.Equals(System.Configuration.ConfigurationManager.AppSettings["PlaceFirstPositionCode"].ToString()))
{
this.placeFirstPosition = placeCode;
this.placeFirstPositionTime = DateTime.Now;
this.txtCode.Text = "";
//处理条码扫描文本框
ArragetxtCode();
return;
}
}
#endregion
#region 一号位时间校验
if (this.dgvNF.Rows.Count == 0 && !string.IsNullOrEmpty(this.placeFirstPosition))//超时判断
{
double timeOutSecond = 0;
//获取超时时间设定值
//DataTable dtTimeOut = new BllTimeOutSet().GetList();
DataTable dtTimeOut = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetTimeOutSet.ToString());
if (dtTimeOut.Rows.Count > 0)
{
timeOutSecond = Convert.ToDouble(dtTimeOut.Rows[0]["TIMEOUT_VALUE"].ToString());
}
//获取超时时间设定值
if (timeOutSecond > 0)
{
TimeSpan ts = DateTime.Now - this.placeFirstPositionTime;
if (ts.TotalSeconds > timeOutSecond)
{
this.placeFirstPosition = "";
this.txtCode.Text = "";
this.placeFirstPositionTime = DateTime.MinValue;
lberror.Text = "扫描本体件超时,请重新扫描1号位!";
//处理条码扫描文本框
ArragetxtCode();
return;
}
}
}
#endregion
#region 请先扫描1号位
if (string.IsNullOrEmpty(this.placeFirstPosition))
{
this.placeFirstPosition = "";
this.txtCode.Text = "";
lberror.Text = "请先扫描1号位!";
return;
}
#endregion
#region FIS区域数据全部扫描完成,请获取数据后再扫描
if (dgvNF.Rows.Count >= dgvMATChange.Rows.Count)
{
Alert("FIS区域数据全部扫描完成,请获取数据后再扫描!");
ArragetxtCode();
return;
}
#endregion
#region 长度校验
//string pp = System.Configuration.ConfigurationManager.AppSettings["UpperBarcodeLen"].ToString();
Int32 ul = int.Parse(System.Configuration.ConfigurationManager.AppSettings["UpperBarcodeLen"].ToString());
Int32 ll = int.Parse(System.Configuration.ConfigurationManager.AppSettings["LowerBarcodeLen"].ToString());
if (txtCode.Text.Length <= ll || txtCode.Text.Length >= ul)
{
Alert("条码错误:条码长度不符合要求(" + ll.ToString() + "-" + ul.ToString() + ")。");
ArragetxtCode();
return;
}
#endregion
#region 校验位计算
if (txtCode.Text.StartsWith("052"))
{
string codepart = txtCode.Text.Substring(0, txtCode.Text.Length - 1).ToUpper();
string checksum = txtCode.Text.Substring(txtCode.Text.Length-1,1).ToUpper();
if (!string.Equals(checksum, CalculateChecksum(codepart)))
{
Alert("条码错误:总成条码校验位错误!");
ArragetxtCode();
return;
}
}
#endregion
#region 判断扫描条形码是否存在 获取扫描条码
string Code = txtCode.Text.Trim().ToUpper();
#region 校验是否有重复的扫过的条码
if (dgvNF.Rows.Count > 0)
{
for (var i = 0; i < dgvNF.Rows.Count; i++)
{
if (dgvNF.Rows[i].Cells[CODE_NF.Name].Value.ToString().ToUpper() == Code)
{
SetContainerItem(nfindex, false);
Alert("该条码已扫描!");
txtCode.Text = "";
txtCode.Focus();
return;
}
}
}
#endregion
//规则
bool signal = false;
string outSourceProduct = "";
foreach (var rule in _barcodeRules)
{
if (System.Text.RegularExpressions.Regex.IsMatch(Code, rule.REGEX))
{
signal = true;
ProMaterial = rule.MATERIAL_CODE;
outSourceProduct = rule.DATA_TYPE;
if (rule.REMARK == "NFPD")
{
Alert("该产品为NF产品,请扫描下护板条码。");
ArragetxtCode();
return;
}
}
}
if (signal == false)
{
//规则表里没有则去数据库里查找是否存在(VW371 bc316产品)
if (System.Text.RegularExpressions.Regex.IsMatch(Code, "^DP\\w+(-\\w+)?-DF[LR][FR]\\w+$"))//扫描输入为门板计划标签
{
//从计划标签中截取产品码
Code = Code.Substring(Code.LastIndexOf('-') + 1);
}
#region 去数据库查询相关产品信息,外来零件忽略此步骤
Product product = null;
if (System.Text.RegularExpressions.Regex.IsMatch(Code, "^BCP"))
{
//BCP开头的是BC316-MP4的包覆件
}
else
{
product = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetProductByAssembleCode.ToString(), Code);
}
if (product != null)
{
Code = string.IsNullOrEmpty(product.MAINCODE) ? product.PRODUCTCODE : product.MAINCODE;
}
else
{
product = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetProductByAssembleCodeMP4.ToString(), Code);
if (product != null)
{
Code = string.IsNullOrEmpty(product.MAINCODE) ? product.PRODUCTCODE : product.MAINCODE;
}
else
{
Alert("未查询到该产品零件信息:" + Code + "。");
//清理文本框
ArragetxtCode();
return;
}
}
#region 校验是否有重复的扫过的条码
//------------------校验是否有重复的扫过的条码------
if (dgvNF.Rows.Count > 0 && product != null)
{
for (var i = 0; i < dgvNF.Rows.Count; i++)
{
if (dgvNF.Rows[i].Cells[CODE_NF.Name].Value.ToString() == Code)
{
SetContainerItem(nfindex, false);
Alert("该条码已扫描!");
txtCode.Text = "";
txtCode.Focus();
return;
}
}
}
//-------------------------End-----------
#endregion
//int ExitResult = agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_GetExitsCode.ToString(), Code);
if ((product == null || string.IsNullOrEmpty(product.PID)))
{
SetContainerItem(nfindex, false);
Alert("扫描的产品条码不存在,请重新扫描!");
txtCode.Text = "";
txtCode.Focus();
return;
}
//Object statusRuslt = agent.InvokeServiceFunction