using System;
using System.Data;
using System.Text;
using System.Threading;
using System.Drawing;
using System.Windows.Forms;
using UAS_MES_NEW.DataOperate;
using UAS_MES_NEW.Entity;
using UAS_MES_NEW.PublicMethod;
using System.Collections.Generic;
using UAS_MES_NEW.CustomControl.PowerControlForm;
namespace UAS_MES_NEW.Make
{
public partial class Make_SmtTestCollection : Form
{
DataHelper dh = null;
DataTable dt = null;
//当前工序的名称
string ErrorMessage = "";
//用于保存是否之前输入的ms_sncode
string LastSncode;
string oMakeCode = "";
string oMSID = "";
string ifrework = "";
string reworkstatus = "";
LogStringBuilder sql = new LogStringBuilder();
AutoSizeFormClass asc = new AutoSizeFormClass();
///
/// 已选的不良
///
List ChoosedList = new List();
///
/// 待选的不良
///
List WaitList = new List();
//当前工序对应版面
string st_table = "";
bool AutoCut = false;
bool LockSn = false;
DataTable Dbfind;
public Make_SmtTestCollection()
{
InitializeComponent();
}
private void TestCollection_Load(object sender, EventArgs e)
{
GoodProduct.Checked = true;
asc.controllInitializeSize(this);
ms_sncode.Focus();
//设置锁定工单
LockMakeCode.GetMakeCodeCtl(ma_code);
ma_code.SetLockCheckBox(LockMakeCode);
ControlLockTimer.Tick += ControlLockTimer_Tick;
ControlLockTimer.Interval = 100;
bd_soncode.FormName = Name;
bd_soncode.TableName = "(with temp1 as (select bd_fsoncode,bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode = '" + ma_prodcode.Text + "' connect by bo_mothercode = prior bd_soncode)select* from temp1)";
bd_soncode.SetValueField = new string[] { "bd_soncode" };
bd_soncode.SelectField = "bd_fsoncode # 首选料号,bd_soncode # 子件编号,pr_detail # 物料名称,pr_spec # 物料规格,bd_location # 位号";
bd_soncode.DBTitle = "不良零件";
bd_soncode.DbChange += Prodcode_DbChange;
//工单号放大镜配置
ma_code.TableName = "make left join product on ma_prodcode=pr_code";
ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,ma_qty # 工单数量,pr_detail # 产品名称,ma_softversion # 软件版本,ma_salecode # 销售单号,pr_sendchecktype # 产品送检方式";
ma_code.FormName = Name;
ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "ma_qty", "pr_detail", "ma_softversion", "ma_salecode", "nvl(pr_sendchecktype,'LineCode')pr_sendchecktype" };
ma_code.Condition = "ma_statuscode='STARTED' and ma_wccode = 'SMT'";
ma_code.DbChange += Ma_code_DbChange;
dh = SystemInf.dh;
StepCount.StepCode = User.CurrentStepCode;
StepCount.Source = User.UserSourceCode;
StepCount.LineCode = User.UserLineCode;
StepCount.Dh = dh;
StepCount.Start();
st_table = dh.getFieldDataByCondition("step", "st_table", "st_code = '" + User.CurrentStepCode + "'").ToString();
}
private void ControlLockTimer_Tick(object sender, EventArgs e)
{
this.Activate();
ms_sncode.Focus();
}
private void Ma_code_DbChange(object sender, EventArgs e)
{
Dbfind = ma_code.ReturnData;
BaseUtil.SetFormValue(this.Controls, Dbfind);
LoadCollectedNum();
LoadCheckQTY();
}
///
/// 将已选不良移动到待选不良
///
///
///
private void WaitReject_Click(object sender, EventArgs e)
{
Boolean HaveReject = false;
for (int i = MakeBadView.Rows.Count - 1; i >= 0; i--)
{
if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
{
if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
{
HaveReject = true;
break;
}
}
}
if (HaveReject)
{
string confirm = MessageBox.Show(this.ParentForm, "确认删除勾选的不良(已保存的不良代码也会删除)", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk).ToString();
if (confirm == "Yes")
{
for (int i = MakeBadView.Rows.Count - 1; i >= 0; i--)
{
if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
{
if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
{
if (MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() != "")
{
List SQLS = new List();
SQLS.Add("delete makebad where mb_id = '" + MakeBadView.Rows[i].Cells["mb_id"].Value.ToString() + "'");
SQLS.Add("delete makebadreason where mbr_id = '" + MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() + "'");
SQLS.Add("delete makebadrscom where mbc_mbrid = '" + MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() + "'");
SQLS.Add("delete makebadrspart where mbp_mbrid = '" + MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() + "'");
SQLS.Add("delete makebadrsloc where mbl_mbrid = '" + MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() + "'");
dh.ExecuteSQLTran(SQLS.ToArray());
}
MakeBadView.Rows.RemoveAt(i);
}
}
}
(MakeBadView.DataSource as DataTable).AcceptChanges();
}
}
HaveReject = false;
}
///
/// 将不良信息移动到已选不良
///
///
///
private void ChooseedReject_Click(object sender, EventArgs e)
{
if (ms_sncode.Text == "")
{
OperateResult.AppendText(">>序列号不能为空\n", Color.Red);
ms_sncode.Focus();
return;
}
LoadChoosedBadListView();
DataTable choose = (MakeBadView.DataSource as DataTable);
List Chooseed = new List();
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
Chooseed.Add(MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString());
}
if (WaitChooseDGV.Rows.Count > 0)
{
for (int i = 0; i < WaitChooseDGV.Rows.Count; i++)
{
if (WaitChooseDGV.Rows[i].Cells["ChooseAll"].Value != null)
{
if ((Boolean)WaitChooseDGV.Rows[i].Cells["ChooseAll"].Value == true)
{
if (!Chooseed.Contains(WaitChooseDGV.Rows[i].Cells["bc_code"].Value.ToString()))
{
DataRow dr1 = choose.NewRow();
dr1["mb_badcode"] = WaitChooseDGV.Rows[i].Cells["bc_code"].Value.ToString();
dr1["mb_badname"] = WaitChooseDGV.Rows[i].Cells["bc_name"].Value.ToString();
dr1["mb_bgname"] = WaitChooseDGV.Rows[i].Cells["bg_name"].Value.ToString();
dr1["mb_bgcode"] = WaitChooseDGV.Rows[i].Cells["bg_code"].Value.ToString();
choose.Rows.Add(dr1);
}
else
{
OperateResult.AppendText(">>不良代码" + WaitChooseDGV.Rows[i].Cells["bc_code"].Value.ToString() + "已存在\n", Color.Red);
}
}
}
}
for (int i = 0; i < WaitChooseDGV.Rows.Count; i++)
{
WaitChooseDGV.Rows[i].Cells["ChooseAll"].Value = false;
}
}
else OperateResult.AppendText(">>请勾选不良明细\n", Color.Red);
}
private void CleanInfo_Click(object sender, EventArgs e)
{
OperateResult.Clear();
}
private void ms_code_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
BaseUtil.CleanDGVData(MakeBadView);
WaitList.Clear();
ChoosedList.Clear();
if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
{
//是否提示过工单切换框,检测前执行
bool NoteAlready = LogicHandler.CheckDiffMakeCodeBeforeStepCheck(ms_sncode.Text, ma_code.Text, NoteForChange.Checked, out oMakeCode, out ErrorMessage);
if (!NoteAlready)
{
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
return;
}
if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
{
//是否提示过工单切换框,检测前后执行
if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(ms_sncode.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
{
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
return;
}
if (ma_code.Text != oMakeCode && oMakeCode != null)
{
dt = (DataTable)dh.ExecuteSql("select ma_code,ma_prodcode,ma_softversion,ma_salecode,pr_detail,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype,ma_qty from make left join product on ma_prodcode=pr_code where ma_code='" + oMakeCode + "'", "select");
if (dt.Rows.Count > 0)
{
BaseUtil.SetFormValue(this.Controls, dt);
LockMakeCode.Checked = true;
}
}
dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
string status = dt.Rows[0]["ms_status"].ToString();
reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
string sncode = dt.Rows[0]["ms_sncode"].ToString();
if (sncode != ms_sncode.Text)
{
OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
return;
}
ifrework = dt.Rows[0]["ms_ifrework"].ToString();
if (GoodProduct.Checked)
{
if (ifrework != "0")
{
if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
{
OperateResult.AppendText(">>" + ms_sncode.Text + "序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
return;
}
}
else
{
if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
{
OperateResult.AppendText(">>" + ms_sncode.Text + "序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
return;
}
}
}
SetCollectResult();
}
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
}
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
}
}
///
/// 加载不良代码的ListView的信息
///
private void LoadBadCodeListView()
{
sql.Clear();
sql.Append("select bg_code,bg_name ,bc_code,bc_name,'' bc_remark from badgroupdetail ");
sql.Append("left join badgroup on bg_id=bgd_bgid left join badcode on bgd_badcode=bc_code where ");
sql.Append("bg_code='SMT' and bg_code is not null order by bgd_detno");
DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
BadInfSource.DataSource = dt;
BaseUtil.FillDgvWithDataTable(WaitChooseDGV, dt);
}
///
/// 加载已选不良的ListView
///
private void LoadChoosedBadListView()
{
sql.Clear();
sql.Append("select mb_id,mbr_id,mb_badcode,mb_badname,mbc_component,mb_bgcode,mb_bgname,WM_CONCAT(distinct mbp_part) mbp_part,WM_CONCAT(distinct mbl_loc) mbl_loc ");
sql.Append("from makebad left join makebadreason on mb_id = mbr_mbid left join makebadrscom on mbc_mbrid = mbr_id left join makebadrspart on MBP_MBRID =mbr_id left join makebadrsloc ");
sql.Append(" on mbl_mbrid = mbr_id where mb_sncode ='" + ms_sncode.Text + "'AND MB_MAKECODE = '" + ma_code.Text + "' AND MB_STEPCODE = '" + User.CurrentStepCode + "' group by mb_id,mbr_id,mb_sncode,mb_badcode,mb_badname,mbc_component,mb_bgcode,mb_bgname");
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
BaseUtil.FillDgvWithDataTable(MakeBadView, dt);
}
///
/// 设置良品或者不良品的采集结果
///
private void SetCollectResult()
{
string ErrorMessage = "";
//如果勾选的是不良品
if (Reject.Checked)
{
LoadBadCodeListView();
LoadChoosedBadListView();
OperateResult.AppendText(">>请采集不良代码\n", Color.Green);
//勾选了自动产生代码
if (AutoBadCode.Checked)
Save_Click(new object(), new EventArgs());
}
else if (GoodProduct.Checked)
{
//如果不是返修的
if (ifrework == "0")
{
dt = (DataTable)dh.ExecuteSql("select mb_id,bc_name,mbr_mbid from makebad left join makebadreason on mbr_mbid=mb_id left join badcode on mb_badcode=bc_code where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and mb_status=0", "select");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["mb_id"].ToString() != dt.Rows[i]["mbr_mbid"].ToString())
ErrorMessage += "【" + dt.Rows[i]["bc_name"].ToString() + "】";
}
//存在不良记录
if (ErrorMessage != "")
{
OperateResult.AppendText(">>序列号:" + ms_sncode.Text + " 已经判为不良品,不允许修改!\n", Color.Red);
return;
}
else
{
//良品信息采集
if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
{
//提示正确返回时传递的信息
if (ErrorMessage.Contains("AFTERSUCCESS"))
OperateResult.AppendText(">>" + ErrorMessage + "\n");
LastSncode = ms_sncode.Text;
OperateResult.AppendText(">>" + ms_sncode.Text + "良品采集成功\n", Color.Green, ms_sncode);
//记录操作日志
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
}
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
}
}
else
{
if (reworkstatus != "3")
{
if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "良品采集", "检测合格", User.UserCode, out ErrorMessage))
{
//提示正确返回时传递的信息
if (ErrorMessage.Contains("AFTERSUCCESS"))
OperateResult.AppendText(">>" + ErrorMessage + "\n");
LastSncode = ms_sncode.Text;
OperateResult.AppendText(">>" + ms_sncode.Text + "成功采集为良品\n", Color.Green, ms_sncode);
//记录操作日志
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集良品", "采集良品成功", LastSncode, ob_checkno.Text);
}
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
}
else
{
OperateResult.AppendText(">>返修的不良序列号必须先进行维修\n", Color.Red);
}
}
}
//加载页面信息
LoadCollectedNum();
LoadCheckQTY();
}
private void 测试采集_SizeChanged(object sender, EventArgs e)
{
asc.controlAutoSize(this);
}
private void LoadCollectedNum()
{
dt = (DataTable)dh.ExecuteSql("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty from make left join makecraftdetail on mcd_macode=ma_code where ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");
BaseUtil.SetFormValue(Controls, dt);
}
private void Save_Click(object sender, EventArgs e)
{
if (ms_sncode.Text == "")
{
OperateResult.AppendText(">>序列号不允许为空\n", Color.Red);
return;
}
if (GoodProduct.Checked)
ms_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
else if (Reject.Checked)
{
if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
{
//判断界面工单是否为空时的序列号是否自动归属工单
string oStatus = "";
if (!LogicHandler.GetMakeInfo(ms_sncode.Text, out oMakeCode, out oStatus, out ErrorMessage))
{
if (ma_code.Text == "")
{
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
return;
}
}
if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? oMakeCode : ma_code.Text, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
{
dt = (DataTable)dh.ExecuteSql("select ma_code,ma_prodcode,ma_softversion,pr_detail,ma_qty from make left join product on ma_prodcode=pr_code where ma_code='" + oMakeCode + "'", "select");
if (dt.Rows.Count > 0)
{
BaseUtil.SetFormValue(this.Controls, dt);
LockMakeCode.Checked = true;
}
}
else
{
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
return;
}
}
else
{
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
return;
}
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "" || MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
{
OperateResult.AppendText(">>不良位置与不良零件均不可为空\n", Color.Red);
return;
}
}
List bccode = new List();
List bcremark = new List();
List bgcode = new List();
List bgname = new List();
List bcname = new List();
bccode.Clear();
bcremark.Clear();
bgcode.Clear();
bgname.Clear();
bcname.Clear();
if (MakeBadView.Rows.Count == 0)
{
OperateResult.AppendText(">>不良品必须选择不良原因和不良代码!\n", Color.Red);
return;
}
else
{
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
if (MakeBadView.Rows[i].Cells["mb_id"].Value.ToString() == "")
{
//获取不良代码组
bgcode.Add(MakeBadView.Rows[i].Cells["mb_bgcode"].Value.ToString());
//获取不良代码组名称
bgname.Add(MakeBadView.Rows[i].Cells["mb_bgname"].Value.ToString());
//获取所有的不良代码
bccode.Add(MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString());
//获取不良名称
bcname.Add(MakeBadView.Rows[i].Cells["mb_badname"].Value.ToString());
//获取所有的不良备注
bcremark.Add(bc_remark.Text);
}
}
}
//如果之前是良品的
dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_checkno" }, "ms_id='" + oMSID + "' and ms_stepcode='" + User.CurrentStepCode + "'");
if (dt.Rows.Count > 0)
{
string status = dt.Rows[0]["ms_status"].ToString();
if (status == "1" || status == "2")
{
dh.UpdateByCondition("steppassed", "sp_result='不良品',sp_ifng=-1,sp_ymd=to_char(sysdate,'yyyymmdd'),sp_hm=to_char(sysdate,'hh24miss')", "sp_id=(select max(sp_id) from steppassed where sp_sncode='" + ms_sncode.Text + "')");
dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty-1", "mcd_macode='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_badtimes=nvl(ms_badtimes,0)+1", "ms_id='" + oMSID + "'");
LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "良品采集成不良", "测试不良", User.UserCode);
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "测试不良", "良品采集成不良", ms_sncode.Text, ob_checkno.Text);
}
string checkno = dt.Rows[0]["ms_checkno"].ToString();
//存在抽检批次更新为空
if (checkno != "")
dh.UpdateByCondition("makeserial", "ms_checkno=''", "ms_id='" + oMSID + "'");
}
else
{
LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "采集成不良", "测试不良", User.UserCode);
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "采集成不良", "测试不良", ms_sncode.Text, ob_checkno.Text);
}
//不良信息采集,mb_status<>0的是之前维修保存的,不能删除
dh.ExecuteSql("delete from makebad where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and nvl(mb_status,0)=0", "delete");
if (LogicHandler.SetTestNGDetail(ms_sncode.Text, ma_code.Text, User.UserCode, User.UserSourceCode, "检查未通过", bgcode.ToArray(), bccode.ToArray(), bgname.ToArray(), bcname.ToArray(), bcremark.ToArray(), out ErrorMessage))
{
OperateResult.AppendText(">>" + ms_sncode.Text + "成功采集为不良\n", Color.Green);
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
//获取当前序列号对应的不良代码编号
string makebadid = dh.getFieldDataByCondition("makebad", "mb_id", "mb_sncode = '" + ms_sncode.Text + "' and mb_makecode = '" + ma_code.Text + "' and mb_badcode = '" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "'").ToString();
//为空插入不良代码表与不良原因表
if (MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString() == "")
{
DataTable temp = dh.getFieldsDatasByCondition(" BADGROUPDETAIL left join badgroup on bgd_bgid = bg_id", new string[] { "bgd_brgcode", "bgd_dutycode", "bgd_solutioncode", "bgd_brcode" }, "bgd_badcode= '" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "' and bg_code = '" + MakeBadView.Rows[i].Cells["mb_bgcode"].Value.ToString() + "'");
string bgd_brgcode = temp.Rows[0]["bgd_brgcode"].ToString();
string bgd_brcode = temp.Rows[0]["bgd_brcode"].ToString();
string bgd_dutycode = temp.Rows[0]["bgd_dutycode"].ToString();
string bgd_solutioncode = temp.Rows[0]["bgd_solutioncode"].ToString();
string mbr_id = dh.GetSEQ("makebadreason_seq");
string bgd_brgname = dh.getFieldDataByCondition("QUA_NGReasonGroup", "nrg_name", "nrg_code = '" + bgd_brgcode + "'").ToString();
string bgd_brname = dh.getFieldDataByCondition("QUA_NGReason", "nr_name", "nr_code = '" + bgd_brcode + "'").ToString();
string bgd_dutyname = dh.getFieldDataByCondition("NGDuty", "nd_name", "nd_code = '" + bgd_dutycode + "'").ToString();
string bgd_solutionname = dh.getFieldDataByCondition("solution", "so_name", "so_code = '" + bgd_solutioncode + "'").ToString();
sql.Clear();
sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
sql.Append("mbr_inman,mbr_brname,mbr_solutionname,mbr_badname,mbr_brgname,mbr_dutyname) select '" + makebadid + "','" + mbr_id + "','" + bgd_brcode + "',");
sql.Append("'" + bgd_solutioncode + "','" + bgd_dutycode + "','" + bgd_brgcode + "','" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "',");
sql.Append("'" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "','" + bgd_brname + "','" + bgd_solutionname + "','" + MakeBadView.Rows[i].Cells["mb_badname"].Value.ToString() + "','" + bgd_brgname + "','" + bgd_dutyname + "' from dual");
dh.ExecuteSql(sql.GetString(), "insert");
if (MakeBadView.Rows[i].Cells["mbc_component"].Value.ToString() != "")
{
sql.Clear();
sql.Append("insert into makebadrscom (mbc_id,mbc_mbrid,mbc_component,mbc_badcode,");
sql.Append("mbc_brcode,mbc_sncode,mbc_makecode,mbc_indate,mbc_inman ) values ");
sql.Append("(makebadrscom_seq.nextval,'" + mbr_id + "' ,'" + MakeBadView.Rows[i].Cells["mbc_component"].Value.ToString() + "',");
sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "')");
dh.ExecuteSql(sql.GetString(), "insert");
}
string[] mbp_part = MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Split(',');
string[] mbl_loc = MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Split(',');
sql.Clear();
sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
sql.Append(",:mbl_loc,'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
sql.Append("sysdate,'" + User.UserCode + "' from dual");
dh.BatchInsert(sql.GetString(), new string[] { "mbl_loc" }, mbl_loc);
//sql.Clear();
//sql.Append("with temp1 as (select bd_soncode,bd_location from bomdetail,bom where bo_id=bd_bomid ");
//sql.Append(" start with bo_mothercode='" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode) ");
//sql.Append("select bd_soncode from temp1 where instr(','||bd_location||',','," + MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().ToUpper() + ",')>0");
//dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
//if (dt.Rows.Count > 0)
//{
// for (int j = 0; j < dt.Rows.Count; i++)
// {
// sql.Clear();
// sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
// sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
// sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",'" + dt.Rows[0][j].ToString() + "',");
// sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
// sql.Append("sysdate,'" + User.UserCode + "' from dual");
// dh.ExecuteSql(sql.GetString(), "insert");
// }
//}
sql.Clear();
sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:mbp_part,");
sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
sql.Append("sysdate,'" + User.UserCode + "' from dual");
dh.BatchInsert(sql.GetString(), new string[] { "mbp_part" }, mbp_part);
}
else
{
//已保存过不良信息的序列号
DataTable temp = dh.getFieldsDatasByCondition(" BADGROUPDETAIL left join badgroup on bgd_bgid = bg_id", new string[] { "bgd_brgcode", "bgd_dutycode", "bgd_solutioncode", "bgd_brcode" }, "bgd_badcode= '" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "' and bg_code = '" + MakeBadView.Rows[i].Cells["mb_bgcode"].Value.ToString() + "'");
string bgd_brgcode = temp.Rows[0]["bgd_brgcode"].ToString();
string bgd_brcode = temp.Rows[0]["bgd_brcode"].ToString();
string bgd_dutycode = temp.Rows[0]["bgd_dutycode"].ToString();
string bgd_solutioncode = temp.Rows[0]["bgd_solutioncode"].ToString();
string mbr_id = MakeBadView.Rows[i].Cells["mbr_id"].Value.ToString();
string bgd_brgname = dh.getFieldDataByCondition("QUA_NGReasonGroup", "nrg_name", "nrg_code = '" + bgd_brgcode + "'").ToString();
string bgd_brname = dh.getFieldDataByCondition("QUA_NGReason", "nr_name", "nr_code = '" + bgd_brcode + "'").ToString();
string bgd_dutyname = dh.getFieldDataByCondition("NGDuty", "nd_name", "nd_code = '" + bgd_dutycode + "'").ToString();
string bgd_solutionname = dh.getFieldDataByCondition("solution", "so_name", "so_code = '" + bgd_solutioncode + "'").ToString();
//删除不良组件,不良位置等信息重新插入
dh.ExecuteSql("delete makebadrscom where mbc_mbrid = '" + mbr_id + "'", "delete");
dh.ExecuteSql("delete makebadrsloc where mbl_mbrid = '" + mbr_id + "'", "delete");
dh.ExecuteSql("delete makebadrspart where mbp_mbrid = '" + mbr_id + "'", "delete");
if (MakeBadView.Rows[i].Cells["mbc_component"].Value.ToString() != "")
{
sql.Clear();
sql.Append("insert into makebadrscom (mbc_id,mbc_mbrid,mbc_component,mbc_badcode,");
sql.Append("mbc_brcode,mbc_sncode,mbc_makecode,mbc_indate,mbc_inman ) values ");
sql.Append("(makebadrscom_seq.nextval,'" + mbr_id + "' ,'" + MakeBadView.Rows[i].Cells["mbc_component"].Value.ToString() + "',");
sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',sysdate,'" + User.UserCode + "')");
dh.ExecuteSql(sql.GetString(), "insert");
}
string[] mbp_part = MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Split(',');
string[] mbl_loc = MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Split(',');
sql.Clear();
sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
sql.Append(",:mbl_loc,'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
sql.Append("sysdate,'" + User.UserCode + "' from dual");
dh.BatchInsert(sql.GetString(), new string[] { "mbl_loc" }, mbl_loc);
sql.Clear();
sql.Append("with temp1 as (select bd_soncode,bd_location from bomdetail,bom where bo_id=bd_bomid ");
sql.Append(" start with bo_mothercode='" + ma_prodcode + "' connect by bo_mothercode= prior bd_soncode) ");
sql.Append("select bd_soncode from temp1 where instr(','||bd_location||',','," + MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().ToUpper() + ",')>0");
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Rows.Count; i++)
{
sql.Clear();
sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",'" + dt.Rows[0][j].ToString() + "',");
sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
sql.Append("sysdate,'" + User.UserCode + "' from dual");
dh.ExecuteSql(sql.GetString(), "insert");
}
}
sql.Clear();
sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:mbp_part,");
sql.Append("'" + MakeBadView.Rows[i].Cells["mb_badcode"].Value.ToString() + "','" + bgd_brcode + "','" + ms_sncode.Text + "','" + ma_code.Text + "',");
sql.Append("sysdate,'" + User.UserCode + "' from dual");
dh.BatchInsert(sql.GetString(), new string[] { "mbp_part" }, mbp_part);
}
}
dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_id", "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + ma_code.Text + "' ");
List SQLS = new List();
if (dt.Rows.Count > 0)
{
string ms_id = dt.Rows[0]["ms_id"].ToString();
string ms_ifrework = dt.Rows[0]["ms_ifrework"].ToString();
if (ms_ifrework == "0")
SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + User.CurrentStepCode + "',ms_status=1,ms_stepcode='SMT_REPAIR' where ms_id='" + ms_id + "'");
else
SQLS.Add("update makeserial set ms_checkno='', ms_nextstepcode ='" + User.CurrentStepCode + "',ms_reworkstatus=1,ms_stepcode='SMT_REPAIR' where ms_id='" + ms_id + "'");
}
SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "' and MB_STEPCODE = '" + User.CurrentStepCode + "'");
dh.ExecuteSQLTran(SQLS.ToArray());
LogicHandler.InsertMakeProcess(ms_sncode.Text, ma_code.Text, User.UserSourceCode, "快速维修采集", "完成快速维修", User.UserCode);
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "快速维修采集", "完成快速维修", ms_sncode.Text, ob_checkno.Text);
//保存不良原因
LastSncode = ms_sncode.Text;
//采集完不良,聚焦序列号
ms_sncode.Focus();
//记录操作日志
ms_sncode.Text = "";
//清除不良信息
BaseUtil.CleanDGVData(MakeBadView);
//加载页面信息
LoadCollectedNum();
LoadCheckQTY();
}
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
}
}
private void bc_code_KeyDown(object sender, KeyEventArgs e)
{
}
private void LoadCheckQTY()
{
sql.Clear();
string condition = "";
int nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
if (nowcheckqty + 1 == batchqty && AutoCut)
{
condition = "and ob_status='UNCHECK' and ob_checkno='" + ob_checkno.Text + "'";
}
else
{
condition = "and ob_status='ENTERING' ";
}
if (pr_sendchecktype.Text == "SaleCode")
{
condition += " and ob_salecode='" + ma_salecode.Text + "'";
}
sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
sql.Append("ob_linecode='" + User.UserLineCode + "' and ob_prodcode='" + ma_prodcode.Text + "' and ");
sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
if (dt.Rows.Count > 0)
{
ob_sendqty.Text = dh.getFieldDataByCondition("oqcbatch", "sum(ob_nowcheckqty)", "ob_makecode='" + ma_code.Text + "' and ob_status<>'ENTERING'").ToString();
ob_batchqty.Text = dt.Rows[0]["ob_batchqty"].ToString();
ob_nowcheckqty.Text = dt.Rows[0]["ob_nowcheckqty"].ToString();
ob_checkno.Text = dt.Rows[0]["ob_checkno"].ToString();
nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
if (nowcheckqty == batchqty)
{
ob_nowcheckqty.ForeColor = Color.Red;
OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
if (AutoCut)
{
OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.Green);
}
}
}
else
{
ob_batchqty.Text = "";
ob_nowcheckqty.Text = "";
ob_checkno.Text = "";
SendCheck.Enabled = false;
}
if (ob_batchqty.Text != "")
{
SendCheck.Enabled = true;
}
else
{
SendCheck.Enabled = false;
}
}
private void GoodProduct_CheckedChanged(object sender, EventArgs e)
{
if (GoodProduct.Checked)
{
WaitReject.Enabled = false;
ChooseedReject.Enabled = false;
Save.Visible = false;
}
else
{
WaitReject.Enabled = true;
ChooseedReject.Enabled = true;
Save.Visible = true;
}
if (ms_sncode.Text == "")
{
ms_sncode.Focus();
}
}
private void SendCheck_Click(object sender, EventArgs e)
{
sql.Clear();
sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
dh.ExecuteSql(sql.GetString(), "select");
ob_sendqty.Text = dh.getFieldDataByCondition("oqcbatch", "sum(ob_nowcheckqty)", "ob_makecode='" + ma_code.Text + "' and ob_status<>'ENTERING'").ToString();
ob_nowcheckqty.Text = "";
ob_batchqty.Text = "";
ob_nowcheckqty.ForeColor = Color.Black;
SendCheck.Enabled = false;
OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
ms_sncode.Focus();
LogicHandler.InsertMakeProcess(LastSncode, ma_code.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
//记录操作日志
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
ob_checkno.Text = "";
}
private void ob_checkno_TextChanged(object sender, EventArgs e)
{
if (ob_checkno.Text != "")
{
string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
if (Cut == "" || Cut == "0")
AutoCut = false;
else
AutoCut = true;
SendCheck.Enabled = true;
}
}
///
/// 工单变化修改数量
///
///
///
private void ma_code_UserControlTextChanged(object sender, EventArgs e)
{
if (ma_code.Text.Length > 4)
{
mcd_inqty.Text = "";
mcd_remainqty.Text = "";
ob_batchqty.Text = "";
ob_nowcheckqty.Text = "";
ob_sendqty.Text = "";
LoadCollectedNum();
LoadCheckQTY();
}
}
private void Make_TestCollection_FormClosing(object sender, FormClosingEventArgs e)
{
dh.Dispose();
}
private void ma_prodcode_TextChanged(object sender, EventArgs e)
{
bd_soncode.TableName = "(with temp1 as (select bd_fsoncode,bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode = '" + ma_prodcode.Text + "' connect by bo_mothercode = prior bd_soncode)select* from temp1)";
bd_soncode.Condition = "1=1";
}
private void Filter_UserControlTextChanged(object sender, EventArgs e)
{
try
{
DataRow[] dr = (BadInfSource.DataSource as DataTable).Select("bc_code like '%" + Filter.Text + "%' or bc_name like '%" + Filter.Text + "%'");
DataTable dt = (BadInfSource.DataSource as DataTable).Clone();
for (int i = 0; i < dr.Length; i++)
{
dt.Rows.Add(dr[i].ItemArray);
}
BaseUtil.FillDgvWithDataTable(WaitChooseDGV, dt);
}
catch (Exception)
{
}
}
private void Make_TestCollection_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.Q)
{
if (!LockSn)
{
ControlLockTimer.Start();
LockSn = true;
Lock_label.Visible = true;
}
else
{
ControlLockTimer.Stop();
LockSn = false;
Lock_label.Visible = false;
}
}
}
private void Reject_CheckedChanged(object sender, EventArgs e)
{
if (Reject.Checked)
{
LoadBadCodeListView();
}
}
private void Prodcode_DbChange(object sender, EventArgs e)
{
MakeBadView.EndEdit();
if (bd_soncode.Text != "")
{
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
{
if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
{
if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
{
MakeBadView.Rows[i].Cells["mbp_part"].Value = bd_soncode.Text;
}
else if (!MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(bd_soncode.Text))
MakeBadView.Rows[i].Cells["mbp_part"].Value += "," + bd_soncode.Text;
if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
{
MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
}
else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
}
}
}
}
else OperateResult.AppendText(">>不良零件不能为空\n", Color.Red);
}
private void bd_soncode_UserControlTextChanged(object sender, EventArgs e)
{
}
private void bd_soncode_Load(object sender, EventArgs e)
{
}
private void bad_loc_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (ma_prodcode.Text != "")
{
if (psl_location.Text != "")
{
DataTable dt = (DataTable)dh.ExecuteSql("select bd_soncode,bd_location,pr_spec,pr_detail from (with temp1 as (select bd_soncode,bd_location,pr_spec,pr_detail from bomdetail innner join bom on bo_id=bd_bomid left join product on bd_soncode = pr_code start with bo_mothercode= '" + ma_prodcode.Text + "' connect by bo_mothercode= prior bd_soncode)select * from temp1) where bd_location = '" + psl_location.Text.ToUpper() + "' OR bd_location LIKE '" + psl_location.Text.ToUpper() + ",%' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + "' OR bd_location LIKE '%," + psl_location.Text.ToUpper() + ",%'", "select");
if (dt.Rows.Count > 0)
{
if (dt.Rows.Count == 1)
{
string psl_prodcode = dt.Rows[0]["bd_soncode"].ToString();
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
{
if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
{
if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
{
MakeBadView.Rows[i].Cells["mbp_part"].Value = psl_prodcode;
}
else if (!MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
MakeBadView.Rows[i].Cells["mbp_part"].Value += "," + psl_prodcode;
if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
{
MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
}
else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
}
}
}
}
else if (dt.Rows.Count > 1)
{
Boolean ifgetloc = false;
for (int j = 0; j < dt.Rows.Count; j++)
{
string psl_prodcode = dt.Rows[j]["bd_soncode"].ToString();
for (int i = 0; i < MakeBadView.Rows.Count; i++)
{
if (MakeBadView.Rows[i].Cells["choose1"].Value != null)
{
if ((Boolean)MakeBadView.Rows[i].Cells["choose1"].Value == true)
{
if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString() == "")
{
OperateResult.AppendText(">>站位" + psl_location.Text + "有替代料,需要提前采集不良零件,第" + (i + 1) + "行不良零件为空\n", Color.Red);
}
else if (MakeBadView.Rows[i].Cells["mbp_part"].Value.ToString().Contains(psl_prodcode))
{
ifgetloc = true;
if (MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString() == "")
{
MakeBadView.Rows[i].Cells["mbl_loc"].Value = psl_location.Text.ToUpper();
}
else if (!MakeBadView.Rows[i].Cells["mbl_loc"].Value.ToString().Contains(psl_location.Text.ToUpper()))
MakeBadView.Rows[i].Cells["mbl_loc"].Value += "," + psl_location.Text.ToUpper();
}
}
}
}
}
if (!ifgetloc)
{
OperateResult.AppendText(">>站位" + psl_location.Text + "有替代料,需要提前采集不良零件,当前所选行均未采集对应不良零件\n", Color.Red);
}
}
}
else
{
OperateResult.AppendText(">>站位" + psl_location.Text.ToUpper() + "无对应物料\n", Color.Red, psl_location);
}
}
else
{
OperateResult.AppendText(">>不良位置录入不能为空\n", Color.Red);
}
}
else
{
OperateResult.AppendText(">>产品编号不能为空\n", Color.Red);
}
}
}
private void psl_location_Leave(object sender, EventArgs e)
{
psl_location.Text = "";
}
}
}