123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- 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 UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicForm;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Make
- {
- public partial class Make_InfoCheck : Form
- {
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataHelper dh;
- LogStringBuilder sql;
- DataTable dt;
- DataTable info;
- string oErrorMessage = "";
- string omakeCode = "";
- string oMsid = "";
- public Make_InfoCheck()
- {
- InitializeComponent();
- }
- private void Make_LabelCheck_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- //聚焦SN号
- sncode.Focus();
- //打开界面提示用户:请输入SN
- OperateResult.AppendText(">>请输入SN\n", Color.Black);
- sql = new LogStringBuilder();
- dh = SystemInf.dh;
- StepCount.StepCode = User.CurrentStepCode;
- StepCount.Source = User.UserSourceCode;
- StepCount.LineCode = User.UserLineCode;
- StepCount.Dh = dh;
- StepCount.Start();
- }
- private void Make_LabelCheck_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void sncode_KeyDown(object sender, KeyEventArgs e)
- {
- //判断是enter事件
- if (e.KeyCode == Keys.Enter)
- {
- if (sncode.Text == "")
- {
- OperateResult.AppendText("<<输入不能为空\n", Color.Red);
- return;
- }
- if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out oErrorMessage))
- {
- //判断序列号下一工序(CHECKSTEPSNANDMACODE)
- if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sncode.Text, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
- {
- dt = (DataTable)dh.ExecuteSql("select psr_type from makeserial left join ProductSNRelation on ms_prodcode=psr_prodcode where ms_id='" + oMsid + "' order by psr_detno", "select");
- CheckItemDGV.DataSource = dt;
- string ErrMsg = "";
- Dictionary<string, string> dic;
- LogicHandler.GetMobileAllInfo(sncode.Text, out dic, out ErrMsg);
- bool AllMatched = true;
- for (int i = 0; i < CheckItemDGV.Rows.Count; i++)
- {
- foreach (var item in dic)
- {
- if (CheckItemDGV.Rows[i].Cells["psr_type"].Value.ToString() == item.Key)
- {
- CheckItemDGV.Rows[i].Cells["psr_systemvalue"].Value = item.Value;
- }
- }
- if (CheckItemDGV.Rows[i].Cells["psr_systemvalue"].Value == null)
- {
- CheckItemDGV.Rows[i].Cells["psr_systemvalue"].Value = "";
- }
- CheckItemDGV.Rows[i].Cells["psr_localvalue"].Value = BaseUtil.GetDataFromDevice(CheckItemDGV.Rows[i].Cells["psr_type"].Value.ToString());
- if (CheckItemDGV.Rows[i].Cells["psr_localvalue"].Value.ToString() != CheckItemDGV.Rows[i].Cells["psr_systemvalue"].Value.ToString())
- {
- AllMatched = false;
- }
- }
- if (AllMatched)
- {
- if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, sncode.Text, "标签核对", "OK", User.UserCode, out oErrorMessage))
- {
- //提示正确返回时传递的信息
- if (oErrorMessage.Contains("AFTERSUCCESS"))
- OperateResult.AppendText(">>" + oErrorMessage + "\n");
- //根据工单号查询makecraftdetail 表中的 mcd_okqty 计数,剩余数为ma_qty - nvl(mcd_inqty,0),刷新页面中工单信息的显示
- sql.Clear();
- sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,");
- sql.Append("ma_qty - nvl(mcd_okqty, 0) remain_qty from make left join makecraftdetail on ");
- sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.SetFormValue(Controls, dt);
- //将SN,时间,结果记录在页面
- //记录日志
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "标签核对", "参数核对成功", sncode.Text, "");
- //SN核对成功
- //>> 请输入SN
- OperateResult.AppendText("<<信息核对成功\n", Color.Green, sncode);
- OperateResult.AppendText(">>请输入SN\n", Color.Black);
- SetCheck set = new SetCheck("OK", Color.Green);
- BaseUtil.SetFormCenter(set);
- set.ShowDialog();
- }
- else
- {
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- }
- }
- else
- {
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- }
- else
- {
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- }
- }
- private void StepCount_Load(object sender, EventArgs e)
- {
- }
- private void CheckItemDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
- {
- //系统值和
- if (e.ColumnIndex >= 0)
- {
- if (CheckItemDGV.Columns[e.ColumnIndex].Name == "psr_systemvalue" || CheckItemDGV.Columns[e.ColumnIndex].Name == "psr_localvalue")
- {
- if (e.RowIndex >= 0)
- {
- if (CheckItemDGV.Rows[e.RowIndex].Cells["psr_systemvalue"].Value != null && (CheckItemDGV.Rows[e.RowIndex].Cells["psr_systemvalue"].Value.ToString() == CheckItemDGV.Rows[e.RowIndex].Cells["psr_localvalue"].Value.ToString()))
- {
- e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
- Rectangle border = e.CellBounds;
- border.Width -= 1;
- e.Graphics.DrawRectangle(Pens.Black, border);
- e.PaintContent(e.CellBounds);
- e.Handled = true;
- }
- else
- {
- e.Graphics.FillRectangle(Brushes.OrangeRed, e.CellBounds);
- Rectangle border = e.CellBounds;
- border.Width -= 1;
- e.Graphics.DrawRectangle(Pens.Black, border);
- e.PaintContent(e.CellBounds);
- e.Handled = true;
- }
- }
- }
- }
- }
- }
- }
|