Browse Source

喷涂报工,是否允许返喷,调用wms接口 getdata 增加linecode

master
ruoxing.wang 2 weeks ago
parent
commit
42afa1ef4e
  1. 586
      InjectionPC/FrmMain2408.Designer.cs
  2. 146
      PaintingPC/FrmQuality.cs
  3. 15
      PaintingPC/Function.cs
  4. 54
      WebService/Function.cs

586
InjectionPC/FrmMain2408.Designer.cs

File diff suppressed because it is too large

146
PaintingPC/FrmQuality.cs

@ -28,6 +28,7 @@ namespace PaintingPC
private Dictionary<string, string> _lastJustDict = new Dictionary<string, string>(); private Dictionary<string, string> _lastJustDict = new Dictionary<string, string>();
private string _foreighColor = string.Empty; private string _foreighColor = string.Empty;
private string _lineCode = string.Empty; private string _lineCode = string.Empty;
private string _stationType = string.Empty;
/// <summary> /// <summary>
/// 从tb_ForeignColorMap表得到的零件号 /// 从tb_ForeignColorMap表得到的零件号
/// </summary> /// </summary>
@ -42,6 +43,7 @@ namespace PaintingPC
this.Size = new Size(1280, 1020); this.Size = new Size(1280, 1020);
this._isWmsQuality = isWmsQuality; this._isWmsQuality = isWmsQuality;
_lineCode = ConfigurationManager.AppSettings["LineCode"].ToString(); _lineCode = ConfigurationManager.AppSettings["LineCode"].ToString();
_stationType = ConfigurationManager.AppSettings["Position"].ToString();
string disableButtons = ConfigurationManager.AppSettings["DisableButtons"].ToString(); string disableButtons = ConfigurationManager.AppSettings["DisableButtons"].ToString();
if (!string.IsNullOrEmpty(disableButtons)) if (!string.IsNullOrEmpty(disableButtons))
{ {
@ -72,8 +74,12 @@ namespace PaintingPC
// if(_lineCode == "2") // if(_lineCode == "2")
// { // {
HidenColorSelect(true); HidenColorSelect(true);
if(_stationType == "下线一检")
{
btnAllowChangeColor.Visible = true; btnAllowChangeColor.Visible = true;
}
// } // }
} }
void HidenColorSelect(bool isHidden) void HidenColorSelect(bool isHidden)
@ -111,7 +117,7 @@ namespace PaintingPC
{ {
try try
{ {
string title = ConfigurationManager.AppSettings["Position"].ToString(); string title = _stationType;
string workClass = Function.GetWorkClass2(); string workClass = Function.GetWorkClass2();
string station = ConfigurationManager.AppSettings["Station"].ToString(); string station = ConfigurationManager.AppSettings["Station"].ToString();
@ -624,6 +630,16 @@ namespace PaintingPC
return; return;
} }
string bcode = txtBarCode.Text.Trim(); string bcode = txtBarCode.Text.Trim();
bool ispass = ScanCodeValidVerify(bcode);
if (ispass == false)
{
txtBarCode.SelectAll();
return;
}
//保存 //保存
string id = SaveInspect(state, colorName, partName, userName); string id = SaveInspect(state, colorName, partName, userName);
@ -819,7 +835,7 @@ namespace PaintingPC
InspectModel model1 = new InspectModel(); InspectModel model1 = new InspectModel();
model1.barcode = Function.UniteBarCodeToOne(txtBarCode.Text.Trim()); model1.barcode = Function.UniteBarCodeToOne(txtBarCode.Text.Trim());
model1.position = "下线质检"; model1.position = _stationType;
model1.stationNo = labStation.Text; model1.stationNo = labStation.Text;
model1.workClass = labWorkClass.Text; model1.workClass = labWorkClass.Text;
model1.inspectResult =inspectResult; model1.inspectResult =inspectResult;
@ -964,6 +980,12 @@ namespace PaintingPC
txtBarCode.Text = ""; txtBarCode.Text = "";
return; return;
} }
bool ispass = ScanCodeValidVerify(barcode);
if (ispass == false)
{
txtBarCode.SelectAll();
return;
}
#endregion #endregion
if (_isWmsQuality) if (_isWmsQuality)
@ -1026,6 +1048,11 @@ namespace PaintingPC
DataTable dt3 = Function.SearchDefectInfo(ConfigurationManager.AppSettings["Station"].Trim()); DataTable dt3 = Function.SearchDefectInfo(ConfigurationManager.AppSettings["Station"].Trim());
if (dt3 != null && dt3.Rows.Count > 0) if (dt3 != null && dt3.Rows.Count > 0)
{ {
DataRow newRow = dt3.NewRow();
newRow.ItemArray = dt3.Rows[0].ItemArray;
newRow["DefectName"] = "点修补";
dt3.Rows.InsertAt(newRow, 0);
drow = Convert.ToInt32(Math.Ceiling((double)dt3.Rows.Count / dcol)); drow = Convert.ToInt32(Math.Ceiling((double)dt3.Rows.Count / dcol));
Label[] dLb = new Label[7]; Label[] dLb = new Label[7];
string[] dstr = new string[dt3.Rows.Count]; string[] dstr = new string[dt3.Rows.Count];
@ -1042,6 +1069,19 @@ namespace PaintingPC
dLb[i] = new Label(); dLb[i] = new Label();
if ((i + dcol * j) < dstr.Length) if ((i + dcol * j) < dstr.Length)
{ {
//if(i==0 && j == 0)
//{
// Label lbl = new Label();
// lbl.Text = "点修补";
// lbl.Font = new Font(dLb[i].Font.FontFamily, 36, FontStyle.Bold);
// lbl.Size = new Size(170, 60);
// lbl.Location = new Point(20 + i * (dLb[i].Size.Width + 25), 5 + j * (dLb[i].Size.Height + 20));
// lbl.BorderStyle = BorderStyle.FixedSingle;
// lbl.BackColor = Color.Red;
// lbl.TextAlign = ContentAlignment.MiddleCenter;
// panel2.Controls.Add(lbl);
// continue;
//}
dLb[i].Text = dstr[i + dcol * j].ToString(); dLb[i].Text = dstr[i + dcol * j].ToString();
dLb[i].Font = new Font(dLb[i].Font.FontFamily, 24, FontStyle.Bold); dLb[i].Font = new Font(dLb[i].Font.FontFamily, 24, FontStyle.Bold);
dLb[i].Size = new Size(150, 50); dLb[i].Size = new Size(150, 50);
@ -1049,6 +1089,13 @@ namespace PaintingPC
dLb[i].BorderStyle = BorderStyle.FixedSingle; dLb[i].BorderStyle = BorderStyle.FixedSingle;
dLb[i].BackColor = Color.Transparent; dLb[i].BackColor = Color.Transparent;
dLb[i].TextAlign = ContentAlignment.MiddleCenter; dLb[i].TextAlign = ContentAlignment.MiddleCenter;
if (dLb[i].Text.Contains("点修补"))
{
dLb[i].Font = new Font(dLb[i].Font.FontFamily, 36, FontStyle.Bold);
dLb[i].Size = new Size(170, 60);
dLb[i].ForeColor = Color.Blue;
}
panel2.Controls.Add(dLb[i]); panel2.Controls.Add(dLb[i]);
dLb[i].Click += new EventHandler(dLbRoom_Click); dLb[i].Click += new EventHandler(dLbRoom_Click);
} }
@ -1287,6 +1334,99 @@ namespace PaintingPC
} }
} }
private bool ScanCodeValidVerify(string barcode)
{
string position = _stationType;
switch (position)
{
case "下线一检": return First(barcode);
case "下线二检": return Second(barcode);break;
case "点修补": return Third(barcode);
default:return true;
}
}
private bool First(string barcode)
{
DataTable dt = Function.GetLastResult(barcode);
if (dt.Rows.Count > 0)
{
ShowHint("扫描条码["+ barcode + "]已存在质检记录,无法在[下线一检]工位进行重新扫码." , false);
return false;
}
return true;
}
private bool Second(string barcode)
{
DataTable dt = Function.GetLastResult(barcode);
if (dt.Rows.Count == 0)
{
ShowHint("扫描条码[" + barcode + "]不存在[下线一检]记录,无法在[下线二检]工位进行扫码.", false);
return false;
}
DataRow dr = dt.Rows[0];
if (dr["reason"].ToString().Contains("点修补") && dr["inspectResult"].ToString().Contains("其它"))
{
ShowHint("扫描条码[" + barcode + "]上次质量判定为[点修补],无法进行二检扫码.", false);
return false;
}
if (dr["inspectResult"].ToString().Contains("报废"))
{
ShowHint("上次质量判定为[报废],无法进行二检扫码.", false);
return false;
}
return true;
}
/// <summary>
/// 点修补扫码校验
/// </summary>
/// <param name="barcode"></param>
/// <returns></returns>
private bool Third(string barcode)
{
string errorMsg = string.Empty;
bool isExsit = Function. GetPointRepairFrWms(barcode, ref errorMsg);
if(isExsit == false)
{
if (!string.IsNullOrEmpty(errorMsg))
{
ShowHint("在wms系统的查询返修出库记录时发生错误,错误原因:"+errorMsg, false);
return false;
}
else{
ShowHint("没有在wms系统的返修出库记录,无法进行点修补.", false);
return false;
}
}
DataTable dt = Function.GetLastResult(barcode);
if (dt.Rows.Count > 0)
{
if(dt.Rows[0]["reason"].ToString().Contains("点修补") && dt.Rows[0]["inspectResult"].ToString().Contains("其它"))
{
return true;
}
else
{
ShowHint("必须上次质量判定记录为点修补,类型为其它,才能在当前[点修补]工位扫码.", false);
return false;
}
}
else
{
ShowHint("没有初始质量判定记录,无法在[点修补]工位扫码.", false);
return false;
}
}
/// <summary> /// <summary>
/// 设置按钮不可用 /// 设置按钮不可用
/// </summary> /// </summary>

