diff --git a/PunchingMistake/FrmQualityNew.cs b/PunchingMistake/FrmQualityNew.cs index 5c18868..5d71134 100644 --- a/PunchingMistake/FrmQualityNew.cs +++ b/PunchingMistake/FrmQualityNew.cs @@ -270,7 +270,14 @@ namespace PunchingMistake private void VerifyLastScan(string type) { DataTable dt = Function2.GetLastQualityResult(_scanAssembleRow["barCode"].ToString()); - if (dt.Rows.Count == 0) return; + if (dt.Rows.Count == 0) + { + if (type == "返修合格") + { + throw new Exception("没有返修判定记录,无法判定为返修合格."); + } + return; + } if(type == "返修合格") { if(dt.Rows[0]["inspectResult"].ToString() != "返修") @@ -335,8 +342,8 @@ namespace PunchingMistake string bcode = txtBarCode.Text.Trim(); VerifyLastScan(state); //保存 - string id = SaveInspect(state, _scanAssembleRow, userName); - if (!string.IsNullOrEmpty(id)) + bool rst = SaveInspect(state, _scanAssembleRow, userName); + if (rst == true) { _scanAssembleRow = null; ShowHint("操作成功", true); @@ -407,7 +414,7 @@ namespace PunchingMistake /// /// /// 返回插入记录的ID - public string SaveInspect(string inspectResult,DataRow scanPaintRow,string userName) + public bool SaveInspect(string inspectResult,DataRow scanPaintRow,string userName) { try { @@ -432,12 +439,12 @@ namespace PunchingMistake //model1.CarType = scanPaintRow["CarType"].ToString(); - if (inspectResult != "合格") + if (inspectResult != "合格" && inspectResult != "返修合格") { if (string.IsNullOrWhiteSpace(model1.damnPosition) || string.IsNullOrWhiteSpace(model1.reason) || string.IsNullOrWhiteSpace(model1.Responsible)) { MessageBox.Show("必须选择缺陷位置,缺陷原因与责任部门,否则无法保存!"); - return ""; + return false; } } model1.productInfo = labProductInfo.Text; @@ -464,7 +471,7 @@ namespace PunchingMistake if(wmsRst == false) { MessageBox.Show(msg); - return ""; + return false; } @@ -489,9 +496,9 @@ namespace PunchingMistake { Function2.UpdateRecordFlag(scanPaintRow["ID"].ToString().ToString(), "1"); - } + } - return ""; + return true; } catch (Exception ex) { @@ -499,7 +506,7 @@ namespace PunchingMistake //LogHelper.WriteErrLogBase("质检提交:" + ex.ToString(), MethodBase.GetCurrentMethod().Name); LogHelper.WriteLog("质检提交:" + ex.ToString()); MessageBox.Show("质检提交异常,原因:" + ex.Message); - return null; + return false; } } void ShowHint(string txt,bool isOk =false) @@ -758,10 +765,8 @@ namespace PunchingMistake throw new Exception("扫描条码没有装配记录,无法质检"); } //写到这 - DataRow dr = dt.Rows[0]; - - + return dr; } diff --git a/PunchingMistake/Function2.cs b/PunchingMistake/Function2.cs index 3108cc0..d7d11ca 100644 --- a/PunchingMistake/Function2.cs +++ b/PunchingMistake/Function2.cs @@ -1159,7 +1159,7 @@ namespace PunchingMistake DataTable res = null; try { - string sql = sql = $"select CarTypeName from v_Car where PartNo='{partNo}' "; + string sql = sql = $"select b.CarTypeName from tb_product a, tb_CarType b where a.CarTypeID = b.ID and a.PartNo='{partNo}' "; res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); @@ -1205,7 +1205,7 @@ namespace PunchingMistake ('" + zcBarCode + @"' ,'" + ZcPartNo + @"' ,'" + state + @"' - ,(select getdate()), '" + @"' + ,(select getdate())" + @" ,'" + userName + @"' ,'" + carType + @"' ,'" + barcode + @"' @@ -1287,14 +1287,13 @@ namespace PunchingMistake try { string sql = string.Empty; - if (barcode.Contains(".")) + if (barcode.Length == 20) { - sql = $"select top 1 * from tb_Punch_Code_Record where ZcBarCode ='{barcode}' order by id desc "; + sql = $"select top 1 * from tb_Punch_Code_Record where barcode ='{barcode}' order by id desc "; } else { - sql = $"select top 1 * from tb_Punch_Code_Record where barcode ='{barcode}' order by id desc "; - + sql = $"select top 1 * from tb_Punch_Code_Record where ZcBarCode ='{barcode}' order by id desc "; } res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); diff --git a/PunchingMistake/Function3.cs b/PunchingMistake/Function3.cs index c6ba8cc..48442c2 100644 --- a/PunchingMistake/Function3.cs +++ b/PunchingMistake/Function3.cs @@ -67,6 +67,10 @@ namespace PunchingMistake { res = true; } + else if (barcode.StartsWith("A010X") && barcode.Length ==35) + { + res = true; + } else { if (barcode.Length == 20)