From 29e117e9d05e6b7f661defe48d6a5db775bae5f3 Mon Sep 17 00:00:00 2001 From: "songnan.zhang" Date: Mon, 26 Sep 2022 14:59:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E5=85=85276?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataValidators/TimeValidator.cs | 2 +- .../StateActions/SubmitData276PA.cs | 5 +- APPQ5/QMAPP.WinForm/App.config | 7 +- .../Forms/Operation/OperationForm.cs | 215 ++++++++++++------ .../QMAPP.WinForm/Properties/AssemblyInfo.cs | 4 +- .../WCF/QMFrameWork.WebServiceHost/Web.config | 7 +- 6 files changed, 163 insertions(+), 77 deletions(-) diff --git a/APPQ5/QMAPP.FJC.TRACING/DataValidators/TimeValidator.cs b/APPQ5/QMAPP.FJC.TRACING/DataValidators/TimeValidator.cs index 091b160..c3a14cd 100644 --- a/APPQ5/QMAPP.FJC.TRACING/DataValidators/TimeValidator.cs +++ b/APPQ5/QMAPP.FJC.TRACING/DataValidators/TimeValidator.cs @@ -34,7 +34,7 @@ namespace QMAPP.FJC.TRACING.DataValidators DateTime serviceTime = dal.GetServiceDateTime(); TimeSpan ts = serviceTime.Subtract(preStatTime); - return new ValidateResult(false, $"未达到{timeCheck.Operator}{(Convert.ToDecimal(timeCheck.Check_Value) / 3600).ToString("#0.0")}小时验证标准,当前时间{(Convert.ToDecimal(ts.TotalSeconds) / 3600).ToString("#0.0")}小时"); + return new ValidateResult(false, $"未达到{timeCheck.Operator}{(Convert.ToDecimal(timeCheck.Check_Value) / 3600).ToString("#0.0")}小时验证标准"); } diff --git a/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs b/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs index fa1f9e7..30cdb53 100644 --- a/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs +++ b/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs @@ -600,7 +600,10 @@ namespace QMAPP.FJC.TRACING.StateActions var bomlocations = pbidal.LocateBom(materials); //确定物料组成数量一致 var bomlocation = bomlocations.FirstOrDefault(p => p.SubCount == materials.Length); - return bomlocation; + if (bomlocations.Count > 0) + return bomlocations[0]; + else + return null; } diff --git a/APPQ5/QMAPP.WinForm/App.config b/APPQ5/QMAPP.WinForm/App.config index 0132462..a1ec161 100644 --- a/APPQ5/QMAPP.WinForm/App.config +++ b/APPQ5/QMAPP.WinForm/App.config @@ -14,11 +14,12 @@ --> + - + - + diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs index 5855eaf..b94f753 100644 --- a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs @@ -817,93 +817,174 @@ namespace QMAPP.WinForm.Forms.Operation } if (ispass)//扫描的是过程主码 { - if (!string.IsNullOrEmpty(result.WorkOrderID)) + //ZHANGSN 20220925 佛山276PA没有计划ID,使用物料号查找配置 + if (_operationServiceParam.machineInfo.WORKLOC_CODE.Contains("276")) { - List list = this.dgvPlan.DataSource as List; - - var pBomcode = GetWorkOrder_MATERIAL_CODE(result.WorkOrderID); - - if (!string.IsNullOrEmpty(pBomcode)) + if (!string.IsNullOrEmpty(result.MATERIAL_CODE)) { - //List filterList = list.Where(p => pBomCodes.Contains(p.MATERIAL_CODE)).ToList(); - - var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = pBomcode, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); - if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) + var bomCodes = GetPBOMCODEValue(result.MATERIAL_CODE); + foreach (var bom in bomCodes) { - foreach (var Config in ScanIPConfig_list) + + var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = bom, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); + if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) { - if (!string.IsNullOrEmpty(Config.PlcAddr)) + foreach (var Config in ScanIPConfig_list) { - var BarCode = Config.BarCode; - var PlcAddr = Config.PlcAddr; - GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在 - if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) + if (!string.IsNullOrEmpty(Config.PlcAddr)) { - var ProductList = SelectProduct(Config.BarCode); - if (ProductList != null) + var BarCode = Config.BarCode; + var PlcAddr = Config.PlcAddr; + GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在 + if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) { - var PID = Guid.NewGuid().ToString(); - var ProductNew = new Product() - { - PRODUCTCODE = BarCode, - PID = PID, - MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, - MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, - PRODUCTSOURCE = "0", - MATERIAL_CODE = ProductList.MATERIAL_CODE, - STATUS = "0", - OUTFLAG = "0", - USINGSTATE = "0", - CAPACITY = 1, - USINGCOUNT = 0, - WORKCELL_CODE = ProductList.WORKCELL_CODE, - WORKLOC_CODE = ProductList.WORKLOC_CODE, - WORKCENTER_CODE = ProductList.WORKCENTER_CODE - }; - - var ProcessRecords = new ProcessRecord() + var ProductList = SelectProduct(Config.BarCode); + if (ProductList != null) { - PID = Guid.NewGuid().ToString(), - PRODUCT_PID = ProductNew.PID, - WORKCELL_CODE = ProductList.WORKCELL_CODE, - WORKLOC_CODE = ProductList.WORKLOC_CODE, - IN_WORKCELL_TIME = DateTime.Now, - WORK_START_TIME = DateTime.Now, - WORK_END_TIME = DateTime.Now, - PROCESS_STATE = "1", - MANUAL_PASS = "", - MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text) - }; - if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords)) - { - txtCode.Text = BarCode; - Operation(); + var PID = Guid.NewGuid().ToString(); + var ProductNew = new Product() + { + PRODUCTCODE = BarCode, + PID = PID, + MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, + MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, + PRODUCTSOURCE = "0", + MATERIAL_CODE = ProductList.MATERIAL_CODE, + STATUS = "0", + OUTFLAG = "0", + USINGSTATE = "0", + CAPACITY = 1, + USINGCOUNT = 0, + WORKCELL_CODE = ProductList.WORKCELL_CODE, + WORKLOC_CODE = ProductList.WORKLOC_CODE, + WORKCENTER_CODE = ProductList.WORKCENTER_CODE + }; + + //var ProcessRecords = new ProcessRecord() + //{ + // PID = Guid.NewGuid().ToString(), + // PRODUCT_PID = ProductNew.PID, + // WORKCELL_CODE = ProductList.WORKCELL_CODE, + // WORKLOC_CODE = ProductList.WORKLOC_CODE, + // IN_WORKCELL_TIME = DateTime.Now, + // WORK_START_TIME = DateTime.Now, + // WORK_END_TIME = DateTime.Now, + // PROCESS_STATE = "1", + // MANUAL_PASS = "", + // MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text) + //}; + //if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords)) + if (InsertProduct(ProductNew)) + { + txtCode.Text = BarCode; + Operation(); + } } } } - } - else - { - txtCode.Text = Config.BarCode; - Operation(); + else + { + txtCode.Text = Config.BarCode; + Operation(); + } } } + } } - //else - //{ - // this.lblError.Text = "通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE"; - // this.lblError.ForeColor = Color.Black; - // MessageBox.Show($"通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE"); - //} } else { - this.lblError.Text = "result.WorkOrderID为空,未进行后续填充!"; - this.lblError.ForeColor = Color.Black; - MessageBox.Show($"result.WorkOrderID为空,未进行后续填充!"); + if (!string.IsNullOrEmpty(result.WorkOrderID)) + { + List list = this.dgvPlan.DataSource as List; + + var pBomcode = GetWorkOrder_MATERIAL_CODE(result.WorkOrderID); + + if (!string.IsNullOrEmpty(pBomcode)) + { + //List filterList = list.Where(p => pBomCodes.Contains(p.MATERIAL_CODE)).ToList(); + + var ScanIPConfig_list = GetSendPlcConfig(new ScanIPConfig() { MaterialCode = pBomcode, LocCode = _operationServiceParam.machineInfo.WORKLOC_CODE }); + if (ScanIPConfig_list != null && ScanIPConfig_list.Count > 0) + { + foreach (var Config in ScanIPConfig_list) + { + if (!string.IsNullOrEmpty(Config.PlcAddr)) + { + var BarCode = Config.BarCode; + var PlcAddr = Config.PlcAddr; + GetNewCode(ref BarCode, ref PlcAddr); //查询产品条码是否存在 + if (UpdateSendPlcConfig(new ScanIPConfig { PID = Config.PID, PlcAddr = PlcAddr })) + { + var ProductList = SelectProduct(Config.BarCode); + if (ProductList != null) + { + var PID = Guid.NewGuid().ToString(); + var ProductNew = new Product() + { + PRODUCTCODE = BarCode, + PID = PID, + MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE, + MACHINENAME = _operationServiceParam.machineInfo.MACHINENAME, + PRODUCTSOURCE = "0", + MATERIAL_CODE = ProductList.MATERIAL_CODE, + STATUS = "0", + OUTFLAG = "0", + USINGSTATE = "0", + CAPACITY = 1, + USINGCOUNT = 0, + WORKCELL_CODE = ProductList.WORKCELL_CODE, + WORKLOC_CODE = ProductList.WORKLOC_CODE, + WORKCENTER_CODE = ProductList.WORKCENTER_CODE + }; + + var ProcessRecords = new ProcessRecord() + { + PID = Guid.NewGuid().ToString(), + PRODUCT_PID = ProductNew.PID, + WORKCELL_CODE = ProductList.WORKCELL_CODE, + WORKLOC_CODE = ProductList.WORKLOC_CODE, + IN_WORKCELL_TIME = DateTime.Now, + WORK_START_TIME = DateTime.Now, + WORK_END_TIME = DateTime.Now, + PROCESS_STATE = "1", + MANUAL_PASS = "", + MODULE_CODE = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text) + }; + if (InsertProduct(ProductNew) && InsertProcessRecord(ProcessRecords)) + { + txtCode.Text = BarCode; + Operation(); + } + } + } + } + else + { + txtCode.Text = Config.BarCode; + Operation(); + } + } + } + + } + //else + //{ + // this.lblError.Text = "通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE"; + // this.lblError.ForeColor = Color.Black; + // MessageBox.Show($"通过result.WorkOrderID({result.WorkOrderID.ToString()})未查询到WorkOrder.PBOM_CODE"); + //} + } + else + { + this.lblError.Text = "result.WorkOrderID为空,未进行后续填充!"; + this.lblError.ForeColor = Color.Black; + MessageBox.Show($"result.WorkOrderID为空,未进行后续填充!"); + } } + } } diff --git a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs index a7597fd..ac09163 100644 --- a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs +++ b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2022.09.23.01")] -[assembly: AssemblyFileVersion("2022.09.23.01")] +[assembly: AssemblyVersion("2022.09.26.01")] +[assembly: AssemblyFileVersion("2022.09.26.01")] diff --git a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config index a2b6567..4dda3e9 100644 --- a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config +++ b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config @@ -76,11 +76,12 @@ + - + + From 8776904d6d6b173ddaa8ab644d4a27e26d6bd3fb Mon Sep 17 00:00:00 2001 From: "songnan.zhang" Date: Mon, 26 Sep 2022 15:18:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs b/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs index 30cdb53..3e3e7ab 100644 --- a/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs +++ b/APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs @@ -599,7 +599,7 @@ namespace QMAPP.FJC.TRACING.StateActions PbomDAL pbidal = new PbomDAL(); var bomlocations = pbidal.LocateBom(materials); //确定物料组成数量一致 - var bomlocation = bomlocations.FirstOrDefault(p => p.SubCount == materials.Length); + //var bomlocation = bomlocations.FirstOrDefault(p => p.SubCount == materials.Length); if (bomlocations.Count > 0) return bomlocations[0]; else