15
PaintingPC/Function.cs

@ -1981,7 +1981,22 @@ namespace PaintingPC
return res; return res;
} }
} }
public static bool GetPointRepairFrWms(string barcode, ref string errorMsg)
{
try
{
string wmsSql = $"select * from TM_BJBMPT_POINT_REPAIR where BarCode='{barcode}' and RepaitType='1'";
string wmsSqlConnString = ConfigurationManager.ConnectionStrings["WmsSqlConnString"].ToString();
DataTable pointRepairTable = SqlHelper.GetDataDateTable(wmsSqlConnString, CommandType.Text, wmsSql, null);
return pointRepairTable.Rows.Count > 0;
}
catch (Exception ex)
{
errorMsg = ex.Message;
return false;
}
}
public static string GetProductInfoFrWms(string barcode, ref string errorMsg) public static string GetProductInfoFrWms(string barcode, ref string errorMsg)
{ {
string res = ""; string res = "";

54
WebService/Function.cs

@ -1106,17 +1106,54 @@ namespace Webservice
/// </summary> /// </summary>
/// <param name="sjBarCode"></param> /// <param name="sjBarCode"></param>
/// <returns></returns> /// <returns></returns>
static bool GetWmsCompleteState(string sjBarCode,ref string wmsMsg) static bool GetWmsCompleteState(string sjBarCode,string workLine, ref string wmsMsg)
{ {
string jsonParam = " [{\"ServiceType\":\"GetMesData\",\"BarCode\":\""+sjBarCode+"\"}]";
string jsonParam = " [{\"ServiceType\":\"GetMesData\",\"BarCode\":\""+sjBarCode+ "\",\"WorkLine\":\"" + workLine + "\"}]";
//string jsonParam = " [{\"ServiceType\":\"GetMesData\",\"BarCode\":\""+sjBarCode+ "\"}]";
WebService.WebReference.JsonService webService = GetWebService(); WebService.WebReference.JsonService webService = GetWebService();
//true 可以操作, false 已经移库,不能操作 //true 可以操作, false 已经移库,不能操作
string rst = webService.GetData(jsonParam); string rst = webService.GetData(jsonParam);
if(!string.IsNullOrEmpty(rst) && rst.ToLower().Contains("true"))
//rst = "['',True ]";
//rst = "['提示描述',False ]";
//rst = "['',False ]";
//rst = "['唯一码[60000002672304231142]未报工!']";
if (!string.IsNullOrEmpty(rst) && rst.ToLower().Contains("true"))
{ {
wmsMsg = "";
return true; return true;
} }
wmsMsg = rst; else
{
string[] s = rst.Replace("[", "").Replace("]", "").Replace("'", "").Split(',');
if(s.Length ==2)//['',false]
{
if (string.IsNullOrEmpty(s[0]))
{
//刘宇让字符串为空,统一用 [该唯一码不在喷涂超市库位,请核对后操作]进行提示
wmsMsg = "WMS接口信息:该唯一码不在喷涂超市库位,请核对后操作!";
}
else
{
wmsMsg = "WMS接口信息:" + s[0];
}
}
else
{
if (!string.IsNullOrEmpty(rst))
{
wmsMsg = "WMS接口信息:" + rst;
}
else
{
wmsMsg = "WMS接口返回结果无法解析,接口内容:" + rst;
}
}
}
//wmsMsg = rst;
return false; return false;
} }
/// <summary> /// <summary>
@ -1131,6 +1168,8 @@ namespace Webservice
{ {
if (string.IsNullOrEmpty(oneBarCode)) return false; if (string.IsNullOrEmpty(oneBarCode)) return false;
string lineid = ConfigurationManager.AppSettings["LineID"].ToString().Trim();
DataTable inspectTable = GetInspectResultTable($"{oneBarCode}"); DataTable inspectTable = GetInspectResultTable($"{oneBarCode}");
if (inspectTable.Rows.Count == 0) if (inspectTable.Rows.Count == 0)
{ {
@ -1152,6 +1191,7 @@ namespace Webservice
lu_Code = GetPaintLU(oneBarCode.Substring(0, 10), colorName); lu_Code = GetPaintLU(oneBarCode.Substring(0, 10), colorName);
} }
//因为客户端先插入,再调用接口,因此取第二条为前置状态 直接访问接口是,应该取第一条进行测试
string lastState = string.Empty; string lastState = string.Empty;
if (inspectTable.Rows.Count > 1) if (inspectTable.Rows.Count > 1)
{ {
@ -1249,7 +1289,7 @@ namespace Webservice
if (lastState.Contains("合格")) if (lastState.Contains("合格"))
{ {
string wmsMsg = string.Empty; string wmsMsg = string.Empty;
bool wmsAllow = GetWmsCompleteState(oneBarCode, ref wmsMsg); bool wmsAllow = GetWmsCompleteState(oneBarCode, lineid, ref wmsMsg);
if (wmsAllow == false) if (wmsAllow == false)
{ {
if (string.IsNullOrEmpty(wmsMsg)) if (string.IsNullOrEmpty(wmsMsg))
@ -1290,7 +1330,7 @@ namespace Webservice
if (lastState.Contains("合格")) if (lastState.Contains("合格"))
{ {
string wmsMsg = string.Empty; string wmsMsg = string.Empty;
bool wmsAllow = GetWmsCompleteState(oneBarCode,ref wmsMsg); bool wmsAllow = GetWmsCompleteState(oneBarCode, lineid, ref wmsMsg);
if (wmsAllow == false) if (wmsAllow == false)
{ {
if (string.IsNullOrEmpty(wmsMsg)) if (string.IsNullOrEmpty(wmsMsg))
@ -1332,7 +1372,7 @@ namespace Webservice
if (lastState.Contains("合格")) if (lastState.Contains("合格"))
{ {
string wmsMsg = string.Empty; string wmsMsg = string.Empty;
bool wmsAllow = GetWmsCompleteState(oneBarCode,ref wmsMsg); bool wmsAllow = GetWmsCompleteState(oneBarCode, lineid, ref wmsMsg);
if (wmsAllow == false) if (wmsAllow == false)
{ {
if (string.IsNullOrEmpty(wmsMsg)) if (string.IsNullOrEmpty(wmsMsg))

Loading…
Cancel
Save