diff --git a/InjectionPC/FrmMain2408.cs b/InjectionPC/FrmMain2408.cs index 744f74a..a0a174c 100644 --- a/InjectionPC/FrmMain2408.cs +++ b/InjectionPC/FrmMain2408.cs @@ -73,6 +73,7 @@ namespace InjectionPC private PlasticBLL _plasticBLL = new PlasticBLL(); private int _plcRate = 100; //500 + private ProductBLL productBll = new ProductBLL(); //允许修改箱码标包的已打码最小数量 private int _allowChangeBoxSizeMaxPrint = 8; #endregion @@ -287,7 +288,7 @@ namespace InjectionPC try { InjectionPlanBLL bll = new InjectionPlanBLL(); - ProductBLL productBll = new ProductBLL(); + DataTable dt = bll.SearchInfoByName(Program.station); if (dt != null && dt.Rows.Count > 0) { @@ -414,7 +415,7 @@ namespace InjectionPC InjectionPlanBLL bll = new InjectionPlanBLL(); BarCodeBLL brbll = new BarCodeBLL(); BarCodeModel md = new BarCodeModel(); - ProductBLL productBll = new ProductBLL(); + //ProductBLL productBll = new ProductBLL(); PlasticBLL pbll= _plasticBLL; InjectionBoxBLL boxbll=new InjectionBoxBLL(); InjectionBoxModel boxmd=new InjectionBoxModel(); @@ -2740,7 +2741,7 @@ namespace InjectionPC try { - if (UnCompletePrintBox("切换下一计划","all") == false) return; + if (UnCompletePrintBox("切换下一计划","all",true,1) == false) return; InjectionPlanBLL planbll=new InjectionPlanBLL(); @@ -3765,17 +3766,35 @@ namespace InjectionPC string GetPackageCode(string partNo,bool autoPrint, string mould) { string batch = GetBatch(autoPrint); - string packageSize = lbNeedQtyL.Text.Trim(); + Label lbNeedQty = lbNeedQtyL; + if(mould == "1") { - packageSize = lbNeedQtyR.Text.Trim(); + lbNeedQty = lbNeedQtyR; + //packageSize = lbNeedQtyR.Text.Trim(); } - if (string.IsNullOrEmpty(packageSize)) + string packageSize = lbNeedQty.Text.Trim(); + int p = 0; + int.TryParse(packageSize, out p); + if (string.IsNullOrEmpty(packageSize) || p == 0) { - packageSize = "1"; + //packageSize = "1"; + DataTable dt3 = productBll.SearchInfoByPartNo(partNo); + if(dt3.Rows.Count>0) + { + packageSize = dt3.Rows[0]["PackCount"].ToString(); + lbNeedQty.Text = packageSize; + } } - - string packageCode = _uniqueBll. GetPackageCodeSerialNo(partNo, batch, packageSize); + int.TryParse(packageSize, out p); + if (string.IsNullOrEmpty(packageSize) || p == 0) + { + packageSize = (_allowChangeBoxSizeMaxPrint + 2).ToString() ; + + lbNeedQty.Text = packageSize; + } + + string packageCode = _uniqueBll.GetPackageCodeSerialNo(partNo, batch, packageSize); return packageCode; } @@ -4200,9 +4219,12 @@ namespace InjectionPC CompleteBoxAndPrint(dt.Rows[0], "0", lbPackageCodeL, lbCurrentlQtyL, 1); lbPackageCodeL.Text = ""; if(needInitComBoxSizeSelect == 1) - comBoxSizeL.SelectedIndex = -1; + { + comBoxSizeL.SelectedIndex = -1; + + lbNeedQtyL.Text = "0"; + } - lbNeedQtyL.Text = "0"; } } } @@ -4223,8 +4245,14 @@ namespace InjectionPC CompleteBoxAndPrint(dt.Rows[0], "1", lbPackageCodeR, lbCurrentlQtyR,1); lbPackageCodeR.Text = ""; + if (needInitComBoxSizeSelect == 1) + { + comBoxSizeR.SelectedIndex = -1; + + lbNeedQtyR.Text = "0"; + } //comBoxSizeR.SelectedIndex = -1; - lbNeedQtyR.Text = "0"; + //lbNeedQtyR.Text = "0"; } } } diff --git a/PaintingPC/FrmQuality.cs b/PaintingPC/FrmQuality.cs index 473aa1c..d957e2d 100644 --- a/PaintingPC/FrmQuality.cs +++ b/PaintingPC/FrmQuality.cs @@ -35,6 +35,8 @@ namespace PaintingPC private string _foreignPartCode = string.Empty; //颜色是否手动修改 private bool _colorHandChanged = false; + private bool _isSingleStation = false; + private string _isTest = "false"; public FrmQuality(bool isWmsQuality) { @@ -45,6 +47,12 @@ namespace PaintingPC _lineCode = ConfigurationManager.AppSettings["LineCode"].ToString(); _stationType = ConfigurationManager.AppSettings["Position"].ToString(); string disableButtons = ConfigurationManager.AppSettings["DisableButtons"].ToString(); + string single = ConfigurationManager.AppSettings["SingleStation"].ToString(); + string _isTest = ConfigurationManager.AppSettings["测试"].ToString(); + if (single == "true") + { + _isSingleStation = true; + } if (!string.IsNullOrEmpty(disableButtons)) { if (disableButtons.Contains("报废")) @@ -75,7 +83,7 @@ namespace PaintingPC // if(_lineCode == "2") // { HidenColorSelect(true); - if(_stationType == "下线一检") + if(_stationType == "下线一检" || (_stationType == "下线二检" && _isSingleStation ==true)) { btnAllowChangeColor.Visible = true; } @@ -707,6 +715,9 @@ namespace PaintingPC { try { + if (_isTest == "true") + return true; + WMSWebService webService = new WMSWebService(); webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString(); //webService.Timeout = 1200000; @@ -1094,7 +1105,8 @@ namespace PaintingPC { dLb[i].Font = new Font(dLb[i].Font.FontFamily, 36, FontStyle.Bold); dLb[i].Size = new Size(170, 60); - dLb[i].ForeColor = Color.Blue; + dLb[i].ForeColor = Color.Red; + //dLb[i].BackColor = Color.Red; } panel2.Controls.Add(dLb[i]); dLb[i].Click += new EventHandler(dLbRoom_Click); @@ -1133,8 +1145,12 @@ namespace PaintingPC string strImageURL = Function.GetImgPath() + picture; - System.Net.WebClient webClient = new System.Net.WebClient(); - webClient.DownloadFile(strImageURL, Directory.GetCurrentDirectory() + @"\" + picture); + if(_isTest != "true") + { + System.Net.WebClient webClient = new System.Net.WebClient(); + webClient.DownloadFile(strImageURL, Directory.GetCurrentDirectory() + @"\" + picture); + } + } @@ -1216,27 +1232,7 @@ namespace PaintingPC reason= dtInspect.Rows[0]["reason"].ToString(); //原因 paintId = dtInspect.Rows[0]["remark3"].ToString(); //原因 - #region 三检结果 - - //for (int i = 0; i < dtInspect.Rows.Count; i++) - //{ - // string time = dtInspect.Rows[i]["InspectTimes"].ToString(); - // string result = dtInspect.Rows[i]["inspectResult"].ToString() + dtInspect.Rows[i]["damnPosition"].ToString() + ":" + dtInspect.Rows[i]["reason"].ToString(); - // switch (time) - // { - // case "1": - // labFirstCheck.Text = result; - // break; - // case "2": - // labSecondCheck.Text = result; - // break; - // case "3": - // labThirdCheck.Text = result; - // break; - // } - //} - - #endregion + #region 选中缺陷位置及原因 @@ -1269,9 +1265,10 @@ namespace PaintingPC } else { + cboxAddColor.Enabled = true; #region 没有一检结果,查询老外数据库,取产品信息 - if (_isWmsQuality == false) + if (_isWmsQuality == false &&(_isSingleStation==true || _stationType=="下线一检")) { string paintError = string.Empty; //喷涂线边质检,没有质检结果,查询老外数据库,取产品信息 @@ -1333,14 +1330,18 @@ namespace PaintingPC LogHelper.WriteErrLogBase("整体项-" + ex.ToString(), MethodBase.GetCurrentMethod().Name); } } - + /// + /// 一检 二检 点修补扫码是否允许验证 + /// + /// + /// private bool ScanCodeValidVerify(string barcode) { string position = _stationType; switch (position) { case "下线一检": return First(barcode); - case "下线二检": return Second(barcode);break; + case "下线二检": return Second(barcode);; case "点修补": return Third(barcode); default:return true; @@ -1362,22 +1363,28 @@ namespace PaintingPC 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("报废")) + if (_isSingleStation == false) { - ShowHint("上次质量判定为[报废],无法进行二检扫码.", false); - return false; + 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; } diff --git a/PaintingPC/Function.cs b/PaintingPC/Function.cs index dc018db..7ef9239 100644 --- a/PaintingPC/Function.cs +++ b/PaintingPC/Function.cs @@ -2034,56 +2034,57 @@ namespace PaintingPC { errorMsg = $"WmsDB 没有条码[{barcode}]对应的数据"; } - if (!string.IsNullOrEmpty(typeCode) && paintCode.ToLower() != "na") - { - string stockNo1 = barcode.Substring(0, 10); - string sqlmap = @"select * from tb_ForeignColorMap where TypeCode='" + typeCode + @"' and StockNo='" + stockNo1 + "'"; - - DataTable mapTable = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sqlmap, null); - if (mapTable.Rows.Count > 0) - { - DataRow mapRow = mapTable.Rows[0]; - string paintSql = @"select * from tb_PaintInfo where PaintCode='" + paintCode + @"'"; - DataTable paintTable = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sqlmap, null); - if (paintTable != null && paintTable.Rows.Count > 0) - { - paintID = paintTable.Rows[0]["ID"].ToString(); - res = mapRow["Color"] + "," + mapRow["PartName"] + "," + paintID + "," + mapRow["PartCode"]; - return res; - } - else - { - errorMsg = $"基础数据-油漆信息管理页面未配置油漆代码为{paintCode}的基础数据"; - } - } + //if (!string.IsNullOrEmpty(typeCode) && paintCode.ToLower() != "na") + //{ + // string stockNo1 = barcode.Substring(0, 10); + // string sqlmap = @"select * from tb_ForeignColorMap where TypeCode='" + typeCode + @"' and StockNo='" + stockNo1 + "'"; + + // DataTable mapTable = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sqlmap, null); + // if (mapTable.Rows.Count > 0) + // { + // DataRow mapRow = mapTable.Rows[0]; + // string paintSql = @"select * from tb_PaintInfo where PaintCode='" + paintCode + @"'"; + // DataTable paintTable = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sqlmap, null); + // if (paintTable != null && paintTable.Rows.Count > 0) + // { + // paintID = paintTable.Rows[0]["ID"].ToString(); + + // res = mapRow["Color"] + "," + mapRow["PartName"] + "," + paintID + "," + mapRow["PartCode"]; + // return res; + // } + // else + // { + // errorMsg = $"基础数据-油漆信息管理页面未配置油漆代码为{paintCode}的基础数据"; + // } + // } - } + //} //根据颜色代码查颜色 if (!string.IsNullOrWhiteSpace(paintCode) && paintCode.ToLower() != "na") { - DataTable dt = new DataTable(); - string sql_c = ""; - sql_c = @"select * from tb_PaintInfo where PaintCode='" + paintCode + @"'"; + //DataTable dt = new DataTable(); + //string sql_c = ""; + //sql_c = @"select * from tb_PaintInfo where PaintCode='" + paintCode + @"'"; - dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_c, null); - if (dt != null && dt.Rows.Count > 0) - { - //res = dt.Rows[0]["ColorName"].ToString(); - //colorInfo = dt.Rows[0]["Des"].ToString().Trim() + "," + - // dt.Rows[0]["ColorCode"].ToString().Trim() + "," + - // dt.Rows[0]["ColorNo"].ToString().Trim(); - //colorInfo = dt.Rows[0]["ColorName"].ToString(); - paintID = dt.Rows[0]["ID"].ToString(); - } - else - { - errorMsg = $"基础数据-油漆信息管理页面未配置油漆代码为{paintCode}的基础数据"; - } + //dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_c, null); + //if (dt != null && dt.Rows.Count > 0) + //{ + // //res = dt.Rows[0]["ColorName"].ToString(); + // //colorInfo = dt.Rows[0]["Des"].ToString().Trim() + "," + + // // dt.Rows[0]["ColorCode"].ToString().Trim() + "," + + // // dt.Rows[0]["ColorNo"].ToString().Trim(); + // //colorInfo = dt.Rows[0]["ColorName"].ToString(); + // paintID = dt.Rows[0]["ID"].ToString(); + //} + //else + //{ + // errorMsg = $"基础数据-油漆信息管理页面未配置油漆代码为{paintCode}的基础数据"; + //} - string sql_1 = @"select Color from tb_PaintColorInfo where StockNo='" + barcode.Substring(0, 10) + @"' and PaintID='" + paintID + @"'"; + string sql_1 = @"select Color from tb_PaintColorInfo where StockNo='" + barcode.Substring(0, 10) + @"' and Paint_No='" + paintCode + @"'"; DataTable dt_1 = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_1, null); if (dt_1 != null && dt_1.Rows.Count > 0) { diff --git a/WebService/Function.cs b/WebService/Function.cs index 36b1392..98f33f8 100644 --- a/WebService/Function.cs +++ b/WebService/Function.cs @@ -915,7 +915,9 @@ namespace Webservice string msg = string.Empty; - if(AllowSendToWms(barcode,isPass, ref repaint,ref msg,ref lu_code, ref colorName, ref productName, ref carType) == false) + string position = string.Empty; + string reason = string.Empty; + if (AllowSendToWms(barcode,isPass, ref repaint,ref msg,ref lu_code, ref colorName, ref productName, ref carType,ref position,ref reason) == false) { model.Result = "0"; model.ResultType = "Result"; @@ -976,6 +978,10 @@ namespace Webservice wmsM.Remark = ""; wmsM.Repaint = repaint.ToString(); wmsM.ColorName = colorName; + wmsM.Position = position; + wmsM.Reason = reason; + + #region 产线及工厂ID LogHelper.WriteSysLogBase("【添加产线ID】barcode:" + barcode, MethodBase.GetCurrentMethod().Name); @@ -1164,7 +1170,7 @@ namespace Webservice /// pRepaint 只存在返喷 Repaint =1 只存在其它 Repaint =3 既存在返喷又存在其它 Repaint =4 /// static bool AllowSendToWms(string oneBarCode, int state, - ref int pRepaint,ref string errorMssg ,ref string lu_Code, ref string colorName, ref string productName,ref string carType) + ref int pRepaint,ref string errorMssg ,ref string lu_Code, ref string colorName, ref string productName,ref string carType,ref string position,ref string reason) { if (string.IsNullOrEmpty(oneBarCode)) return false; @@ -1179,8 +1185,24 @@ namespace Webservice colorName = inspectTable.Rows[0]["remark1"].ToString(); productName = inspectTable.Rows[0]["remark2"].ToString(); carType = inspectTable.Rows[0]["CarType"].ToString(); + position = inspectTable.Rows[0]["position"].ToString(); + if(position == "下线一检") + { + position = "喷涂质检"; + } + else if (position == "下线二检") + { + position = "喷涂终检"; + } + else if (position .Contains( "点修补")) + { + position = "喷涂点修终检"; + } + + reason = inspectTable.Rows[0]["reason"].ToString(); string foreignPartCode = inspectTable.Rows[0]["ForeignPartCode"].ToString(); + if (!string.IsNullOrEmpty(foreignPartCode)) { lu_Code = foreignPartCode; diff --git a/WebService/Model/WMS03Model.cs b/WebService/Model/WMS03Model.cs index a139b7d..77d2cb8 100644 --- a/WebService/Model/WMS03Model.cs +++ b/WebService/Model/WMS03Model.cs @@ -77,5 +77,8 @@ namespace WebService.Model /// public string Repaint { get; set; } public string ColorName { get; set; } + + public string Position { get; set; } + public string Reason { get; set; } } } \ No newline at end of file