From c938728967bcab158b07617ab543054ea30f19c5 Mon Sep 17 00:00:00 2001 From: "dequan.zhang" <13820060@qq.com> Date: Thu, 5 May 2022 08:23:14 +0800 Subject: [PATCH] =?UTF-8?q?BC316=E8=A3=85=E9=85=8D=E5=87=86=E6=97=B6?= =?UTF-8?q?=E5=8C=96=20=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APP/QMAPP.Web/App_Data/PCPower.xml | 1 + .../ProductionPlan/WorkOrderDAL.cs | 35 + .../ProductionPlan/WorkOrder.cs | 9 + .../DAHandler/DataAcquirer.cs | 7 + APPQ5/QMAPP.FJC.TRACING/DAInterface/DAArgs.cs | 5 + .../DataValidators/PlanValidator.cs | 6 +- APPQ5/QMAPP.WinForm/App.config | 27 +- .../Forms/Operation/BZDPasswordForm.cs | 6 + .../Forms/Operation/BZDRePrintForm.cs | 9 +- .../Operation/OperationForm_316.Designer.cs | 1654 +++++++ .../Forms/Operation/OperationForm_316.cs | 3843 +++++++++++++++++ .../Forms/Operation/OperationForm_316.resx | 686 +++ APPQ5/QMAPP.WinForm/MainForm.Designer.cs | 39 +- APPQ5/QMAPP.WinForm/MainForm.cs | 47 +- APPQ5/QMAPP.WinForm/Menu.xml | 1 + APPQ5/QMAPP.WinForm/QMAPP.WinForm.csproj | 14 + QMAPP.BoraUpgrade.BLL/BoraUpgradeRouteBLL.cs | 128 + QMAPP.BoraUpgrade.BLL/PrintCodeRouteHelper.cs | 422 ++ QMAPP.BoraUpgrade.BLL/ProduceShift.cs | 6 + QMAPP.BoraUpgrade.BLL/ProductHelper.cs | 149 + QMAPP.BoraUpgrade.BLL/ProductMaxCodeBLL.cs | 27 + .../Properties/AssemblyInfo.cs | 36 + .../QMAPP.BoraUpgrade.BLL.csproj | 75 + QMAPP.BoraUpgrade.BLL/VirtualMaterialBLL.cs | 47 + QMAPP.BoraUpgrade.BLL/WorkCellHelper.cs | 27 + QMAPP.BoraUpgrade.BLL/WorkOrderBLL.cs | 256 ++ QMAPP.BoraUpgrade.Common/Config.cs | 36 + QMAPP.BoraUpgrade.Common/Enum.cs | 26 + .../Properties/AssemblyInfo.cs | 36 + .../QMAPP.BoraUpgrade.Common.csproj | 57 + QMAPP.BoraUpgrade.Common/SqlHelper.cs | 2612 +++++++++++ QMAPP.BoraUpgrade.DAL/BoraUpgradeRouteDAL.cs | 77 + .../PrintCodeRouteDataAccess.cs | 57 + QMAPP.BoraUpgrade.DAL/ProductDataAccess.cs | 304 ++ QMAPP.BoraUpgrade.DAL/ProductMaxCodeDAL.cs | 46 + .../Properties/AssemblyInfo.cs | 36 + .../QMAPP.BoraUpgrade.DAL.csproj | 78 + QMAPP.BoraUpgrade.DAL/VirtualMaterialDAL.cs | 43 + QMAPP.BoraUpgrade.DAL/WorkCellDAL.cs | 54 + QMAPP.BoraUpgrade.DAL/WorkOrderDAL.cs | 979 +++++ .../Properties/AssemblyInfo.cs | 36 + .../QMAPP.BoraUpgrade.Entity.csproj | 58 + QMAPP.BoraUpgrade.Entity/T_AW_PRODUCT.cs | 39 + .../T_CC_PrintCodeRoute.cs | 104 + QMAPP.BoraUpgrade.Entity/T_MD_MATERIAL.cs | 33 + .../T_QD_BoraUpgradeRoute.cs | 134 + .../T_QD_VirtualMaterial.cs | 21 + QMSolution.sln | 62 + .../WCF/QMFrameWork.WebServiceHost/Web.config | 44 +- 49 files changed, 12469 insertions(+), 65 deletions(-) create mode 100644 APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.Designer.cs create mode 100644 APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.cs create mode 100644 APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.resx create mode 100644 QMAPP.BoraUpgrade.BLL/BoraUpgradeRouteBLL.cs create mode 100644 QMAPP.BoraUpgrade.BLL/PrintCodeRouteHelper.cs create mode 100644 QMAPP.BoraUpgrade.BLL/ProduceShift.cs create mode 100644 QMAPP.BoraUpgrade.BLL/ProductHelper.cs create mode 100644 QMAPP.BoraUpgrade.BLL/ProductMaxCodeBLL.cs create mode 100644 QMAPP.BoraUpgrade.BLL/Properties/AssemblyInfo.cs create mode 100644 QMAPP.BoraUpgrade.BLL/QMAPP.BoraUpgrade.BLL.csproj create mode 100644 QMAPP.BoraUpgrade.BLL/VirtualMaterialBLL.cs create mode 100644 QMAPP.BoraUpgrade.BLL/WorkCellHelper.cs create mode 100644 QMAPP.BoraUpgrade.BLL/WorkOrderBLL.cs create mode 100644 QMAPP.BoraUpgrade.Common/Config.cs create mode 100644 QMAPP.BoraUpgrade.Common/Enum.cs create mode 100644 QMAPP.BoraUpgrade.Common/Properties/AssemblyInfo.cs create mode 100644 QMAPP.BoraUpgrade.Common/QMAPP.BoraUpgrade.Common.csproj create mode 100644 QMAPP.BoraUpgrade.Common/SqlHelper.cs create mode 100644 QMAPP.BoraUpgrade.DAL/BoraUpgradeRouteDAL.cs create mode 100644 QMAPP.BoraUpgrade.DAL/PrintCodeRouteDataAccess.cs create mode 100644 QMAPP.BoraUpgrade.DAL/ProductDataAccess.cs create mode 100644 QMAPP.BoraUpgrade.DAL/ProductMaxCodeDAL.cs create mode 100644 QMAPP.BoraUpgrade.DAL/Properties/AssemblyInfo.cs create mode 100644 QMAPP.BoraUpgrade.DAL/QMAPP.BoraUpgrade.DAL.csproj create mode 100644 QMAPP.BoraUpgrade.DAL/VirtualMaterialDAL.cs create mode 100644 QMAPP.BoraUpgrade.DAL/WorkCellDAL.cs create mode 100644 QMAPP.BoraUpgrade.DAL/WorkOrderDAL.cs create mode 100644 QMAPP.BoraUpgrade.Entity/Properties/AssemblyInfo.cs create mode 100644 QMAPP.BoraUpgrade.Entity/QMAPP.BoraUpgrade.Entity.csproj create mode 100644 QMAPP.BoraUpgrade.Entity/T_AW_PRODUCT.cs create mode 100644 QMAPP.BoraUpgrade.Entity/T_CC_PrintCodeRoute.cs create mode 100644 QMAPP.BoraUpgrade.Entity/T_MD_MATERIAL.cs create mode 100644 QMAPP.BoraUpgrade.Entity/T_QD_BoraUpgradeRoute.cs create mode 100644 QMAPP.BoraUpgrade.Entity/T_QD_VirtualMaterial.cs diff --git a/APP/QMAPP.Web/App_Data/PCPower.xml b/APP/QMAPP.Web/App_Data/PCPower.xml index 62132d7..5c13bdd 100644 --- a/APP/QMAPP.Web/App_Data/PCPower.xml +++ b/APP/QMAPP.Web/App_Data/PCPower.xml @@ -37,6 +37,7 @@ + diff --git a/APPQ5/QMAPP.FJC.DAL/ProductionPlan/WorkOrderDAL.cs b/APPQ5/QMAPP.FJC.DAL/ProductionPlan/WorkOrderDAL.cs index bd4d152..63e5816 100644 --- a/APPQ5/QMAPP.FJC.DAL/ProductionPlan/WorkOrderDAL.cs +++ b/APPQ5/QMAPP.FJC.DAL/ProductionPlan/WorkOrderDAL.cs @@ -802,6 +802,41 @@ namespace QMAPP.FJC.DAL.ProductionPlan } } + /// + /// 获取指定工位第一条的派工单 + /// + /// + /// + public WorkOrder GetNewFirstOrderInLoc(string orderplan_pid, string mouldcode) + { + try + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT TOP 1 W.* "); + sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); + sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W "); + sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P "); + sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M "); + sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); + sql.AppendFormat(" WHERE W.[PID]=@orderplan_pid "); + + sql.AppendLine(" AND W.[STATE]<>'4' "); + sql.AppendFormat(" ORDER BY W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); + parameters.Add(new DataParameter("orderplan_pid", orderplan_pid)); + parameters.Add(new DataParameter("mouldcode", mouldcode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.Get(sql.ToString(), parameters.ToArray()); + } + } + catch (Exception ex) + { + throw ex; + } + } + /// /// 获取工序下匹配的派工单 /// diff --git a/APPQ5/QMAPP.FJC.Entity/ProductionPlan/WorkOrder.cs b/APPQ5/QMAPP.FJC.Entity/ProductionPlan/WorkOrder.cs index b069f5d..bf87675 100644 --- a/APPQ5/QMAPP.FJC.Entity/ProductionPlan/WorkOrder.cs +++ b/APPQ5/QMAPP.FJC.Entity/ProductionPlan/WorkOrder.cs @@ -176,6 +176,15 @@ namespace QMAPP.FJC.Entity.ProductionPlan /// public string FIS_ASMSETCODE { get; set; } + /// + /// + /// + public string InitNo { get; set; } + /// + /// + /// + public string No { get; set; } + } } diff --git a/APPQ5/QMAPP.FJC.TRACING/DAHandler/DataAcquirer.cs b/APPQ5/QMAPP.FJC.TRACING/DAHandler/DataAcquirer.cs index 4012bcb..5389c7f 100644 --- a/APPQ5/QMAPP.FJC.TRACING/DAHandler/DataAcquirer.cs +++ b/APPQ5/QMAPP.FJC.TRACING/DAHandler/DataAcquirer.cs @@ -72,6 +72,13 @@ namespace QMAPP.FJC.TRACING.DAHandler log.AppendFormat("LOADCH:{0}ms\t", stopwatch.ElapsedMilliseconds); stopwatch.Start(); + //20220501 DQZhang BC316 生产计划获取 FIS计划排序后的第一条(321654) + if (data.WorkLocState.CurrentState.WORKCELL_CODE == "ASSEMBLE_BC316") + { + data.WorkLocState.CurrentState.ORDERPLAN_PID = Args.WorkerPid; + } + + if (data.OrderPlan == null) { if (!string.IsNullOrWhiteSpace(data.WorkLocState.CurrentState.ORDERPLAN_PID)) diff --git a/APPQ5/QMAPP.FJC.TRACING/DAInterface/DAArgs.cs b/APPQ5/QMAPP.FJC.TRACING/DAInterface/DAArgs.cs index 3232ebe..3cb1d4d 100644 --- a/APPQ5/QMAPP.FJC.TRACING/DAInterface/DAArgs.cs +++ b/APPQ5/QMAPP.FJC.TRACING/DAInterface/DAArgs.cs @@ -51,5 +51,10 @@ namespace QMAPP.FJC.TRACING.DAInterface /// 附加数据 /// public Dictionary AttachData { get; set; } + + /// + /// fis计划PID + /// + public string WorkerPid { get; set; } } } diff --git a/APPQ5/QMAPP.FJC.TRACING/DataValidators/PlanValidator.cs b/APPQ5/QMAPP.FJC.TRACING/DataValidators/PlanValidator.cs index 644d97f..b271c13 100644 --- a/APPQ5/QMAPP.FJC.TRACING/DataValidators/PlanValidator.cs +++ b/APPQ5/QMAPP.FJC.TRACING/DataValidators/PlanValidator.cs @@ -27,7 +27,11 @@ namespace QMAPP.FJC.TRACING.DataValidators if (data.WorkLocState.WORKCELL_CODE == "ASSEMBLE_BC316") { //20210120 DQzhang 获取当前工位第一条派工单 - workorder = workorderdal.GetFirstOrderInLoc(data.WorkLocState.WORKCELL_CODE, data.MouldCode); + //workorder = workorderdal.GetFirstOrderInLoc(data.WorkLocState.WORKCELL_CODE, data.MouldCode); + + + //20220501 DQzhang 用pid 获取重新排序后的第一条派工单 + workorder = workorderdal.GetNewFirstOrderInLoc(data.WorkLocState.CurrentState.ORDERPLAN_PID, data.MouldCode); } //----------------------------------------------------------------------------------------------- diff --git a/APPQ5/QMAPP.WinForm/App.config b/APPQ5/QMAPP.WinForm/App.config index f59e43a..671f65f 100644 --- a/APPQ5/QMAPP.WinForm/App.config +++ b/APPQ5/QMAPP.WinForm/App.config @@ -2,22 +2,37 @@ - - + + + + - - - + + + + + + + + + + + + diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/BZDPasswordForm.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/BZDPasswordForm.cs index 81f6416..92d2dd9 100644 --- a/APPQ5/QMAPP.WinForm/Forms/Operation/BZDPasswordForm.cs +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/BZDPasswordForm.cs @@ -26,6 +26,7 @@ namespace QMAPP.WinForm.Forms.Operation Product _CurrentProduct = null; private OperationForm _parentForm; + private OperationForm_316 operationForm_316; public BZDPasswordForm(OperationForm parentForm) { @@ -35,6 +36,11 @@ namespace QMAPP.WinForm.Forms.Operation _parentForm = parentForm; } + public BZDPasswordForm(OperationForm_316 operationForm_316) + { + this.operationForm_316 = operationForm_316; + } + #region 打印按钮 /// diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/BZDRePrintForm.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/BZDRePrintForm.cs index 65bac0b..6e42a32 100644 --- a/APPQ5/QMAPP.WinForm/Forms/Operation/BZDRePrintForm.cs +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/BZDRePrintForm.cs @@ -19,7 +19,7 @@ namespace QMAPP.WinForm.Forms.Operation Product _CurrentProduct = null; private OperationForm _parentForm; - + private OperationForm_316 operationForm_316; public BZDRePrintForm(OperationForm parentForm) { @@ -29,6 +29,11 @@ namespace QMAPP.WinForm.Forms.Operation _parentForm = parentForm; } + public BZDRePrintForm(OperationForm_316 operationForm_316) + { + this.operationForm_316 = operationForm_316; + } + #region 打印按钮 /// @@ -107,7 +112,7 @@ namespace QMAPP.WinForm.Forms.Operation //}; ////_agent.InvokeServiceFunction>(B9BasicService.ProductBLL_Insert.ToString(), ProductNew); //DataResult result;//判断是否成功 - //result =_agent.InvokeServiceFunction>(B9BasicService.ProductBLL_Insert.ToString(), ProductNew); + //result = _agent.InvokeServiceFunction>(B9BasicService.ProductBLL_Insert.ToString(), ProductNew); //if (!result.IsSuccess) //{ // MessageBox.Show(result.Msg); diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.Designer.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.Designer.cs new file mode 100644 index 0000000..5880a9d --- /dev/null +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.Designer.cs @@ -0,0 +1,1654 @@ +namespace QMAPP.WinForm.Forms.Operation +{ + partial class OperationForm_316 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OperationForm_316)); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle51 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle52 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle50 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle53 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle60 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle54 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle55 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle56 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle57 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle58 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle59 = new System.Windows.Forms.DataGridViewCellStyle(); + this.panel2 = new System.Windows.Forms.Panel(); + this.tBMat = new System.Windows.Forms.TextBox(); + this.cBoxVAN = new System.Windows.Forms.CheckBox(); + this.btnChange = new System.Windows.Forms.Button(); + this.cbMould = new System.Windows.Forms.ComboBox(); + this.lblError = new System.Windows.Forms.TextBox(); + this.lblLock = new System.Windows.Forms.LinkLabel(); + this.comMachine = new System.Windows.Forms.ComboBox(); + this.btnAdd = new System.Windows.Forms.Button(); + this.txtCode = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.lblMouldTitle = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.panelSearch = new System.Windows.Forms.Panel(); + this.cboxSort = new System.Windows.Forms.CheckBox(); + this.lblMould = new System.Windows.Forms.Label(); + this.lblWorkcellState = new System.Windows.Forms.Label(); + this.lblMouldTitle2 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.plDAI = new System.Windows.Forms.Panel(); + this.DGView = new System.Windows.Forms.DataGridView(); + this.dgcMouldCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcMouldName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.daname = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.statename = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.datype = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.materialtypename = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcDAMaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.davalue = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.daresult = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Pid = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.tsbCancel = new System.Windows.Forms.ToolStripDropDownButton(); + this.tsbReSignal = new System.Windows.Forms.ToolStripDropDownButton(); + this.tsbPass = new System.Windows.Forms.ToolStripDropDownButton(); + this.tsbRecovery = new System.Windows.Forms.ToolStripDropDownButton(); + this.tsbConnect = new System.Windows.Forms.ToolStripButton(); + this.tsbPrint = new System.Windows.Forms.ToolStripButton(); + this.tsbOrderOperation = new System.Windows.Forms.ToolStripDropDownButton(); + this.tsmiSuspendOrder = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiCancelSuspend = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiResetOrder = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiTakebackOrder = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiDeleteOrder = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiIgnoreFISBreak = new System.Windows.Forms.ToolStripMenuItem(); + this.tsbAndon = new System.Windows.Forms.ToolStripButton(); + this.tsbSearch = new System.Windows.Forms.ToolStripButton(); + this.btnEditProduct = new System.Windows.Forms.ToolStripButton(); + this.btnRefresh = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.panel4 = new System.Windows.Forms.Panel(); + this.plInfo = new System.Windows.Forms.Panel(); + this.gbMlist = new System.Windows.Forms.GroupBox(); + this.dgvMlist = new System.Windows.Forms.DataGridView(); + this.dgcMListMaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcMListMaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcMListQty = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.btnCollapse = new System.Windows.Forms.Button(); + this.plPlanAndRecord = new System.Windows.Forms.Panel(); + this.cbPlanFilter = new System.Windows.Forms.ComboBox(); + this.label10 = new System.Windows.Forms.Label(); + this.cbListRowcount = new System.Windows.Forms.ComboBox(); + this.cbRefreshRate = new System.Windows.Forms.ComboBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.tabView = new System.Windows.Forms.TabControl(); + this.tpPlan = new System.Windows.Forms.TabPage(); + this.dgvPlan = new System.Windows.Forms.DataGridView(); + this.InitNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcOrderNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcSeq = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcMaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcMaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcState = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcPlanDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgcShift = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.No = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tlpPlanCount = new System.Windows.Forms.TableLayoutPanel(); + this.lblDayPlanCount = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.lblShiftCompleteCount = new System.Windows.Forms.Label(); + this.lblShiftPlanCount = new System.Windows.Forms.Label(); + this.lblPlanCount = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.tpRecord = new System.Windows.Forms.TabPage(); + this.DGViewProList = new System.Windows.Forms.DataGridView(); + this.PRODUCTCODE = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PRODUCTCODESTR = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MOLDNUMBER = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.OPERATEDDATE = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PPID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PROID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.OPERATESTATE = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.panel2.SuspendLayout(); + this.panelSearch.SuspendLayout(); + this.plDAI.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DGView)).BeginInit(); + this.toolStrip1.SuspendLayout(); + this.panel4.SuspendLayout(); + this.plInfo.SuspendLayout(); + this.gbMlist.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvMlist)).BeginInit(); + this.plPlanAndRecord.SuspendLayout(); + this.tabView.SuspendLayout(); + this.tpPlan.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvPlan)).BeginInit(); + this.tlpPlanCount.SuspendLayout(); + this.tpRecord.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DGViewProList)).BeginInit(); + this.SuspendLayout(); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.SystemColors.InactiveBorder; + this.panel2.Controls.Add(this.tBMat); + this.panel2.Controls.Add(this.cBoxVAN); + this.panel2.Controls.Add(this.btnChange); + this.panel2.Controls.Add(this.cbMould); + this.panel2.Controls.Add(this.lblError); + this.panel2.Controls.Add(this.lblLock); + this.panel2.Controls.Add(this.comMachine); + this.panel2.Controls.Add(this.btnAdd); + this.panel2.Controls.Add(this.txtCode); + this.panel2.Controls.Add(this.label1); + this.panel2.Controls.Add(this.lblMouldTitle); + this.panel2.Controls.Add(this.label2); + this.panel2.Dock = System.Windows.Forms.DockStyle.Top; + this.panel2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.panel2.Location = new System.Drawing.Point(0, 0); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1698, 148); + this.panel2.TabIndex = 15; + // + // tBMat + // + this.tBMat.BackColor = System.Drawing.SystemColors.InactiveBorder; + this.tBMat.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.tBMat.Font = new System.Drawing.Font("微软雅黑", 24F, System.Drawing.FontStyle.Bold); + this.tBMat.Location = new System.Drawing.Point(773, 101); + this.tBMat.Name = "tBMat"; + this.tBMat.Size = new System.Drawing.Size(335, 43); + this.tBMat.TabIndex = 13; + // + // cBoxVAN + // + this.cBoxVAN.AutoSize = true; + this.cBoxVAN.Location = new System.Drawing.Point(832, 27); + this.cBoxVAN.Name = "cBoxVAN"; + this.cBoxVAN.Size = new System.Drawing.Size(49, 21); + this.cBoxVAN.TabIndex = 12; + this.cBoxVAN.Text = "82V"; + this.cBoxVAN.UseVisualStyleBackColor = true; + this.cBoxVAN.Visible = false; + // + // btnChange + // + this.btnChange.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnChange.Location = new System.Drawing.Point(1058, 17); + this.btnChange.Name = "btnChange"; + this.btnChange.Size = new System.Drawing.Size(96, 31); + this.btnChange.TabIndex = 11; + this.btnChange.Text = "切换设备"; + this.btnChange.UseVisualStyleBackColor = true; + this.btnChange.Visible = false; + this.btnChange.Click += new System.EventHandler(this.btnChange_Click); + // + // cbMould + // + this.cbMould.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbMould.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbMould.FormattingEnabled = true; + this.cbMould.Location = new System.Drawing.Point(895, 18); + this.cbMould.Name = "cbMould"; + this.cbMould.Size = new System.Drawing.Size(151, 29); + this.cbMould.TabIndex = 10; + this.cbMould.SelectedIndexChanged += new System.EventHandler(this.cbMould_SelectedIndexChanged); + // + // lblError + // + this.lblError.BackColor = System.Drawing.SystemColors.InactiveBorder; + this.lblError.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.lblError.Dock = System.Windows.Forms.DockStyle.Bottom; + this.lblError.Font = new System.Drawing.Font("微软雅黑", 24F, System.Drawing.FontStyle.Bold); + this.lblError.Location = new System.Drawing.Point(0, 54); + this.lblError.Multiline = true; + this.lblError.Name = "lblError"; + this.lblError.ReadOnly = true; + this.lblError.Size = new System.Drawing.Size(1698, 94); + this.lblError.TabIndex = 9; + this.lblError.Text = "文字信息"; + // + // lblLock + // + this.lblLock.AutoSize = true; + this.lblLock.Location = new System.Drawing.Point(1160, 22); + this.lblLock.Name = "lblLock"; + this.lblLock.Size = new System.Drawing.Size(56, 17); + this.lblLock.TabIndex = 8; + this.lblLock.TabStop = true; + this.lblLock.Tag = "0"; + this.lblLock.Text = "锁定工位"; + this.lblLock.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblLock_LinkClicked); + // + // comMachine + // + this.comMachine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comMachine.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comMachine.FormattingEnabled = true; + this.comMachine.Location = new System.Drawing.Point(631, 18); + this.comMachine.Name = "comMachine"; + this.comMachine.Size = new System.Drawing.Size(195, 29); + this.comMachine.TabIndex = 7; + this.comMachine.SelectionChangeCommitted += new System.EventHandler(this.comMachine_SelectionChangeCommitted); + // + // btnAdd + // + this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnAdd.Location = new System.Drawing.Point(463, 17); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(65, 31); + this.btnAdd.TabIndex = 6; + this.btnAdd.Text = "提交"; + this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); + // + // txtCode + // + this.txtCode.Font = new System.Drawing.Font("微软雅黑", 12F); + this.txtCode.ImeMode = System.Windows.Forms.ImeMode.Disable; + this.txtCode.Location = new System.Drawing.Point(90, 18); + this.txtCode.Name = "txtCode"; + this.txtCode.Size = new System.Drawing.Size(367, 29); + this.txtCode.TabIndex = 5; + this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(7, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(82, 20); + this.label1.TabIndex = 0; + this.label1.Text = "条 码:"; + // + // lblMouldTitle + // + this.lblMouldTitle.AutoSize = true; + this.lblMouldTitle.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblMouldTitle.Location = new System.Drawing.Point(837, 22); + this.lblMouldTitle.Name = "lblMouldTitle"; + this.lblMouldTitle.Size = new System.Drawing.Size(54, 20); + this.lblMouldTitle.TabIndex = 4; + this.lblMouldTitle.Text = "模架:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(544, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(84, 20); + this.label2.TabIndex = 4; + this.label2.Text = "当前设备:"; + // + // panelSearch + // + this.panelSearch.BackColor = System.Drawing.SystemColors.ScrollBar; + this.panelSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelSearch.Controls.Add(this.cboxSort); + this.panelSearch.Controls.Add(this.lblMould); + this.panelSearch.Controls.Add(this.lblWorkcellState); + this.panelSearch.Controls.Add(this.lblMouldTitle2); + this.panelSearch.Controls.Add(this.label9); + this.panelSearch.Controls.Add(this.label3); + this.panelSearch.Dock = System.Windows.Forms.DockStyle.Top; + this.panelSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.panelSearch.Location = new System.Drawing.Point(0, 148); + this.panelSearch.Name = "panelSearch"; + this.panelSearch.Size = new System.Drawing.Size(1698, 35); + this.panelSearch.TabIndex = 17; + // + // cboxSort + // + this.cboxSort.AutoSize = true; + this.cboxSort.Checked = true; + this.cboxSort.CheckState = System.Windows.Forms.CheckState.Checked; + this.cboxSort.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cboxSort.Location = new System.Drawing.Point(802, 3); + this.cboxSort.Margin = new System.Windows.Forms.Padding(2); + this.cboxSort.Name = "cboxSort"; + this.cboxSort.Size = new System.Drawing.Size(93, 26); + this.cboxSort.TabIndex = 27; + this.cboxSort.Text = "器具排序"; + this.cboxSort.UseVisualStyleBackColor = true; + this.cboxSort.CheckedChanged += new System.EventHandler(this.cboxSort_CheckedChanged); + // + // lblMould + // + this.lblMould.AutoSize = true; + this.lblMould.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblMould.Location = new System.Drawing.Point(498, 4); + this.lblMould.Name = "lblMould"; + this.lblMould.Size = new System.Drawing.Size(0, 26); + this.lblMould.TabIndex = 5; + // + // lblWorkcellState + // + this.lblWorkcellState.AutoSize = true; + this.lblWorkcellState.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblWorkcellState.Location = new System.Drawing.Point(204, 4); + this.lblWorkcellState.Name = "lblWorkcellState"; + this.lblWorkcellState.Size = new System.Drawing.Size(50, 26); + this.lblWorkcellState.TabIndex = 0; + this.lblWorkcellState.Text = "准备"; + // + // lblMouldTitle2 + // + this.lblMouldTitle2.AutoSize = true; + this.lblMouldTitle2.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblMouldTitle2.Location = new System.Drawing.Point(415, 7); + this.lblMouldTitle2.Name = "lblMouldTitle2"; + this.lblMouldTitle2.Size = new System.Drawing.Size(84, 20); + this.lblMouldTitle2.TabIndex = 6; + this.lblMouldTitle2.Text = "当前模架:"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(5, 6); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(74, 22); + this.label9.TabIndex = 0; + this.label9.Text = "数据采集"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(125, 7); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(84, 20); + this.label3.TabIndex = 4; + this.label3.Text = "当前状态:"; + // + // plDAI + // + this.plDAI.Controls.Add(this.DGView); + this.plDAI.Dock = System.Windows.Forms.DockStyle.Top; + this.plDAI.Location = new System.Drawing.Point(0, 183); + this.plDAI.Name = "plDAI"; + this.plDAI.Size = new System.Drawing.Size(1698, 127); + this.plDAI.TabIndex = 18; + // + // DGView + // + this.DGView.AllowUserToAddRows = false; + this.DGView.AllowUserToDeleteRows = false; + this.DGView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.DGView.BackgroundColor = System.Drawing.SystemColors.ButtonFace; + dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle31.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle31.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + dataGridViewCellStyle31.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle31.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle31.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.DGView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle31; + this.DGView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.DGView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dgcMouldCode, + this.dgcMouldName, + this.daname, + this.statename, + this.datype, + this.materialtypename, + this.dgcDAMaterialCode, + this.davalue, + this.daresult, + this.Pid}); + dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle41.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle41.Padding = new System.Windows.Forms.Padding(0, 0, 14, 0); + dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.DGView.DefaultCellStyle = dataGridViewCellStyle41; + this.DGView.Dock = System.Windows.Forms.DockStyle.Fill; + this.DGView.GridColor = System.Drawing.SystemColors.ControlDarkDark; + this.DGView.Location = new System.Drawing.Point(0, 0); + this.DGView.Name = "DGView"; + this.DGView.ReadOnly = true; + dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle42.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle42.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle42.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle42.SelectionBackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle42.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle42.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.DGView.RowHeadersDefaultCellStyle = dataGridViewCellStyle42; + this.DGView.RowTemplate.Height = 30; + this.DGView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.DGView.Size = new System.Drawing.Size(1698, 127); + this.DGView.TabIndex = 3; + this.DGView.Tag = "0"; + this.DGView.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.DG_RowPostPaint); + // + // dgcMouldCode + // + this.dgcMouldCode.DataPropertyName = "MouldCode"; + dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle32.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.dgcMouldCode.DefaultCellStyle = dataGridViewCellStyle32; + this.dgcMouldCode.HeaderText = "模架编号"; + this.dgcMouldCode.Name = "dgcMouldCode"; + this.dgcMouldCode.ReadOnly = true; + this.dgcMouldCode.Visible = false; + this.dgcMouldCode.Width = 115; + // + // dgcMouldName + // + this.dgcMouldName.DataPropertyName = "MouldName"; + dataGridViewCellStyle33.Font = new System.Drawing.Font("微软雅黑", 15.25F, System.Drawing.FontStyle.Bold); + this.dgcMouldName.DefaultCellStyle = dataGridViewCellStyle33; + this.dgcMouldName.HeaderText = "模架"; + this.dgcMouldName.Name = "dgcMouldName"; + this.dgcMouldName.ReadOnly = true; + this.dgcMouldName.Width = 81; + // + // daname + // + this.daname.DataPropertyName = "DAName"; + dataGridViewCellStyle34.Font = new System.Drawing.Font("宋体", 15.75F); + this.daname.DefaultCellStyle = dataGridViewCellStyle34; + this.daname.HeaderText = "采集项名称"; + this.daname.Name = "daname"; + this.daname.ReadOnly = true; + this.daname.Width = 132; + // + // statename + // + this.statename.DataPropertyName = "StateName"; + dataGridViewCellStyle35.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statename.DefaultCellStyle = dataGridViewCellStyle35; + this.statename.HeaderText = "采集时序"; + this.statename.Name = "statename"; + this.statename.ReadOnly = true; + this.statename.Visible = false; + this.statename.Width = 115; + // + // datype + // + this.datype.DataPropertyName = "DAType"; + dataGridViewCellStyle36.Font = new System.Drawing.Font("宋体", 15.75F); + this.datype.DefaultCellStyle = dataGridViewCellStyle36; + this.datype.HeaderText = "数据类型"; + this.datype.Name = "datype"; + this.datype.ReadOnly = true; + this.datype.Width = 115; + // + // materialtypename + // + this.materialtypename.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.materialtypename.DataPropertyName = "MaterialCode"; + dataGridViewCellStyle37.Font = new System.Drawing.Font("宋体", 15.75F); + this.materialtypename.DefaultCellStyle = dataGridViewCellStyle37; + this.materialtypename.FillWeight = 50F; + this.materialtypename.HeaderText = "物料类型"; + this.materialtypename.Name = "materialtypename"; + this.materialtypename.ReadOnly = true; + // + // dgcDAMaterialCode + // + this.dgcDAMaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.dgcDAMaterialCode.DataPropertyName = "MaterialName"; + dataGridViewCellStyle38.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgcDAMaterialCode.DefaultCellStyle = dataGridViewCellStyle38; + this.dgcDAMaterialCode.FillWeight = 50F; + this.dgcDAMaterialCode.HeaderText = "物料名称"; + this.dgcDAMaterialCode.Name = "dgcDAMaterialCode"; + this.dgcDAMaterialCode.ReadOnly = true; + // + // davalue + // + this.davalue.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.davalue.DataPropertyName = "DAValue"; + dataGridViewCellStyle39.Font = new System.Drawing.Font("宋体", 15.75F); + this.davalue.DefaultCellStyle = dataGridViewCellStyle39; + this.davalue.HeaderText = "采集值"; + this.davalue.Name = "davalue"; + this.davalue.ReadOnly = true; + // + // daresult + // + this.daresult.DataPropertyName = "DAResult"; + dataGridViewCellStyle40.Font = new System.Drawing.Font("宋体", 15.75F); + this.daresult.DefaultCellStyle = dataGridViewCellStyle40; + this.daresult.HeaderText = "结果"; + this.daresult.Name = "daresult"; + this.daresult.ReadOnly = true; + this.daresult.Width = 81; + // + // Pid + // + this.Pid.DataPropertyName = "DACode"; + this.Pid.HeaderText = "DACode"; + this.Pid.Name = "Pid"; + this.Pid.ReadOnly = true; + this.Pid.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.Pid.Visible = false; + this.Pid.Width = 101; + // + // toolStrip1 + // + this.toolStrip1.AutoSize = false; + this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tsbCancel, + this.tsbReSignal, + this.tsbPass, + this.tsbRecovery, + this.tsbConnect, + this.tsbPrint, + this.tsbOrderOperation, + this.tsbAndon, + this.tsbSearch, + this.btnEditProduct, + this.btnRefresh, + this.toolStripButton1, + this.toolStripButton3}); + this.toolStrip1.Location = new System.Drawing.Point(0, 544); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(1698, 70); + this.toolStrip1.Stretch = true; + this.toolStrip1.TabIndex = 19; + this.toolStrip1.Text = "toolStrip1"; + // + // tsbCancel + // + this.tsbCancel.AutoSize = false; + this.tsbCancel.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbCancel.Image = ((System.Drawing.Image)(resources.GetObject("tsbCancel.Image"))); + this.tsbCancel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbCancel.ImageTransparentColor = System.Drawing.Color.White; + this.tsbCancel.Name = "tsbCancel"; + this.tsbCancel.Size = new System.Drawing.Size(100, 60); + this.tsbCancel.Text = "复位"; + this.tsbCancel.ToolTipText = "取消"; + this.tsbCancel.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tsbCancel_DropDownItemClicked); + this.tsbCancel.Click += new System.EventHandler(this.tsbCancel_Click); + // + // tsbReSignal + // + this.tsbReSignal.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbReSignal.Image = global::QMAPP.WinForm.Resource1.signal; + this.tsbReSignal.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbReSignal.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbReSignal.Name = "tsbReSignal"; + this.tsbReSignal.Size = new System.Drawing.Size(131, 67); + this.tsbReSignal.Text = "重发信号"; + this.tsbReSignal.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tsbReSignal_DropDownItemClicked); + this.tsbReSignal.Click += new System.EventHandler(this.tsbReSignal_Click); + // + // tsbPass + // + this.tsbPass.AutoSize = false; + this.tsbPass.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbPass.Image = ((System.Drawing.Image)(resources.GetObject("tsbPass.Image"))); + this.tsbPass.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbPass.ImageTransparentColor = System.Drawing.Color.White; + this.tsbPass.Name = "tsbPass"; + this.tsbPass.Size = new System.Drawing.Size(100, 60); + this.tsbPass.Text = "放行"; + this.tsbPass.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tsbPass_DropDownItemClicked); + this.tsbPass.Click += new System.EventHandler(this.tsbPass_Click); + // + // tsbRecovery + // + this.tsbRecovery.AutoSize = false; + this.tsbRecovery.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbRecovery.Image = ((System.Drawing.Image)(resources.GetObject("tsbRecovery.Image"))); + this.tsbRecovery.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbRecovery.ImageTransparentColor = System.Drawing.Color.White; + this.tsbRecovery.Name = "tsbRecovery"; + this.tsbRecovery.Size = new System.Drawing.Size(100, 60); + this.tsbRecovery.Text = "撤销"; + this.tsbRecovery.ToolTipText = "取消"; + this.tsbRecovery.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tsbRecovery_DropDownItemClicked); + this.tsbRecovery.Click += new System.EventHandler(this.tsbRecovery_Click); + // + // tsbConnect + // + this.tsbConnect.AutoSize = false; + this.tsbConnect.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbConnect.Image = ((System.Drawing.Image)(resources.GetObject("tsbConnect.Image"))); + this.tsbConnect.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbConnect.ImageTransparentColor = System.Drawing.Color.White; + this.tsbConnect.Name = "tsbConnect"; + this.tsbConnect.Size = new System.Drawing.Size(140, 60); + this.tsbConnect.Text = "重接服务器"; + this.tsbConnect.Click += new System.EventHandler(this.tsbConnect_Click); + // + // tsbPrint + // + this.tsbPrint.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbPrint.Image = ((System.Drawing.Image)(resources.GetObject("tsbPrint.Image"))); + this.tsbPrint.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbPrint.ImageTransparentColor = System.Drawing.Color.White; + this.tsbPrint.Name = "tsbPrint"; + this.tsbPrint.Size = new System.Drawing.Size(142, 67); + this.tsbPrint.Text = "重打总成码"; + this.tsbPrint.Visible = false; + this.tsbPrint.Click += new System.EventHandler(this.tsbPrint_Click); + // + // tsbOrderOperation + // + this.tsbOrderOperation.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tsmiSuspendOrder, + this.tsmiCancelSuspend, + this.tsmiResetOrder, + this.tsmiTakebackOrder, + this.tsmiDeleteOrder, + this.tsmiIgnoreFISBreak}); + this.tsbOrderOperation.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbOrderOperation.Image = global::QMAPP.WinForm.Resource1.edit; + this.tsbOrderOperation.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbOrderOperation.ImageTransparentColor = System.Drawing.Color.White; + this.tsbOrderOperation.Name = "tsbOrderOperation"; + this.tsbOrderOperation.Size = new System.Drawing.Size(135, 67); + this.tsbOrderOperation.Text = "工单操作"; + this.tsbOrderOperation.Visible = false; + // + // tsmiSuspendOrder + // + this.tsmiSuspendOrder.Image = global::QMAPP.WinForm.Resource1.stop; + this.tsmiSuspendOrder.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiSuspendOrder.Name = "tsmiSuspendOrder"; + this.tsmiSuspendOrder.Size = new System.Drawing.Size(184, 26); + this.tsmiSuspendOrder.Text = "挂起工单"; + this.tsmiSuspendOrder.TextAlign = System.Drawing.ContentAlignment.BottomCenter; + this.tsmiSuspendOrder.Click += new System.EventHandler(this.tsmiSuspendOrder_Click); + // + // tsmiCancelSuspend + // + this.tsmiCancelSuspend.Image = global::QMAPP.WinForm.Resource1.back; + this.tsmiCancelSuspend.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiCancelSuspend.Name = "tsmiCancelSuspend"; + this.tsmiCancelSuspend.Size = new System.Drawing.Size(184, 26); + this.tsmiCancelSuspend.Text = "取消挂起"; + this.tsmiCancelSuspend.Click += new System.EventHandler(this.tsmiCancelSuspend_Click); + // + // tsmiResetOrder + // + this.tsmiResetOrder.Image = global::QMAPP.WinForm.Resource1.reload; + this.tsmiResetOrder.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiResetOrder.Name = "tsmiResetOrder"; + this.tsmiResetOrder.Size = new System.Drawing.Size(184, 26); + this.tsmiResetOrder.Text = "重置工单"; + this.tsmiResetOrder.Click += new System.EventHandler(this.tsmiResetOrder_Click); + // + // tsmiTakebackOrder + // + this.tsmiTakebackOrder.Image = global::QMAPP.WinForm.Resource1.undo; + this.tsmiTakebackOrder.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiTakebackOrder.Name = "tsmiTakebackOrder"; + this.tsmiTakebackOrder.Size = new System.Drawing.Size(184, 26); + this.tsmiTakebackOrder.Text = "收回工单"; + this.tsmiTakebackOrder.Click += new System.EventHandler(this.tsmiTakebackOrder_Click); + // + // tsmiDeleteOrder + // + this.tsmiDeleteOrder.Image = global::QMAPP.WinForm.Resource1.delete; + this.tsmiDeleteOrder.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiDeleteOrder.Name = "tsmiDeleteOrder"; + this.tsmiDeleteOrder.Size = new System.Drawing.Size(184, 26); + this.tsmiDeleteOrder.Text = "删除工单"; + this.tsmiDeleteOrder.Click += new System.EventHandler(this.tsmiDeleteOrder_Click); + // + // tsmiIgnoreFISBreak + // + this.tsmiIgnoreFISBreak.Image = global::QMAPP.WinForm.Resource1.recover; + this.tsmiIgnoreFISBreak.Margin = new System.Windows.Forms.Padding(0, 7, 0, 7); + this.tsmiIgnoreFISBreak.Name = "tsmiIgnoreFISBreak"; + this.tsmiIgnoreFISBreak.Size = new System.Drawing.Size(184, 26); + this.tsmiIgnoreFISBreak.Text = "忽略FIS断号"; + this.tsmiIgnoreFISBreak.Click += new System.EventHandler(this.tsmiIgnoreFISBreak_Click); + // + // tsbAndon + // + this.tsbAndon.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbAndon.Image = global::QMAPP.WinForm.Resource1.call; + this.tsbAndon.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbAndon.ImageTransparentColor = System.Drawing.Color.White; + this.tsbAndon.Name = "tsbAndon"; + this.tsbAndon.Size = new System.Drawing.Size(147, 67); + this.tsbAndon.Text = "ANDON呼叫"; + this.tsbAndon.Visible = false; + this.tsbAndon.Click += new System.EventHandler(this.tsbAndon_Click); + // + // tsbSearch + // + this.tsbSearch.AutoSize = false; + this.tsbSearch.Font = new System.Drawing.Font("微软雅黑", 12F); + this.tsbSearch.Image = ((System.Drawing.Image)(resources.GetObject("tsbSearch.Image"))); + this.tsbSearch.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.tsbSearch.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbSearch.Name = "tsbSearch"; + this.tsbSearch.Size = new System.Drawing.Size(100, 60); + this.tsbSearch.Text = "查询"; + this.tsbSearch.Click += new System.EventHandler(this.tsbSearch_Click); + // + // btnEditProduct + // + this.btnEditProduct.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnEditProduct.Image = global::QMAPP.WinForm.Resource1.edit; + this.btnEditProduct.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btnEditProduct.ImageTransparentColor = System.Drawing.Color.White; + this.btnEditProduct.Name = "btnEditProduct"; + this.btnEditProduct.Size = new System.Drawing.Size(126, 67); + this.btnEditProduct.Text = "产品返修"; + this.btnEditProduct.Visible = false; + this.btnEditProduct.Click += new System.EventHandler(this.btnEditProduct_Click); + // + // btnRefresh + // + this.btnRefresh.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefresh.Image = global::QMAPP.WinForm.Resource1.reload; + this.btnRefresh.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btnRefresh.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnRefresh.Name = "btnRefresh"; + this.btnRefresh.Size = new System.Drawing.Size(62, 67); + this.btnRefresh.Text = "刷新"; + this.btnRefresh.Visible = false; + this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); + // + // toolStripButton1 + // + this.toolStripButton1.Image = global::QMAPP.WinForm.Resource1.barchart; + this.toolStripButton1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(120, 67); + this.toolStripButton1.Text = "缺陷统计卡"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); + // + // toolStripButton3 + // + this.toolStripButton3.AutoSize = false; + this.toolStripButton3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.toolStripButton3.Image = global::QMAPP.WinForm.Resource1.print1; + this.toolStripButton3.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.White; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(140, 60); + this.toolStripButton3.Text = "补打总成码"; + this.toolStripButton3.Visible = false; + this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click); + // + // panel4 + // + this.panel4.BackColor = System.Drawing.SystemColors.ScrollBar; + this.panel4.Controls.Add(this.plInfo); + this.panel4.Controls.Add(this.plPlanAndRecord); + this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel4.Location = new System.Drawing.Point(0, 310); + this.panel4.Name = "panel4"; + this.panel4.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0); + this.panel4.Size = new System.Drawing.Size(1698, 234); + this.panel4.TabIndex = 21; + // + // plInfo + // + this.plInfo.BackColor = System.Drawing.SystemColors.Control; + this.plInfo.Controls.Add(this.gbMlist); + this.plInfo.Controls.Add(this.btnCollapse); + this.plInfo.Dock = System.Windows.Forms.DockStyle.Right; + this.plInfo.Location = new System.Drawing.Point(1579, 3); + this.plInfo.Name = "plInfo"; + this.plInfo.Padding = new System.Windows.Forms.Padding(5); + this.plInfo.Size = new System.Drawing.Size(119, 231); + this.plInfo.TabIndex = 1; + this.plInfo.Visible = false; + // + // gbMlist + // + this.gbMlist.Controls.Add(this.dgvMlist); + this.gbMlist.Dock = System.Windows.Forms.DockStyle.Fill; + this.gbMlist.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.gbMlist.Location = new System.Drawing.Point(41, 5); + this.gbMlist.Name = "gbMlist"; + this.gbMlist.Size = new System.Drawing.Size(73, 221); + this.gbMlist.TabIndex = 0; + this.gbMlist.TabStop = false; + this.gbMlist.Text = "装配物料清单"; + // + // dgvMlist + // + this.dgvMlist.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvMlist.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dgcMListMaterialName, + this.dgcMListMaterialCode, + this.dgcMListQty}); + this.dgvMlist.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvMlist.Location = new System.Drawing.Point(3, 28); + this.dgvMlist.Name = "dgvMlist"; + this.dgvMlist.ReadOnly = true; + this.dgvMlist.RowHeadersVisible = false; + this.dgvMlist.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgvMlist.RowTemplate.Height = 35; + this.dgvMlist.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgvMlist.Size = new System.Drawing.Size(67, 190); + this.dgvMlist.TabIndex = 0; + // + // dgcMListMaterialName + // + this.dgcMListMaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.dgcMListMaterialName.DataPropertyName = "MATERIAL_NAME"; + this.dgcMListMaterialName.HeaderText = "物料名称"; + this.dgcMListMaterialName.Name = "dgcMListMaterialName"; + this.dgcMListMaterialName.ReadOnly = true; + this.dgcMListMaterialName.Width = 113; + // + // dgcMListMaterialCode + // + this.dgcMListMaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.dgcMListMaterialCode.DataPropertyName = "MATERIAL_CODE"; + this.dgcMListMaterialCode.HeaderText = "物料号"; + this.dgcMListMaterialCode.Name = "dgcMListMaterialCode"; + this.dgcMListMaterialCode.ReadOnly = true; + this.dgcMListMaterialCode.Width = 94; + // + // dgcMListQty + // + this.dgcMListQty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.dgcMListQty.DataPropertyName = "UNIT_SUM"; + this.dgcMListQty.HeaderText = "数量"; + this.dgcMListQty.Name = "dgcMListQty"; + this.dgcMListQty.ReadOnly = true; + this.dgcMListQty.Width = 75; + // + // btnCollapse + // + this.btnCollapse.Dock = System.Windows.Forms.DockStyle.Left; + this.btnCollapse.Image = global::QMAPP.WinForm.Resource1.back; + this.btnCollapse.Location = new System.Drawing.Point(5, 5); + this.btnCollapse.Name = "btnCollapse"; + this.btnCollapse.Size = new System.Drawing.Size(36, 221); + this.btnCollapse.TabIndex = 1; + this.btnCollapse.UseVisualStyleBackColor = true; + this.btnCollapse.Click += new System.EventHandler(this.btnCollapse_Click); + // + // plPlanAndRecord + // + this.plPlanAndRecord.Controls.Add(this.cbPlanFilter); + this.plPlanAndRecord.Controls.Add(this.label10); + this.plPlanAndRecord.Controls.Add(this.cbListRowcount); + this.plPlanAndRecord.Controls.Add(this.cbRefreshRate); + this.plPlanAndRecord.Controls.Add(this.label8); + this.plPlanAndRecord.Controls.Add(this.label6); + this.plPlanAndRecord.Controls.Add(this.tabView); + this.plPlanAndRecord.Dock = System.Windows.Forms.DockStyle.Fill; + this.plPlanAndRecord.Location = new System.Drawing.Point(0, 3); + this.plPlanAndRecord.Name = "plPlanAndRecord"; + this.plPlanAndRecord.Size = new System.Drawing.Size(1698, 231); + this.plPlanAndRecord.TabIndex = 0; + // + // cbPlanFilter + // + this.cbPlanFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cbPlanFilter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbPlanFilter.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbPlanFilter.FormattingEnabled = true; + this.cbPlanFilter.Items.AddRange(new object[] { + "显示全部工单", + "隐藏挂起工单", + "只看挂起工单"}); + this.cbPlanFilter.Location = new System.Drawing.Point(1230, 1); + this.cbPlanFilter.Name = "cbPlanFilter"; + this.cbPlanFilter.Size = new System.Drawing.Size(143, 33); + this.cbPlanFilter.TabIndex = 17; + this.cbPlanFilter.Visible = false; + // + // label10 + // + this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(1172, 11); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(53, 12); + this.label10.TabIndex = 16; + this.label10.Text = "工单过滤"; + this.label10.Visible = false; + // + // cbListRowcount + // + this.cbListRowcount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cbListRowcount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbListRowcount.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbListRowcount.FormattingEnabled = true; + this.cbListRowcount.Items.AddRange(new object[] { + "20", + "30", + "40", + "50", + "100"}); + this.cbListRowcount.Location = new System.Drawing.Point(1460, 1); + this.cbListRowcount.Name = "cbListRowcount"; + this.cbListRowcount.Size = new System.Drawing.Size(78, 33); + this.cbListRowcount.TabIndex = 15; + // + // cbRefreshRate + // + this.cbRefreshRate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cbRefreshRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbRefreshRate.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbRefreshRate.FormattingEnabled = true; + this.cbRefreshRate.Items.AddRange(new object[] { + "1s", + "2s", + "5s", + "10s", + "15s", + "20s"}); + this.cbRefreshRate.Location = new System.Drawing.Point(1625, 1); + this.cbRefreshRate.Name = "cbRefreshRate"; + this.cbRefreshRate.Size = new System.Drawing.Size(66, 33); + this.cbRefreshRate.TabIndex = 14; + // + // label8 + // + this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(1378, 11); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(77, 12); + this.label8.TabIndex = 12; + this.label8.Text = "列表显示行数"; + // + // label6 + // + this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(1543, 11); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(77, 12); + this.label6.TabIndex = 13; + this.label6.Text = "计划刷新频率"; + // + // tabView + // + this.tabView.Controls.Add(this.tpPlan); + this.tabView.Controls.Add(this.tpRecord); + this.tabView.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabView.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.tabView.ItemSize = new System.Drawing.Size(120, 32); + this.tabView.Location = new System.Drawing.Point(0, 0); + this.tabView.Name = "tabView"; + this.tabView.SelectedIndex = 0; + this.tabView.Size = new System.Drawing.Size(1698, 231); + this.tabView.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; + this.tabView.TabIndex = 11; + // + // tpPlan + // + this.tpPlan.Controls.Add(this.dgvPlan); + this.tpPlan.Controls.Add(this.tlpPlanCount); + this.tpPlan.Location = new System.Drawing.Point(4, 36); + this.tpPlan.Name = "tpPlan"; + this.tpPlan.Size = new System.Drawing.Size(1690, 191); + this.tpPlan.TabIndex = 0; + this.tpPlan.Text = "生产计划"; + this.tpPlan.UseVisualStyleBackColor = true; + // + // dgvPlan + // + this.dgvPlan.AllowUserToAddRows = false; + this.dgvPlan.AllowUserToDeleteRows = false; + this.dgvPlan.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dgvPlan.BackgroundColor = System.Drawing.SystemColors.ButtonFace; + dataGridViewCellStyle43.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle43.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle43.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle43.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle43.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle43.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle43.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvPlan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle43; + this.dgvPlan.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvPlan.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.InitNo, + this.dgcOrderNo, + this.dgcSeq, + this.dgcMaterialCode, + this.dgcMaterialName, + this.dgcState, + this.dgcPlanDate, + this.dgcShift, + this.dataGridViewTextBoxColumn8, + this.dataGridViewTextBoxColumn9, + this.dataGridViewTextBoxColumn10, + this.dataGridViewTextBoxColumn11, + this.No}); + this.dgvPlan.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvPlan.Location = new System.Drawing.Point(0, 0); + this.dgvPlan.Name = "dgvPlan"; + this.dgvPlan.ReadOnly = true; + dataGridViewCellStyle51.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle51.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle51.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle51.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle51.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle51.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle51.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvPlan.RowHeadersDefaultCellStyle = dataGridViewCellStyle51; + dataGridViewCellStyle52.Padding = new System.Windows.Forms.Padding(0, 0, 8, 0); + this.dgvPlan.RowsDefaultCellStyle = dataGridViewCellStyle52; + this.dgvPlan.RowTemplate.Height = 23; + this.dgvPlan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgvPlan.Size = new System.Drawing.Size(1525, 191); + this.dgvPlan.TabIndex = 6; + this.dgvPlan.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.dgvPlan_RowPrePaint); + this.dgvPlan.SelectionChanged += new System.EventHandler(this.dgvPlan_SelectionChanged); + // + // InitNo + // + this.InitNo.DataPropertyName = "InitNo"; + this.InitNo.HeaderText = "位置"; + this.InitNo.Name = "InitNo"; + this.InitNo.ReadOnly = true; + this.InitNo.Width = 67; + // + // dgcOrderNo + // + this.dgcOrderNo.DataPropertyName = "ORDERPLAN_NO"; + dataGridViewCellStyle44.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgcOrderNo.DefaultCellStyle = dataGridViewCellStyle44; + this.dgcOrderNo.HeaderText = "订单号"; + this.dgcOrderNo.Name = "dgcOrderNo"; + this.dgcOrderNo.ReadOnly = true; + this.dgcOrderNo.Width = 84; + // + // dgcSeq + // + this.dgcSeq.DataPropertyName = "SEQ"; + dataGridViewCellStyle45.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcSeq.DefaultCellStyle = dataGridViewCellStyle45; + this.dgcSeq.HeaderText = "顺序号"; + this.dgcSeq.Name = "dgcSeq"; + this.dgcSeq.ReadOnly = true; + this.dgcSeq.Width = 84; + // + // dgcMaterialCode + // + this.dgcMaterialCode.DataPropertyName = "MATERIAL_CODE"; + dataGridViewCellStyle46.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcMaterialCode.DefaultCellStyle = dataGridViewCellStyle46; + this.dgcMaterialCode.HeaderText = "零件号"; + this.dgcMaterialCode.Name = "dgcMaterialCode"; + this.dgcMaterialCode.ReadOnly = true; + this.dgcMaterialCode.Width = 84; + // + // dgcMaterialName + // + this.dgcMaterialName.DataPropertyName = "MATERIAL_NAME"; + dataGridViewCellStyle47.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcMaterialName.DefaultCellStyle = dataGridViewCellStyle47; + this.dgcMaterialName.HeaderText = "零件描述"; + this.dgcMaterialName.Name = "dgcMaterialName"; + this.dgcMaterialName.ReadOnly = true; + this.dgcMaterialName.Width = 101; + // + // dgcState + // + dataGridViewCellStyle48.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgcState.DefaultCellStyle = dataGridViewCellStyle48; + this.dgcState.HeaderText = "工单状态"; + this.dgcState.MinimumWidth = 80; + this.dgcState.Name = "dgcState"; + this.dgcState.ReadOnly = true; + this.dgcState.Width = 101; + // + // dgcPlanDate + // + this.dgcPlanDate.DataPropertyName = "PLAN_DATE"; + dataGridViewCellStyle49.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcPlanDate.DefaultCellStyle = dataGridViewCellStyle49; + this.dgcPlanDate.HeaderText = "计划日期"; + this.dgcPlanDate.Name = "dgcPlanDate"; + this.dgcPlanDate.ReadOnly = true; + this.dgcPlanDate.Width = 101; + // + // dgcShift + // + this.dgcShift.DataPropertyName = "SHIFT_CODE"; + dataGridViewCellStyle50.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcShift.DefaultCellStyle = dataGridViewCellStyle50; + this.dgcShift.HeaderText = "班次"; + this.dgcShift.Name = "dgcShift"; + this.dgcShift.ReadOnly = true; + this.dgcShift.Width = 67; + // + // dataGridViewTextBoxColumn8 + // + this.dataGridViewTextBoxColumn8.DataPropertyName = "PID"; + this.dataGridViewTextBoxColumn8.HeaderText = "Pid"; + this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8"; + this.dataGridViewTextBoxColumn8.ReadOnly = true; + this.dataGridViewTextBoxColumn8.Width = 60; + // + // dataGridViewTextBoxColumn9 + // + this.dataGridViewTextBoxColumn9.DataPropertyName = "PDID"; + this.dataGridViewTextBoxColumn9.HeaderText = "PROID"; + this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9"; + this.dataGridViewTextBoxColumn9.ReadOnly = true; + this.dataGridViewTextBoxColumn9.Visible = false; + this.dataGridViewTextBoxColumn9.Width = 78; + // + // dataGridViewTextBoxColumn10 + // + this.dataGridViewTextBoxColumn10.DataPropertyName = "PRODUCTTYPE"; + this.dataGridViewTextBoxColumn10.HeaderText = "PType"; + this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10"; + this.dataGridViewTextBoxColumn10.ReadOnly = true; + this.dataGridViewTextBoxColumn10.Visible = false; + this.dataGridViewTextBoxColumn10.Width = 78; + // + // dataGridViewTextBoxColumn11 + // + this.dataGridViewTextBoxColumn11.DataPropertyName = "OPERATESTATE"; + this.dataGridViewTextBoxColumn11.HeaderText = "OPERATESTATE"; + this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11"; + this.dataGridViewTextBoxColumn11.ReadOnly = true; + this.dataGridViewTextBoxColumn11.Visible = false; + this.dataGridViewTextBoxColumn11.Width = 141; + // + // No + // + this.No.DataPropertyName = "No"; + this.No.HeaderText = "架顺序"; + this.No.Name = "No"; + this.No.ReadOnly = true; + this.No.Visible = false; + this.No.Width = 84; + // + // tlpPlanCount + // + this.tlpPlanCount.BackColor = System.Drawing.SystemColors.ScrollBar; + this.tlpPlanCount.ColumnCount = 1; + this.tlpPlanCount.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpPlanCount.Controls.Add(this.lblDayPlanCount, 0, 1); + this.tlpPlanCount.Controls.Add(this.label11, 0, 0); + this.tlpPlanCount.Controls.Add(this.lblShiftCompleteCount, 0, 7); + this.tlpPlanCount.Controls.Add(this.lblShiftPlanCount, 0, 5); + this.tlpPlanCount.Controls.Add(this.lblPlanCount, 0, 3); + this.tlpPlanCount.Controls.Add(this.label7, 0, 6); + this.tlpPlanCount.Controls.Add(this.label5, 0, 4); + this.tlpPlanCount.Controls.Add(this.label4, 0, 2); + this.tlpPlanCount.Dock = System.Windows.Forms.DockStyle.Right; + this.tlpPlanCount.Location = new System.Drawing.Point(1525, 0); + this.tlpPlanCount.Name = "tlpPlanCount"; + this.tlpPlanCount.RowCount = 8; + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.774436F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.03759F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.774436F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.03759F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.774436F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.03759F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.774436F)); + this.tlpPlanCount.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.78947F)); + this.tlpPlanCount.Size = new System.Drawing.Size(165, 191); + this.tlpPlanCount.TabIndex = 4; + // + // lblDayPlanCount + // + this.lblDayPlanCount.AutoSize = true; + this.lblDayPlanCount.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblDayPlanCount.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblDayPlanCount.Location = new System.Drawing.Point(3, 18); + this.lblDayPlanCount.Name = "lblDayPlanCount"; + this.lblDayPlanCount.Size = new System.Drawing.Size(159, 28); + this.lblDayPlanCount.TabIndex = 8; + this.lblDayPlanCount.Text = "0"; + this.lblDayPlanCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Dock = System.Windows.Forms.DockStyle.Bottom; + this.label11.Location = new System.Drawing.Point(3, 2); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(159, 16); + this.label11.TabIndex = 7; + this.label11.Text = "当日计划总数量"; + // + // lblShiftCompleteCount + // + this.lblShiftCompleteCount.AutoSize = true; + this.lblShiftCompleteCount.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblShiftCompleteCount.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblShiftCompleteCount.Location = new System.Drawing.Point(3, 156); + this.lblShiftCompleteCount.Name = "lblShiftCompleteCount"; + this.lblShiftCompleteCount.Size = new System.Drawing.Size(159, 35); + this.lblShiftCompleteCount.TabIndex = 6; + this.lblShiftCompleteCount.Text = "0"; + this.lblShiftCompleteCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblShiftPlanCount + // + this.lblShiftPlanCount.AutoSize = true; + this.lblShiftPlanCount.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblShiftPlanCount.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblShiftPlanCount.Location = new System.Drawing.Point(3, 110); + this.lblShiftPlanCount.Name = "lblShiftPlanCount"; + this.lblShiftPlanCount.Size = new System.Drawing.Size(159, 28); + this.lblShiftPlanCount.TabIndex = 5; + this.lblShiftPlanCount.Text = "0"; + this.lblShiftPlanCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblPlanCount + // + this.lblPlanCount.AutoSize = true; + this.lblPlanCount.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblPlanCount.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblPlanCount.Location = new System.Drawing.Point(3, 64); + this.lblPlanCount.Name = "lblPlanCount"; + this.lblPlanCount.Size = new System.Drawing.Size(159, 28); + this.lblPlanCount.TabIndex = 4; + this.lblPlanCount.Text = "0"; + this.lblPlanCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Dock = System.Windows.Forms.DockStyle.Bottom; + this.label7.Location = new System.Drawing.Point(3, 140); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(159, 16); + this.label7.TabIndex = 2; + this.label7.Text = "本班次已完成数量"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Dock = System.Windows.Forms.DockStyle.Bottom; + this.label5.Location = new System.Drawing.Point(3, 94); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(159, 16); + this.label5.TabIndex = 1; + this.label5.Text = "本班次待完成数量"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Dock = System.Windows.Forms.DockStyle.Bottom; + this.label4.Location = new System.Drawing.Point(3, 48); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(159, 16); + this.label4.TabIndex = 0; + this.label4.Text = "待完成计划数量"; + // + // tpRecord + // + this.tpRecord.Controls.Add(this.DGViewProList); + this.tpRecord.Location = new System.Drawing.Point(4, 36); + this.tpRecord.Name = "tpRecord"; + this.tpRecord.Size = new System.Drawing.Size(1690, 191); + this.tpRecord.TabIndex = 1; + this.tpRecord.Text = "加工记录"; + this.tpRecord.UseVisualStyleBackColor = true; + // + // DGViewProList + // + this.DGViewProList.AllowUserToAddRows = false; + this.DGViewProList.AllowUserToDeleteRows = false; + this.DGViewProList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.DGViewProList.BackgroundColor = System.Drawing.SystemColors.ButtonFace; + dataGridViewCellStyle53.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle53.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle53.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle53.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle53.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle53.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle53.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.DGViewProList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle53; + this.DGViewProList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.DGViewProList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.PRODUCTCODE, + this.PRODUCTCODESTR, + this.MOLDNUMBER, + this.dataGridViewTextBoxColumn2, + this.Column5, + this.OPERATEDDATE, + this.PPID, + this.PROID, + this.PType, + this.OPERATESTATE}); + this.DGViewProList.Dock = System.Windows.Forms.DockStyle.Fill; + this.DGViewProList.Location = new System.Drawing.Point(0, 0); + this.DGViewProList.Name = "DGViewProList"; + this.DGViewProList.ReadOnly = true; + dataGridViewCellStyle60.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle60.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle60.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle60.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle60.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle60.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle60.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.DGViewProList.RowHeadersDefaultCellStyle = dataGridViewCellStyle60; + this.DGViewProList.RowTemplate.Height = 23; + this.DGViewProList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.DGViewProList.Size = new System.Drawing.Size(1690, 191); + this.DGViewProList.TabIndex = 5; + this.DGViewProList.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.DGViewProList_RowPrePaint); + // + // PRODUCTCODE + // + this.PRODUCTCODE.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.PRODUCTCODE.DataPropertyName = "PRODUCTCODE"; + dataGridViewCellStyle54.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PRODUCTCODE.DefaultCellStyle = dataGridViewCellStyle54; + this.PRODUCTCODE.FillWeight = 29.82234F; + this.PRODUCTCODE.HeaderText = "条码"; + this.PRODUCTCODE.Name = "PRODUCTCODE"; + this.PRODUCTCODE.ReadOnly = true; + this.PRODUCTCODE.Width = 240; + // + // PRODUCTCODESTR + // + this.PRODUCTCODESTR.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.PRODUCTCODESTR.DataPropertyName = "PRODUCTCODESTR"; + dataGridViewCellStyle55.Font = new System.Drawing.Font("宋体", 15.75F); + this.PRODUCTCODESTR.DefaultCellStyle = dataGridViewCellStyle55; + this.PRODUCTCODESTR.HeaderText = "骨架条码"; + this.PRODUCTCODESTR.Name = "PRODUCTCODESTR"; + this.PRODUCTCODESTR.ReadOnly = true; + this.PRODUCTCODESTR.Visible = false; + this.PRODUCTCODESTR.Width = 240; + // + // MOLDNUMBER + // + this.MOLDNUMBER.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.MOLDNUMBER.DataPropertyName = "MOLDNUMBER"; + dataGridViewCellStyle56.Font = new System.Drawing.Font("宋体", 15.75F); + this.MOLDNUMBER.DefaultCellStyle = dataGridViewCellStyle56; + this.MOLDNUMBER.FillWeight = 380.7106F; + this.MOLDNUMBER.HeaderText = "模架号"; + this.MOLDNUMBER.Name = "MOLDNUMBER"; + this.MOLDNUMBER.ReadOnly = true; + this.MOLDNUMBER.Width = 90; + // + // dataGridViewTextBoxColumn2 + // + this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.dataGridViewTextBoxColumn2.DataPropertyName = "OPERATESTATETEXT"; + dataGridViewCellStyle57.Font = new System.Drawing.Font("宋体", 15.75F); + this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle57; + this.dataGridViewTextBoxColumn2.FillWeight = 29.82234F; + this.dataGridViewTextBoxColumn2.HeaderText = "加工状态"; + this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; + this.dataGridViewTextBoxColumn2.ReadOnly = true; + this.dataGridViewTextBoxColumn2.Width = 130; + // + // Column5 + // + this.Column5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.Column5.DataPropertyName = "CREATEDATE"; + dataGridViewCellStyle58.Font = new System.Drawing.Font("宋体", 15.75F); + this.Column5.DefaultCellStyle = dataGridViewCellStyle58; + this.Column5.FillWeight = 29.82234F; + this.Column5.HeaderText = "加工时间"; + this.Column5.Name = "Column5"; + this.Column5.ReadOnly = true; + this.Column5.Width = 200; + // + // OPERATEDDATE + // + this.OPERATEDDATE.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.OPERATEDDATE.DataPropertyName = "OPERATEDDATE"; + dataGridViewCellStyle59.Font = new System.Drawing.Font("宋体", 15.75F); + this.OPERATEDDATE.DefaultCellStyle = dataGridViewCellStyle59; + this.OPERATEDDATE.FillWeight = 29.82234F; + this.OPERATEDDATE.HeaderText = "加工完成时间"; + this.OPERATEDDATE.Name = "OPERATEDDATE"; + this.OPERATEDDATE.ReadOnly = true; + this.OPERATEDDATE.Width = 200; + // + // PPID + // + this.PPID.DataPropertyName = "PID"; + this.PPID.HeaderText = "Pid"; + this.PPID.Name = "PPID"; + this.PPID.ReadOnly = true; + this.PPID.Visible = false; + // + // PROID + // + this.PROID.DataPropertyName = "PDID"; + this.PROID.HeaderText = "PROID"; + this.PROID.Name = "PROID"; + this.PROID.ReadOnly = true; + this.PROID.Visible = false; + // + // PType + // + this.PType.DataPropertyName = "PRODUCTTYPE"; + this.PType.HeaderText = "PType"; + this.PType.Name = "PType"; + this.PType.ReadOnly = true; + this.PType.Visible = false; + // + // OPERATESTATE + // + this.OPERATESTATE.DataPropertyName = "OPERATESTATE"; + this.OPERATESTATE.HeaderText = "OPERATESTATE"; + this.OPERATESTATE.Name = "OPERATESTATE"; + this.OPERATESTATE.ReadOnly = true; + this.OPERATESTATE.Visible = false; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // OperationForm_316 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1698, 614); + this.Controls.Add(this.panel4); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.plDAI); + this.Controls.Add(this.panelSearch); + this.Controls.Add(this.panel2); + this.Name = "OperationForm_316"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "加工操作"; + this.Activated += new System.EventHandler(this.OperationForm_Activated); + this.Load += new System.EventHandler(this.Form_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OperationForm_KeyDown); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.panelSearch.ResumeLayout(false); + this.panelSearch.PerformLayout(); + this.plDAI.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.DGView)).EndInit(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.panel4.ResumeLayout(false); + this.plInfo.ResumeLayout(false); + this.gbMlist.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgvMlist)).EndInit(); + this.plPlanAndRecord.ResumeLayout(false); + this.plPlanAndRecord.PerformLayout(); + this.tabView.ResumeLayout(false); + this.tpPlan.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgvPlan)).EndInit(); + this.tlpPlanCount.ResumeLayout(false); + this.tlpPlanCount.PerformLayout(); + this.tpRecord.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.DGViewProList)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panelSearch; + private System.Windows.Forms.Panel plDAI; + private System.Windows.Forms.DataGridView DGView; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtCode; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton tsbSearch; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Button btnAdd; + private System.Windows.Forms.ComboBox comMachine; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.LinkLabel lblLock; + private System.Windows.Forms.ToolStripButton tsbConnect; + private System.Windows.Forms.ToolStripButton tsbPrint; + private System.Windows.Forms.ToolStripButton btnRefresh; + private System.Windows.Forms.ToolStripButton btnEditProduct; + private System.Windows.Forms.Label lblWorkcellState; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox lblError; + private System.Windows.Forms.ComboBox cbMould; + private System.Windows.Forms.Label lblMouldTitle; + private System.Windows.Forms.Label lblMould; + private System.Windows.Forms.Label lblMouldTitle2; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.ToolStripDropDownButton tsbPass; + private System.Windows.Forms.ToolStripDropDownButton tsbRecovery; + private System.Windows.Forms.ToolStripDropDownButton tsbOrderOperation; + private System.Windows.Forms.ToolStripMenuItem tsmiSuspendOrder; + private System.Windows.Forms.ToolStripMenuItem tsmiResetOrder; + private System.Windows.Forms.ToolStripMenuItem tsmiCancelSuspend; + private System.Windows.Forms.ToolStripMenuItem tsmiTakebackOrder; + private System.Windows.Forms.ToolStripMenuItem tsmiDeleteOrder; + private System.Windows.Forms.ToolStripDropDownButton tsbReSignal; + private System.Windows.Forms.ToolStripDropDownButton tsbCancel; + private System.Windows.Forms.ToolStripButton tsbAndon; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.Button btnChange; + private System.Windows.Forms.Panel plPlanAndRecord; + private System.Windows.Forms.ComboBox cbPlanFilter; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.ComboBox cbListRowcount; + private System.Windows.Forms.ComboBox cbRefreshRate; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TabControl tabView; + private System.Windows.Forms.TabPage tpPlan; + private System.Windows.Forms.DataGridView dgvPlan; + private System.Windows.Forms.TableLayoutPanel tlpPlanCount; + private System.Windows.Forms.Label lblDayPlanCount; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label lblShiftCompleteCount; + private System.Windows.Forms.Label lblShiftPlanCount; + private System.Windows.Forms.Label lblPlanCount; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TabPage tpRecord; + private System.Windows.Forms.DataGridView DGViewProList; + private System.Windows.Forms.DataGridViewTextBoxColumn PRODUCTCODE; + private System.Windows.Forms.DataGridViewTextBoxColumn PRODUCTCODESTR; + private System.Windows.Forms.DataGridViewTextBoxColumn MOLDNUMBER; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; + private System.Windows.Forms.DataGridViewTextBoxColumn Column5; + private System.Windows.Forms.DataGridViewTextBoxColumn OPERATEDDATE; + private System.Windows.Forms.DataGridViewTextBoxColumn PPID; + private System.Windows.Forms.DataGridViewTextBoxColumn PROID; + private System.Windows.Forms.DataGridViewTextBoxColumn PType; + private System.Windows.Forms.DataGridViewTextBoxColumn OPERATESTATE; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMouldCode; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMouldName; + private System.Windows.Forms.DataGridViewTextBoxColumn daname; + private System.Windows.Forms.DataGridViewTextBoxColumn statename; + private System.Windows.Forms.DataGridViewTextBoxColumn datype; + private System.Windows.Forms.DataGridViewTextBoxColumn materialtypename; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcDAMaterialCode; + private System.Windows.Forms.DataGridViewTextBoxColumn davalue; + private System.Windows.Forms.DataGridViewTextBoxColumn daresult; + private System.Windows.Forms.DataGridViewTextBoxColumn Pid; + private System.Windows.Forms.ToolStripMenuItem tsmiIgnoreFISBreak; + + private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.CheckBox cBoxVAN; + private System.Windows.Forms.TextBox tBMat; + private System.Windows.Forms.CheckBox cboxSort; + private System.Windows.Forms.Panel plInfo; + private System.Windows.Forms.GroupBox gbMlist; + private System.Windows.Forms.DataGridView dgvMlist; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMListMaterialName; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMListMaterialCode; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMListQty; + private System.Windows.Forms.Button btnCollapse; + private System.Windows.Forms.DataGridViewTextBoxColumn InitNo; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcOrderNo; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcSeq; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMaterialCode; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcMaterialName; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcState; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcPlanDate; + private System.Windows.Forms.DataGridViewTextBoxColumn dgcShift; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn9; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn10; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn11; + private System.Windows.Forms.DataGridViewTextBoxColumn No; + } +} \ No newline at end of file diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.cs new file mode 100644 index 0000000..c10739d --- /dev/null +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.cs @@ -0,0 +1,3843 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Drawing; +using System.Windows.Forms; +using System.ComponentModel; +using QMAPP.FJC.Entity; +using QMAPP.FJC.Entity.Basic; +using QMAPP.FJC.Entity.Operation; +using QMAPP.FJC.Entity.SendPlan; +using QMAPP.ServicesAgent; +using QMAPP.WinForm.Common; +using QMFrameWork.Common.Serialization; +using QMFrameWork.Data; +using QMAPP.Entity; +using System.Linq; +using System.Reflection; +using System.ServiceModel; +using System.Threading; +using System.Net.Sockets; +using System.IO; +using QMAPP.FJC.Entity.QT; +using QMAPP.FJC.TRACING.DAInterface; +using QMAPP.WinForm.Forms.Andon; +using DCS.Common; +using QMAPP.WinForm.Forms.Mend; +using System.Collections; +using QMAPP.FJC.Entity.ProductionPlan; +using gregn6Lib; +using System.Data; +using QMAPP.FJC.Entity.BZD; +using QMAPP.BoraUpgrade.BLL; + +namespace QMAPP.WinForm.Forms.Operation +{ + /// + /// 描述:加工操作 + /// 作者:王庆男 + /// 时间:2015年7月1日 + /// + [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)] + public partial class OperationForm_316 : Form, ServiceOpc.IOpcServiceCallback + { + #region 全局变量 + public static SynchronizationContext SynchronizationContext; + //与服务器传递参与以及窗口静态变量 + OperationServiceParam _operationServiceParam = new OperationServiceParam(); + //获取服务代理 + QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent(); + + ServiceOpc.OpcServiceClient proy;//连接OPC服务 + + BarCodeHook BarCode = new BarCodeHook(); + + /// + /// 附加信息 + /// + Dictionary AttachInfo = new Dictionary(); + + /// + /// 采集点列表 + /// + private List daiList = new List(); + /// + /// 数据采集点视图 + /// + private BindingList daiviewSource = new BindingList(); + /// + /// 数据采集点视图 + /// + private List daicache = new List(); + /// + /// 模架列表 + /// + private List mouldList = new List(); + /// + /// 条码格式规则列表 + /// + private List _barcodeRules; + + /// + /// 正确的声音文件路径 + /// + private string okSoundPath = null; + /// + /// 错误的声音文件路径 + /// + private string errorSoundPath = null; + /// + /// 用于隐藏计划tab页 + /// + Hashtable htPages = new Hashtable(); + + private string _showDetailError = "false"; //后修改内容,若果true. 发生异常时显示异常详细信息. false,显示内容和原来一样,不发生变化 + private string _lowCfgAutoSwitchLoc = string.Empty; //自动填充配置的工位 + private string _ipGJBarCodeRegex = string.Empty; + + private string[] _cfgAutoInputLocs = null;//DP 自动输入配置的工位 + private string _cfgAutoInputSwitch = string.Empty; //DP 自动输入配置的开关 + private string _bentiBarCodeRegex = string.Empty; //DP 自动输入配置的开关 + //private string _cfgAutoProduct = string.Empty; //DP 自动输入配置的开关 + + private string _052printWorkloc = string.Empty; //052打印工位 + + private string _371BiaoPiBarCodeRegex = string.Empty; //表皮码 + private string _316BiaoPiBarCodeRegex = string.Empty; //表皮码 + + private string _AutoMachineCode = string.Empty; //自动扫码的配置设备编号 + + private string _firstBoxA = "true"; + private int _containCount = 6; + + #endregion + + #region 窗体构造函数 + /// + /// 窗体构造函数 + /// + public OperationForm_316() + { + InitializeComponent(); + + _showDetailError = System.Configuration.ConfigurationManager.AppSettings["是否显示异常详细信息"]?.ToLower(); + _lowCfgAutoSwitchLoc = GetAppConfigValue("AutomationLocAdd"); //查找所有 需要自动填充的工位 + _ipGJBarCodeRegex = GetAppConfigValue("AutomationBarCodeRegex"); //查找所有 需要自动填充的工位 + _AutoMachineCode = GetAppConfigValue("MachineCode"); //查找所有 需要自动填充的工位 + + var str__cfgAutoInputLocs = GetAppConfigValue("AutoInputLocAdd"); //查找所有 需要自动填充的工位 + if (str__cfgAutoInputLocs.Split(';').Length > 0) + _cfgAutoInputLocs = str__cfgAutoInputLocs.Split(';'); + _cfgAutoInputSwitch = GetAppConfigValue("AutoInputSwitch"); //查找所有 需要自动填充的工位 + _bentiBarCodeRegex = GetAppConfigValue("AutoInput"); + + _052printWorkloc = System.Configuration.ConfigurationManager.AppSettings["052打印工位"]; + _371BiaoPiBarCodeRegex = System.Configuration.ConfigurationManager.AppSettings["052打印条码规则371"]; + _316BiaoPiBarCodeRegex = System.Configuration.ConfigurationManager.AppSettings["052打印条码规则316"]; + + string firstA = System.Configuration.ConfigurationManager.AppSettings["先装A面"]?.Trim(); + _firstBoxA = string.IsNullOrEmpty(firstA) == true ? "true" : firstA.ToLower(); + + this.WindowState = FormWindowState.Maximized; + //this.CheckFile(); + okSoundPath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"] + "Sound\\" + PlaySoundConst.strSoundOk; + errorSoundPath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"] + "Sound\\" + PlaySoundConst.strSoundNg; + SynchronizationContext = new SynchronizationContext(); + BarCode.BarCodeEvent += new BarCodeHook.BarCodeDelegate(BarCode_BarCodeEvent); + //BarCode.Start(); + } + #endregion + + #region 键盘Hook + void BarCode_BarCodeEvent(BarCodeHook.BarCodes barCode) + { + ShowInfo(barCode); + } + + private void ShowInfo(BarCodeHook.BarCodes barCode) + { + if (!this.txtCode.Focused) + { + this.txtCode.Focus(); + } + } + #endregion + + #region 窗体载入 + private void Form_Load(object sender, EventArgs e) + { + LoadViewSetting(); + + //初始化控件属性 + this.DGView.AutoGenerateColumns = false; + this.DGViewProList.AutoGenerateColumns = false; + + //隐藏工单计划 + //DeletePlanPage("tpPlan"); + + //加载所有设备下拉列表 + LoadMachineList(); + + _barcodeRules = _agent.InvokeServiceFunction>(B9BasicService.BarcodeRulesBLL_GetAllList.ToString()); + + this.DGView.DataSource = daiviewSource; + //页面初始化 + Init(); + + //tsbRe.Visible = false; + DGViewProList.ClearSelection(); + + #region 打印模板拷贝 + PrintTempleCopyClass printClass = new PrintTempleCopyClass(); + printClass.CopyPrintTemple("IPASSYLABEL"); + printClass.CopyPrintTemple("DPPLANLABEL"); + #endregion + btnRefresh.Visible = true; + txtCode.Focus(); + } + #endregion + + #region 加载设备列表 + /// + /// 加载设备列表 + /// + private void LoadMachineList() + { + #region + BasicData basicData = new BasicData(); + var machinelist=basicData.GetMachineInfoAndModelList(new string[] { }, true); + this.comMachine.DataSource = machinelist; + this.comMachine.DisplayMember = "MACHINENAME"; + this.comMachine.ValueMember = "MACHINECODDE"; + + //如果工位已设定 + if (ClientContext.MachineInfo != null && !string.IsNullOrEmpty(ClientContext.MachineInfo.PID)) + { + this.comMachine.SelectedValue = ClientContext.MachineInfo.MACHINECODDE; + //this.lblLock.Visible = false; + this.LockType(false); + } + else + { + //this.lblLock.Visible = false; + this.LockType(false); + } + #endregion + } + #endregion + + #region 加载列表显示设置 + /// + /// 加载列表显示设置 + /// + private void LoadViewSetting() + { + #region 加载列表显示设置 + string filepath = ConfigurationManager.AppSettings["SaveFilePath"]; + filepath = string.Format("{0}ViewSetting.cfg", filepath); + + var setting = new { ListRowcount = 20, RefreshRate = 5 }; + if (System.IO.File.Exists(filepath)) + { + string settingstring = System.IO.File.ReadAllText(filepath); + setting = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(settingstring, setting); + } + cbListRowcount.Text = setting.ListRowcount.ToString(); + cbRefreshRate.Text = string.Format("{0}s", setting.RefreshRate); + cbPlanFilter.SelectedIndex = 1; + + cbListRowcount.SelectedIndexChanged += new EventHandler(cbListRowcount_SelectedIndexChanged); + cbRefreshRate.SelectedIndexChanged += new EventHandler(cbRefreshRate_SelectedIndexChanged); + cbPlanFilter.TextChanged += new EventHandler(cbPlanFilter_SelectedIndexChanged); + + #endregion + } + #endregion + + #region 初始化界面 + /// + /// 初始化界面 + /// 加载当前设备对应的工序信息 + /// 加载当前工序的先决条件 + /// + private void Init() + { + ClientContext.OpcState = 0; + var mouldno=0; + this.tsbConnect.Visible = false; + this.tsbReSignal.Visible = false; + this.btnChange.Visible = false; + this.cBoxVAN.Visible = false; + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + _operationServiceParam = new OperationServiceParam(); + _operationServiceParam.produceShift = ClientContext.produceShift; + _operationServiceParam.machineInfo = this.comMachine.SelectedItem as MachineInfo; + if (string.IsNullOrEmpty(_operationServiceParam.machineInfo.PID)) + { + return; + } + if (!string.IsNullOrEmpty(_operationServiceParam.machineInfo.OPCGROUPNAME)) + { + btnChange.Visible = true; + } + //****************20210413 DQZhang BC316 VAN ************************************** + if (_operationServiceParam.machineInfo.MACHINECODDE== "ASSEMBLE_BC316") + { + this.cBoxVAN.Visible = true; + } + //********************************************************************************* + + //else + //{ + // //隐藏工单计划 + // if (_operationServiceParam.machineInfo.PLAN_SET == "1") + // { + // DeletePlanPage("tpPlan"); + // } + // else + // { + // AddPage("tpPlan"); + // } + //} + if (LocalSetting.Settings["AbilityValid","1"] == "1") + { + var userabbility = _agent.InvokeServiceFunction>("UserWithMachineBLL_GetUserAbility", ClientContext.LoginInfo.UserID); + if (!userabbility.Exists(p => p.MACHINEID == _operationServiceParam.machineInfo.PID) && !string.Equals("ADMIN", ClientContext.LoginInfo.LoginUserID)) + { + plDAI.Enabled = + txtCode.Enabled = + btnAdd.Enabled = + panel4.Enabled = + toolStrip1.Enabled = false; + MessageBox.Show("当前登录用户不具备此工位的操作能力!\r\n请更换用户或联系管理员设置能力矩阵。", "操作者能力矩阵", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + + if (string.IsNullOrEmpty(_operationServiceParam.machineInfo.MOLDNUMBER)) + { + _operationServiceParam.machineInfo.MOLDNUMBER = "1"; + } + _operationServiceParam.produceShift = ClientContext.produceShift; + mouldno = ConnectOPCHost(mouldno); + LoadDAI(mouldno); + BindAll(); + + //var extendpages=tabView.TabPages. + tabView.TabPages.Clear(); + tabView.TabPages.Add(tpPlan); + tabView.TabPages.Add(tpRecord); + + if (_operationServiceParam.machineInfo.OPERATETYPE == "EINSP")//终检工位,增加卡扣漏装检测设备接口 + { + DeviceInterface.LeakInspection frm = new DeviceInterface.LeakInspection(); + + + var tabpage = new TabPage(frm.Text); + tabView.TabPages.Add(tabpage); + frm.TopLevel = false; + frm.Parent = tabpage; + //frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + frm.Machine = _operationServiceParam.machineInfo; + //frm.WindowState = FormWindowState.Maximized; + //frm.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + frm.Dock = DockStyle.Fill; + frm.Show(); + + tabpage.BackColor = Color.Black; + //tabpage.Controls.Add(frm); + + } + + //****************20210413 DQZhang BC316 VAN ************************************** + if (_operationServiceParam.machineInfo.MACHINECODDE == "LFRAME_WELD_MP2BC316") + { + SwitchMould(cbMould.SelectedValue + ""); + } + //********************************************************************************* + + } + #endregion + + #region 加载采集点信息 + /// + /// 加载采集点信息 + /// + /// + private void LoadDAI(int mouldno) + { + #region 获取采集点 + + daiList = _agent.InvokeServiceFunction>(B9IPCService.DAIBLL_GetList.ToString(), new DAI() { WORKLOC_CODE = _operationServiceParam.machineInfo.WORKLOC_CODE }); + var cachelist = _agent.InvokeServiceFunction>(B9IPCService.DAICacheBLL_GetWorklocCache.ToString(), _operationServiceParam.machineInfo.WORKLOC_CODE); + mouldList = _agent.InvokeServiceFunction>(B9BasicService.MachineInfoModelBLL_GetAllList.ToString(), new MachineInfoModels { MID = _operationServiceParam.machineInfo.PID }).OrderBy(p=>p.MODELCODE).ToList(); + cbMould.DisplayMember = "MODELNAME"; + cbMould.ValueMember = "MODELCODE"; + cbMould.DataSource = mouldList.ToList(); + mouldList.Insert(0, new MachineInfoModels { MODELCODE = "" }); + + + daicache.Clear(); + foreach (var mould in mouldList) + { + foreach (var dai in daiList.Where(p => string.Equals(p.DIVBY_MOULD, mould.MODELCODE != "" ? "1" : "0"))) + { + var daiview = new FJC.Entity.View.DAIFormView + { + DACode = dai.DA_CODE, + DAName = dai.DA_NAME, + DAResult = "", + DAType = dai.DATA_TYPE, + MaterialType = dai.MATERIAL_TYPE, + MaterialTypeName = "",// dai.MATERIAL_TYPE_NAME, + MaterialCode = "", + MaterialName = "", + StateCode = dai.STATE_CODE, + StateName = dai.STATE_NAME, + DAValue = "", + MouldCode = string.IsNullOrWhiteSpace(mould.MODELCODE) ? dai.WORKCELL_CODE : mould.MODELCODE, + MouldName = mould.MODELNAME, + }; + var cache = cachelist.FirstOrDefault(p => p.DA_CODE == daiview.DACode && (string.IsNullOrWhiteSpace(p.MOULD_CODE) || p.MOULD_CODE == daiview.MouldCode) && (!string.Equals(p.PREINPUT, "1"))); + if (cache != null && !string.IsNullOrWhiteSpace(cache.DA_VALUE)) + { + daiview.DAValue = cache.DA_VALUE; + daiview.MaterialCode = cache.MATERIAL_CODE; + daiview.MaterialName = cache.MATERIAL_NAME; + daiview.DAResult = "通过"; + } + + daicache.Add(daiview); + } + + } + + dgcMouldName.Visible = mouldList.Count > 1; + + if (daiList.Count(p => string.Equals(p.CANPREINPUT, "1")) > 0) + { + dgcMouldName.Visible = true; + int i = 0; + int m = mouldList.Count; + if (string.Equals(_operationServiceParam.machineInfo.ISSTATION, 2)) + { + i = 1; + } + else + { + i = 0; + m = 1; + } + for (; i < m; i++) + { + foreach (var dai in daiList.Where(p => string.Equals(p.CANPREINPUT, "1"))) + { + var mould = mouldList[i]; + var daiview = new QMAPP.FJC.Entity.View.DAIFormView + { + DACode = dai.DA_CODE, + DAName = dai.DA_NAME, + DAResult = "", + DAType = dai.DATA_TYPE, + MaterialType = dai.MATERIAL_TYPE, + MaterialCode = "",// dai.MATERIAL_TYPE_NAME, + MaterialName = "", + StateCode = dai.STATE_CODE, + StateName = dai.STATE_NAME, + DAValue = "", + MouldCode = "PRE-" + (string.IsNullOrWhiteSpace(mould.MODELCODE) ? dai.WORKCELL_CODE : mould.MODELCODE), + MouldName = "预备", + PREINPUT = "1" + }; + var cache = cachelist.FirstOrDefault(p => p.DA_CODE == daiview.DACode && string.Equals(p.PREINPUT, "1")&&string.Equals(p.MOULD_CODE,(string.IsNullOrWhiteSpace(mould.MODELCODE) ? dai.WORKCELL_CODE : mould.MODELCODE))); + if (cache != null && !string.IsNullOrWhiteSpace(cache.DA_VALUE)) + { + daiview.DAValue = cache.DA_VALUE; + daiview.MaterialCode = cache.MATERIAL_CODE; + daiview.MaterialName = cache.MATERIAL_NAME; + daiview.DAResult = "通过"; + } + daicache.Add(daiview); + } + } + } + + //dgcMouldName.Visible = mouldList.Count > 1; + lblMouldTitle.Visible = cbMould.Visible = mouldList.Count > 1; + + + + if (mouldList.Count <= 2) + { + SwitchMould(""); + } + else + { + if (mouldno > 0) + { + var mould = mouldList.FirstOrDefault(p => string.Equals(p.MODELSTATION, mouldno.ToString())); + if (mould != null) + { + SwitchMould(mould.MODELCODE); + } + } + else + { + SwitchMould(""); + } + //cbMould_SelectedIndexChanged(this, EventArgs.Empty); + } + + //= _agent.InvokeServiceFunction>(B9IPCService.DAIBLL_GetList.ToString(), new DAI() { WORKLOC_CODE = _operationServiceParam.machineInfo.WORKLOCCODE }); + + + + #endregion + } + + #endregion + + #region 连接OPC服务 + //TODO:优化连接失败时的长时间卡死状态 + /// + /// 连接OPC服务 + /// + /// + /// + private int ConnectOPCHost(int mouldno) + { + if (string.IsNullOrEmpty(_operationServiceParam.machineInfo.PID)) + { + ClientContext.OpcState = 0; + proy = null; + return 0; + } + if (!_operationServiceParam.machineInfo.ISCONTROL.Equals("0")) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + + //设置与设备双工通信 + if (_operationServiceParam.machineInfo.ISCONTROL.Equals("2") || _operationServiceParam.machineInfo.ISCONTROL.Equals("3")) + { + this.tsbConnect.Visible = true; + this.tsbReSignal.Visible = true; + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + try + { + ClientContext.OpcState = 4; + this.lblError.Text = "正在连接中稍后..."; + + mouldno = proy.Register(_operationServiceParam.machineInfo.MACHINECODDE); + ClientContext.OpcState = 1; + this.lblError.Text = "服务器连接成功!"; + this.lblError.ForeColor = Color.Green; + } + catch (Exception) + { + ClientContext.OpcState = 2; + this.lblError.Text = "连接服务失败!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + } + } + else + { + ClientContext.OpcState = 2; + this.lblError.Text = "服务已经断开,请重连!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + } + } + } + else + { + ClientContext.OpcState = 0; + proy = null; + } + return mouldno; + } + #endregion + + #region 行序号 + /// + /// 行序号 + /// + /// + /// + private void DG_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) + { + Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, this.DGView.RowHeadersWidth - 4, e.RowBounds.Height); + TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right); + } + #endregion + + #region 添加零件 + /// + /// 添加零件 + /// + /// + /// + private void btnAdd_Click(object sender, EventArgs e) + { + WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + txtCode.Text.Trim().ToUpper()); + Operation(); + } + #endregion + + #region 采集点扫描校验 + /// + /// 采集点扫描校验 + /// + private void Operation() + { + + try + { + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + //使用登录码快速切换用户 + if (System.Text.RegularExpressions.Regex.IsMatch(txtCode.Text, "^<\\w+::\\w+>$")) + { + var ret = ClientContext.CodeLogin(txtCode.Text); + if (string.Equals(ret, "登录成功!")) + { + ClientContext.SetUserAuth(this); + if (LocalSetting.Settings["AbilityValid", "1"] == "1") + { + var userabbility = _agent.InvokeServiceFunction>("UserWithMachineBLL_GetUserAbility", ClientContext.LoginInfo.UserID); + if (!userabbility.Exists(p => p.MACHINEID == _operationServiceParam.machineInfo.PID) && !string.Equals("ADMIN", ClientContext.LoginInfo.LoginUserID)) + { + plDAI.Enabled = + txtCode.Enabled = + btnAdd.Enabled = + panel4.Enabled = + toolStrip1.Enabled = false; + MessageBox.Show("当前登录用户不具备此工位的操作能力!\r\n请更换用户或联系管理员设置能力矩阵。", "操作者能力矩阵", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + } + lblError.Text = ret; + txtCode.Text = ""; + txtCode.SelectAll(); + txtCode.Focus(); + return; + } + + #region 20220429 DQZhang + DataTable fisPlanTable = dgvPlan.DataSource as DataTable; + //fisPlanTable = fisPlanTable.AsEnumerable().Where(p => p.Field("SendState") == 0).CopyToDataTable(); + //if (fisPlanTable == null || fisPlanTable.Rows.Count == 0) + //{ + // throw new Exception("暂时没有fis计划,请刷新页面!"); + //} + //DataRow fisPlanRow = fisPlanTable.Rows[0]; + // + //DataRow fisPlanRow = null; + + if (fisPlanTable.Rows.Count < 1) + { + throw new Exception("没有fis计划,请创建计划!"); + } + DataRow fisPlanRow = fisPlanTable.Rows[0]; + var orderid = this.dgvPlan.SelectedRows[0].Cells[1].Value.ToString(); + var WorkerPid = this.dgvPlan.SelectedRows[0].Cells[8].Value.ToString(); + + #endregion + + + + + + #region 输入条码校验 + //判断设备列表 + if (comMachine.Items.Count <= 0) + { + txtCode.Text = ""; + PlaySound.PlaySounds.Play(@errorSoundPath); + this.lblError.Text = "请先选择设备!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + txtCode.SelectAll(); + txtCode.Focus(); + return; + } + + string productCode = this.txtCode.Text.Trim().ToUpper();//窗体零件条码 + if (string.IsNullOrEmpty(productCode)) + { + txtCode.Text = ""; + PlaySound.PlaySounds.Play(@errorSoundPath); + this.lblError.Text = "请输入条码!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + txtCode.SelectAll(); + txtCode.Focus(); + return; + } + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + + #endregion + + #region 条码格式解析 + + var dai = LocateDAI(productCode); + if (dai == null) + { + txtCode.Text = ""; + PlaySound.PlaySounds.Play(@errorSoundPath); + this.lblError.Text = "输入条码不是本工序可接受格式!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + txtCode.SelectAll(); + txtCode.Focus(); + return; + } + + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + #endregion + + object davalue = productCode; + //if(string.IsNullOrEmpty(_cfgAutoProduct)) + // _cfgAutoProduct = productCode; + //采集点输入 + var result = _agent.InvokeServiceFunction(B9IPCService.DAI_Input.ToString() + , new DAArgs + { + WorkerPid = WorkerPid, + WorkCellCode = dai.WORKCELL_CODE, + WorkLocCode = dai.WORKLOC_CODE, + DACode = dai.DA_CODE, + DAValue = davalue, + MaterialCode = dai.MATERIAL_CODE, + MachineCode = _operationServiceParam.machineInfo.MACHINECODDE, + MachineName = _operationServiceParam.machineInfo.MACHINENAME, + IsControl = _operationServiceParam.machineInfo.ISCONTROL, + MouldCode = string.Equals(dai.DIVBY_MOULD, "0") ? _operationServiceParam.machineInfo.WORKCELL_CODE : (string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text), + AttachData = AttachInfo + }); + + var daiview = daicache.FirstOrDefault(p => p.DACode == dai.DA_CODE && (string.IsNullOrWhiteSpace(p.MouldCode) || p.MouldCode == (result.PreInput ? "PRE-" + result.MouldCode : result.MouldCode))); + if (result.PreInput) + { + string mouldcode = result.MouldCode; + if (_operationServiceParam.machineInfo.ISSTATION != 2) + { + mouldcode = _operationServiceParam.machineInfo.WORKCELL_CODE; + } + daiview = daicache.FirstOrDefault(p => p.DACode == dai.DA_CODE && (string.IsNullOrWhiteSpace(p.MouldCode) || p.MouldCode == "PRE-" + mouldcode)); + } + + if (!string.IsNullOrEmpty(_052printWorkloc) && + _052printWorkloc.Contains(_operationServiceParam.machineInfo.WORKLOC_CODE) && result.Success) + { + if (string.IsNullOrEmpty(processMainCode)) + { + processMainCode = productCode; + if (!string.IsNullOrEmpty(result.MATERIAL_CODE)) + { + List list1 = + this.dgvPlan.DataSource as List; + var PbomItem = _agent.InvokeServiceFunction>(B9IPCService.PbomItemBLL_Get.ToString(), result.MATERIAL_CODE); + var BomCodes = ""; + if (PbomItem != null && PbomItem.Count > 0) + { + BomCodes = PbomItem[0].PBOM_CODE; + + var SSS = _agent.InvokeServiceFunction(B9IPCService.PbomItemBLL_GetBom.ToString(), BomCodes); + if (SSS != null) + planMATERIAL_CODE = SSS.MATERIAL_CODE; + } + + //List pBomCodes1 = GetPBOMCODEValue(result.MATERIAL_CODE); + + //List filterList1 = + // list1.Where(p => pBomCodes1.Contains(p.PBOM_CODE)).ToList(); + + + //if (filterList1.Count > 0) + //{ + // planMATERIAL_CODE = filterList1[0].MATERIAL_CODE; + //} + } + } + else + { + if ((System.Text.RegularExpressions.Regex.IsMatch(productCode, _371BiaoPiBarCodeRegex) || System.Text.RegularExpressions.Regex.IsMatch(productCode, _316BiaoPiBarCodeRegex)) + && processMainCode != productCode) + { + processMainCode = productCode; + } + } + } + + if (!result.Success) //如果采集数据输入失败 + { + PlaySound.PlaySounds.Play(@errorSoundPath); + this.lblError.Text = result.Message; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + + if (daiview != null) + { + if (daiview.DAResult != "通过") + { + daiview.DAResult = "未通过"; + daiview.DAValue = productCode; + daiview.MaterialType = result.MATERIAL_CODE; + } + } + + dai.MATERIAL_CODE = string.IsNullOrEmpty(result.MATERIAL_CODE) ? "" : result.MATERIAL_CODE; + dai.Result = EnumGeter.ORDERTYPE.NOK.GetHashCode().ToString(); + } + else + { + if (daiview != null) + { + daiview.DAResult = "通过"; + daiview.DAValue = productCode; + daiview.MaterialCode = result.MATERIAL_CODE; + daiview.MaterialName = result.MATERIAL_NAME; + } + + dai.MATERIAL_CODE = result.MATERIAL_CODE; + dai.Result = dai.Result = EnumGeter.ORDERTYPE.OK.GetHashCode().ToString(); + + //执行返回结果中包含的动作 + DoResultActions(result); + + #region 20220429 QDZhang BC316装车排序起始号记录 + //if (result.Success) + if (result.Actions.Count>0) + { + if (fisPlanTable.Rows.Count > 0) + { + int initNo = 0; + int.TryParse(fisPlanRow["No"].ToString(), out initNo); + if (!cboxSort.Checked) + initNo = 0; + WorkOrderBLL.SaveStartIndex(initNo); + } + } + + + #endregion + + this.txtCode.Text = ""; + + if (this.lblLock.Tag.ToString().Equals("0")) + { + LockType(false); + } + } + try + { + #region 工位自动输入采集点信息 + //工位与配置 且经过所有的验证 + if (result.Success && !string.IsNullOrEmpty(_lowCfgAutoSwitchLoc) && _lowCfgAutoSwitchLoc.Contains(_operationServiceParam.machineInfo.WORKLOC_CODE)) + { + var ispass = false; + foreach (var str in _ipGJBarCodeRegex.Split(';')) + { + if (System.Text.RegularExpressions.Regex.IsMatch(productCode, str))//扫描的是过程主码 + { + ispass = true; + } + + } + if (ispass)//扫描的是过程主码 + { + 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为空,未进行后续填充!"); + } + } + } + + #endregion + + #region DP 超声焊1的工位,低配自动输入挡流板条码 + //DP叫总成焊接工位 不是扫高低配,而是扫多个配置. 扫一个本体码,在配置中,找到多个配置码,自动填写. + if (_cfgAutoInputSwitch == "true" && _cfgAutoInputLocs.Contains(_operationServiceParam.machineInfo.WORKLOC_CODE)) + { + var ispass = false; + foreach (var str in _bentiBarCodeRegex.Split(';')) + { + if (System.Text.RegularExpressions.Regex.IsMatch(productCode, str))//扫描的是过程主码 + { + ispass = true; + } + + } + if (ispass)//扫描的是本体条码 + { + List list = this.dgvPlan.DataSource as List; + if (!string.IsNullOrEmpty(result.MATERIAL_CODE)) + { + var bomCodes = GetPBOMCODEValue(result.MATERIAL_CODE); + //List filterList = list.Where(p => bomCodes.Contains(p.PBOM_CODE)).ToList(); + if (bomCodes.Count > 0) + { + string PBOM_CODE = bomCodes[0]; + + //List autoInputBarCodes = LocSwitchHelper.GetAutoInputBarCode(bomCode, _operationServiceParam.machineInfo.WORKLOC_CODE); + + List autoInputBarCodes = _agent.InvokeServiceFunction>(B9IPCService.MaterialBomConfigBLL_GetAutoInputBarCode.ToString(), PBOM_CODE, _operationServiceParam.machineInfo.WORKLOC_CODE); + foreach (string autoInputBarCode in autoInputBarCodes) + { + //LoadPreState(dai, GetMouldCode(result.MouldCode), isAutoInput, true); + //自动触发txtCode_KeyDown实现 + txtCode.Text = autoInputBarCode; + + //txtCode_KeyDown(null,null); + Operation(); + } + + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + } + else + { + string s = $"没有找到物料号{result.MATERIAL_CODE}对应的计划,请检查T_MD_PBOM_ITEM是否进行了配置."; + this.lblError.Text = s; + this.lblError.ForeColor = Color.Red; + txtCode.SelectAll(); + txtCode.Focus(); + WriteLog.WriteError(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + s); + + } + } + } + } + + + #endregion + } + catch (Exception ex) + { + if (_showDetailError == "true") + { + WriteLog.WriteError(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + ex.Message); + this.lblError.Text = ""; + Reset(string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text); + txtCode.SelectAll(); + txtCode.Focus(); + MessageBox.Show(ex.Message); + return; + } + else + { + throw ex; + } + } + + #region 20220429 QDZhang BC316装车排序起始号记录 + //if (result.Success) + //{ + // //if (fisPlanTable.Rows.Count > 0) + // //{ + // int initNo = 0; + // int.TryParse(fisPlanRow["No"].ToString(), out initNo); + // if (!cboxSort.Checked) + // initNo = 0; + // WorkOrderBLL.SaveStartIndex(initNo); + // //} + //} + + + #endregion + + + + + + + //闫永刚2017-10-2发送操作命令 + dai.MOULD_CODE = string.Equals(dai.DIVBY_MOULD, "1") ? result.MouldCode : "1"; + + if (!result.PreInput) + { + SendSignal(dai); + } + + //刷新采集模式为自适应的采集数据 + if (daiList.Count(p => p.DA_MODE == "3") > 0) + { + var cachelist = _agent.InvokeServiceFunction>(B9IPCService.DAICacheBLL_GetWorklocCache.ToString(), _operationServiceParam.machineInfo.WORKLOC_CODE); + foreach (var item in daiList.Where(p => p.DA_MODE == "3")) + { + var viewitem = daicache.FirstOrDefault(p => p.DACode == item.DA_CODE && (string.IsNullOrWhiteSpace(p.MouldCode) || p.MouldCode == result.MouldCode)); + var cache = cachelist.FirstOrDefault(p => p.DA_CODE == item.DA_CODE); + if (viewitem != null) + { + if (cache != null && !string.IsNullOrWhiteSpace(cache.DA_VALUE)) + { + viewitem.DAValue = cache.DA_VALUE; + viewitem.MaterialCode = cache.MATERIAL_CODE; + viewitem.MaterialName = cache.MATERIAL_NAME; + viewitem.DAResult = "通过"; + } + else + { + viewitem.DAValue = ""; + viewitem.MaterialTypeName = ""; + viewitem.MaterialCode = ""; + viewitem.MaterialName = ""; + viewitem.DAResult = ""; + } + } + } + } + + DGView.Refresh(); + DGViewColorBind(); + + //设置焦点 + this.ActiveControl = this.txtCode; + txtCode.SelectAll(); + txtCode.Focus(); + + GC.Collect(); + + } + catch (Exception ex) + { + WriteLog.WriteError(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + ex.Message); + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + Reset(string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text); + txtCode.SelectAll(); + txtCode.Focus(); + MessageBox.Show("系统异常,请重新扫描!"); + } + + } + #endregion + + #region 执行返回结果中包含的动作 + /// + /// 执行返回结果中包含的动作 + /// + /// + private void DoResultActions(DAResult result) + { + lblError.Text = string.Format("当前工位状态:{0}", result.StateName); + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + lblWorkcellState.Text = result.StateName; + foreach (var act in result.Actions) + { + switch (act) + { + case "SUBMIT": //状态变化动作为 提交数据 + { + //TODO:更细界面数据 + BindView(); + BindPlanView(); + break; + } + case "SUBMIT_NOPLAN": //状态变化动作为 提交数据 + { + //TODO:更细界面数据 + BindView(); + //BindPlanView(); + break; + } + case "SIGNAL_START": //状态变化动作为 发送启动信号 + { + //TODO:发送启动信号 + break; + } + case "PUSHDATA": //推送提前输入数据 + { + //TODO:发送信号 + var cachelist = _agent.InvokeServiceFunction>(B9IPCService.DAICacheBLL_GetWorklocCache.ToString(), _operationServiceParam.machineInfo.WORKLOC_CODE); + string premouldcode = "PRE-" + result.MouldCode; + if (_operationServiceParam.machineInfo.ISSTATION != 2) + { + premouldcode = "PRE-" + _operationServiceParam.machineInfo.WORKCELL_CODE; + } + + foreach (var daiview in daicache.Where(p=>(p.MouldCode==result.MouldCode||string.IsNullOrEmpty(p.MouldCode)||p.MouldCode==premouldcode))) + { + var cache = cachelist.FirstOrDefault(p => p.DA_CODE == daiview.DACode + && (string.Equals(daiview.PREINPUT, "1") + ? (p.MOULD_CODE == result.MouldCode + && p.PREINPUT == "1") + : (p.MOULD_CODE == daiview.MouldCode + && p.PREINPUT != "1"))); + if (cache != null && !string.IsNullOrWhiteSpace(cache.DA_VALUE)) + { + daiview.DAValue = cache.DA_VALUE; + daiview.MaterialCode = cache.MATERIAL_CODE; + daiview.MaterialName = cache.MATERIAL_NAME; + daiview.DAResult = "通过"; + } + else + { + daiview.DAValue = ""; + daiview.MaterialTypeName = ""; + daiview.MaterialCode = ""; + daiview.MaterialName = ""; + daiview.DAResult = ""; + } + } + Action signalaction = new Action(() => + { + string sleep = result.Actions.FirstOrDefault(p => p.StartsWith("SLEEP")); + if (sleep != null) + { + int st = 0; + int.TryParse(sleep.Replace("SLEEP_", ""), out st); + System.Threading.Thread.Sleep(st); + } + else + { + System.Threading.Thread.Sleep(10000); + } + //TODO:发送信号 + foreach (var daiview in daiviewSource) + { + if (daiview.DAResult == "通过" && !string.Equals(daiview.PREINPUT, "1")) + { + DAI signalDai = new DAI() + { + WORKCELL_CODE = _operationServiceParam.machineInfo.WORKCELL_CODE, + WORKLOC_CODE = _operationServiceParam.machineInfo.WORKLOC_CODE, + DA_CODE = daiview.DACode, + MOULD_CODE = string.Equals(_operationServiceParam.machineInfo.WORKCELL_CODE, result.MouldCode) ? "1" : result.MouldCode, + Result = EnumGeter.ORDERTYPE.OK.GetHashCode().ToString(), + MATERIAL_CODE = daiview.MaterialCode + }; + SendSignal(signalDai); + } + } + }); + signalaction.BeginInvoke(null, null); + + break; + } + case "PRINT_ASSY": //状态变化动作为 打印总成码 + { + //TODO:清空界面数据 复位启动信号 + //PrintAssemblyLabel(result.ProcessCode); + Print052QRCODE(true, result.ProcessCode); + break; + } + + case "PRINT_PROCESS": //状态变化动作为 打印过程码 + { + //TODO:清空界面数据 复位启动信号 + PrintProcessLabel(result.ProcessCode); + break; + } + case "PRINT_PLAN": //状态变化动作为 打印计划标签 + { + //TODO:清空界面数据 复位启动信号 + PrintPlanLabel(result); + break; + } + case "RESET": //状态变化动作为 复位 + { + //TODO:清空界面数据 复位启动信号 + //SendRecoveryOrder(result.MouldCode); + Reset(result.MouldCode); + break; + } + case "SHOWMLIST": //状态变化动作为 显示装配物料清单 + { + ShowMaterialList(result.WorkOrderID); + break; + } + case "HIDEMLIST": //状态变化动作为 隐藏装配物料清单 + { + HideMaterialList(); + break; + } + default: + { + if (act.StartsWith("SIGNAL_")) + { + string dacode = act.Replace("SIGNAL_", ""); + var daiview = daiviewSource.FirstOrDefault(p => p.DACode == dacode && p.DAResult == "通过" && !string.Equals(p.PREINPUT, "1")); + if (daiview != null) + { + DAI signalDai = new DAI() + { + WORKCELL_CODE = _operationServiceParam.machineInfo.WORKCELL_CODE, + WORKLOC_CODE = _operationServiceParam.machineInfo.WORKLOC_CODE, + DA_CODE = daiview.DACode, + MOULD_CODE = string.Equals(_operationServiceParam.machineInfo.WORKCELL_CODE, result.MouldCode) ? "1" : result.MouldCode, + Result = EnumGeter.ORDERTYPE.OK.GetHashCode().ToString(), + MATERIAL_CODE = daiview.MaterialCode + }; + SendSignal(signalDai); + } + } + break; + } + } + } + } + + private void HideMaterialList() + { + dgvMlist.AutoGenerateColumns = false; + dgvMlist.DataSource = new List(); + plInfo.Visible = false; + } + private void ShowMaterialList(string OrderNo) + { + var mlist = _agent.InvokeServiceFunction>("PbomBLL_GetWorkingBom", _operationServiceParam.machineInfo.WORKLOC_CODE, OrderNo); + + dgvMlist.AutoGenerateColumns = false; + dgvMlist.DataSource = mlist; + dgvMlist.ClearSelection(); + if (mlist != null && mlist.Count > 0) + { + gbMlist.Visible = plInfo.Visible = true; + try + { + foreach (DataGridViewRow row in DGView.Rows) + { + FJC.Entity.View.DAIFormView dv = row.DataBoundItem as FJC.Entity.View.DAIFormView; + if (dv != null && dv.StateCode.ToUpper() == "ASSY") + { + if (!mlist.Exists(p => (p.MATERIAL_TYPE_CODE + "").StartsWith(dv.MaterialType))) + { + row.Visible = false; + continue; + } + row.Visible = true; + } + } + } + catch + { + + } + } + else + { + gbMlist.Visible = plInfo.Visible = false; + } + plInfo.AutoSize = !gbMlist.Visible; + } + + #endregion + + #region 发送信号 + /// + /// 发送信号 + /// + /// + private void SendSignal(DAI dai) + { + if (proy == null) + return; + string paraStr = JsonConvertHelper.GetSerializes(dai); + if (proy.State == System.ServiceModel.CommunicationState.Faulted) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + } + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + var task = new System.Threading.Tasks.Task(() => + { + //闫永刚2017-10-2发送操作命令 + proy.SendOperateOrder(paraStr); + }); + task.Start(); + } + } + #endregion + + #region 发送操作命令 + /// + /// 发送操作命令 + /// + private void SendRecoveryOrder(string mouldcode) + { + DAI dai = daiList[0]; + + DAI recoveryDai = new DAI() { WORKCELL_CODE = dai.WORKCELL_CODE, WORKLOC_CODE = dai.WORKLOC_CODE, DA_CODE = "RECOVERY", MOULD_CODE = string.IsNullOrWhiteSpace(mouldcode) ? "1" : mouldcode, Result = "0" }; + + if (proy == null) + { + return; + } + if (proy.State == System.ServiceModel.CommunicationState.Faulted) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + } + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + //闫永刚2017-10-2发送操作命令 + + string paraStr = JsonConvertHelper.GetSerializes(recoveryDai); + proy.SendOperateOrder(paraStr); + } + } + #endregion + + #region 根据输入条码定位采集点 + /// + /// 根据输入条码定位采集点 + /// + /// + private DAI LocateDAI(string productCode) + { + foreach (var rule in _barcodeRules) + { + if (System.Text.RegularExpressions.Regex.IsMatch(productCode, rule.REGEX)) + { + var dai = daiList.FirstOrDefault(p => (p.MATERIAL_TYPE == rule.MATERIAL_TYPE || p.MATERIAL_TYPE == rule.PARENT_TYPE) && p.DATA_TYPE == rule.DATA_TYPE); + if (dai != null) + { + var ndai = (DAI)dai.Clone(); + ndai.MATERIAL_CODE = rule.MATERIAL_CODE; + ndai.MATERIAL_TYPE = rule.MATERIAL_TYPE; + return ndai; + } + + } + } + //条码未匹配到任何正则 + Product product = _agent.InvokeServiceFunction(B9BasicService.ProductBLL_GetOrginProduct.ToString(), productCode); + if (product != null) + { + var dai = daiList.FirstOrDefault(p => p.MATERIAL_TYPE == product.MATERIAL_TYPE); + if (dai != null) + { + var ndai = (DAI)dai.Clone(); + ndai.MATERIAL_CODE = product.MATERIAL_CODE; + return ndai; + } + + } + + return null; + } + #endregion + + #region 发送指令或者接受完成指令刷新列表 + /// + /// 发送指令或者接受完成指令刷新列表 + /// + public void BindView() + { + #region 刷新生产零件的列表 + this.DGViewProList.DataSource = new List(); + //加载当前工序,当前设备的最后几条加工记录 + DataPage dataPage = new DataPage(); + dataPage.PageSize = int.Parse(cbListRowcount.Text); + dataPage.PageIndex = 1; + dataPage.SortExpression = " ROWVALUE ASC"; + MainOperation operationSearchModel = new MainOperation(); + //operationSearchModel.CREATEUSER = ClientContext.LoginInfo.UserID; + operationSearchModel.MACHINECODDE = _operationServiceParam.machineInfo.MACHINECODDE; + //operationSearchModel.PROCESSTYPE = _operationServiceParam.processSet.PROCESSTYPE; + operationSearchModel.CURRENTPROCESS = _operationServiceParam.machineInfo.WORKLOC_CODE; + + //if (_operationServiceParam.processSet.PROCESSTYPE != EnumGeter.ProcessType.maojie.GetHashCode().ToString() + // && (this.comProductType.SelectedValue.ToString() != EnumGeter.ProductType.fengdao.GetHashCode().ToString() + // || this.comProductType.SelectedValue.ToString() != EnumGeter.ProductType.HUDfengdao.GetHashCode().ToString() + // ) + // ) + //{ + // operationSearchModel.PRODUCTTYPE = this.comProductType.SelectedValue.ToString(); + //} + + try + { + #region 服务查询 + dataPage = _agent.InvokeServiceFunction(B9BasicService.MainOperationBLL_GetOperationListNew.ToString(), operationSearchModel, dataPage); + List listOperetions = JsonConvertHelper.GetDeserialize>(dataPage.Result.ToString()); + #endregion + this.DGViewProList.DataSource = listOperetions; + DGViewProList.ClearSelection(); + + } + catch (Exception ex) + { + throw ex; + } + + #endregion + } + #endregion + + #region 发送指令或者接受完成指令刷新列表 + /// + /// 发送指令或者接受完成指令刷新列表 + /// + public void BindPlanView() + { + #region 刷新生产计划 + dgvPlan.AutoGenerateColumns = false; + this.dgvPlan.DataSource = new List(); + + + try + { + DataPage dataPage = new DataPage(); + dataPage.PageSize = int.Parse(cbListRowcount.Text); + dataPage.PageIndex = 1; + dataPage.SortExpression = " ROWVALUE ASC"; + string workcellcode = daiList.Select(p => p.WORKCELL_CODE).FirstOrDefault() + ""; + #region 服务查询 + var orderlist = _agent.InvokeServiceFunction>(B9IPCService.WorkOrderBLL_GetOrderInCell.ToString(), workcellcode,cbPlanFilter.SelectedIndex, dataPage); + #endregion + //this.dgvPlan.DataSource = orderlist; + //DGViewProList.ClearSelection(); + + + #region BC316装配排序 + //DataTable dt = WorkOrderBLL.GetFisOrder(_lineCode, _displayType, 100); + + DataTable dt = WorkOrderBLL.GetFisOrder(workcellcode, cbPlanFilter.SelectedIndex, dataPage.PageSize); + + int startIndex = WorkOrderBLL.GetStartIndex(); + + + //20220427 BC316总成装配 排序 + if (workcellcode == "ASSEMBLE_BC316") + { + + + DataTable allTable = null; + if (cboxSort.Checked) + { + dt.Columns.Add("InitNo"); + dt.Columns.Add("No"); + + #region 扫描2个条码后,下次页面刷新时,又重654321排序. 纪录扫描位置,下次刷新时,从数据前面插入相应数量的记录.然后进行计算序列号. 最后再将插入的记录删掉.保证可以得到4321这样的顺序 + for (int m = 0; m < startIndex; m++) + { + if (_firstBoxA == "true") + { + int q = (_containCount / 2); + if (m < q && startIndex <= q) + { + DataRow dr = dt.NewRow(); + dr["WORKCENTER_CODE"] = "Temp"; + dt.Rows.InsertAt(dr, q - startIndex); + } + else + { + DataRow dr = dt.NewRow(); + if (m < q) + { + + dr["WORKCENTER_CODE"] = "Temp"; + dt.Rows.InsertAt(dr, 0); + } + else + { + dr["WORKCENTER_CODE"] = "Temp"; + dt.Rows.InsertAt(dr, 3 * q - startIndex); + } + + } + + } + else + { + DataRow dr = dt.NewRow(); + dr["WORKCENTER_CODE"] = "Temp"; + dt.Rows.InsertAt(dr, _containCount - startIndex); + } + + } + + + #endregion + + + Func loadPlan = null; + if (_firstBoxA == "true") + { + loadPlan = LoadAPlan; + } + else + { + loadPlan = LoadBPlan; + } + int totalCount = dt.Rows.Count; + DataTable unitTable = dt.Clone(); + allTable = dt.Clone(); + for (int i = 1; i <= dt.Rows.Count; i++) + { + unitTable.Rows.Add(dt.Rows[i - 1].ItemArray); + if (i % _containCount == 0) + { + DataTable unitSortTable = loadPlan(unitTable, _containCount, startIndex); + foreach (DataRow dr in unitSortTable.Rows) + { + allTable.Rows.Add(dr.ItemArray); + } + unitTable.Rows.Clear(); + } + //注释掉, 只保留被6整除的数据. 例如查询15条,每个器具6条. 只查询出12条. + //else if( i== totalCount && i% _containCount >0) + //{ + // DataTable unitSortTable = loadPlan(unitTable, _containCount, startIndex); + // foreach (DataRow dr in unitSortTable.Rows) + // { + // allTable.Rows.Add(dr.ItemArray); + // } + // unitTable.Rows.Clear(); + //} + } + + #region 删除用于计算的多余空数据 + List list = new List(); + foreach (DataRow dr in allTable.Rows) + { + if (dr["WORKCENTER_CODE"].ToString() == "Temp") + { + list.Add(dr); + //allTable.Rows.Remove(dr); + } + } + foreach (DataRow dr in list) + { + allTable.Rows.Remove(dr); + } + #endregion + } + else + { + allTable = dt; + } + + //dgvPlan.DataSource = allTable; + this.dgvPlan.DataSource = allTable; + } + else + { + this.dgvPlan.DataSource = orderlist; + } + #endregion + + + + + //20220420 BC316总成装配 显示当前计划在画面上部 + if (workcellcode== "ASSEMBLE_BC316") + { + var planfirst = this.dgvPlan.SelectedRows[0].Cells[3].Value.ToString(); + this.tBMat.Text = planfirst; + } + + + var plancount = _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_GetOrderCountInCell.ToString(), workcellcode, ""); + lblPlanCount.Text = plancount.ToString(); + + var dayplancount = _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_GetDayPlanCount.ToString(), _operationServiceParam.machineInfo.WORKCENTER_CODE); + lblDayPlanCount.Text = dayplancount.ToString(); + + var shiftplancount = _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_GetOrderCountInCell.ToString(), workcellcode, _operationServiceParam.produceShift.PRODUCESHIFTTCODE); + lblShiftPlanCount.Text = shiftplancount.ToString(); + + if (!string.IsNullOrWhiteSpace(_operationServiceParam.produceShift.PID)) + { + var shift = _operationServiceParam.produceShift; + var condition = new FJC.Entity.QT.ProcessRecord(); + condition.WORKCELL_CODE = workcellcode; + condition.WORK_START_TIME = DateTime.Now.Date.Add(shift.PSSTART - shift.PSSTART.Date); + condition.WORK_END_TIME = DateTime.Now.Date.Add(shift.PSEND - shift.PSEND.Date); + if (condition.WORK_END_TIME < condition.WORK_START_TIME) + { + condition.WORK_END_TIME = condition.WORK_END_TIME.AddDays(1); + } + var shiftcompletecount = _agent.InvokeServiceFunction(B9IPCService.ProcessRecordBLL_GetCount.ToString(), condition); + lblShiftCompleteCount.Text = shiftcompletecount.ToString(); + } + else + { + lblShiftCompleteCount.Text = ""; + } + + } + catch (Exception ex) + { + WriteLog.WriteError(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + ex.Message); + } + finally + { + timecounter = 0; + } + #endregion + } + #endregion + + /// + /// 器具A面靠人 顺序为321654 + /// + /// + /// + /// 第一条起始位置 + /// + DataTable LoadAPlan(DataTable fisTable, int pLoadCount, int startIndex) + { + for (int i = 0; i < fisTable.Rows.Count; i++) + { + fisTable.Rows[i]["InitNo"] = i + 1; + } + + int q = (pLoadCount / 2); + for (int i = 0; i < pLoadCount; i++) + { + if (i < q) + { + if (i < fisTable.Rows.Count) + fisTable.Rows[i]["No"] = q - i; + } + else + { + if (i < fisTable.Rows.Count) + fisTable.Rows[i]["No"] = 2 * q - (i - q); + } + } + DataTable dt = fisTable.AsEnumerable().OrderBy(p => p.Field("No")).CopyToDataTable(); + + return dt; + } + + /// + /// 器具B面靠人 顺序为654321 + /// + /// + /// + /// 第一条起始位置 + /// + DataTable LoadBPlan(DataTable fisTable, int pLoadCount, int startIndex) + { + for (int i = 0; i < fisTable.Rows.Count; i++) + { + //fisTable.Rows[i]["InitNo"] = i + 1; + //fisTable.Rows[i]["No"] = fisTable.Rows.Count - i; + fisTable.Rows[i]["InitNo"] = (pLoadCount - (fisTable.Rows.Count - i)) + 1; + fisTable.Rows[i]["No"] = pLoadCount - i; + } + DataTable dt = fisTable.AsEnumerable().OrderBy(p => p.Field("No")).CopyToDataTable(); + return dt; + } + + #region 绑定先决条件以及绑定加工记录 + /// + /// 绑定先决条件以及绑定加工记录 + /// + private void BindAll() + { + //设置当前的工序 + //_operationServiceParam.processSet = this.comProductType.SelectedItem as ProcessSet; + if (_operationServiceParam.machineInfo != null)//_operationServiceParam.processSet != null && + { + this.DGView.Refresh(); + DGViewColorBind(); + + BindView(); + BindPlanView(); + } + + } + #endregion + + #region 窗口数据重置 + /// + /// 窗口数据重置 + /// + private void Reset(string mouldcode) + { + foreach (var v in daicache.Where(p=>string.Equals(p.MouldCode,mouldcode))) + { + if (!string.IsNullOrWhiteSpace(v.StateCode)) + { + v.MaterialName = ""; + v.MaterialCode = ""; + v.DAValue = ""; + v.DAResult = ""; + } + } + _operationServiceParam = new OperationServiceParam(); + _operationServiceParam.machineInfo = this.comMachine.SelectedItem as MachineInfo; + _operationServiceParam.produceShift = ClientContext.produceShift; + BindAll(); + } + #endregion + + #region 刷新数据采集列表 + /// + /// 刷新数据采集列表 + /// + private void DGViewColorBind() + { + int panelheight = 0; + DGView.ClearSelection(); + if (DGView.Rows.Count > 0) + { + string mould = ""; + for (int i = 0; i < DGView.Rows.Count; i++) + { + + DataGridViewRow dgr = DGView.Rows[i]; + panelheight += dgr.Height; + if (!string.Equals(dgr.Cells[dgcMouldCode.Name].Value, mould)) + { + if (i > 0) + { + DataGridViewRow dgru = DGView.Rows[i - 1]; + dgru.DividerHeight = 4; + dgru.Height = dgr.Height + 4; + panelheight += 4; + } + + mould = dgr.Cells[dgcMouldCode.Name].Value + ""; + } + if (dgr.Cells["daresult"].Value != null && dgr.Cells["daresult"].Value.ToString() == "通过") + { + dgr.DefaultCellStyle.BackColor = Color.Green; + } + else if (dgr.Cells["daresult"].Value != null && dgr.Cells["daresult"].Value.ToString() == "未通过") + { + dgr.DefaultCellStyle.BackColor = Color.Red; + } + else + { + dgr.DefaultCellStyle.BackColor = SystemColors.Window; + } + } + plDAI.Height = 27 + panelheight; + } + + } + #endregion + + #region 标签打印 + + #region 新版总工标签打印 + + GridppReport Report = null; + public string planMATERIAL_CODE = ""; + public string processMainCode = ""; + + ///// + ///// 总成标签打印 + ///// + ///// + //private void PrintAssemblyLabe(string processcode) + //{ + // tsbPrint.Visible = true; + // ///////////////////// + // string selectKey = processcode; + // Main main = _agent.InvokeServiceFunction
(B9IPCService.MainBLL_GetByCondition.ToString(), new Main() { EPIDERMISCODE = selectKey }); + // if (main == null) + // { + // MessageBox.Show("获取总成条码异常!"); + // return; + // } + // MaterialCodeInit mcinit = _agent.InvokeServiceFunction(B9IPCService.MainBLL_GetMaterialSetByCondition.ToString(), new MaterialCodeInit() { MATERIAL_CODE = main.MATERIAL_CODE, WORKCELL_CODE = "ASSEMBLY" }); + // if (mcinit == null) + // { + // MessageBox.Show("获取总成条码异常!"); + // return; + // } + + // #region 总成装配打印 + + // rePrintBzd.barcode = main.MAINCODE; + // rePrintBzd.MATERIAL_CODE = main.MATERIAL_CODE; + // rePrintBzd.color = mcinit.COLOR; + + // try + // { + // Report = new GridppReport(); + + // string reportPath = System.Configuration.ConfigurationManager.AppSettings["AssemblyPrintingTemplatePath"].ToString(); + + // //数据填充 + // Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox2); + + // Report.LoadFromFile(reportPath); + + // //rep.Printer.PrinterName = "默认打印机";//调取不同的打印机 + + // Report.Print(false); + // } + // catch (Exception) + // { + + // throw; + // } + // finally + // { + + // Report = new GridppReport(); + // } + + //} + + + //新增 + private BZD rePrintBzd = new BZD(); + + //private void ReadFetchRecordBox2() + //{ + // try + // { + // string e052BarCode = rePrintBzd.barcode; + + // Report.DetailGrid.Recordset.Append(); + + // Report.FieldByName("BarCode").Value = string.Format("*{0}*", e052BarCode);//总装条码 + + // Report.FieldByName("FullBarCode").Value = e052BarCode;//总装条码 + + // Report.FieldByName("PartCode").Value = rePrintBzd.color;//颜色 + + // Report.FieldByName("PartDesc").Value = rePrintBzd.MATERIAL_CODE; //物料号 + + // Report.DetailGrid.Recordset.Post(); + // } + // catch (Exception err) + // { + // throw new Exception(err.Message); + // } + //} + + private void ReadFetchRecordBo3() + { + try + { + string e052BarCode = rePrintBzd.barcode; + + Report.DetailGrid.Recordset.Append(); + + Report.FieldByName("BarCode").Value = string.Format("*{0}*", e052BarCode);//总装条码 + + Report.FieldByName("FullBarCode").Value = e052BarCode;//总装条码 + + Report.FieldByName("PartCode").Value = rePrintBzd.color;//颜色 + + Report.FieldByName("PartDesc").Value = rePrintBzd.MATERIAL_CODE; //物料号 + + Report.DetailGrid.Recordset.Post(); + } + catch (Exception err) + { + throw new Exception(err.Message); + } + } + + /// + /// 打印052标签 + /// + /// 物料号是否为固定值 + /// 主码 + public void Print052QRCODE(bool cBoxVANstr, string processcode) + { + try + { + if (!cBoxVANstr || "IP_ASSEMBLING,GWASSEMBLE_VW371PA".Contains(_operationServiceParam.machineInfo.WORKLOC_CODE)) + cBoxVAN.Visible = false; + + Report = new GridppReport(); + + //数据填充 + //Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox); + processMainCode = processcode; + + string reportPath = System.Configuration.ConfigurationManager.AppSettings["AssemblyPrintingTemplatePath"].ToString(); + + //数据填充 + Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox); + + Report.LoadFromFile(reportPath); + + //rep.Printer.PrinterName = "默认打印机";//调取不同的打印机 + + Report.Print(false); + } + catch (Exception) + { + + throw; + } + finally + { + + Report = new GridppReport(); + } + + #endregion + + + } + + + public class BZD + { + public string barcode; + public string color; + public string MATERIAL_CODE; + public string count; + }; + /// + /// 获取BZD码 + /// + /// + private BZD getBZDCode() + { + BZD bzd = new BZD(); + List list = new List(); + List paramList = new List(); + + //张松男 20210207 总成工位打印052 缺少物料号 重新查找填充 start + if (string.IsNullOrEmpty(planMATERIAL_CODE)) + { + var MaterialCodes = ""; + var dataSrouce = _agent.InvokeServiceFunction(B9IPCService.BZDConfigBLL_GetMaterialCode.ToString(), processMainCode); + foreach (DataRow dataRow in dataSrouce.Rows) + { + MaterialCodes = dataRow["MATERIAL_CODE"].ToString(); + } + if (!string.IsNullOrEmpty(MaterialCodes)) + planMATERIAL_CODE = MaterialCodes; + else + throw new Exception("创建BZD码失败!缺少planMATERIAL_CODE"); + } + //张松男 20210207 总成工位打印052 缺少物料号 重新查找填充 end + + + paramList.Add(planMATERIAL_CODE); + paramList.Add(processMainCode); + + try + { + //读取BZDCONFIG配置列表 + list = _agent.InvokeServiceFunction>( + B9IPCService.BZDRecorderBLL_CreateBZDCode.ToString(), paramList); + if (list != null) + { + //将返回值赋值给bzd对象 + bzd.barcode = list[0]; + bzd.color = list[1]; + bzd.MATERIAL_CODE = list[2]; + bzd.count = list[3]; + if (bzd.count == "0") + { + planMATERIAL_CODE = null; + processMainCode = null; + throw new Exception($"创建BZD码失败!缺少list[3];planMATERIAL_CODE={planMATERIAL_CODE};processMainCode={processMainCode}"); + } + planMATERIAL_CODE = null; + processMainCode = null; + } + else + { + planMATERIAL_CODE = null; + processMainCode = null; + throw new Exception($"创建BZD码异常!list=null;planMATERIAL_CODE={planMATERIAL_CODE};processMainCode={processMainCode}"); + } + } + catch (Exception e) + { + planMATERIAL_CODE = null; + processMainCode = null; + MessageBox.Show(e.Message); + throw; + } + + return bzd; + } + + /// + /// 填充数据 + /// + private void ReadFetchRecordBox() + { + try + { + BZD bzd = getBZDCode(); + string e052BarCode = bzd.barcode; + Report.DetailGrid.Recordset.Append(); + + //************20210712 DQZhang BC316 VAN --20220422 只有生产备件时有82V,主要生产VAN************************************* + if (cBoxVAN.Checked && cBoxVAN.Visible == true) + { + Report.FieldByName("PartDesc").Value = "5CG.857.003.A 82V"; + } + else + { + Report.FieldByName("PartDesc").Value = bzd.MATERIAL_CODE; //物料号 //物料号 + } + + Report.FieldByName("BarCode").Value = string.Format("*{0}*", e052BarCode);//总装条码 + + Report.FieldByName("FullBarCode").Value = e052BarCode;//总装条码 + + Report.FieldByName("PartCode").Value = bzd.color;//颜色 + + Report.DetailGrid.Recordset.Post(); + } + catch (Exception err) + { + throw new Exception(err.Message); + } + } + + #endregion + + #region 总成标签打印 + /// + /// 总成标签打印 + /// + /// + private void PrintAssemblyLabel(string processcode) + { + tsbPrint.Visible = true; + ///////////////////// + string selectKey = processcode; + Main main = _agent.InvokeServiceFunction
(B9IPCService.MainBLL_GetByCondition.ToString(), new Main() { EPIDERMISCODE = selectKey }); + if (main == null) + { + MessageBox.Show("获取总成条码异常!"); + return; + } + MaterialCodeInit mcinit = _agent.InvokeServiceFunction(B9IPCService.MainBLL_GetMaterialSetByCondition.ToString(), new MaterialCodeInit() { MATERIAL_CODE = main.MATERIAL_CODE, WORKCELL_CODE = "LS_ASSEMBLE_VW371" }); + if (mcinit == null) + { + MessageBox.Show("获取总成条码异常!"); + return; + } + #region 总成装配打印 + //string xmlPath = System.Configuration.ConfigurationSettings.AppSettings["XmlName"].ToString(); ; + //BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate( xmlPath); + //bool b = g.PrintBarCode(_operationServiceParam.main.MAINCODE); + QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo(); + //ll.BarCode = main.MAINCODE + "," + main.MATERIAL_CODE + ","; + + //************20210413 DQZhang BC316 VAN************************************* + if (cBoxVAN.Checked) + { + ll.BarCode = main.MAINCODE + "," + "5CG.857.003.A VAN" + ","; + } + else + { + ll.BarCode = main.MAINCODE + "," + main.MATERIAL_CODE + ","; + } + //*************************************************************************** + + ll.BarCode += mcinit.HB; + //if (selectKey.ToUpper().Substring(12, 1) == "H") + //{ + // ll.BarCode += "高"; + //} + //else + //{ + // ll.BarCode += "低"; + //} + ll.BarCode += mcinit.COLOR; + //if (selectKey.Substring(13, 1) == "1") + //{ + // ll.BarCode += "黑"; + //} + //else if (selectKey.Substring(13, 1) == "2") + //{ + // ll.BarCode += "灰"; + //} + //else + //{ + // ll.BarCode += "米"; + //} + + ll.BarCode += " ";// +mcinit.PRODUCT_TYPES; + //ll.BarCode += "\r\n" + ll.BarCode;//总成标签一式两份 + + QM.Assist.PrintUtil.LabelList2.Add(ll); + QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil(); + pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString(), + System.Configuration.ConfigurationManager.AppSettings["ZCtemPath"].ToString(), + System.Configuration.ConfigurationManager.AppSettings["ZCdataPath"].ToString()); + ///总成标签一式两份 + //pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString + // (), System.Configuration.ConfigurationManager.AppSettings["ZCtemPath"].ToString + // (), System.Configuration.ConfigurationManager.AppSettings["ZCdataPath"].ToString + // ()); + + #endregion + } + #endregion + + #region 过程标签打印 + /// + /// 过程标签打印 + /// + /// + private void PrintProcessLabel(string processcode) + { + ///////////////////// + string selectKey = processcode; + Product product = _agent.InvokeServiceFunction(B9IPCService.ProductBLL_Get.ToString(), new Product() { PRODUCTCODE = selectKey }); + if (product == null) + { + MessageBox.Show("获取产品信息异常!"); + return; + } + + #region 过程标签打印 + + QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo(); + ll.BarCode = product.PRODUCTCODE + "," + product.MATERIAL_CODE + ","; + + ll.BarCode += product.MATERIAL_CODE + "," + product.MATERIAL_CODE + "," + product.MATERIAL_TYPE; + + QM.Assist.PrintUtil.LabelList2.Add(ll); + QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil(); + pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString + (), System.Configuration.ConfigurationManager.AppSettings["ProcessCodeTMPPath"].ToString + (), System.Configuration.ConfigurationManager.AppSettings["ProcessCodeDATPath"].ToString + ()); + + #endregion + } + #endregion + + #region 计划标签打印 + /// + /// 计划标签打印 + /// + /// + private void PrintPlanLabel(DAResult result) + { + var labeldata = _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_GetPlanLabel.ToString(), result.WorkOrderID); + labeldata.SN = result.ProcessCode; + + #region 计划标签打印 + //string xmlPath = System.Configuration.ConfigurationSettings.AppSettings["XmlName"].ToString(); ; + //BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate( xmlPath); + //bool b = g.PrintBarCode(_operationServiceParam.main.MAINCODE); + QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo(); + + + //planno,plantype,seq,bom,vin,kin,sn,pn,prodname,plandate,project,hbtype,color + ll.BarCode = string.Format("'{0},'{1},'{2},'{3},'{4},'{5},'{6},'{7},'{8},'{9},'{10},'{11},'{12}", + labeldata.PlanNo,//计划号 + labeldata.PlanType,//计划类型(0:FIS,1:STOCK,2:INSERT) + labeldata.SEQ,//顺序号 + labeldata.BOM,//bom号 + labeldata.VIN,//底盘号 + labeldata.KIN,//车身号 + labeldata.SN,//序号 + labeldata.PN,//总成物料号 + labeldata.ProdName,//总成物料名称 + labeldata.PlanDate,//计划日期 + labeldata.ProjectCode,//项目编号 + labeldata.HBType,//车型配置 + labeldata.Color//颜色 + ); + + + + QM.Assist.PrintUtil.LabelList2.Add(ll); + QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil(); + pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString + (), System.Configuration.ConfigurationManager.AppSettings["PlanLabelTMPPath"].ToString + (), System.Configuration.ConfigurationManager.AppSettings["PlanLabelDATPath"].ToString + ()); + + #endregion + } + #endregion + + + #region 设备下拉改变事件 + /// + /// 设备下拉改变事件 + /// + /// + /// + private void comMachine_SelectionChangeCommitted(object sender, EventArgs e) + { + Init(); + } + #endregion + + #region 重新发发送操作指令 + /// + /// 重新发发送操作指令 + /// + /// + /// + private void sendOrderButton_Click(object sender, EventArgs e) + { + if (this.DGViewProList.SelectedRows.Count == 0) + { + MessageBox.Show("请选择要重新发送操作指令的加工信息!"); + return; + } + + + if (MessageBox.Show("确定重新发送操作指令?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + //判断是否已加工完成 + if (!this.DGViewProList.SelectedRows[0].Cells["OPERATESTATE"].Value.ToString().Equals(EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString())) + { + MessageBox.Show("只有加工中的零件可以重新发送操作指令!"); + return; + } + + string molderNumber = this.DGViewProList.SelectedRows[0].Cells["MOLDNUMBER"].Value.ToString(); + + + #region 发送指令 + + if (proy.State == System.ServiceModel.CommunicationState.Faulted) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + } + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + string moldnumber = _operationServiceParam.machineInfo.MOLDNUMBER; + try + { + + _operationServiceParam.machineInfo.MOLDNUMBER = molderNumber; + DataResult reMsg = _agent.InvokeServiceFunction>(B9BasicService.MainOperationBLL_GetSendOrder.ToString(), _operationServiceParam.machineInfo, true); + if (!string.IsNullOrEmpty(reMsg.Result) && proy != null && (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened)) + { + proy.SendOperateOrder(reMsg.Result); + this.lblError.Text = "发送指令成功!"; + this.lblError.ForeColor = Color.Green; + this.lblError.BackColor = SystemColors.InactiveBorder; + _operationServiceParam.machineInfo.MOLDNUMBER = moldnumber; + } + } + catch (Exception ex) + { + this.lblError.Text += "发送指令失败!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + _operationServiceParam.machineInfo.MOLDNUMBER = moldnumber; + } + } + + #endregion + + } + #endregion + + #region 锁定解锁 + /// + /// 锁定解锁 + /// + /// + /// + private void lblLock_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + + if (this.lblLock.Tag.ToString().Equals("0")) + { + LockType(false); + } + else + { + LockType(true); + } + } + #endregion + + #region 设备和类别锁定 + /// + /// 设备和类别锁定 + /// + /// + private void LockType(bool lockFlag) + { + this.comMachine.Enabled = lockFlag; + //this.comProductType.Enabled = lockFlag; + if (lockFlag) + { + + this.lblLock.Text = "锁定工位"; + this.lblLock.Tag = "0"; + } + else + { + string locationfile = System.Configuration.ConfigurationManager.AppSettings["loactionfile"]; + System.IO.File.WriteAllText(locationfile, this.comMachine.SelectedValue.ToString()); + this.lblLock.Text = "解锁工位"; + this.lblLock.Tag = "1"; + } + + } + #endregion + + #region 回车事件 + /// + /// 回车事件 + /// + /// + /// + private void txtCode_KeyDown(object sender, KeyEventArgs e) + { + + if (e.KeyCode == Keys.Enter)//如果输入的是回车键 + { + WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + txtCode.Text.Trim().ToUpper()); + Operation(); ;//触发button事件 + } + + } + + /// + /// 回车事件 + /// + /// + /// + private void OperationForm_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter)//如果输入的是回车键 + { + this.btnAdd_Click(sender, e);//触发button事件 + } + } + + #endregion + + #region OPC推送消息 + /// + /// OPC推送消息 + /// + /// 消息类型 3:模架号变化, + /// 消息内容 + public void ReturnResult(string messageType, string message) + { + this.Invoke((EventHandler)(delegate + { + try + { + if (messageType == "3") //模架号 MOULDCARRIER + { + var mould = mouldList.FirstOrDefault(p => string.Equals(p.MODELSTATION, message)); + if (mould != null) + { + SwitchMould(mould.MODELCODE); + } + } + else if (messageType == "4") //模具号 MOULDNUMBER + { + var str_messages = message.Split(':'); + if (!(string.Equals(str_messages[str_messages.Length - 1], "0") || string.Equals(str_messages[str_messages.Length - 1].ToUpper(), "FALSE"))) + { + DAInput(message, "MN"); + } + return; + } + else if (messageType == "5") //模具号OTHER + { + var str_messages = message.Split(':'); + if (AttachInfo.ContainsKey(str_messages[0])) + { + AttachInfo[str_messages[0]] = str_messages[1]; + } + else + { + AttachInfo.Add(str_messages[0], str_messages[1]); + } + return; + } + else if (string.Equals(messageType, "HeartBeat")) + { + opcheartbeatwaithandel.Set(); + } + else if(messageType == "0") // PRODUCTCODE + { + if (_AutoMachineCode.Contains(_operationServiceParam.machineInfo.MACHINECODDE)) + { + List list = QMFrameWork.Common.Serialization.JsonConvertHelper.GetDeserialize>(message); + if (list.Count <= 0) + { + this.lblError.Text = "没有条码,请检查服务!"; + this.lblError.ForeColor = Color.Red; + return; + } + foreach (var t in list) + { + if (_operationServiceParam.machineInfo.MACHINECODDE == t.MACHINECODDE && t.COLUMNTYPE == "8") + { + txtCode.Text = t.PARAVALUE.ToString().Trim(); + Operation(); + } + } + } + } + else + { + DAInput(message, "PARM"); + return; + } + + } + catch (Exception ex) + { + WriteLog.WriteError(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + ex.Message); + this.lblError.Text = ""; + this.lblError.ForeColor = Color.Black; + this.lblError.BackColor = SystemColors.InactiveBorder; + Reset(string.IsNullOrWhiteSpace(lblMould.Text) ? _operationServiceParam.machineInfo.WORKCELL_CODE : lblMould.Text); + txtCode.SelectAll(); + txtCode.Focus(); + MessageBox.Show("系统异常,请重新扫描!"); + } + })); + } + + private void DAInput(string message,string datype) + { + var mould = mouldList.FirstOrDefault(p => string.Equals(p.MODELCODE, message.Split(':')[0])); + + var dai = daiList.FirstOrDefault(p => p.DATA_TYPE == datype); + var daiview = daicache.FirstOrDefault(p => p.DACode == dai.DA_CODE && (mould == null || p.MouldCode == mould.MODELCODE)); + //daiviews.FirstOrDefault(p => p.DACode == dai.DA_CODE); + daiview.DAValue = message; + var result = _agent.InvokeServiceFunction(B9IPCService.DAI_Input.ToString() + , new DAArgs + { + WorkCellCode = dai.WORKCELL_CODE, + WorkLocCode = dai.WORKLOC_CODE, + DACode = dai.DA_CODE, + DAValue = message, + MaterialCode = dai.MATERIAL_CODE, + MachineCode = _operationServiceParam.machineInfo.MACHINECODDE, + MachineName = _operationServiceParam.machineInfo.MACHINENAME, + IsControl = _operationServiceParam.machineInfo.ISCONTROL, + MouldCode = mould == null ? _operationServiceParam.machineInfo.WORKCELL_CODE : mould.MODELCODE, + AttachData=AttachInfo + }); + + if (!result.Success) //如果采集数据输入失败 + { + daiview.DAResult = "未通过"; + DGView.Refresh(); + DGViewColorBind(); + this.lblError.Text = result.Message; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + txtCode.SelectAll(); + txtCode.Focus(); + return; + } + else + { + daiview.DAValue = result.AnalyzedValue; + daiview.DAResult = "通过"; + daiview.MaterialCode = result.MATERIAL_CODE; + daiview.MaterialName = result.MATERIAL_NAME; + DGView.Refresh(); + DGViewColorBind(); + //TODO:更新界面数据 + } + DoResultActions(result); + + if (this.lblLock.Tag.ToString().Equals("0")) + { + LockType(false); + } + DGView.Refresh(); + DGViewColorBind(); + + this.txtCode.Text = ""; + //设置焦点 + this.ActiveControl = this.txtCode; + this.txtCode.Focus(); + + GC.Collect(); + } + #endregion + + #region 重新连接服务器 + /// + /// 重新连接服务器 + /// + private void ReContact() + { + //设置与设备双工通信 + if (_operationServiceParam.machineInfo.ISCONTROL.Equals("2") || _operationServiceParam.machineInfo.ISCONTROL.Equals("3")) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + try + { + this.lblError.BackColor = SystemColors.InactiveBorder; + this.lblError.ForeColor = Color.Black; + this.lblError.Text = "正在连接中稍后!"; + var mouldno = proy.Register(_operationServiceParam.machineInfo.MACHINECODDE); + this.lblError.Text = "服务器连接成功!"; + this.lblError.ForeColor = Color.Green; + + if (mouldList.Count <= 2) + { + SwitchMould(""); + } + else + { + if (mouldno > 0) + { + var mould = mouldList.FirstOrDefault(p => string.Equals(p.MODELSTATION, mouldno.ToString())); + if (mould != null) + { + SwitchMould(mould.MODELCODE); + } + + } + else + { + SwitchMould(""); + } + //cbMould_SelectedIndexChanged(this, EventArgs.Empty); + } + } + catch (Exception) + { + this.lblError.Text = "连接服务失败!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + } + } + } + } + #endregion + + #region 工具栏Click + + #region 重接服务器 + /// + /// 重接服务器 + /// + /// + /// + private void tsbConnect_Click(object sender, EventArgs e) + { + ReContact(); + } + /// + /// 重接服务器 + /// + /// + /// + private void tsbRecovery_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(lblMould.Text) && cbMould.Items.Count > 1) + { + tsbRecovery.DropDownItems.Clear(); + foreach (MachineInfoModels mould in cbMould.Items) + { + var dditem = tsbRecovery.DropDownItems.Add(mould.MODELNAME); + dditem.Tag = mould.MODELCODE; + dditem.Padding = new Padding(0, 10, 0, 0); + } + tsbRecovery.ShowDropDown(); + return; + } + string mouldcode = string.IsNullOrWhiteSpace(lblMould.Text) ? (cbMould.Items.Count < 2 ? _operationServiceParam.machineInfo.WORKCELL_CODE : cbMould.SelectedValue.ToString()) : lblMould.Text; + Recovery(mouldcode); + } + #endregion + + #region 撤销 + /// + /// 撤销 + /// + /// + private void Recovery(string mouldcode) + { + + if (MessageBox.Show("确定对该零件进行撤销操作?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + var result = _agent.InvokeServiceFunction(B9IPCService.DAI_Rollback.ToString() + , new DAArgs + { + WorkCellCode = _operationServiceParam.machineInfo.WORKCELL_CODE, + WorkLocCode = _operationServiceParam.machineInfo.WORKLOC_CODE, + DACode = "", + DAValue = "", + MaterialCode = "", + MachineCode = _operationServiceParam.machineInfo.MACHINECODDE, + MachineName = _operationServiceParam.machineInfo.MACHINENAME, + IsControl = _operationServiceParam.machineInfo.ISCONTROL, + MouldCode = mouldcode, + AttachData = AttachInfo + }); + + if (!result.Success) //如果采集数据输入失败 + { + this.lblError.Text = result.Message; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + return; + } + SendRecoveryOrder(result.MouldCode); + DoResultActions(result); + DGView.Refresh(); + DGViewColorBind(); + + //设置焦点 + this.ActiveControl = this.txtCode; + txtCode.SelectAll(); + txtCode.Focus(); + } + /// + /// 撤销 + /// + /// + /// + private void tsbRecovery_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + string mouldcode = e.ClickedItem.Tag.ToString(); + Recovery(mouldcode); + + } + #endregion + + #region 重打总成码 + + /// + /// + /// + public string PRODUCT_CODE { get; set; } + + /// + /// 重打总成码 + /// + /// + /// + private void tsbPrint_Click(object sender, EventArgs e) + { + if (this.DGViewProList.SelectedRows.Count == 0) + { + MessageBox.Show("请选择打印的本体信息!"); + return; + } + + + if (MessageBox.Show("确定打印该本体的总成条码?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + + ///////////////////// + string selectKey = this.DGViewProList.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString(); + + + PRODUCT_CODE = selectKey; + + Report = new GridppReport(); + + //数据填充 + //Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox); + + + string reportPath = System.Configuration.ConfigurationManager.AppSettings["AssemblyPrintingTemplatePath"].ToString(); + + //数据填充 + Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReadFetchRecordBox3); + + Report.LoadFromFile(reportPath); + + //rep.Printer.PrinterName = "默认打印机";//调取不同的打印机 + + Report.Print(false); + + PRODUCT_CODE = null; + + //PrintAssemblyLabe(selectKey); + } + + /// + /// 重打总成 + /// + private void ReadFetchRecordBox3() + { + try + { + var record = _agent.InvokeServiceFunction(B9IPCService.BZDRecorderBLL_GetRecord.ToString(), new BZDRecorder2() { PRODUCTCODE = PRODUCT_CODE }); + + if (record == null) + { + //record = _agent.InvokeServiceFunction(B9IPCService.BZDRecorderBLL_Get316Record.ToString(), new BZDRecorder2() { PRODUCTCODE = PRODUCT_CODE }); + + //var config = _agent.InvokeServiceFunction>(B9IPCService.BZDConfigBLL_GetMaterial.ToString(), new BZDConfig() { MATERIALCODDE = record.MPID }); + var config = _agent.InvokeServiceFunction>(B9IPCService.BZDConfigBLL_Get.ToString(), new BZDConfig() { PID = record.MPID }); + string e052BarCode = record.BZDCODE; + var MATERIAL_CODE = config.Result.MATERIALCODDE; + var color = config.Result.configDetail; + + //添加补打记录 + _agent.InvokeServiceFunction(B9IPCService.BarCodeReplacementBLL_Insert.ToString(), new BarCodeReplacement() { ProductCode = PRODUCT_CODE, Type = "BZD条码重打" }); + + Report.DetailGrid.Recordset.Append(); + + Report.FieldByName("BarCode").Value = string.Format("*{0}*", e052BarCode);//总装条码 + + Report.FieldByName("FullBarCode").Value = e052BarCode;//总装条码 + + Report.FieldByName("PartCode").Value = color;//颜色 + + Report.FieldByName("PartDesc").Value = MATERIAL_CODE; //物料号 + + Report.DetailGrid.Recordset.Post(); + + } + else + { + var config = _agent.InvokeServiceFunction>(B9IPCService.BZDConfigBLL_Get.ToString(), new BZDConfig() { PID = record.MPID }); + string e052BarCode = record.BZDCODE; + var MATERIAL_CODE = config.Result.MATERIALCODDE; + var color = config.Result.ColorDetail; + + //添加补打记录 + _agent.InvokeServiceFunction(B9IPCService.BarCodeReplacementBLL_Insert.ToString(), new BarCodeReplacement() { ProductCode = PRODUCT_CODE, Type = "BZD条码重打" }); + + Report.DetailGrid.Recordset.Append(); + + Report.FieldByName("BarCode").Value = string.Format("*{0}*", e052BarCode);//总装条码 + + Report.FieldByName("FullBarCode").Value = e052BarCode;//总装条码 + + Report.FieldByName("PartCode").Value = color;//颜色 + + Report.FieldByName("PartDesc").Value = MATERIAL_CODE; //物料号 + + Report.DetailGrid.Recordset.Post(); + } + + } + catch (Exception err) + { + throw new Exception(err.Message); + } + } + + + #endregion + + #region 补打总成 + + + /// + /// 重打总成码 + /// + /// + /// + private void toolStripButton3_Click(object sender, EventArgs e) + { + BZDPasswordForm psd = new BZDPasswordForm(this); + BZDRePrintForm frm = new BZDRePrintForm(this); + + var result = psd.ShowDialog(); + if (result.ToString() == "OK") + { + frm.ShowDialog(); + } + + } + + #endregion + + #region 刷新 + /// + /// 刷新 + /// + /// + /// + private void btnRefresh_Click(object sender, EventArgs e) + { + BindView(); + BindPlanView(); + } + #endregion + + #region 产品返修操作 + /// + /// 产品返修操作 + /// + /// + /// + private void btnEditProduct_Click(object sender, EventArgs e) + { + if (this.DGViewProList.SelectedRows.Count == 0) + { + MessageBox.Show("请选择要进行返修的表皮信息!"); + return; + } + + if (MessageBox.Show("确定要进行返修的表皮信息?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + + //判断是否已加工完成 + if (!this.DGViewProList.SelectedRows[0].Cells["OPERATESTATE"].Value.ToString().Equals(EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString())) + { + MessageBox.Show("只有加工完成的零件可以产品返修操作!"); + return; + } + + //获取产品条码 + string selectKey = this.DGViewProList.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString(); + + string pid = this.DGViewProList.SelectedRows[0].Cells["PPID"].Value.ToString(); + MainOperation mo = new MainOperation() { PID = pid }; + + DataResult result = _agent.InvokeServiceFunction(B9BasicService.MainOperationBLL_MendProudct.ToString(), mo); + MessageBox.Show(result.Msg); + if (result.IsSuccess) + { + this.BindView(); + BindPlanView(); + } + } + #endregion + + #region 取消加工 + /// + /// 取消加工 + /// + /// + /// + private void tsbCancel_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(lblMould.Text) && cbMould.Items.Count > 1) + { + tsbCancel.DropDownItems.Clear(); + foreach (MachineInfoModels mould in cbMould.Items) + { + var dditem = tsbCancel.DropDownItems.Add(mould.MODELNAME); + dditem.Tag = mould.MODELCODE; + dditem.Padding = new Padding(0, 10, 0, 0); + } + tsbCancel.ShowDropDown(); + return; + } + string mouldcode = string.IsNullOrWhiteSpace(lblMould.Text) ? (cbMould.Items.Count < 2 ? _operationServiceParam.machineInfo.WORKCELL_CODE : cbMould.SelectedValue.ToString()) : lblMould.Text; + ResetClick(mouldcode); + } + + #endregion + + #region 复位 + /// + /// 撤销 + /// + /// + private void ResetClick(string mouldcode) + { + + if (MessageBox.Show("确定对本工位进行复位操作?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + var result = _agent.InvokeServiceFunction(B9IPCService.DAI_Reset.ToString() + , new DAArgs + { + WorkCellCode = _operationServiceParam.machineInfo.WORKCELL_CODE, + WorkLocCode = _operationServiceParam.machineInfo.WORKLOC_CODE, + DACode = "", + DAValue = "", + MaterialCode = "", + MachineCode = _operationServiceParam.machineInfo.MACHINECODDE, + MachineName = _operationServiceParam.machineInfo.MACHINENAME, + MouldCode = mouldcode, + AttachData = AttachInfo + }); + + if (!result.Success) //如果采集数据输入失败 + { + this.lblError.Text = result.Message; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + return; + } + SendRecoveryOrder(mouldcode); + DoResultActions(result); + DGView.Refresh(); + DGViewColorBind(); + } + #endregion + + #region 重置 + /// + /// 重置 + /// + /// + /// + private void tsbCancel_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + string mouldcode = e.ClickedItem.Tag.ToString(); + ResetClick(mouldcode); + + } + #endregion + + #region 打开查询界面 + /// + /// 打开查询界面 + /// + /// + /// + private void tsbSearch_Click(object sender, EventArgs e) + { + Form f = Application.OpenForms["MainOperationStaticForm"]; //查找是否打开过Form1窗体 + if (f == null) //没打开过 + { + MainOperationStaticForm form = new MainOperationStaticForm(_operationServiceParam.machineInfo, _operationServiceParam.processSet); + form.MdiParent = this.ParentForm; + form.Show(); //重新new一个Show出来 + } + else + { + f.WindowState = FormWindowState.Normal; + f.Focus(); //打开过就让其获得焦点 + } + } + #endregion + + #region 放行 + /// + /// 放行 + /// + /// + /// + private void tsbPass_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(lblMould.Text)&&cbMould.Items.Count>1) + { + tsbPass.DropDownItems.Clear(); + foreach (MachineInfoModels mould in cbMould.Items) + { + var dditem = tsbPass.DropDownItems.Add(mould.MODELNAME); + dditem.Tag = mould.MODELCODE; + dditem.Padding = new Padding(0, 10, 0, 0); + } + tsbPass.ShowDropDown(); + return; + } + string mouldcode = string.IsNullOrWhiteSpace(lblMould.Text) ? (cbMould.Items.Count < 2 ? _operationServiceParam.machineInfo.WORKCELL_CODE : cbMould.SelectedValue.ToString()) : lblMould.Text; + LetPass(mouldcode); + } + /// + /// 放行 + /// + /// + /// + private void tsbPass_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + string mould = e.ClickedItem.Tag.ToString(); + + LetPass(mould); + } + /// + /// 放行 + /// + /// + private void LetPass(string mould) + { + if (MessageBox.Show("确定对该零件进行放行操作?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + + var result = _agent.InvokeServiceFunction(B9IPCService.DAI_LetPass.ToString() + , new DAArgs + { + WorkCellCode = _operationServiceParam.machineInfo.WORKCELL_CODE, + WorkLocCode = _operationServiceParam.machineInfo.WORKLOC_CODE, + DACode = "", + DAValue = "", + MaterialCode = "", + MachineCode = _operationServiceParam.machineInfo.MACHINECODDE, + MachineName = _operationServiceParam.machineInfo.MACHINENAME, + IsControl = _operationServiceParam.machineInfo.ISCONTROL, + MouldCode = mould,//string.IsNullOrWhiteSpace(lblMould.Text) ? (cbMould.Items.Count < 2 ? _operationServiceParam.machineInfo.WORKCELL_CODE : cbMould.SelectedValue.ToString()) : lblMould.Text + AttachData = AttachInfo + }); + + if (!result.Success) //如果采集数据输入失败 + { + this.lblError.Text = result.Message; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + return; + } + SendRecoveryOrder(mould); + DoResultActions(result); + DGView.Refresh(); + DGViewColorBind(); + + //设置焦点 + this.ActiveControl = this.txtCode; + txtCode.SelectAll(); + txtCode.Focus(); + } + #endregion + + #region 重发启动信号 + /// + /// 重新发送启动信号 + /// + /// + /// + private void tsbReSignal_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(lblMould.Text) && cbMould.Items.Count > 1) + { + tsbReSignal.DropDownItems.Clear(); + foreach (MachineInfoModels mould in cbMould.Items) + { + var dditem = tsbReSignal.DropDownItems.Add(mould.MODELNAME); + dditem.Tag = mould.MODELCODE; + dditem.Padding = new Padding(0, 10, 0, 0); + } + tsbReSignal.ShowDropDown(); + return; + } + string mouldcode = string.IsNullOrWhiteSpace(lblMould.Text) ? (cbMould.Items.Count < 2 ? _operationServiceParam.machineInfo.WORKCELL_CODE : cbMould.SelectedValue.ToString()) : lblMould.Text; + ReSignal(mouldcode); + } + /// + /// 重发启动信号 + /// + /// + /// + private void tsbReSignal_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + string mould = e.ClickedItem.Tag.ToString(); + + ReSignal(mould); + } + int reSignalClickCounter = 0; + /// + /// 重发启动信号 + /// + /// + private void ReSignal(string mouldcode) + { + var result = _agent.InvokeServiceFunction>(B9IPCService.DAIBLL_GetSignalDAI.ToString(), _operationServiceParam.machineInfo.WORKCELL_CODE, string.Equals(_operationServiceParam.machineInfo.WORKCELL_CODE, mouldcode) ? "" : mouldcode); + + var dcache = daicache.FirstOrDefault(p => p.DACode == result.Result && p.MouldCode == mouldcode); + if (dcache == null) + { + return; + } + if (!string.Equals(dcache.DAResult, "通过")) + { + if (reSignalClickCounter < 5) + { + lblError.Text = "数据采集未通过,无法发送启动信号!"; + this.lblError.ForeColor = Color.White; + this.lblError.BackColor = Color.Red; + reSignalClickCounter += 1; + return; + } + else //连续点击重发信号5次 + { + var dresult = MessageBox.Show("数据采集未通过,是否需要强制发送启动信号?", "发送启动信号", MessageBoxButtons.YesNoCancel); + if (dresult != System.Windows.Forms.DialogResult.Yes) + { + return; + } + } + } + DAI signalDai = new DAI() + { + WORKCELL_CODE = _operationServiceParam.machineInfo.WORKCELL_CODE, + WORKLOC_CODE = _operationServiceParam.machineInfo.WORKLOC_CODE, + DA_CODE = dcache.DACode, + MOULD_CODE = string.Equals(_operationServiceParam.machineInfo.WORKCELL_CODE, mouldcode) ? "1" : mouldcode, + Result = EnumGeter.ORDERTYPE.OK.GetHashCode().ToString(), + MATERIAL_CODE = dcache.MaterialCode + + }; + SendSignal(signalDai); + reSignalClickCounter = 0; + } + #endregion + + #region 点击缺陷统计卡 + /// + /// 点击缺陷统计卡 + /// + /// + /// + private void toolStripButton1_Click(object sender, EventArgs e) + { + if (this.DGViewProList.SelectedRows.Count == 0) + { + MessageBox.Show("请选择加工记录!"); + return; + } + if (this.DGViewProList.SelectedRows.Count > 1) + { + MessageBox.Show("只能选择一条加工记录!"); + return; + } + + var temp = DGViewProList.SelectedRows[0].Cells["PRODUCTCODE"].Value.ToString(); + MendRecorderReasonForm form = new MendRecorderReasonForm(temp); + + form.ShowDialog(); + } + #endregion + + #region 安东呼叫 + /// + /// 安东呼叫 + /// + /// + /// + private void tsbAndon_Click(object sender, EventArgs e) + { + Form f = Application.OpenForms["CallManageForm"]; //查找是否打开过Form1窗体 + if (f == null) //没打开过 + { + CallManageForm form = new CallManageForm(_operationServiceParam.machineInfo.WORKCENTER_CODE, _operationServiceParam.machineInfo.WORKLOC_CODE, _operationServiceParam.machineInfo.MACHINECODDE); + form.MdiParent = this.MdiParent; + form.WindowState = FormWindowState.Maximized; + form.Show(); //重新new一个Show出来 + } + else + { + //先关闭 + f.Close(); + //重新打开 + CallManageForm form = new CallManageForm(_operationServiceParam.machineInfo.WORKCENTER_CODE, _operationServiceParam.machineInfo.WORKLOC_CODE, _operationServiceParam.machineInfo.MACHINECODDE); + form.MdiParent = this.MdiParent; + form.WindowState = FormWindowState.Maximized; + form.Show(); //重新new一个Show出来 + } + } + #endregion + #endregion + + #region 设置加工记录表列的颜色信息 + /// + /// 设置列的颜色信息 + /// + /// + /// + private void DGViewProList_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) + { + if (e.RowIndex > DGViewProList.Rows.Count - 1) + return; + DataGridViewRow dgr = DGViewProList.Rows[e.RowIndex]; + try + { + if (dgr.Cells["OPERATESTATE"].Value.ToString() == EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString()) + { + dgr.DefaultCellStyle.BackColor = Color.YellowGreen; + DGViewProList.ClearSelection(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + #endregion + + #region 切换模具 + /// + /// 切换模具 + /// + /// + private void SwitchMould(string mouldcode) + { + lblMould.Text = mouldcode; + daiviewSource.Clear(); + foreach (var row in daicache) + { + if (string.IsNullOrWhiteSpace(mouldcode) || string.IsNullOrWhiteSpace(row.MouldCode) || string.Equals(row.MouldCode, daiList.FirstOrDefault().WORKCELL_CODE) || string.Equals(row.MouldCode, mouldcode) || string.Equals(row.PREINPUT, "1")) + { + if (row.DAType == "PARM") + { } + else + { + daiviewSource.Add(row); + } + } + } + DGViewColorBind(); + } + #endregion + + #region 列表定时刷新 + private void cbListRowcount_SelectedIndexChanged(object sender, EventArgs e) + { + SaveSetting(); + BindView(); + BindPlanView(); + } + + private void cbRefreshRate_SelectedIndexChanged(object sender, EventArgs e) + { + SaveSetting(); + } + private void cbPlanFilter_SelectedIndexChanged(object sender, EventArgs e) + { + BindPlanView(); + SaveSetting(); + } + + private void SaveSetting() + { + string filepath = ConfigurationManager.AppSettings["SaveFilePath"]; + filepath = string.Format("{0}ViewSetting.cfg", filepath); + var setting = new + { + ListRowcount = int.Parse(cbListRowcount.Text), + RefreshRate = int.Parse(cbRefreshRate.Text.Trim('s')), + //PlanFilter = cbPlanFilter.SelectedIndex + }; + string settingstring = Newtonsoft.Json.JsonConvert.SerializeObject(setting); + System.IO.File.WriteAllText(filepath, settingstring); + } + int timecounter = 0; + int opcheartbeatcount = 0; + System.Threading.AutoResetEvent opcheartbeatwaithandel = new AutoResetEvent(false); + private void timer1_Tick(object sender, EventArgs e) + { + if (!tsbOrderOperation.DropDown.Visible) + { + timecounter += 1; + if (timecounter > int.Parse(cbRefreshRate.Text.Trim('s')))//计时达到刷新时间 + { + + BindPlanView(); + + } + } + if (proy != null) + { + opcheartbeatcount += 1; + if (opcheartbeatcount > 10) + { + if (proy.State == System.ServiceModel.CommunicationState.Faulted) + { + System.ServiceModel.InstanceContext site = new System.ServiceModel.InstanceContext(this); + proy = new ServiceOpc.OpcServiceClient(site); + } + if (proy.State == System.ServiceModel.CommunicationState.Created || proy.State == System.ServiceModel.CommunicationState.Opened) + { + var task = new System.Threading.Tasks.Task(() => + { + try + { + proy.SendOperateOrder(string.Format("HeartBeat:{0}", _operationServiceParam.machineInfo.MACHINECODDE)); + //opcheartbeatwaithandel.Reset(); + if (opcheartbeatwaithandel.WaitOne(5000)) + { + ClientContext.OpcState = 1; + } + else + { + ClientContext.OpcState = 3; + } + } + catch + { + ClientContext.OpcState = 2; + } + }); + task.Start(); + } + opcheartbeatcount = 0; + } + } + } + #endregion + + #region 切换选择计划和加工记录 + /// + /// 切换选择计划和加工记录 + /// + /// + /// + private void tabView_Selected(object sender, TabControlEventArgs e) + { + tsbOrderOperation.Visible = tabView.SelectedTab == tpPlan; + //butDEFECT.Enabled = tabView.SelectedTab == tpRecord; + } + #endregion + + #region 工单操作 + + #region 取消挂起 + /// + /// 取消挂起 + /// + /// + /// + private void tsmiCancelSuspend_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count <= 0) + { + MessageBox.Show("请选择一条工单进行取消挂起操作!"); + return; + } + List ids = new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (!int.Equals(order.STATE, 4)) + { + MessageBox.Show("只可取消状态为挂起的工单!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_CancelSuspend.ToString(), ids); + BindPlanView(); + } + #endregion + + #region 删除工单 + /// + /// 删除工单 + /// + /// + /// + private void tsmiDeleteOrder_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count <= 0) + { + MessageBox.Show("请选择一条工单进行删除操作!"); + return; + } + List ids = new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (!int.Equals(order.STATE, 4)) + { + MessageBox.Show("只可删除状态为挂起的工单!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_DeleteOrder.ToString(), ids); + BindPlanView(); + } + #endregion + + #region 重置工单 + /// + /// 重置工单 + /// + /// + /// + private void tsmiResetOrder_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count <= 0) + { + MessageBox.Show("请选择一条工单进行重置操作!"); + return; + } + List ids = new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (!int.Equals(order.STATE, 4)) + { + MessageBox.Show("只可重置状态为挂起的工单!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_ResetOrder.ToString(), ids); + BindPlanView(); + } + #endregion + + #region 挂起工单 + /// + /// 挂起工单 + /// + /// + /// + private void tsmiSuspendOrder_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count <= 0) + { + MessageBox.Show("请选择一条工单进行挂起操作!"); + return; + } + List ids=new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (int.Equals(order.STATE, 2)) + { + MessageBox.Show("不能挂起正在执行的工单!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_SuspendOrder.ToString(), ids); + BindPlanView(); + } + #endregion + + #region 回收工单 + /// + /// 回收工单 + /// + /// + /// + private void tsmiTakebackOrder_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count <= 0) + { + MessageBox.Show("请选择一条工单进行回收操作!"); + return; + } + List ids = new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (!int.Equals(order.STATE, 4)) + { + MessageBox.Show("只可回收状态为挂起的工单!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_TakeBack.ToString(), ids); + BindPlanView(); + } + #endregion + + #endregion + + #region 工单列表选择发送变化时延时自动刷新 + /// + /// 工单列表选择发送变化时延时自动刷新 + /// + /// + /// + private void dgvPlan_SelectionChanged(object sender, EventArgs e) + { + timecounter = -10; + } + #endregion + + #region 设置计划工单列状态、颜色 + /// + /// 设置计划工单列状态、颜色 + /// + /// + /// + private void dgvPlan_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) + { + var WORKORDER_STATE_TEXT = new string[] { "初始", "确认", "执行中", "完成", "挂起" }; + var row = dgvPlan.Rows[e.RowIndex]; + row.Cells[dgcState.Name].Value = WORKORDER_STATE_TEXT[0]; + //var order = (FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + //if (order.STATE >= 0 && order.STATE < WORKORDER_STATE_TEXT.Length) + //{ + // row.Cells[dgcState.Name].Value = WORKORDER_STATE_TEXT[order.STATE]; + //} + //if (order.STATE == FJC.Entity.EnumGeter.WorkOrderState.Suspended.GetHashCode()) + //{ + // row.DefaultCellStyle.BackColor = Color.LightGray; + // row.DefaultCellStyle.ForeColor = Color.Gray; + //} + //if (order.STATE == FJC.Entity.EnumGeter.WorkOrderState.Executing.GetHashCode()) + //{ + // row.DefaultCellStyle.BackColor = Color.YellowGreen; + // dgvPlan.ClearSelection(); + //} + } + #endregion + + #region 切换计划和加工记录触发动作 + /// + /// 切换计划和加工记录触发动作 + /// + /// + /// + private void tabView_SelectedIndexChanged(object sender, EventArgs e) + { + txtCode.SelectAll(); + txtCode.Focus(); + } + #endregion + + #region 采集区扫描颜色显示 + /// + /// 采集区扫描颜色显示 + /// + /// + /// + private void OperationForm_Activated(object sender, EventArgs e) + { + DGViewColorBind(); + } + #endregion + + #region 切换模具 + /// + /// 切换模具 + /// + /// + /// + private void cbMould_SelectedIndexChanged(object sender, EventArgs e) + { + if (_operationServiceParam.machineInfo.ISSTATION.Equals(1)) + { + SwitchMould(cbMould.SelectedValue + ""); + } + } + #endregion + + #region 切换设备 + /// + /// 切换设备配置文件 + /// 20181119gzf + /// + /// + /// + private void CheckFile() + { + string locationfile2 = System.Configuration.ConfigurationManager.AppSettings["loactionfile2"]; + if (File.Exists(@locationfile2)) + { + this.btnChange.Visible = true; + } + else + { + this.btnChange.Visible = false; + } + } + + /// + /// 切换设备 + /// 20181119gzf + /// + /// + /// + private void btnChange_Click(object sender, EventArgs e) + { + //string locationfile = System.Configuration.ConfigurationManager.AppSettings["loactionfile"]; + //string locationfile2 = System.Configuration.ConfigurationManager.AppSettings["loactionfile2"]; + //string str1 = File.ReadAllText(@locationfile); + //string str2 = File.ReadAllText(locationfile2); + //System.IO.File.WriteAllText(locationfile, str2); + //System.IO.File.WriteAllText(locationfile2, str1); + var machineInfo = this.comMachine.SelectedItem as MachineInfo; + List machinelist = comMachine.DataSource as List; + if (machinelist != null && machineInfo != null && !string.IsNullOrEmpty(machineInfo.OPCGROUPNAME)) + { + var grouplist = machinelist.Where(p => p.OPCGROUPNAME == machineInfo.OPCGROUPNAME).ToList(); + var currentindex=grouplist.IndexOf(machineInfo); + if (currentindex < grouplist.Count - 1) + { + currentindex += 1; + } + else + { + currentindex = 0; + } + this.comMachine.SelectedValue = grouplist[currentindex].MACHINECODDE; + this.Init(); + } + } + #endregion + + private void btnCollapse_Click(object sender, EventArgs e) + { + gbMlist.Visible = !gbMlist.Visible; + plInfo.AutoSize = !gbMlist.Visible; + } + + private void tsmiIgnoreFISBreak_Click(object sender, EventArgs e) + { + if (dgvPlan.SelectedRows.Count != 1) + { + MessageBox.Show("请选择一条(且只能选择一条)工单进行忽略断号操作!"); + return; + } + List ids = new List(); + foreach (System.Windows.Forms.DataGridViewRow row in dgvPlan.SelectedRows) + { + var order = (QMAPP.FJC.Entity.ProductionPlan.WorkOrder)row.DataBoundItem; + if (!int.Equals(order.ORDER_TYPE, "0")) + { + MessageBox.Show("只可对FIS工单进行忽略断号操作!"); + return; + } + ids.Add(order.PID); + } + _agent.InvokeServiceFunction("WorkOrderBLL_IgnoreFISBreak", ids); + BindPlanView(); + } + + #region 根据配置 自动填充采集点 + + /// + /// 查找配置表 + /// + /// + public string GetAppConfigValue(string pConfigCode) + { + var AppConfig = _agent.InvokeServiceFunction(B9IPCService.AppConfigBLL_Get.ToString(), pConfigCode); + + if (AppConfig != null) + return AppConfig.Value; + else + return null; + } + + /// + /// 查找PbomItem + /// + /// + public List GetPBOMCODEValue(string MATERIAL_CODE) + { + var list = new List(); + var PbomItem = _agent.InvokeServiceFunction>(B9IPCService.PbomItemBLL_Get.ToString(), MATERIAL_CODE); + + if (PbomItem != null) + { + foreach (var va in PbomItem) + { + list.Add(va.PBOM_CODE); + } + return list; + } + else + return list; + } + + /// + /// 查找ScanIPConfig + /// + /// + public List GetSendPlcConfig(ScanIPConfig ScanIPConfigs) + { + var list = new List(); + var PbomItemList = _agent.InvokeServiceFunction>(B9IPCService.ScanIPConfigBLL_Get.ToString(), ScanIPConfigs); + + return PbomItemList.OrderBy(c=>c.CFG).ToList(); + } + + /// + /// 查找Product + /// + /// + public Product SelectProduct(string Products) + { + var list = new List(); + var ProductList = _agent.InvokeServiceFunction(B9IPCService.ProductBLL_Get.ToString(), new Product() { PRODUCTCODE = Products }); + return ProductList; + } + + /// + /// 查找ScanIPConfig + /// + /// + public bool UpdateSendPlcConfig(ScanIPConfig ScanIPConfigs) + { + var list = new List(); + var PbomItemList = _agent.InvokeServiceFunction>(B9IPCService.ScanIPConfigBLL_Update.ToString(), ScanIPConfigs); + if (PbomItemList.Result > 0) + return true; + else + return false; + } + + /// + /// 插入产品信息 + /// + /// + public bool InsertProduct(Product Products) + { + var list = new List(); + var PbomItemList = _agent.InvokeServiceFunction>(B9IPCService.ProductBLL_Insert.ToString(), Products); + if (PbomItemList.Result >0) + return true; + else + return false; + } + + /// + /// 插入加工记录信息 + /// + /// + public bool InsertProcessRecord(ProcessRecord ProcessRecords) + { + var list = new List(); + var PbomItemList = _agent.InvokeServiceFunction>(B9IPCService.ProcessRecordBLL_Insert.ToString(), ProcessRecords); + if (PbomItemList.Result >0) + return true; + else + return false; + } + + /// + /// 查找WorkOrder + /// + /// + public string GetWorkOrder_MATERIAL_CODE(string WorkOrderPID) + { + var WorkOrder = _agent.InvokeServiceFunction(B9IPCService.WorkOrderBLL_Get.ToString(), new WorkOrder() { PID = WorkOrderPID }); + if (WorkOrder != null) + return WorkOrder.PBOM_CODE; + else + return null; + } + + /// + /// 查找WorkOrder + /// + /// + public void GetNewCode(ref string Code,ref string Number) + { + var code1 = Convert.ToInt32(Code.Substring(Code.Length - 9, 9)); + Code = Code.Substring(0, Code.Length - 9) + (code1 + Convert.ToInt32(Number)).ToString().PadLeft(9, '0'); + + var ProductList = SelectProduct(Code); + if (ProductList != null ) + { + var newnumber = (Convert.ToInt32(Number) + 1).ToString(); + GetNewCode(ref Code,ref newnumber); + Number = newnumber; + } + else + Number = (Convert.ToInt32(Number) + 1).ToString(); + } + + + #endregion + + /// + /// 器具排序 + /// + /// + /// + private void cboxSort_CheckedChanged(object sender, EventArgs e) + { + WorkOrderBLL.SaveStartIndex(0); + + BindPlanView(); + } + } +} \ No newline at end of file diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.resx b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.resx new file mode 100644 index 0000000..64363a9 --- /dev/null +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm_316.resx @@ -0,0 +1,686 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAA0DSURBVGhDzZlZbFx3FcZDSouKkNgEQiCEWISoWglRChUC + CSE2CQkhsai8oIIEZZEQ8IDEAyAQD6gPtBXQIhUQhcaJtxl7vNvxeGyP19iO9y2O7dhxYsdrnMR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True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 127, 17 + + + 49 + + \ No newline at end of file diff --git a/APPQ5/QMAPP.WinForm/MainForm.Designer.cs b/APPQ5/QMAPP.WinForm/MainForm.Designer.cs index 8b81ae7..c9b594c 100644 --- a/APPQ5/QMAPP.WinForm/MainForm.Designer.cs +++ b/APPQ5/QMAPP.WinForm/MainForm.Designer.cs @@ -33,8 +33,8 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.btnInjectGroup = new System.Windows.Forms.ToolStripMenuItem(); this.btnInjectPrint = new System.Windows.Forms.ToolStripMenuItem(); - this.btnInjectPut = new System.Windows.Forms.ToolStripMenuItem(); // - this.btnInjectPutNEW = new System.Windows.Forms.ToolStripMenuItem(); // + this.btnInjectPut = new System.Windows.Forms.ToolStripMenuItem(); + this.btnInjectPutNEW = new System.Windows.Forms.ToolStripMenuItem(); this.btnInjectPrintForm = new System.Windows.Forms.ToolStripMenuItem(); this.搪塑下线ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.btnvVWSinglePrint = new System.Windows.Forms.ToolStripMenuItem(); @@ -57,8 +57,8 @@ this.btnUserOut = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiWarehouse = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiPutIn = new System.Windows.Forms.ToolStripMenuItem(); - this.TJtsmiPutIn = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTakeOut = new System.Windows.Forms.ToolStripMenuItem(); + this.TJtsmiPutIn = new System.Windows.Forms.ToolStripMenuItem(); this.TJtsmiTakeOut = new System.Windows.Forms.ToolStripMenuItem(); this.tsiShipment = new System.Windows.Forms.ToolStripMenuItem(); this.FrmPlace = new System.Windows.Forms.ToolStripMenuItem(); @@ -76,6 +76,7 @@ this.tsslblOPCStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.tsslblIps = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.bC316总成装配ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -133,7 +134,7 @@ this.btnInjectPutNEW.Text = "注塑投料新版"; this.btnInjectPutNEW.Click += new System.EventHandler(this.btnInjectPutNEW_Click); // - // btnInjectPutNEW + // btnInjectPrintForm // this.btnInjectPrintForm.Name = "btnInjectPrintForm"; this.btnInjectPrintForm.Size = new System.Drawing.Size(188, 28); @@ -193,7 +194,8 @@ this.PrintCodeToolStripMenuItem, this.tsmiPrintPlanlabel, this.TJtsmiPrintPlanlabel, - this.tsmDPAssmblyItem}); + this.tsmDPAssmblyItem, + this.bC316总成装配ToolStripMenuItem}); this.btnOperateGroup.Name = "btnOperateGroup"; this.btnOperateGroup.Size = new System.Drawing.Size(94, 28); this.btnOperateGroup.Text = "加工工位"; @@ -201,28 +203,28 @@ // btnOperateStation // this.btnOperateStation.Name = "btnOperateStation"; - this.btnOperateStation.Size = new System.Drawing.Size(224, 28); + this.btnOperateStation.Size = new System.Drawing.Size(241, 28); this.btnOperateStation.Text = "加工操作"; this.btnOperateStation.Click += new System.EventHandler(this.btnOperateStation_Click); // // PrintCodeToolStripMenuItem // this.PrintCodeToolStripMenuItem.Name = "PrintCodeToolStripMenuItem"; - this.PrintCodeToolStripMenuItem.Size = new System.Drawing.Size(224, 28); + this.PrintCodeToolStripMenuItem.Size = new System.Drawing.Size(241, 28); this.PrintCodeToolStripMenuItem.Text = "总成装配条码打印"; this.PrintCodeToolStripMenuItem.Click += new System.EventHandler(this.PrintCodeToolStripMenuItem_Click); // // tsmiPrintPlanlabel // this.tsmiPrintPlanlabel.Name = "tsmiPrintPlanlabel"; - this.tsmiPrintPlanlabel.Size = new System.Drawing.Size(224, 28); + this.tsmiPrintPlanlabel.Size = new System.Drawing.Size(241, 28); this.tsmiPrintPlanlabel.Text = "门板计划标签打印"; this.tsmiPrintPlanlabel.Click += new System.EventHandler(this.tsmiPrintPlanlabel_Click); // // TJtsmiPrintPlanlabel // this.TJtsmiPrintPlanlabel.Name = "TJtsmiPrintPlanlabel"; - this.TJtsmiPrintPlanlabel.Size = new System.Drawing.Size(224, 28); + this.TJtsmiPrintPlanlabel.Size = new System.Drawing.Size(241, 28); this.TJtsmiPrintPlanlabel.Text = "TJ门板计划标签打印"; this.TJtsmiPrintPlanlabel.Click += new System.EventHandler(this.TJtsmiPrintPlanlabel_Click); // @@ -230,7 +232,7 @@ // this.tsmDPAssmblyItem.Name = "tsmDPAssmblyItem"; this.tsmDPAssmblyItem.ShowShortcutKeys = false; - this.tsmDPAssmblyItem.Size = new System.Drawing.Size(224, 28); + this.tsmDPAssmblyItem.Size = new System.Drawing.Size(241, 28); this.tsmDPAssmblyItem.Text = "门板FIS补码"; this.tsmDPAssmblyItem.Click += new System.EventHandler(this.tsmDPAssmblyItem_Click); // @@ -295,7 +297,7 @@ this.tsmiPutIn, this.tsmiTakeOut, this.TJtsmiPutIn, - this.TJtsmiTakeOut,}); + this.TJtsmiTakeOut}); this.tsmiWarehouse.Name = "tsmiWarehouse"; this.tsmiWarehouse.Size = new System.Drawing.Size(112, 28); this.tsmiWarehouse.Text = "出入库管理"; @@ -313,7 +315,6 @@ this.tsmiTakeOut.Size = new System.Drawing.Size(170, 28); this.tsmiTakeOut.Text = "计划外出库"; this.tsmiTakeOut.Click += new System.EventHandler(this.tsmiTakeOut_Click); - // // TJtsmiPutIn // @@ -322,7 +323,7 @@ this.TJtsmiPutIn.Text = "TJ入库管理"; this.TJtsmiPutIn.Click += new System.EventHandler(this.TJtsmiPutIn_Click); // - // tsmiTakeOut + // TJtsmiTakeOut // this.TJtsmiTakeOut.Name = "TJtsmiTakeOut"; this.TJtsmiTakeOut.Size = new System.Drawing.Size(170, 28); @@ -341,14 +342,14 @@ // FrmPlace // this.FrmPlace.Name = "FrmPlace"; - this.FrmPlace.Size = new System.Drawing.Size(152, 28); + this.FrmPlace.Size = new System.Drawing.Size(169, 28); this.FrmPlace.Text = "仪表发运"; this.FrmPlace.Click += new System.EventHandler(this.FrmPlace_Click); // // TJFrmPlace // this.TJFrmPlace.Name = "TJFrmPlace"; - this.TJFrmPlace.Size = new System.Drawing.Size(152, 28); + this.TJFrmPlace.Size = new System.Drawing.Size(169, 28); this.TJFrmPlace.Text = "TJ门板发运"; this.TJFrmPlace.Click += new System.EventHandler(this.TJFrmPlace_Click); // @@ -455,6 +456,13 @@ this.timer1.Interval = 5000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // bC316总成装配ToolStripMenuItem + // + this.bC316总成装配ToolStripMenuItem.Name = "bC316总成装配ToolStripMenuItem"; + this.bC316总成装配ToolStripMenuItem.Size = new System.Drawing.Size(241, 28); + this.bC316总成装配ToolStripMenuItem.Text = "BC316总成装配"; + this.bC316总成装配ToolStripMenuItem.Click += new System.EventHandler(this.bC316总成装配ToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -529,6 +537,7 @@ private System.Windows.Forms.ToolStripStatusLabel tsslblIps; private System.Windows.Forms.ToolStripMenuItem tsmiUserManage; private System.Windows.Forms.ToolStripMenuItem tsmiDefectRecording; + private System.Windows.Forms.ToolStripMenuItem bC316总成装配ToolStripMenuItem; } } diff --git a/APPQ5/QMAPP.WinForm/MainForm.cs b/APPQ5/QMAPP.WinForm/MainForm.cs index 889af9a..8d63963 100644 --- a/APPQ5/QMAPP.WinForm/MainForm.cs +++ b/APPQ5/QMAPP.WinForm/MainForm.cs @@ -23,6 +23,7 @@ using System.ServiceModel.Configuration; using QMAPP.WinForm.Forms.RePrint; using QMAPP.WinForm.Forms.TianJin; + namespace QMAPP.WinForm { /// @@ -551,20 +552,20 @@ namespace QMAPP.WinForm private void PrintCodeToolStripMenuItem_Click(object sender, EventArgs e) { - //Form f = Application.OpenForms["PrintForm"]; //查找是否打开过Form1窗体 - //if (f == null) //没打开过 - //{ - // PrintForm form = new PrintForm(); - // ClientContext.SetUserAuth(form); - // //new KeyEvent().SetKeyToTxt(form); - // form.MdiParent = this; - // form.Show(); //重新new一个Show出来 - //} - //else - //{ - // f.WindowState = FormWindowState.Normal; - // f.Focus(); //打开过就让其获得焦点 - //} + Form f = Application.OpenForms["PrintForm"]; //查找是否打开过Form1窗体 + if (f == null) //没打开过 + { + PrintForm form = new PrintForm(); + ClientContext.SetUserAuth(form); + //new KeyEvent().SetKeyToTxt(form); + form.MdiParent = this; + form.Show(); //重新new一个Show出来 + } + else + { + f.WindowState = FormWindowState.Normal; + f.Focus(); //打开过就让其获得焦点 + } return; } @@ -1151,5 +1152,23 @@ namespace QMAPP.WinForm f.Focus(); //打开过就让其获得焦点 } } + + private void bC316总成装配ToolStripMenuItem_Click(object sender, EventArgs e) + { + Form f = Application.OpenForms["OperationForm_316"]; //查找是否打开过Form1窗体 + if (f == null) //没打开过 + { + OperationForm_316 form = new OperationForm_316(); + new KeyEvent().SetKeyToTxt(form); + ClientContext.SetUserAuth(form); + form.MdiParent = this; + form.Show(); //重新new一个Show出来 + } + else + { + f.WindowState = FormWindowState.Normal; + f.Focus(); //打开过就让其获得焦点 + } + } } } diff --git a/APPQ5/QMAPP.WinForm/Menu.xml b/APPQ5/QMAPP.WinForm/Menu.xml index 64f56df..caf7182 100644 --- a/APPQ5/QMAPP.WinForm/Menu.xml +++ b/APPQ5/QMAPP.WinForm/Menu.xml @@ -36,6 +36,7 @@ + diff --git a/APPQ5/QMAPP.WinForm/QMAPP.WinForm.csproj b/APPQ5/QMAPP.WinForm/QMAPP.WinForm.csproj index 8f9d25a..3c52588 100644 --- a/APPQ5/QMAPP.WinForm/QMAPP.WinForm.csproj +++ b/APPQ5/QMAPP.WinForm/QMAPP.WinForm.csproj @@ -452,6 +452,12 @@ MainOperationCompleteForm.cs + + Form + + + OperationForm_316.cs + Form @@ -1143,6 +1149,10 @@ MainOperationCompleteForm.cs + + OperationForm_316.cs + Designer + PrintPlanLabel.cs @@ -1589,6 +1599,10 @@ {604FB24F-7706-497C-BEC7-27D7B6B5A82C} QMAPP.Entity + + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF} + QMAPP.BoraUpgrade.BLL + {82A4D3A5-844B-49E0-9D06-0C2B273EF1F0} QMAPP.FJC.BLL diff --git a/QMAPP.BoraUpgrade.BLL/BoraUpgradeRouteBLL.cs b/QMAPP.BoraUpgrade.BLL/BoraUpgradeRouteBLL.cs new file mode 100644 index 0000000..90b794d --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/BoraUpgradeRouteBLL.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + /// + /// 宝来升级路由业务层 + /// + public class BoraUpgradeRouteBLL + { + /// + /// 获取全部宝来升级路由列表 + /// + /// + public static List GetBoraUpgradeRouteList() + { + List returnVal = new List(); + + DataTable dataTable = BoraUpgradeRouteDAL.GetBoraUpgradeRouteList(); + + if ( dataTable.Rows.Count != 0 ) + { + foreach (DataRow currRow in dataTable.Rows) + { + T_QD_BoraUpgradeRoute newBoraUpgradeRoute = new T_QD_BoraUpgradeRoute(); + + newBoraUpgradeRoute.BoraRouteID = int.Parse( currRow["BoraRouteID"].ToString() ); + + newBoraUpgradeRoute.WorkCell_Code = currRow["WorkCell_Code"].ToString(); + + newBoraUpgradeRoute.NextWorkCell_Code = currRow["NextWorkCell_Code"].ToString(); + + newBoraUpgradeRoute.Machine_Code = currRow["Machine_Code"].ToString(); + + newBoraUpgradeRoute.RouteRegular = currRow["RouteRegular"].ToString(); + + newBoraUpgradeRoute.RouteDirection = int.Parse(currRow["RouteDirection"].ToString()); + + newBoraUpgradeRoute.IsProductCode = bool.Parse(currRow["IsProductCode"].ToString()); + + newBoraUpgradeRoute.IsClear = bool.Parse(currRow["IsClear"].ToString()); + + newBoraUpgradeRoute.IsDeleted = bool.Parse( currRow["IsDeleted"].ToString() ); + + newBoraUpgradeRoute.CreateTime = DateTime.Parse( currRow["CreateTime"].ToString() ); + + newBoraUpgradeRoute.ModeCode = currRow["ModeCode"].ToString(); + + if (!string.IsNullOrWhiteSpace(currRow["EmptyDAICount"].ToString())) + { + newBoraUpgradeRoute.EmptyDAICount = int.Parse(currRow["EmptyDAICount"].ToString()); + } + else + { + newBoraUpgradeRoute.EmptyDAICount = -1; + } + + returnVal.Add(newBoraUpgradeRoute); + } + } + + return returnVal; + } + + /// + /// 根据工位编码获取宝来升级路由实例 + /// + /// 工位编码 + /// + public static T_QD_BoraUpgradeRoute GetBoraUpgradeRouteByWorkCell(string WorkCell_Code) + { + T_QD_BoraUpgradeRoute returnVal = new T_QD_BoraUpgradeRoute(); + + DataTable dataTable = BoraUpgradeRouteDAL.GetBoraUpgradeRouteByWorkCell( WorkCell_Code ); + + if (dataTable.Rows.Count != 0) + { + foreach (DataRow currRow in dataTable.Rows) + { + returnVal.BoraRouteID = int.Parse(currRow["BoraRouteID"].ToString()); + + returnVal.WorkCell_Code = currRow["WorkCell_Code"].ToString(); + + returnVal.NextWorkCell_Code = currRow["NextWorkCell_Code"].ToString(); + + returnVal.Machine_Code = currRow["Machine_Code"].ToString(); + + returnVal.RouteRegular = currRow["RouteRegular"].ToString(); + + returnVal.RouteDirection = int.Parse(currRow["RouteDirection"].ToString()); + + returnVal.IsProductCode = bool.Parse(currRow["IsProductCode"].ToString()); + + returnVal.IsClear = bool.Parse(currRow["IsClear"].ToString()); + + returnVal.IsDeleted = bool.Parse(currRow["IsDeleted"].ToString()); + + returnVal.CreateTime = DateTime.Parse(currRow["CreateTime"].ToString()); + + if ( string.IsNullOrWhiteSpace(currRow["EmptyDAICount"].ToString()) ) + { + returnVal.EmptyDAICount = int.Parse(currRow["EmptyDAICount"].ToString()); + } + else + { + returnVal.EmptyDAICount = -1; + } + + break; + } + } + else + { + returnVal = null; + } + + return returnVal; + } + } +} diff --git a/QMAPP.BoraUpgrade.BLL/PrintCodeRouteHelper.cs b/QMAPP.BoraUpgrade.BLL/PrintCodeRouteHelper.cs new file mode 100644 index 0000000..db11355 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/PrintCodeRouteHelper.cs @@ -0,0 +1,422 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +using System.Text.RegularExpressions; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class PrintCodeRouteHelper + { + #region 获取全部打码规则 + /// + /// 获取全部打码规则 + /// + /// + public static List GetAllPrintCodeRouteList() + { + List returnVal = null; + + DataTable dataSrouce = PrintCodeRouteDataAccess.GetPrintCodeRouteAllList(); + + if (dataSrouce.Rows.Count > 0) + { + returnVal = new List(); + + foreach (DataRow currDataRow in dataSrouce.Rows) + { + T_CC_PrintCodeRoute newPrintCodeRoute = new T_CC_PrintCodeRoute(); + + newPrintCodeRoute.PrintCodeRouteID = int.Parse(currDataRow[0].ToString()); + + newPrintCodeRoute.BarCodeRule = currDataRow[1].ToString(); + + newPrintCodeRoute.MachineName = currDataRow[2].ToString(); + + newPrintCodeRoute.MachineCode = currDataRow[3].ToString(); + + newPrintCodeRoute.Material_Code = currDataRow[4].ToString(); + + newPrintCodeRoute.WorkCell_Code = currDataRow[5].ToString(); + + newPrintCodeRoute.WorkLoc_Code = currDataRow[6].ToString(); + + newPrintCodeRoute.WorkCenter = currDataRow[7].ToString(); + + newPrintCodeRoute.Matrail_Type = currDataRow[8].ToString(); + + newPrintCodeRoute.IsProduct = bool.Parse(currDataRow[9].ToString()); + + newPrintCodeRoute.IsAppend = bool.Parse(currDataRow[10].ToString()); + + newPrintCodeRoute.Color = int.Parse(currDataRow["Color"].ToString()); + + newPrintCodeRoute.MachineID = currDataRow["MachineID"].ToString(); + + returnVal.Add(newPrintCodeRoute); + } + + } + + return returnVal; + } + #endregion + + #region + /// + /// 处理打码路由 + /// + /// 产品码 + /// 工位码 + public static T_CC_PrintCodeRoute ProcessPrintCodeRoute(List ePrintCodeRouteList, string ProductCode, string WorkCell_Code) + { + T_CC_PrintCodeRoute returnVal = null; + + //提取产品信息 + T_AW_PRODUCT eProduct = ProductHelper.GetProductByProductCode(ProductCode); + + if (eProduct == null) + { + #region 处理新增 + foreach ( T_CC_PrintCodeRoute ePrintCodeRoute in ePrintCodeRouteList ) + { + //匹配工位 + T_CC_PrintCodeRoute eMatchingPrintCodeRoute = + ePrintCodeRouteList.Find(s => s.WorkCell_Code == WorkCell_Code); + + //判断是否存在匹配 + if ( eMatchingPrintCodeRoute == null ) + { + break; + } + + //changed by wrx 20200312 Regex.IsMatch("A3ZQZC202003120003", "1")=true Regex.IsMatch("A3ZQZC202003", "1")=false 不知道为什么 + + string realProductCode = string.Empty; + + string createTime = string.Empty; + + string color = string.Empty; + + string machineID = string.Empty; + + + if ( ProductCode.Length == 29 ) + { + realProductCode = ProductCode.Substring(0, 23); + + createTime = string.Format("20{0}-{1}-{2} {3}:{4}:{5}", ProductCode.Substring(11, 2), ProductCode.Substring(13, 2), ProductCode.Substring(15, 2), + ProductCode.Substring(17, 2), ProductCode.Substring(19, 2), ProductCode.Substring(21, 2) + ); + + color = ProductCode.Substring(23, 1); + + machineID = ProductCode.Substring(24, 1); + + } + else + { + return null; + } + + if (System.Text.RegularExpressions.Regex.IsMatch(realProductCode, ePrintCodeRoute.BarCodeRule) == true + && ePrintCodeRoute.WorkCell_Code.ToUpper().Trim() == WorkCell_Code.ToUpper().Trim() + && ePrintCodeRoute.BarCodeRule != "1" && ePrintCodeRoute.BarCodeRule != "2" && ePrintCodeRoute.BarCodeRule != "3" + && color == ePrintCodeRoute.Color.ToString() && machineID == ePrintCodeRoute.MachineID + ) + { + if (eMatchingPrintCodeRoute.IsProduct == true) + { + //判断是否追加 + if (eMatchingPrintCodeRoute.IsAppend == true) + { + #region 组成新增产品实例 + T_AW_PRODUCT newProduct = new T_AW_PRODUCT(); + + newProduct.PID = Guid.NewGuid().ToString(); + + newProduct.PRODUCTTYPE = string.Empty; + + newProduct.PRODUCTCODE = ProductCode; + + newProduct.PRODUCTSOURCE = "0"; + + newProduct.MACHINENAME = ePrintCodeRoute.MachineName; + + newProduct.MACHINECODDE = ePrintCodeRoute.MachineCode; + + newProduct.MATERIAL_CODE = ePrintCodeRoute.Material_Code; + + newProduct.STATUS = "0"; + + newProduct.OUTFLAG = "0"; + + newProduct.CAPACITY = 1; + + newProduct.USINGCOUNT = 0; + + newProduct.WORKCELL_CODE = ePrintCodeRoute.WorkCell_Code; + + newProduct.WORKLOC_CODE = ePrintCodeRoute.WorkLoc_Code; + + newProduct.WORKCENTER_CODE = ePrintCodeRoute.WorkCenter; + + newProduct.MATERIAL_TYPE = ePrintCodeRoute.Matrail_Type; + + newProduct.USINGSTATE = "0"; + + newProduct.CREATEDATE = DateTime.Parse(createTime); + + #endregion + + //新增 + ProductHelper.Insert(newProduct); + } + } + + //非产品 + if (eMatchingPrintCodeRoute.IsProduct == false) + { + returnVal = eMatchingPrintCodeRoute; + } + + break; + } + } + #endregion + } + else + { + if (ePrintCodeRouteList == null || ePrintCodeRouteList.Count == 0) return null; + //匹配工位 + List eMatchingPrintCodeRouteList = + ePrintCodeRouteList.FindAll(s => s.WorkCell_Code == WorkCell_Code); + + + #region 处理更新 + foreach (T_CC_PrintCodeRoute ePrintCodeRoute in eMatchingPrintCodeRouteList) + { + if ( System.Text.RegularExpressions.Regex.IsMatch(ProductCode, ePrintCodeRoute.BarCodeRule) == false ) + { + break; + } + + //changed by wrx 20200312 Regex.IsMatch("A3ZQZC202003120003", "1")=true Regex.IsMatch("A3ZQZC202003", "1")=false 不知道为什么 + if (ePrintCodeRoute.WorkCell_Code.ToUpper().Trim() == WorkCell_Code.ToUpper().Trim() && ePrintCodeRoute.IsAppend == false && eProduct.USINGSTATE == "0" + && ePrintCodeRoute.BarCodeRule != "1" && ePrintCodeRoute.BarCodeRule != "2" && ePrintCodeRoute.BarCodeRule != "3") + { + T_AW_PRODUCT modifyProduct = new T_AW_PRODUCT(); + + modifyProduct.PID = eProduct.PID; + + //modifyProduct.MATERIAL_CODE = ePrintCodeRoute.Material_Code; + + modifyProduct.WORKCELL_CODE = ePrintCodeRoute.WorkCell_Code; + + modifyProduct.WORKLOC_CODE = ePrintCodeRoute.WorkLoc_Code; + + modifyProduct.WORKCENTER_CODE = ePrintCodeRoute.WorkCenter; + + modifyProduct.MATERIAL_TYPE = ePrintCodeRoute.Matrail_Type; + + ProductHelper.Modify(modifyProduct); + } + } + #endregion + } + + return returnVal; + } + + + public static void SaveLLightBarCode(List pPrintCodeRouteList,string pProductCode,string pWorkCellCode) + { + foreach(T_CC_PrintCodeRoute route in pPrintCodeRouteList) + { + if(System.Text.RegularExpressions.Regex.IsMatch(pProductCode, route.BarCodeRule) == true && route.WorkCell_Code == pWorkCellCode) + { + DataTable exsitTable = PrintCodeRouteDataAccess.GetExsitProductCodeQty(pProductCode, pWorkCellCode); + if(exsitTable.Rows.Count == 0) + { + T_AW_PRODUCT newProduct = new T_AW_PRODUCT(); + + newProduct.PID = Guid.NewGuid().ToString(); + + newProduct.PRODUCTTYPE = string.Empty; + + newProduct.PRODUCTCODE = pProductCode; + + newProduct.PRODUCTSOURCE = "0"; + + newProduct.MACHINENAME = route.MachineName; + + newProduct.MACHINECODDE = route.MachineCode; + + newProduct.MATERIAL_CODE = route.Material_Code; + + newProduct.STATUS = "0"; + + newProduct.OUTFLAG = "0"; + + newProduct.CAPACITY = 1; + + newProduct.USINGCOUNT = 0; + + newProduct.WORKCELL_CODE = route.WorkCell_Code; + + newProduct.WORKLOC_CODE = route.WorkLoc_Code; + + newProduct.WORKCENTER_CODE = route.WorkCenter; + + newProduct.MATERIAL_TYPE = route.Matrail_Type; + + newProduct.USINGSTATE = "0"; + + newProduct.CREATEDATE = DateTime.Now; + + #endregion + + //新增 + ProductHelper.Insert(newProduct); + } + //else + //{ + // T_AW_PRODUCT modifyProduct = new T_AW_PRODUCT(); + + // modifyProduct.PID = exsitTable.Rows[0]["PID"].ToString(); + + // //modifyProduct.MATERIAL_CODE = ePrintCodeRoute.Material_Code; + + // modifyProduct.WORKCELL_CODE = route.WorkCell_Code; + + // modifyProduct.WORKLOC_CODE = route.WorkLoc_Code; + + // modifyProduct.WORKCENTER_CODE = route.WorkCenter; + + // modifyProduct.MATERIAL_TYPE = route.Matrail_Type; + + // ProductHelper.Modify(modifyProduct); + //} + + return; + } + } + } + + + + + + #region 处理打码路由 + /// + /// 处理打码路由 + /// + /// 产品码 + /// 工位码 + public static T_CC_PrintCodeRoute ProcessPrintCodeRoute(List ePrintCodeRouteList, string ProductCode) + { + T_CC_PrintCodeRoute returnVal = null; + + //提取产品信息 + T_AW_PRODUCT eProduct = ProductHelper.GetProductByProductCode(ProductCode); + + if (eProduct == null) + { + #region 处理新增 + foreach (T_CC_PrintCodeRoute ePrintCodeRoute in ePrintCodeRouteList) + { + + //changed by wrx 20200312 Regex.IsMatch("A3ZQZC202003120003", "1")=true Regex.IsMatch("A3ZQZC202003", "1")=false 不知道为什么 + + string realProductCode = string.Empty; + + string createTime = string.Empty; + + string color = string.Empty; + + string machineID = string.Empty; + + + if (ProductCode.Length == 29) + { + realProductCode = ProductCode.Substring(0, 23); + + createTime = string.Format("20{0}-{1}-{2} {3}:{4}:{5}", ProductCode.Substring(11, 2), ProductCode.Substring(13, 2), ProductCode.Substring(15, 2), + ProductCode.Substring(17, 2), ProductCode.Substring(19, 2), ProductCode.Substring(21, 2) + ); + + color = ProductCode.Substring(23, 1); + + machineID = ProductCode.Substring(24, 1); + + } + else + { + return null; + } + + if (System.Text.RegularExpressions.Regex.IsMatch(realProductCode, ePrintCodeRoute.BarCodeRule) == true + && ePrintCodeRoute.BarCodeRule != "1" && ePrintCodeRoute.BarCodeRule != "2" && ePrintCodeRoute.BarCodeRule != "3" + && color == ePrintCodeRoute.Color.ToString() && machineID == ePrintCodeRoute.MachineID + ) + { + #region 组成新增产品实例 + T_AW_PRODUCT newProduct = new T_AW_PRODUCT(); + + newProduct.PID = Guid.NewGuid().ToString(); + + newProduct.PRODUCTTYPE = string.Empty; + + newProduct.PRODUCTCODE = ProductCode; + + newProduct.PRODUCTSOURCE = "0"; + + newProduct.MACHINENAME = ePrintCodeRoute.MachineName; + + newProduct.MACHINECODDE = ePrintCodeRoute.MachineCode; + + newProduct.MATERIAL_CODE = ePrintCodeRoute.Material_Code; + + newProduct.STATUS = "0"; + + newProduct.OUTFLAG = "0"; + + newProduct.CAPACITY = 1; + + newProduct.USINGCOUNT = 0; + + newProduct.WORKCELL_CODE = ePrintCodeRoute.WorkCell_Code; + + newProduct.WORKLOC_CODE = ePrintCodeRoute.WorkLoc_Code; + + newProduct.WORKCENTER_CODE = ePrintCodeRoute.WorkCenter; + + newProduct.MATERIAL_TYPE = ePrintCodeRoute.Matrail_Type; + + newProduct.USINGSTATE = "0"; + + newProduct.CREATEDATE = DateTime.Parse(createTime); + + #endregion + + //新增 + ProductHelper.Insert(newProduct); + + break; + } + } + #endregion + } + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.BLL/ProduceShift.cs b/QMAPP.BoraUpgrade.BLL/ProduceShift.cs new file mode 100644 index 0000000..65ddf4b --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/ProduceShift.cs @@ -0,0 +1,6 @@ +namespace QMAPP.BoraUpgrade.BLL +{ + public class ProduceShiftOld + { + } +} \ No newline at end of file diff --git a/QMAPP.BoraUpgrade.BLL/ProductHelper.cs b/QMAPP.BoraUpgrade.BLL/ProductHelper.cs new file mode 100644 index 0000000..081d9d6 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/ProductHelper.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class ProductHelper + { + /// + /// 新增产品信息 + /// + /// 产品实例 + /// 成功 True 否则 False + public static bool Insert(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + returnVal = ProductDataAccess.Insert(eProduct); + + return returnVal; + } + public static int GetIsMilling(string productCode) + { + return ProductDataAccess.GetIsMilling(productCode); + } + /// + /// 根据ProductCode提取产品实例 + /// + /// 产品编号 + /// + public static T_AW_PRODUCT GetProductByProductCode(string productCode) + { + T_AW_PRODUCT returnVal = null; + + DataTable dataSrouce = ProductDataAccess.GetProductByProductCode(productCode); + + + if (dataSrouce.Rows.Count > 0) + { + returnVal = new T_AW_PRODUCT(); + + DataRow fristDataRow = dataSrouce.Rows[0]; + + returnVal.PID = fristDataRow[0].ToString(); + + returnVal.PRODUCTCODE = fristDataRow[2].ToString(); + + returnVal.MATERIAL_CODE = fristDataRow[6].ToString(); + + returnVal.PLAN_NO = fristDataRow[27].ToString(); + + returnVal.USINGCOUNT = int.Parse(fristDataRow["USINGCOUNT"].ToString()); + + returnVal.USINGSTATE = fristDataRow["USINGSTATE"].ToString(); + } + + return returnVal; + } + + public static T_AW_PRODUCT GetProductByLoc(string productCode, string locCode) + { + T_AW_PRODUCT returnVal = null; + + DataTable dataSrouce = ProductDataAccess.GetProductByLocCode(productCode, locCode); + + + if (dataSrouce.Rows.Count > 0) + { + returnVal = new T_AW_PRODUCT(); + + DataRow fristDataRow = dataSrouce.Rows[0]; + + returnVal.PID = fristDataRow["PID"].ToString(); + + returnVal.PRODUCTCODE = fristDataRow["PRODUCTCODE"].ToString(); + + returnVal.MATERIAL_CODE = fristDataRow["MATERIAL_CODE"].ToString(); + + returnVal.STATUS = fristDataRow["STATUS"].ToString(); + returnVal.USINGSTATE = fristDataRow["USINGSTATE"].ToString(); + returnVal.WORKCELL_CODE = fristDataRow["WORKCELL_CODE"].ToString(); + returnVal.WORKLOC_CODE = fristDataRow["WORKLOC_CODE"].ToString(); + returnVal.MACHINECODDE = fristDataRow["MACHINECODDE"].ToString(); + if (!string.IsNullOrEmpty(fristDataRow["UPDATEDATE"].ToString())) + returnVal.UPDATEDATE = DateTime.Parse(fristDataRow["UPDATEDATE"].ToString()); + if (!string.IsNullOrEmpty(fristDataRow["CREATEDATE"].ToString())) + returnVal.CREATEDATE = DateTime.Parse(fristDataRow["CREATEDATE"].ToString()); + + + } + + return returnVal; + } + + + public static DataTable GetBora3MCodes(string pMaterialCode) + { + return ProductDataAccess.GetBora3MCodes(pMaterialCode); + } + /// + /// 宝来3.0洗削后,将产品物料号,从宝来3.0的新物料号改回原物料号 + /// + /// 产品条码 + /// 宝来物料号 + /// 宝来3.0物料号 + public static bool UpdateProductMaterialCode(string productCode, string mCode, string bora3MCode) + { + return ProductDataAccess.UpdateProductMaterialCode(productCode, mCode, bora3MCode); + } + + + public static DateTime GetSerivceTime() + { + return ProductDataAccess.GetServiceDateTime(); + } + + #region 修改产品信息 + /// + /// 修改产品信息 + /// + /// 产品信息实例 + /// 成功 True 否则 False + public static bool Update(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + returnVal = ProductDataAccess.Update(eProduct); + + return returnVal; + } + + public static bool Modify(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + returnVal = ProductDataAccess.Modify(eProduct); + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.BLL/ProductMaxCodeBLL.cs b/QMAPP.BoraUpgrade.BLL/ProductMaxCodeBLL.cs new file mode 100644 index 0000000..98cdbec --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/ProductMaxCodeBLL.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class ProductMaxCodeBLL + { + #region 根据工单ID提取物料列表 + /// + /// 根据工单ID提取物料列表 + /// + /// + public static int GetProductMaxCode(string MATERIAL_TYPE_CODE, string GenerateDate, string ProductType) + { + return QMAPP.BoraUpgrade.DAL.ProductMaxCodeDAL.GetProductMaxCode(MATERIAL_TYPE_CODE, GenerateDate, ProductType); + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.BLL/Properties/AssemblyInfo.cs b/QMAPP.BoraUpgrade.BLL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..fa4f8a2 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("QMAPP.BoraUpgrade.BLL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QMAPP.BoraUpgrade.BLL")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("109a6e75-15f1-49e5-a7fb-fd1555d79f46")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/QMAPP.BoraUpgrade.BLL/QMAPP.BoraUpgrade.BLL.csproj b/QMAPP.BoraUpgrade.BLL/QMAPP.BoraUpgrade.BLL.csproj new file mode 100644 index 0000000..ed578d3 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/QMAPP.BoraUpgrade.BLL.csproj @@ -0,0 +1,75 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF} + Library + Properties + QMAPP.BoraUpgrade.BLL + QMAPP.BoraUpgrade.BLL + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + {17123cdd-0ba7-496f-8e4e-fcbabe0463ca} + QMAPP.FJC.Entity + + + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6} + QMAPP.BoraUpgrade.DAL + + + {0C8B7A06-ED56-4198-9386-B8EA1D176571} + QMAPP.BoraUpgrade.Entity + + + + + \ No newline at end of file diff --git a/QMAPP.BoraUpgrade.BLL/VirtualMaterialBLL.cs b/QMAPP.BoraUpgrade.BLL/VirtualMaterialBLL.cs new file mode 100644 index 0000000..2affe8d --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/VirtualMaterialBLL.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class VirtualMaterialBLL + { + /// + /// 获取全部宝来升级路由列表 + /// + /// + public static List GetVirtualMateialByWorkCellCode(string workCellCode) + { + List returnVal = new List(); + + DataTable dataTable = VirtualMaterialDAL.GetVirtualMaterialByWorkCellCode(workCellCode); + + if (dataTable.Rows.Count != 0) + { + foreach (DataRow currRow in dataTable.Rows) + { + T_QD_VirtualMaterial newVirtualMaterial = new T_QD_VirtualMaterial(); + + newVirtualMaterial.PID = int.Parse( currRow["PID"].ToString() ); + + newVirtualMaterial.WorkCellCode = currRow["WorkCellCode"].ToString(); + + newVirtualMaterial.MaterialCode = currRow["MaterialCode"].ToString(); + + newVirtualMaterial.MaterialType = currRow["MaterialType"].ToString(); + + returnVal.Add(newVirtualMaterial); + } + } + + return returnVal; + } + } +} diff --git a/QMAPP.BoraUpgrade.BLL/WorkCellHelper.cs b/QMAPP.BoraUpgrade.BLL/WorkCellHelper.cs new file mode 100644 index 0000000..2e30f92 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/WorkCellHelper.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class WorkCellHelper + { + #region 根据当前工位码提取前序工位处理码 + /// + /// 根据当前工位码提取前序工位处理码 + /// + /// + public static string GetPreWorkCellProccessCode(string currWorkCellCode,int _Count,int OutTime,string metairal_type) + { + return QMAPP.BoraUpgrade.DAL.WorkCellDAL.GetPreWorkCellProccessCode(currWorkCellCode, _Count, OutTime, metairal_type); + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.BLL/WorkOrderBLL.cs b/QMAPP.BoraUpgrade.BLL/WorkOrderBLL.cs new file mode 100644 index 0000000..8f8ad58 --- /dev/null +++ b/QMAPP.BoraUpgrade.BLL/WorkOrderBLL.cs @@ -0,0 +1,256 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.DAL; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.BLL +{ + public class WorkOrderBLL + { + /// + /// 获取全部宝来升级路由列表 + /// + /// + public static T_MD_MATERIAL GetMaterialListByWorkOrderID(string workOrderID, string materialType) + { + T_MD_MATERIAL newMaterial = new T_MD_MATERIAL(); + + DataTable dataTable = QMAPP.BoraUpgrade.DAL.WorkOrderDAL.GetMaterialByWorkOrderID(workOrderID, materialType); + + if (dataTable.Rows.Count != 0) + { + foreach (DataRow currRow in dataTable.Rows) + { + newMaterial.PID = currRow["PID"].ToString(); + newMaterial.MATERIAL_CODE = currRow["MATERIAL_CODE"].ToString(); + newMaterial.MATERIAL_TYPE_CODE = currRow["MATERIAL_TYPE_CODE"].ToString(); + newMaterial.UNIT_CODE = currRow["UNIT_CODE"].ToString(); + newMaterial.MATERIAL_NAME = currRow["MATERIAL_NAME"].ToString(); + newMaterial.MATERIAL_COMP = currRow["MATERIAL_COMP"].ToString(); + newMaterial.REMARK = currRow["REMARK"].ToString(); + newMaterial.CREATEUSER = currRow["CREATEUSER"].ToString(); + newMaterial.CREATEDATE = DateTime.Parse(currRow["CREATEDATE"].ToString()); + newMaterial.UPDATEUSER = currRow["UPDATEUSER"].ToString(); + newMaterial.UPDATEDATE = currRow["UPDATEDATE"].ToString(); + newMaterial.OUTSOURCE = currRow["OUTSOURCE"].ToString(); + newMaterial.STD_QTY = int.Parse(currRow["STD_QTY"].ToString()); + newMaterial.FLGDEL = currRow["FLGDEL"].ToString(); + newMaterial.COLOR = currRow["COLOR"].ToString(); + newMaterial.HBTYPE = currRow["HBTYPE"].ToString(); + newMaterial.PROJECTCODE = currRow["PROJECTCODE"].ToString(); + + if ( !string.IsNullOrWhiteSpace(currRow["WEIGHT"].ToString()) ) + { + newMaterial.WEIGHT = int.Parse(currRow["WEIGHT"].ToString()); + } + + newMaterial.MATERIAL_SHORT = currRow["MATERIAL_SHORT"].ToString(); + newMaterial.WORKBIN_TYPE = currRow["WORKBIN_TYPE"].ToString(); + newMaterial.CAPACITY = int.Parse(currRow["CAPACITY"].ToString()); + newMaterial.FACTORY_CODE = currRow["FACTORY_CODE"].ToString(); + } + } + + return newMaterial; + } + /// + /// 查询fis工单 + /// + /// 0:未处理 1:已打印BZD 2:已器具排序 + /// + public static DataTable GetFisOrder(string lineCode,int state,int pQty = 1000) + { + return WorkOrderDAL.GetFisOrders(lineCode, state, pQty); + } + /// + /// 修改fis订单的状态 + /// + /// + /// + /// + public static bool UpdateFisOrderState(string pOrderNo, string pBzdCode, int state) + { + return WorkOrderDAL.UpdateFisOrderState(pOrderNo, pBzdCode, state); + } + /// + /// 终检排序扫描记录的保存 T_AW_FinalSortRecord + /// + /// + public static bool SaveSacnOrderRecord(DataRow dataRow) + { + return WorkOrderDAL.SaveSacnOrderRecord(dataRow); + } + /// + /// A3车型,根据BZD条码获取物料号 + /// + /// + /// + public static string GetA3MaterialCodeByBZD(string bzdCode) + { + return WorkOrderDAL.GetA3MaterialCodeByBZD(bzdCode); + } + + /// + /// MPID码获取物料号 + /// + /// + /// + public static string GetA3MaterialCodeByPID(string mpid) + { + return WorkOrderDAL.GetA3MaterialCodeByPID(mpid); + } + + /// + /// BZD条码是否没有被使用 + /// + /// + /// + public static bool IsNoUsedBzdCode(string pBzdCode) + { + return WorkOrderDAL.IsNoUsedBzdCode(pBzdCode); + } + + /// + /// 宝来仪表板,根据本体码查询总成数据 + /// + /// + /// + public static DataTable GetMainInfo(string productCode) + { + return WorkOrderDAL.GetMainInfo(productCode); + } + /// + /// 根据扫描的本体码查找生产产品的总成零件号 + /// 适合倒数第二工位 ,在product表找最新生产记录的物料号. 然后在pbomitem表找到pbomcode. 最后在pbom表找到总成零件号 + /// + /// + /// + public static string GetPMaterialCode(string productCode) + { + return WorkOrderDAL.GetPMaterialCode(productCode); + } + /// + /// 校验该本体条码在该工序是否生产完成 + /// + /// + /// + /// + public static bool VerifyLastCellOver(string productCode,string lastCellCode) + { + return WorkOrderDAL.VerifyLastCellOver(productCode, lastCellCode); + } + public static bool IsBarCodeRepet(string productCode ) + { + return WorkOrderDAL.IsBarCodeRepet(productCode); + } + /// + /// 查询计划编号 + /// + /// + /// + public static string GetPlanCode(string productCode) + { + return WorkOrderDAL.GetPlanCode(productCode); + } + /// + /// 获取班次信息 + /// + /// + public static List GetShiftList() + { + return WorkOrderDAL.GetShiftList(); + } + public static string GetBoraBZDCode(string productCode, string materialCode) + { + return WorkOrderDAL.GetBoraBZDCode(productCode, materialCode); + } + public static string GetA3ProductCodeByBzd(string bzdCode) + { + return WorkOrderDAL.GetA3ProductCodeByBzd(bzdCode); + } + + public static string GetA3ProductCreateByBzd(string bzdCode) + { + return WorkOrderDAL.GetA3ProductCreateByBzd(bzdCode); + } + public static string GetA3MpidCodeByBzd(string bzdCode) + { + return WorkOrderDAL.GetA3MpidCodeByBzd(bzdCode); + } + public static void SaveA3MainRecord( string[] basicData, string userID, string materialCode, string bzdCode, string productionCode,string lineCode) + { + WorkOrderDAL.SaveA3MainRecord(basicData, bzdCode, productionCode, userID, materialCode, lineCode); + } + public static DataTable GetStoreData(int count = 100) + { + return WorkOrderDAL.GetStoreData(count); + } + /// + /// 计划挂起 + /// + public static void UpBills(List upRows) + { + + List rows = upRows.Where(p => p.Field("SendState") != 0).ToList(); + if(rows.Count >0) + { + List list = rows.Select(p => p.Field("FisOrderNo")).ToList(); + throw new Exception("挂起失败,因为编号为[" + string.Join(";", list) + "]的订单正在生产或发运状态中,不满足要求"); + } + foreach(DataRow upRow in upRows) + { + WorkOrderDAL.UpdateFisSetState(upRow); + } + + } + /// + /// 查询每天早8:30到第二天8:30的产量 + /// + /// + public static string GetDayYield() + { + return WorkOrderDAL.GetDayYield(); + } + public static string GetA3DayYield() + { + return WorkOrderDAL.GetA3DayYield(); + } + public static string GetBoraHDayYield() + { + return WorkOrderDAL.GetBoraHDayYield(); + } + public static string GetBoraLDayYield() + { + return WorkOrderDAL.GetBoraLDayYield(); + } + public static void UpBillsDispose(List upRows) + { + + List rows = upRows.Where(p => p.Field("SendState") != 9).ToList(); + if (rows.Count > 0) + { + List list = rows.Select(p => p.Field("FisOrderNo")).ToList(); + throw new Exception("取消挂起失败,因为编号为[" + string.Join(";", list) + "]的订单不属于挂起状态!"); + } + //foreach (DataRow upRow in upRows) + //{ + // WorkOrderDAL.UpdateFisSetStateDispose(upRow); + //} + WorkOrderDAL.UpdateFisSetStateDisposes(upRows); + } + + public static void SaveStartIndex(int startIndex) + { + WorkOrderDAL.SaveStartIndex(startIndex); + } + public static int GetStartIndex() + { + return WorkOrderDAL.GetStartIndex(); + } + } +} diff --git a/QMAPP.BoraUpgrade.Common/Config.cs b/QMAPP.BoraUpgrade.Common/Config.cs new file mode 100644 index 0000000..eb78eec --- /dev/null +++ b/QMAPP.BoraUpgrade.Common/Config.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Configuration; + +namespace QMAPP.BoraUpgrade.Common +{ + /// + /// 配置信息类 + /// CreateTime:2018.10.30 + /// Author :陈冲 + /// Mail :22367340@qq.com + /// + public class Config + { + /// + /// 主数据库文件 + /// + public static string maindbConnectionString = ConfigurationManager.ConnectionStrings["maindb"].ToString(); + //"Data Source=10.123.4.21;Initial Catalog=ADIENT_QD_MES;User Id=sa;Password=adient708!;";// providerName="System.Data.SqlClient" + //public static string a3dbConnectionString = ConfigurationManager.ConnectionStrings["a3db"]?.ToString(); + public static string a3dbConnectionString = ConfigurationManager.ConnectionStrings["maindb"]?.ToString(); + + public static string bzdConnectionString = ConfigurationManager.ConnectionStrings["maindbBZD"].ToString(); + + //"Data Source=10.123.4.65;Initial Catalog=ADIENT_QD_MES_4;User Id=mes;Password=123u3M12912@2;";// + + ///// + ///// FIS数据库文件(需要在QMAPP.WinForm的App.Config中配置) + ///// + //public static string maindbMBConnectionString = ConfigurationManager.ConnectionStrings["maindbMB"].ToString(); + } +} diff --git a/QMAPP.BoraUpgrade.Common/Enum.cs b/QMAPP.BoraUpgrade.Common/Enum.cs new file mode 100644 index 0000000..b41c497 --- /dev/null +++ b/QMAPP.BoraUpgrade.Common/Enum.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Common +{ + public class Enum + { + /// + /// 路由方向 + /// + public enum RouteDirection + { + /// + /// 向前 + /// + Forward = 0, + + /// + /// 向后 + /// + Backward = 1 + } + } +} diff --git a/QMAPP.BoraUpgrade.Common/Properties/AssemblyInfo.cs b/QMAPP.BoraUpgrade.Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2f5da74 --- /dev/null +++ b/QMAPP.BoraUpgrade.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("QMAPP.BoraUpgrade.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QMAPP.BoraUpgrade.Common")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("f9eea6dc-197f-41ef-8b8e-fd197af81bd1")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/QMAPP.BoraUpgrade.Common/QMAPP.BoraUpgrade.Common.csproj b/QMAPP.BoraUpgrade.Common/QMAPP.BoraUpgrade.Common.csproj new file mode 100644 index 0000000..9fedf82 --- /dev/null +++ b/QMAPP.BoraUpgrade.Common/QMAPP.BoraUpgrade.Common.csproj @@ -0,0 +1,57 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {2DEB0026-EF98-4E33-A132-2F46B5E646FE} + Library + Properties + QMAPP.BoraUpgrade.Common + QMAPP.BoraUpgrade.Common + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QMAPP.BoraUpgrade.Common/SqlHelper.cs b/QMAPP.BoraUpgrade.Common/SqlHelper.cs new file mode 100644 index 0000000..05829e0 --- /dev/null +++ b/QMAPP.BoraUpgrade.Common/SqlHelper.cs @@ -0,0 +1,2612 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +//Ref: +using System.Data; +using System.Xml; +using System.Data.SqlClient; +using System.Collections; + + +namespace QMAPP.BoraUpgrade.Common +{ + /// + /// 数据访问类 + /// CreateTime:2018.10.30 + /// Author :陈冲 + /// Mail :22367340@qq.com + /// + public class SqlHelper + { + /// + /// This method is used to attach array of SqlParameters to a SqlCommand. + /// + /// This method will assign a value of DbNull to any parameter with a direction of + /// InputOutput and a value of null. + /// + /// This behavior will prevent default values from being used, but + /// this will be the less common case than an intended pure output parameter (derived as InputOutput) + /// where the user provided no input value. + /// + /// The command to which the parameters will be added + /// An array of SqlParameters to be added to command + private static void AttachParameters(SqlCommand command, + SqlParameter[] commandParameters) + { + if (command == null) { throw new ArgumentNullException("command"); } + if (commandParameters != null) + { + foreach (SqlParameter p in commandParameters) + { + if (p != null) + { + // Check for derived output value with no value assigned + if ((p.Direction == ParameterDirection.InputOutput || + p.Direction == ParameterDirection.Input) && + (p.Value == null)) + { + p.Value = DBNull.Value; + } + command.Parameters.Add(p); + } + } + } + } + + /// + /// This method assigns dataRow column values to an array of SqlParameters + /// + /// Array of SqlParameters to be assigned values + /// The dataRow used to hold the stored procedure's parameter values + private static void AssignParameterValues(SqlParameter[] commandParameters, + DataRow dataRow) + { + if ((commandParameters == null) || (dataRow == null)) + { + // Do nothing if we get no data + return; + } + int i = 0; + // Set the parameters values + foreach (SqlParameter commandParameter in commandParameters) + { + // Check the parameter name + if (commandParameter.ParameterName == null || + commandParameter.ParameterName.Length <= 1) + throw new Exception( + string.Format( + "Please provide a valid parameter name on the parameter #{0}, the ParameterName property has the following value: '{1}'.", + i, commandParameter.ParameterName)); + if (dataRow.Table.Columns.IndexOf(commandParameter.ParameterName.Substring( + 1)) != -1) + { commandParameter.Value = dataRow[commandParameter.ParameterName.Substring(1)]; } + i++; + } + } + + /// + /// This method assigns an array of values to an array of SqlParameters + /// + /// Array of SqlParameters to be assigned values + /// Array of objects holding the values to be assigned + private static void AssignParameterValues(SqlParameter[] commandParameters, + object[] parameterValues) + { + if ((commandParameters == null) || (parameterValues == null)) + { + // Do nothing if we get no data + return; + } + // We must have the same number of values as we pave parameters to put them in + if (commandParameters.Length != parameterValues.Length) + { + throw new ArgumentException("Parameter count does not match Parameter Value count."); + } + // Iterate through the SqlParameters, assigning the values from the corresponding position in the + // value array + for (int i = 0, j = commandParameters.Length; i < j; i++) + { + // If the current array value derives from IDbDataParameter, then assign its Value property + if (parameterValues[i] is IDbDataParameter) + { + IDbDataParameter paramInstance = (IDbDataParameter)parameterValues[i]; + if (paramInstance.Value == null) + { + commandParameters[i].Value = DBNull.Value; + } + else + { + commandParameters[i].Value = paramInstance.Value; + } + } + else if (parameterValues[i] == null) + { + commandParameters[i].Value = DBNull.Value; + } + else + { + commandParameters[i].Value = parameterValues[i]; + } + } + } + + /// + /// This method opens (if necessary) and assigns a connection, transaction, command type and parameters + /// to the provided command + /// + /// The SqlCommand to be prepared + /// A valid SqlConnection, on which to execute this command + /// A valid SqlTransaction, or 'null' + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParameters to be associated with the command or 'null' if no parameters are required + /// true if the connection was opened by the method, otherwose is false. + private static void PrepareCommand(SqlCommand command, SqlConnection connection, + SqlTransaction transaction, CommandType commandType, string commandText, + SqlParameter[] commandParameters, out bool mustCloseConnection) + { + if (command == null) { throw new ArgumentNullException("command"); } + if (commandText == null || commandText.Length == 0) { throw new ArgumentNullException("commandText"); } + // If the provided connection is not open, we will open it + if (connection.State != ConnectionState.Open) + { + mustCloseConnection = true; + connection.Open(); + } + else + { + mustCloseConnection = false; + } + // Associate the connection with the command + command.Connection = connection; + // Set the command text (stored procedure name or SQL statement) + command.CommandText = commandText; + // If we were provided a transaction, assign it + if (transaction != null) + { + if (transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + command.Transaction = transaction; + } + // Set the command type + command.CommandType = commandType; + // Attach the command parameters if they are provided + if (commandParameters != null) + { + AttachParameters(command, commandParameters); + } + return; + } + + + #region ExecuteNonQuery + + /// + /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in + /// the connection string + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders"); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(string connectionString, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteNonQuery(connectionString, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns no resultset) against the database specified in the connection string + /// using the provided parameters + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(string connectionString, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + return ExecuteNonQuery(connection, commandType, commandText, commandParameters); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in + /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36); + /// + /// A valid connection string for a SqlConnection + /// The name of the stored prcedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(string connectionString, string spName, + params object[] parameterValues) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders"); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlConnection connection, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteNonQuery(connection, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns no resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlConnection connection, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, + commandParameters, out mustCloseConnection); + // Finally, execute the command + int retval = cmd.ExecuteNonQuery(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + if (mustCloseConnection) + { connection.Close(); } + return retval; + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlConnection connection, string spName, + params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders"); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlTransaction transaction, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteNonQuery(transaction, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns no resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlTransaction transaction, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, transaction.Connection, transaction, commandType, + commandText, commandParameters, out mustCloseConnection); + // Finally, execute the command + int retval = cmd.ExecuteNonQuery(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + return retval; + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An int representing the number of rows affected by the command + public static int ExecuteNonQuery(SqlTransaction transaction, string spName, + params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName); + } + } + + #endregion ExecuteNonQuery + + #region ExecuteDataset + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in + /// the connection string. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(string connectionString, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteDataset(connectionString, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string + /// using the provided parameters. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(string connectionString, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + return ExecuteDataset(connection, commandType, commandText, commandParameters); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in + /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36); + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(string connectionString, string spName, + params object[] parameterValues) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlConnection connection, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteDataset(connection, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlConnection connection, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, + commandParameters, out mustCloseConnection); + // Create the DataAdapter & DataSet + using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + { + DataSet ds = new DataSet(); + // Fill the DataSet using default values for DataTable names, etc + da.Fill(ds); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + if (mustCloseConnection) + { connection.Close(); } + // Return the dataset + return ds; + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlConnection connection, string spName, + params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteDataset(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteDataset(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlTransaction transaction, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteDataset(transaction, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlTransaction transaction, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, transaction.Connection, transaction, commandType, + commandText, commandParameters, out mustCloseConnection); + // Create the DataAdapter & DataSet + using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + { + DataSet ds = new DataSet(); + // Fill the DataSet using default values for DataTable names, etc + da.Fill(ds); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + // Return the dataset + return ds; + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDataset(SqlTransaction transaction, string spName, + params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteDataset(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteDataset(transaction, CommandType.StoredProcedure, spName); + } + } + + #endregion ExecuteDataset + + #region ExecuteReader + + /// + /// This enum is used to indicate whether the connection was provided by the caller, or created by SqlHelper, so that + /// we can set the appropriate CommandBehavior when calling ExecuteReader() + /// + private enum SqlConnectionOwnership + { + /// Connection is owned and managed by SqlHelper + Internal, + /// Connection is owned and managed by the caller + External + } + + /// + /// Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior. + /// + /// + /// If we created and opened the connection, we want the connection to be closed when the DataReader is closed. + /// + /// If the caller provided the connection, we want to leave it to them to manage. + /// + /// A valid SqlConnection, on which to execute this command + /// A valid SqlTransaction, or 'null' + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParameters to be associated with the command or 'null' if no parameters are required + /// Indicates whether the connection parameter was provided by the caller, or created by SqlHelper + /// SqlDataReader containing the results of the command + private static SqlDataReader ExecuteReader(SqlConnection connection, + SqlTransaction transaction, CommandType commandType, string commandText, + SqlParameter[] commandParameters, SqlConnectionOwnership connectionOwnership) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + bool mustCloseConnection = false; + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + try + { + PrepareCommand(cmd, connection, transaction, commandType, commandText, + commandParameters, out mustCloseConnection); + // Create a reader + SqlDataReader dataReader; + // Call ExecuteReader with the appropriate CommandBehavior + if (connectionOwnership == SqlConnectionOwnership.External) + { + dataReader = cmd.ExecuteReader(); + } + else + { + dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection); + } + // Detach the SqlParameters from the command object, so they can be used again. + // HACK: There is a problem here, the output parameter values are fletched + // when the reader is closed, so if the parameters are detached from the command + // then the SqlReader can磘 set its values. + // When this happen, the parameters can磘 be used again in other command. + bool canClear = true; + foreach (SqlParameter commandParameter in cmd.Parameters) + { + if (commandParameter.Direction != ParameterDirection.Input) + { canClear = false; } + } + if (canClear) + { + cmd.Parameters.Clear(); + } + return dataReader; + } + catch + { + if (mustCloseConnection) + { connection.Close(); } + throw; + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in + /// the connection string. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(string connectionString, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteReader(connectionString, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string + /// using the provided parameters. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(string connectionString, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + SqlConnection connection = null; + try + { + connection = new SqlConnection(connectionString); + connection.Open(); + // Call the private overload that takes an internally owned connection in place of the connection string + return ExecuteReader(connection, null, commandType, commandText, + commandParameters, SqlConnectionOwnership.Internal); + } + catch + { + // If we fail to return the SqlDatReader, we need to close the connection ourselves + if (connection != null) { connection.Close(); } + throw; + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in + /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36); + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(string connectionString, + string spName, params object[] parameterValues) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + AssignParameterValues(commandParameters, parameterValues); + return ExecuteReader(connectionString, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteReader(connectionString, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlConnection connection, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteReader(connection, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlConnection connection, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + // Pass through the call to the private overload using a null transaction value and an externally owned connection + return ExecuteReader(connection, (SqlTransaction)null, commandType, commandText, + commandParameters, SqlConnectionOwnership.External); + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlConnection connection, + string spName, params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + AssignParameterValues(commandParameters, parameterValues); + return ExecuteReader(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteReader(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlTransaction transaction, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteReader(transaction, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlTransaction transaction, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + // Pass through to private overload, indicating that the connection is owned by the caller + return ExecuteReader(transaction.Connection, transaction, commandType, + commandText, commandParameters, SqlConnectionOwnership.External); + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// SqlDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReader(SqlTransaction transaction, + string spName, params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + AssignParameterValues(commandParameters, parameterValues); + return ExecuteReader(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteReader(transaction, CommandType.StoredProcedure, spName); + } + } + + #endregion ExecuteReader + + #region ExecuteScalar + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in + /// the connection string. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount"); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(string connectionString, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteScalar(connectionString, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string + /// using the provided parameters. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(string connectionString, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + return ExecuteScalar(connection, commandType, commandText, commandParameters); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in + /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36); + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(string connectionString, string spName, + params object[] parameterValues) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount"); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlConnection connection, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteScalar(connection, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlConnection connection, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, + commandParameters, out mustCloseConnection); + // Execute the command & return the results + object retval = cmd.ExecuteScalar(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + if (mustCloseConnection) + { connection.Close(); } + return retval; + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlConnection connection, string spName, + params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteScalar(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteScalar(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount"); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlTransaction transaction, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteScalar(transaction, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlTransaction transaction, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, transaction.Connection, transaction, commandType, + commandText, commandParameters, out mustCloseConnection); + // Execute the command & return the results + object retval = cmd.ExecuteScalar(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + return retval; + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalar(SqlTransaction transaction, string spName, + params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // PPull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteScalar(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteScalar(transaction, CommandType.StoredProcedure, spName); + } + } + + #endregion ExecuteScalar + + #region ExecuteXmlReader + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command using "FOR XML AUTO" + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlConnection connection, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteXmlReader(connection, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command using "FOR XML AUTO" + /// An array of SqlParamters used to execute the command + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlConnection connection, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + bool mustCloseConnection = false; + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + try + { + PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, + commandParameters, out mustCloseConnection); + // Create the DataAdapter & DataSet + XmlReader retval = cmd.ExecuteXmlReader(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + return retval; + } + catch + { + if (mustCloseConnection) + { connection.Close(); } + throw; + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(conn, "GetOrders", 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure using "FOR XML AUTO" + /// An array of objects to be assigned as the input values of the stored procedure + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlConnection connection, + string spName, params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders"); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command using "FOR XML AUTO" + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlTransaction transaction, + CommandType commandType, string commandText) + { + // Pass through the call providing null for the set of SqlParameters + return ExecuteXmlReader(transaction, commandType, commandText, + (SqlParameter[])null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command using "FOR XML AUTO" + /// An array of SqlParamters used to execute the command + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlTransaction transaction, + CommandType commandType, string commandText, + params SqlParameter[] commandParameters) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + // Create a command and prepare it for execution + SqlCommand cmd = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(cmd, transaction.Connection, transaction, commandType, + commandText, commandParameters, out mustCloseConnection); + // Create the DataAdapter & DataSet + XmlReader retval = cmd.ExecuteXmlReader(); + // Detach the SqlParameters from the command object, so they can be used again + cmd.Parameters.Clear(); + return retval; + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// XmlReader r = ExecuteXmlReader(trans, "GetOrders", 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// An array of objects to be assigned as the input values of the stored procedure + /// A dataset containing the resultset generated by the command + public static XmlReader ExecuteXmlReader(SqlTransaction transaction, + string spName, params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + // Otherwise we can just call the SP without params + return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName); + } + } + + #endregion ExecuteXmlReader + + #region FillDataset + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in + /// the connection string. + /// + /// + /// e.g.: + /// FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + public static void FillDataset(string connectionString, CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + FillDataset(connection, commandType, commandText, dataSet, tableNames); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string + /// using the provided parameters. + /// + /// + /// e.g.: + /// FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24)); + /// + /// A valid connection string for a SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// An array of SqlParamters used to execute the command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + public static void FillDataset(string connectionString, CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames, + params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + FillDataset(connection, commandType, commandText, dataSet, tableNames, + commandParameters); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in + /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// FillDataset(connString, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, 24); + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of objects to be assigned as the input values of the stored procedure + public static void FillDataset(string connectionString, string spName, + DataSet dataSet, string[] tableNames, + params object[] parameterValues) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + // Create & open a SqlConnection, and dispose of it after we are done + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + // Call the overload that takes a connection in place of the connection string + FillDataset(connection, spName, dataSet, tableNames, parameterValues); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. + /// + /// + /// e.g.: + /// FillDataset(conn, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + public static void FillDataset(SqlConnection connection, + CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames) + { + FillDataset(connection, commandType, commandText, dataSet, tableNames, null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// FillDataset(conn, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of SqlParamters used to execute the command + public static void FillDataset(SqlConnection connection, + CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames, + params SqlParameter[] commandParameters) + { + FillDataset(connection, null, commandType, commandText, dataSet, tableNames, + commandParameters); + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// FillDataset(conn, "GetOrders", ds, new string[] {"orders"}, 24, 36); + /// + /// A valid SqlConnection + /// The name of the stored procedure + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of objects to be assigned as the input values of the stored procedure + public static void FillDataset(SqlConnection connection, string spName, + DataSet dataSet, string[] tableNames, + params object[] parameterValues) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + FillDataset(connection, CommandType.StoredProcedure, spName, dataSet, + tableNames, commandParameters); + } + else + { + // Otherwise we can just call the SP without params + FillDataset(connection, CommandType.StoredProcedure, spName, dataSet, + tableNames); + } + } + + /// + /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. + /// + /// + /// e.g.: + /// FillDataset(trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + public static void FillDataset(SqlTransaction transaction, + CommandType commandType, + string commandText, + DataSet dataSet, string[] tableNames) + { + FillDataset(transaction, commandType, commandText, dataSet, tableNames, null); + } + + /// + /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the provided parameters. + /// + /// + /// e.g.: + /// FillDataset(trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24)); + /// + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of SqlParamters used to execute the command + public static void FillDataset(SqlTransaction transaction, + CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames, + params SqlParameter[] commandParameters) + { + FillDataset(transaction.Connection, transaction, commandType, commandText, + dataSet, tableNames, commandParameters); + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified + /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// + /// This method provides no access to output parameters or the stored procedure's return value parameter. + /// + /// e.g.: + /// FillDataset(trans, "GetOrders", ds, new string[]{"orders"}, 24, 36); + /// + /// A valid SqlTransaction + /// The name of the stored procedure + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of objects to be assigned as the input values of the stored procedure + public static void FillDataset(SqlTransaction transaction, string spName, + DataSet dataSet, string[] tableNames, + params object[] parameterValues) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If we receive parameter values, we need to figure out where they go + if ((parameterValues != null) && (parameterValues.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Assign the provided values to these parameters based on parameter order + AssignParameterValues(commandParameters, parameterValues); + // Call the overload that takes an array of SqlParameters + FillDataset(transaction, CommandType.StoredProcedure, spName, dataSet, + tableNames, commandParameters); + } + else + { + // Otherwise we can just call the SP without params + FillDataset(transaction, CommandType.StoredProcedure, spName, dataSet, + tableNames); + } + } + + /// + /// Private helper method that execute a SqlCommand (that returns a resultset) against the specified SqlTransaction and SqlConnection + /// using the provided parameters. + /// + /// + /// e.g.: + /// FillDataset(conn, trans, CommandType.StoredProcedure, "GetOrders", ds, new string[] {"orders"}, new SqlParameter("@prodid", 24)); + /// + /// A valid SqlConnection + /// A valid SqlTransaction + /// The CommandType (stored procedure, text, etc.) + /// The stored procedure name or T-SQL command + /// A dataset wich will contain the resultset generated by the command + /// This array will be used to create table mappings allowing the DataTables to be referenced + /// by a user defined name (probably the actual table name) + /// + /// An array of SqlParamters used to execute the command + private static void FillDataset(SqlConnection connection, + SqlTransaction transaction, CommandType commandType, + string commandText, DataSet dataSet, string[] tableNames, + params SqlParameter[] commandParameters) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (dataSet == null) { throw new ArgumentNullException("dataSet"); } + // Create a command and prepare it for execution + SqlCommand command = new SqlCommand(); + bool mustCloseConnection = false; + PrepareCommand(command, connection, transaction, commandType, commandText, + commandParameters, out mustCloseConnection); + // Create the DataAdapter & DataSet + using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command)) + { + // Add the table mappings specified by the user + if (tableNames != null && tableNames.Length > 0) + { + string tableName = "Table"; + for (int index = 0; index < tableNames.Length; index++) + { + if (tableNames[index] == null || tableNames[index].Length == 0) { throw new ArgumentException("The tableNames parameter must contain a list of tables, a value was provided as null or empty string.", "tableNames"); } + dataAdapter.TableMappings.Add(tableName, tableNames[index]); + tableName += (index + 1).ToString(); + } + } + // Fill the DataSet using default values for DataTable names, etc + dataAdapter.Fill(dataSet); + // Detach the SqlParameters from the command object, so they can be used again + command.Parameters.Clear(); + } + if (mustCloseConnection) + { connection.Close(); } + } + #endregion + + #region UpdateDataset + /// + /// Executes the respective command for each inserted, updated, or deleted row in the DataSet. + /// + /// + /// e.g.: + /// UpdateDataset(conn, insertCommand, deleteCommand, updateCommand, dataSet, "Order"); + /// + /// A valid transact-SQL statement or stored procedure to insert new records into the data source + /// A valid transact-SQL statement or stored procedure to delete records from the data source + /// A valid transact-SQL statement or stored procedure used to update records in the data source + /// The DataSet used to update the data source + /// The DataTable used to update the data source. + public static void UpdateDataset(SqlCommand insertCommand, + SqlCommand deleteCommand, SqlCommand updateCommand, DataSet dataSet, + string tableName) + { + if (insertCommand == null) { throw new ArgumentNullException("insertCommand"); } + if (deleteCommand == null) { throw new ArgumentNullException("deleteCommand"); } + if (updateCommand == null) { throw new ArgumentNullException("updateCommand"); } + if (tableName == null || tableName.Length == 0) { throw new ArgumentNullException("tableName"); } + // Create a SqlDataAdapter, and dispose of it after we are done + using (SqlDataAdapter dataAdapter = new SqlDataAdapter()) + { + // Set the data adapter commands + dataAdapter.UpdateCommand = updateCommand; + dataAdapter.InsertCommand = insertCommand; + dataAdapter.DeleteCommand = deleteCommand; + // Update the dataset changes in the data source + dataAdapter.Update(dataSet, tableName); + // Commit all the changes made to the DataSet + dataSet.AcceptChanges(); + } + } + #endregion + + #region CreateCommand + /// + /// Simplify the creation of a Sql command object by allowing + /// a stored procedure and optional parameters to be provided + /// + /// + /// e.g.: + /// SqlCommand command = CreateCommand(conn, "AddCustomer", "CustomerID", "CustomerName"); + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// An array of string to be assigned as the source columns of the stored procedure parameters + /// A valid SqlCommand object + public static SqlCommand CreateCommand(SqlConnection connection, string spName, + params string[] sourceColumns) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // Create a SqlCommand + SqlCommand cmd = new SqlCommand(spName, connection); + cmd.CommandType = CommandType.StoredProcedure; + // If we receive parameter values, we need to figure out where they go + if ((sourceColumns != null) && (sourceColumns.Length > 0)) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Assign the provided source columns to these parameters based on parameter order + for (int index = 0; index < sourceColumns.Length; index++) + { commandParameters[index].SourceColumn = sourceColumns[index]; } + // Attach the discovered parameters to the SqlCommand object + AttachParameters(cmd, commandParameters); + } + return cmd; + } + #endregion + + #region ExecuteNonQueryTypedParams + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in + /// the connection string using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An int representing the number of rows affected by the command + public static int ExecuteNonQueryTypedParams(String connectionString, + String spName, DataRow dataRow) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An int representing the number of rows affected by the command + public static int ExecuteNonQueryTypedParams(SqlConnection connection, + String spName, DataRow dataRow) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified + /// SqlTransaction using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid SqlTransaction object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An int representing the number of rows affected by the command + public static int ExecuteNonQueryTypedParams(SqlTransaction transaction, + String spName, DataRow dataRow) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // Sf the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, + spName); + } + } + #endregion + + #region ExecuteDatasetTypedParams + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in + /// the connection string using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDatasetTypedParams(string connectionString, + String spName, DataRow dataRow) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + //If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the dataRow column values as the store procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDatasetTypedParams(SqlConnection connection, + String spName, DataRow dataRow) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + return SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on row values. + /// + /// A valid SqlTransaction object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A dataset containing the resultset generated by the command + public static DataSet ExecuteDatasetTypedParams(SqlTransaction transaction, + String spName, DataRow dataRow) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteDataset(transaction, CommandType.StoredProcedure, + spName); + } + } + + #endregion + + #region ExecuteReaderTypedParams + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in + /// the connection string using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReaderTypedParams(String connectionString, + String spName, DataRow dataRow) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, + spName); + } + } + + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReaderTypedParams(SqlConnection connection, + String spName, DataRow dataRow) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + return SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlTransaction object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// A SqlDataReader containing the resultset generated by the command + public static SqlDataReader ExecuteReaderTypedParams(SqlTransaction transaction, + String spName, DataRow dataRow) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + return SqlHelper.ExecuteReader(transaction, CommandType.StoredProcedure, + spName); + } + } + #endregion + + #region ExecuteScalarTypedParams + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in + /// the connection string using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalarTypedParams(String connectionString, + String spName, DataRow dataRow) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connectionString, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteScalar(connectionString, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalarTypedParams(SqlConnection connection, + String spName, DataRow dataRow) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + return SqlHelper.ExecuteScalar(connection, CommandType.StoredProcedure, spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlTransaction object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An object containing the value in the 1x1 resultset generated by the command + public static object ExecuteScalarTypedParams(SqlTransaction transaction, + String spName, DataRow dataRow) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, spName, + commandParameters); + } + else + { + return SqlHelper.ExecuteScalar(transaction, CommandType.StoredProcedure, + spName); + } + } + #endregion + + #region ExecuteXmlReaderTypedParams + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReaderTypedParams(SqlConnection connection, + String spName, DataRow dataRow) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteXmlReader(connection, CommandType.StoredProcedure, + spName); + } + } + + /// + /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlTransaction + /// using the dataRow column values as the stored procedure's parameters values. + /// This method will query the database to discover the parameters for the + /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. + /// + /// A valid SqlTransaction object + /// The name of the stored procedure + /// The dataRow used to hold the stored procedure's parameter values. + /// An XmlReader containing the resultset generated by the command + public static XmlReader ExecuteXmlReaderTypedParams(SqlTransaction transaction, + String spName, DataRow dataRow) + { + if (transaction == null) { throw new ArgumentNullException("transaction"); } + if (transaction != null && transaction.Connection == null) { throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + // If the row has values, the store procedure parameters must be initialized + if (dataRow != null && dataRow.ItemArray.Length > 0) + { + // Pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) + SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet( + transaction.Connection, spName); + // Set the parameters values + AssignParameterValues(commandParameters, dataRow); + return SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, + spName, commandParameters); + } + else + { + return SqlHelper.ExecuteXmlReader(transaction, CommandType.StoredProcedure, + spName); + } + } + #endregion + + } + + /// + /// SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the + /// ability to discover parameters for stored procedures at run-time. + /// + public sealed class SqlHelperParameterCache + { + #region private methods, variables, and constructors + + //Since this class provides only static methods, make the default constructor private to prevent + //instances from being created with "new SqlHelperParameterCache()" + private SqlHelperParameterCache() { } + + private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable()); + + /// + /// Resolve at run time the appropriate set of SqlParameters for a stored procedure + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// Whether or not to include their return value parameter + /// The parameter array discovered. + private static SqlParameter[] DiscoverSpParameterSet(SqlConnection connection, + string spName, bool includeReturnValueParameter) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + SqlCommand cmd = new SqlCommand(spName, connection); + cmd.CommandType = CommandType.StoredProcedure; + connection.Open(); + SqlCommandBuilder.DeriveParameters(cmd); + connection.Close(); + if (!includeReturnValueParameter) + { + cmd.Parameters.RemoveAt(0); + } + SqlParameter[] discoveredParameters = new SqlParameter[cmd.Parameters.Count]; + cmd.Parameters.CopyTo(discoveredParameters, 0); + // Init the parameters with a DBNull value + foreach (SqlParameter discoveredParameter in discoveredParameters) + { + discoveredParameter.Value = DBNull.Value; + } + return discoveredParameters; + } + + /// + /// Deep copy of cached SqlParameter array + /// + /// + /// + private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters) + { + SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length]; + for (int i = 0, j = originalParameters.Length; i < j; i++) + { + clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i]).Clone(); + } + return clonedParameters; + } + + #endregion private methods, variables, and constructors + + #region caching functions + + /// + /// Add parameter array to the cache + /// + /// A valid connection string for a SqlConnection + /// The stored procedure name or T-SQL command + /// An array of SqlParamters to be cached + public static void CacheParameterSet(string connectionString, + string commandText, params SqlParameter[] commandParameters) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (commandText == null || commandText.Length == 0) { throw new ArgumentNullException("commandText"); } + string hashKey = connectionString + ":" + commandText; + paramCache[hashKey] = commandParameters; + } + + /// + /// Retrieve a parameter array from the cache + /// + /// A valid connection string for a SqlConnection + /// The stored procedure name or T-SQL command + /// An array of SqlParamters + public static SqlParameter[] GetCachedParameterSet(string connectionString, + string commandText) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (commandText == null || commandText.Length == 0) { throw new ArgumentNullException("commandText"); } + string hashKey = connectionString + ":" + commandText; + SqlParameter[] cachedParameters = paramCache[hashKey] as SqlParameter[]; + if (cachedParameters == null) + { + return null; + } + else + { + return CloneParameters(cachedParameters); + } + } + + #endregion caching functions + + #region Parameter Discovery Functions + + /// + /// Retrieves the set of SqlParameters appropriate for the stored procedure + /// + /// + /// This method will query the database for this information, and then store it in a cache for future requests. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// An array of SqlParameters + public static SqlParameter[] GetSpParameterSet(string connectionString, + string spName) + { + return GetSpParameterSet(connectionString, spName, false); + } + + /// + /// Retrieves the set of SqlParameters appropriate for the stored procedure + /// + /// + /// This method will query the database for this information, and then store it in a cache for future requests. + /// + /// A valid connection string for a SqlConnection + /// The name of the stored procedure + /// A bool value indicating whether the return value parameter should be included in the results + /// An array of SqlParameters + public static SqlParameter[] GetSpParameterSet(string connectionString, + string spName, bool includeReturnValueParameter) + { + if (connectionString == null || connectionString.Length == 0) { throw new ArgumentNullException("connectionString"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + using (SqlConnection connection = new SqlConnection(connectionString)) + { + return GetSpParameterSetInternal(connection, spName, + includeReturnValueParameter); + } + } + + /// + /// Retrieves the set of SqlParameters appropriate for the stored procedure + /// + /// + /// This method will query the database for this information, and then store it in a cache for future requests. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// An array of SqlParameters + internal static SqlParameter[] GetSpParameterSet(SqlConnection connection, + string spName) + { + return GetSpParameterSet(connection, spName, false); + } + + /// + /// Retrieves the set of SqlParameters appropriate for the stored procedure + /// + /// + /// This method will query the database for this information, and then store it in a cache for future requests. + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// A bool value indicating whether the return value parameter should be included in the results + /// An array of SqlParameters + internal static SqlParameter[] GetSpParameterSet(SqlConnection connection, + string spName, bool includeReturnValueParameter) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + using (SqlConnection clonedConnection = (SqlConnection)(( + ICloneable)connection).Clone()) + { + return GetSpParameterSetInternal(clonedConnection, spName, + includeReturnValueParameter); + } + } + + /// + /// Retrieves the set of SqlParameters appropriate for the stored procedure + /// + /// A valid SqlConnection object + /// The name of the stored procedure + /// A bool value indicating whether the return value parameter should be included in the results + /// An array of SqlParameters + private static SqlParameter[] GetSpParameterSetInternal( + SqlConnection connection, string spName, bool includeReturnValueParameter) + { + if (connection == null) { throw new ArgumentNullException("connection"); } + if (spName == null || spName.Length == 0) { throw new ArgumentNullException("spName"); } + string hashKey = connection.ConnectionString + ":" + spName + + (includeReturnValueParameter ? ":include ReturnValue Parameter" : ""); + SqlParameter[] cachedParameters; + cachedParameters = paramCache[hashKey] as SqlParameter[]; + if (cachedParameters == null) + { + SqlParameter[] spParameters = DiscoverSpParameterSet(connection, spName, + includeReturnValueParameter); + paramCache[hashKey] = spParameters; + cachedParameters = spParameters; + } + return CloneParameters(cachedParameters); + } + + #endregion Parameter Discovery Functions + } +} diff --git a/QMAPP.BoraUpgrade.DAL/BoraUpgradeRouteDAL.cs b/QMAPP.BoraUpgrade.DAL/BoraUpgradeRouteDAL.cs new file mode 100644 index 0000000..4ec3bf0 --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/BoraUpgradeRouteDAL.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.DAL +{ + /// + /// 宝来升级路由数据层 + /// + public class BoraUpgradeRouteDAL + { + #region 根据ProductCode提取产品实例 + /// + /// 获取全部宝来升级路由列表 + /// + /// + public static DataTable GetBoraUpgradeRouteList() + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@" + Select + * + From [dbo].[T_QD_BoraUpgradeRoute] + Where IsDeleted = 0 +"; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript ); + + if ( dataSet.Tables.Count > 0 ) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + + /// + /// 根据工位编码获取宝来升级路由实例 + /// + /// 工位编码 + /// + public static DataTable GetBoraUpgradeRouteByWorkCell(string WorkCell_Code) + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@" + Select + Top 1 * + From [dbo].[T_QD_BoraUpgradeRoute] + Where IsDeleted = 0 + And WorkCell_Code = '{0}' +"; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript,WorkCell_Code) ); + + if (dataSet.Tables.Count > 0) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/PrintCodeRouteDataAccess.cs b/QMAPP.BoraUpgrade.DAL/PrintCodeRouteDataAccess.cs new file mode 100644 index 0000000..032a0bb --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/PrintCodeRouteDataAccess.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; + +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.DAL +{ + /// + /// 注塑条码打码-数据访问类 + /// CreateTime:2019.10.18 + /// Author :陈冲 + /// Mail :22367340@qq.com + /// + public class PrintCodeRouteDataAccess + { + #region 获取全部打码规则 + /// + /// 获取全部打码规则 + /// + /// 产品编号 + /// + public static DataTable GetPrintCodeRouteAllList() + { + DataTable returnVal = new DataTable(); + + string sqlScript = @"Select * From [T_QD_PrintCodeRoute]"; + + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text,sqlScript); + + if ( dataSet.Tables.Count > 0 ) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + + public static DataTable GetExsitProductCodeQty(string productCode,string cellCode) + { + string sql = $"select * from T_AW_Product where ProductCode='{productCode}' and WorkCell_Code='{cellCode}'"; + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sql); + + DataTable dataTable = dataSet.Tables[0]; + + return dataTable; + } + + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/ProductDataAccess.cs b/QMAPP.BoraUpgrade.DAL/ProductDataAccess.cs new file mode 100644 index 0000000..e6dce49 --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/ProductDataAccess.cs @@ -0,0 +1,304 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + + +using QMAPP.BoraUpgrade.Common; + +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.DAL +{ + /// + /// 门板种子数据-数据访问类 + /// CreateTime:2018.10.31 + /// Author :陈冲 + /// Mail :22367340@qq.com + /// + public class ProductDataAccess + { + #region 新增产品信息 + /// + /// 新增产品信息 + /// + /// 产品信息实例 + /// 成功 True 否则 False + public static bool Insert(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + string sqlScriptTemp = +@" +Insert Into T_AW_Product +(PID,ProductType,ProductCode,ProductSource,MachineCodde,Material_Code,[Status],IsParent,CurrentProcess,PRODUCELINE,PRODUCESHIFTNAME,PRODUCESHIFTTCODE, + OutFlag,UsingState,Capacity,UsingCount,CreateUser,UpdateUser,WorkCell_Code,WorkLoc_Code,WorkCenter_Code, + Team_code,EndofLine,MATERIAL_TYPE,CreateDate,UpdateDate,PLAN_NO) +Values +( + '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}', + '{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}', + '{20}','{21}','{22}','{23}',getdate(),getdate(),'{24}' +)"; + + + string sqlScript = + string.Format(sqlScriptTemp, + eProduct.PID, eProduct.PRODUCTTYPE, eProduct.PRODUCTCODE, eProduct.PRODUCTSOURCE, + eProduct.MACHINECODDE, eProduct.MATERIAL_CODE, eProduct.STATUS, eProduct.ISPARENT, eProduct.CURRENTPROCESS, + eProduct.PRODUCELINE, eProduct.PRODUCESHIFTNAME, eProduct.PRODUCESHIFTTCODE, eProduct.OUTFLAG, + eProduct.USINGSTATE, eProduct.CAPACITY, eProduct.USINGCOUNT, eProduct.CREATEUSER, eProduct.UPDATEUSER, + eProduct.WORKCELL_CODE, eProduct.WORKLOC_CODE, eProduct.WORKCENTER_CODE, eProduct.TEAM_CODE, + eProduct.ENDOFLINE, eProduct.MATERIAL_TYPE, eProduct.PLAN_NO + ); + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + + return returnVal; + } + #endregion + + #region wrx + /// + /// 是否铣削过 + /// + /// + /// 1:已铣削 0:未铣削 + public static int GetIsMilling(string productCode) + { + string sqlScript = +@"Select Top 1 * From [dbo].[T_AW_MillingRecord] Where BarCode = '{0}' Order By AddTime Desc"; + + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, productCode)); + + if (dataSet.Tables.Count > 0) + { + if(dataSet.Tables[0].Rows.Count > 0) + return 1; + } + + return 0; + } + #endregion + + + + + #region 根据ProductCode提取产品实例 + /// + /// 根据ProductCode提取产品实例 + /// + /// 产品编号 + /// + public static DataTable GetProductByProductCode(string productCode) + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@"Select Top 1 * From [dbo].[T_AW_PRODUCT] Where USINGSTATE<> 2 and PRODUCTCODE = '{0}' Order By CREATEDATE Desc"; + + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, productCode)); + + if (dataSet.Tables.Count > 0) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + + /// + /// 根据产品条码以及工位查询 + /// + /// + /// + /// + public static DataTable GetProductByLocCode(string productCode, string locCode) + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@"Select Top 1 * From [dbo].[T_AW_PRODUCT] Where PRODUCTCODE = '{0}' and WORKLOC_CODE='{1}' Order By UPDATEDATE Desc,CREATEDATE Desc "; + + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, productCode, locCode)); + + if (dataSet.Tables.Count > 0) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + + public static DateTime GetServiceDateTime() + { + StringBuilder sql = new StringBuilder(); + try + { + string sqlScript = @"select GetDATE() as time "; + + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript)); + + if (dataSet.Tables.Count > 0) + { + string datetimestr = dataSet.Tables[0].Rows[0]["time"].ToString() ; + return DateTime.Parse(datetimestr); + } + + return DateTime.Now; + } + catch (Exception ex) + { + throw ex; + } + } + + public static DataTable GetBora3MCodes(string pMaterialCode) + { + DataTable table = null; + List list = new List(); + string sqlScript = $" select * from T_BD_Bora3Materials where Bora3MCode ='{pMaterialCode}'"; + DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript); + if (dataSet.Tables.Count > 0) + { + table = dataSet.Tables[0]; + //foreach (DataRow dataRow in table.Rows) + //{ + // string pbom = dataRow["Bora3MCode"].ToString(); + // if (!list.Contains(pbom) && !string.IsNullOrEmpty(pbom)) + // { + // list.Add(pbom); + // } + //} + } + return table; + } + public static bool UpdateProductMaterialCode(string productCode, string mCode, string bora3MCode) + { + bool returnVal = false; + + string sqlScriptTemp = @"Update T_AW_Product Set MATERIAL_CODE = '{0}' Where PRODUCTCODE = '{1}' "; + + + string sqlScript = + string.Format(sqlScriptTemp, mCode, productCode); + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + return returnVal; + } + #endregion + + #region 修改产品信息 + /// + /// 修改产品信息 + /// + /// 产品信息实例 + /// 成功 True 否则 False + public static bool Update(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + string sqlScriptTemp = +@" +Update T_AW_Product Set PLAN_NO = '{0}' Where PID = '{1}' +"; + + + string sqlScript = + string.Format(sqlScriptTemp,eProduct.PLAN_NO,eProduct.PID + ); + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + return returnVal; + } + #endregion + + #region 修改产品信息 + /// + /// 修改产品信息 + /// + /// 产品信息实例 + /// 成功 True 否则 False + public static bool Modify(T_AW_PRODUCT eProduct) + { + bool returnVal = false; + + string sqlScriptTemp = +@" +Update T_AW_Product Set WORKCELL_CODE = '{0}',WORKLOC_CODE = '{1}',WORKCENTER_CODE='{2}',MATERIAL_TYPE='{3}' Where PID = '{4}' +"; + + + string sqlScript = + string.Format(sqlScriptTemp, eProduct.WORKCELL_CODE,eProduct.WORKLOC_CODE,eProduct.WORKCENTER_CODE, eProduct.MATERIAL_TYPE,eProduct.PID + ); + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/ProductMaxCodeDAL.cs b/QMAPP.BoraUpgrade.DAL/ProductMaxCodeDAL.cs new file mode 100644 index 0000000..80e0ded --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/ProductMaxCodeDAL.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; +using QMAPP.BoraUpgrade.Entity; + + +namespace QMAPP.BoraUpgrade.DAL +{ + public class ProductMaxCodeDAL + { + #region 根据工单ID提取物料列表 + /// + /// 根据工单ID提取物料列表 + /// + /// + public static int GetProductMaxCode(string MATERIAL_TYPE_CODE, string GenerateDate, string ProductType) + { + int returnVal = 1; + + string sqlScript = +@" +SELECT ISNULL(MAX(RIGHT(PRODUCTCODE,6)),0) +FROM T_AW_PRODUCT WHERE MATERIAL_TYPE='{0}' +AND DATEDIFF(day,CREATEDATE,'{1}')=0 +AND PRODUCTCODE LIKE '{2}%'; +"; + + sqlScript = string.Format(sqlScript, MATERIAL_TYPE_CODE,GenerateDate, ProductType); + + string result = + SqlHelper.ExecuteScalar(Config.maindbConnectionString, CommandType.Text, sqlScript).ToString(); + + + int.TryParse(result, out returnVal); + + return returnVal+1; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/Properties/AssemblyInfo.cs b/QMAPP.BoraUpgrade.DAL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..421c72a --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("QMAPP.BoraUpgrade.DAL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QMAPP.BoraUpgrade.DAL")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("9cffeca1-5f19-47f8-8e26-bf8c0363801c")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/QMAPP.BoraUpgrade.DAL/QMAPP.BoraUpgrade.DAL.csproj b/QMAPP.BoraUpgrade.DAL/QMAPP.BoraUpgrade.DAL.csproj new file mode 100644 index 0000000..aebd7f0 --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/QMAPP.BoraUpgrade.DAL.csproj @@ -0,0 +1,78 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6} + Library + Properties + QMAPP.BoraUpgrade.DAL + QMAPP.BoraUpgrade.DAL + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + {17123cdd-0ba7-496f-8e4e-fcbabe0463ca} + QMAPP.FJC.Entity + + + {604fb24f-7706-497c-bec7-27d7b6b5a82c} + QMAPP.Entity + + + {2DEB0026-EF98-4E33-A132-2F46B5E646FE} + QMAPP.BoraUpgrade.Common + + + {0C8B7A06-ED56-4198-9386-B8EA1D176571} + QMAPP.BoraUpgrade.Entity + + + + + \ No newline at end of file diff --git a/QMAPP.BoraUpgrade.DAL/VirtualMaterialDAL.cs b/QMAPP.BoraUpgrade.DAL/VirtualMaterialDAL.cs new file mode 100644 index 0000000..796e4b4 --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/VirtualMaterialDAL.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; +using QMAPP.BoraUpgrade.Entity; + + +namespace QMAPP.BoraUpgrade.DAL +{ + public class VirtualMaterialDAL + { + #region 根据工单ID提取物料列表 + /// + /// 根据工单ID提取物料列表 + /// + /// + public static DataTable GetVirtualMaterialByWorkCellCode(string workCellCode) + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@" +Select * From T_QD_VirtualMaterial Where WorkCellCode = '{0}' +"; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, workCellCode)); + + if (dataSet.Tables.Count > 0) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/WorkCellDAL.cs b/QMAPP.BoraUpgrade.DAL/WorkCellDAL.cs new file mode 100644 index 0000000..8246201 --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/WorkCellDAL.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; +using QMAPP.BoraUpgrade.Entity; + +namespace QMAPP.BoraUpgrade.DAL +{ + public class WorkCellDAL + { + #region 根据当前工位码提取前序工位处理码 + /// + /// 根据当前工位码提取前序工位处理码 + /// + /// + public static string GetPreWorkCellProccessCode(string currWorkCellCode, int _Count, int OutTime, string metairal_type) + { + string returnVal = string.Empty; + + string sqlScript = + @" + select top {0} A.PRODUCTCODE as PRODUCTCODE from T_AW_MAINOPERATION A left join (Select PRODUCTCODE From T_AW_Product + Where WORKLOC_CODE = '{2}' And Material_Type = '{3}' And UPDATEDATE > DATEADD(hh,-{1},GETDATE() )) B ON A.PRODUCTCODE = B.PRODUCTCODE + WHERE A.UPDATEDATE > DATEADD(hh,-{1},GETDATE() ) + And A.WorkCell_Code In + ( + Select Pre_WorkCell_Code From [dbo].T_MD_PROCESS_ROUTE_WORKCELL_SEQ Where FLGDEL = 0 And WorkCell_Code = '{2}' + ) + and B.PRODUCTCODE IS NULL + Order By A.OperatedDate Desc + "; + + string aa = string.Format(sqlScript, _Count, OutTime, currWorkCellCode, metairal_type); + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, _Count, OutTime, currWorkCellCode, metairal_type)); + + if (dataSet.Tables[0].Rows.Count > 0) + { + returnVal = dataSet.Tables[0].Rows[dataSet.Tables[0].Rows.Count - 1][0].ToString(); + } + + + return returnVal; + } + #endregion + } +} diff --git a/QMAPP.BoraUpgrade.DAL/WorkOrderDAL.cs b/QMAPP.BoraUpgrade.DAL/WorkOrderDAL.cs new file mode 100644 index 0000000..d152bac --- /dev/null +++ b/QMAPP.BoraUpgrade.DAL/WorkOrderDAL.cs @@ -0,0 +1,979 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Ref: +using System.Data; + +using QMAPP.BoraUpgrade.Common; +using QMAPP.BoraUpgrade.Entity; +using QMAPP.FJC.Entity.Operation; +using QMAPP.FJC.Entity.Basic; + +namespace QMAPP.BoraUpgrade.DAL +{ + public class WorkOrderDAL + { + #region 根据工单ID提取物料列表 + /// + /// 根据工单ID提取物料列表 + /// + /// + public static DataTable GetMaterialByWorkOrderID(string workOrderID, string material_Type) + { + DataTable returnVal = new DataTable(); + + string sqlScript = +@" +Select * From T_MD_MATERIAL Where Material_Code In +( + Select Material_Code From T_MD_PBOM_ITEM Where PBOM_CODE IN + ( + Select PBOM_Code From dbo.T_PP_WORKORDER Where PID = '{0}' + + ) And FLGDEl = 0 +) +And FLGDEl = 0 +And Material_Type_Code Like '{1}%' +"; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, workOrderID, material_Type)); + + if (dataSet.Tables.Count > 0) + { + returnVal = dataSet.Tables[0]; + } + + return returnVal; + } + #endregion + + static string GetOldFisOrderSql(string WORKCENTER_CODE, int pState, int pQty) + { + StringBuilder strSql = new StringBuilder(); + //List parameters = new List(); + strSql.Append(" SELECT TOP " + pQty); + strSql.Append(" T1.ORDER_NO,T1.BZDCode, T1.PID,T1.VWSEQ,T1.PRODNO,T1.CARSETDESC_CN, T1.CP5A,T1.[LINENO], "); + strSql.Append("T1.KIN,T1.VIN,T1.SCANSTATE, T2.WORKCENTER_CODE "); + strSql.Append(" FROM dbo.V_PP_FISORDER T1 "); + strSql.Append(" INNER JOIN dbo.V_PP_FISORDERSENDDETAIL T2 "); + strSql.Append(" on T1.PID=T2.FIS_PID "); + strSql.Append(" WHERE T1.scanstate=0 "); + //strSql.Append(" and LEFT(T1.VWSEQ,2)='" + pFistype + "' AND T1.flagdel=0 "); + strSql.Append(" AND T1.flagdel=0 "); + strSql.Append($" AND T1.State={pState} "); + if (!string.IsNullOrEmpty(WORKCENTER_CODE)) + { + strSql.Append(" and T2.WORKCENTER_CODE='" + WORKCENTER_CODE + "'"); + } + strSql.Append(" ORDER BY T1.CP5A ASC,T1.VWSEQ ASC,T1.PRODNO ASC "); + + return strSql.ToString(); + } + static string GetNewFisOrderSql(string WORKCENTER_CODE, int pState, int pQty) + { + //string fisSendState = ""; + //if(pState ==10) + //{ + // fisSendState = "AND T1.SendState=0 "; + //} + //else if (pState == 11) + //{ + // fisSendState = "AND T1.SendState=9 "; + //} + //else if (pState == 12) + //{ + // fisSendState = "AND ( T1.SendState=0 or T1.SendState=9 ) "; + //} + //else + //{ + // fisSendState = $"AND T1.SendState={pState} "; + //} + //StringBuilder strSql = new StringBuilder(); + ////List parameters = new List(); + //strSql.Append(" SELECT TOP " + pQty); + //strSql.Append(" T1.ORDER_NO,T1.BZDCode, T1.PID,T1.VWSEQ,T1.PRODNO,T1.CARSETDESC_CN, T1.CP5A,T1.[LINENO], T1.[SendState], "); + //strSql.Append("T1.KIN,T1.VIN,T1.SCANSTATE ,T1.WORKCENTER_CODE "); + //strSql.Append(" FROM dbo.V_PP_FISORDER_ZDQ T1 "); + //strSql.Append(" WHERE 1=1 "); + ////strSql.Append(" and LEFT(T1.VWSEQ,2)='" + pFistype + "' AND T1.flagdel=0 "); + //strSql.Append(" AND T1.flagdel=0 "); + ////strSql.Append($" AND T1.SendState={pState} "); //T1.State是发运状态. T1.SendState是T_AW_FisSendState表的状态 //and T1.CP5A > '202008150108' and T1.order_no is not null + //strSql.Append(fisSendState); + //if (!string.IsNullOrEmpty(WORKCENTER_CODE)) + //{ + // strSql.Append(" and T1.WORKCENTER_CODE='" + WORKCENTER_CODE + "'"); + //} + //strSql.Append(" ORDER BY T1.CP5A ASC,T1.VWSEQ ASC,T1.PRODNO ASC "); + //strSql.Append(" WHERE T1.scanstate=0 "); + + StringBuilder strSql = new StringBuilder(); + strSql.Append("SELECT TOP " + pQty); + strSql.Append(" W.[PID] "); + strSql.Append(" ,W.[ORDERPLANID] "); + strSql.Append(" ,W.[ORDERPLAN_NO] "); + strSql.Append(" ,W.[ORDER_TYPE] "); + strSql.Append(" ,W.[SEQ] "); + strSql.Append(" ,W.[MATERIAL_CODE] "); + strSql.Append(" ,M.[MATERIAL_NAME] "); + strSql.Append(" ,W.[PBOM_CODE] "); + strSql.Append(" ,W.[QTY] "); + strSql.Append(" ,W.[COMPLETE_QTY] "); + strSql.Append(" ,W.[PLAN_DATE] "); + strSql.Append(" ,W.[SHIFT_CODE] "); + strSql.Append(" ,W.[WORKCENTER_CODE] "); + strSql.Append(" ,W.[WORKCENTER_NAME] "); + strSql.Append(" ,W.[WORKCELL_CODE] "); + strSql.Append(" ,W.[WORKCELL_NAME] "); + strSql.Append(" ,W.[WORKLOC_CODE] "); + strSql.Append(" ,W.[REMARK] "); + strSql.Append(" ,W.[EQPT_NAME] "); + strSql.Append(" ,W.[EQPT_CODE] "); + strSql.Append(" ,W.[STATE] "); + strSql.Append(" ,W.[MOULD_CODE] "); + strSql.Append(" ,W.[PRI] "); + strSql.Append(" ,W.[UPDATEDATE] "); + strSql.Append(" ,P.[IGNORE_FISBREAK] "); + strSql.Append(" ,P.[FIS_ASMSETCODE] "); + strSql.Append(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); + strSql.Append(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + strSql.Append(" ON P.[PID]=W.[ORDERPLANID] "); + strSql.Append(" LEFT JOIN [T_MD_MATERIAL] AS M WITH(NOLOCK)"); + strSql.Append(" ON W.[MATERIAL_CODE] = M.[MATERIAL_CODE] "); + strSql.Append(" WHERE W.[WORKCELL_CODE] = '" + WORKCENTER_CODE + "'"); + switch (pState) + { + case 1: + { + strSql.Append(" AND W.[STATE]<>4 "); + break; + } + case 2: + { + strSql.Append(" AND W.[STATE]=4 "); + break; + } + } + strSql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); + + + + return strSql.ToString(); + } + /// + /// 查询fis订单 + /// + /// 0:未处理 1:已打印BZD 2:已器具排序 + /// + public static DataTable GetFisOrders( string WORKCENTER_CODE, int pState,int pQty) + { + #region + + try + { + DataTable returnDt = null; + string sqlStr = GetNewFisOrderSql(WORKCENTER_CODE, pState, pQty); + //using (IDataSession session = AppDataFactory.CreateMainSession()) + //{ + // returnDt = session.GetTable(strSql.ToString(), parameters.ToArray()); + //} + DataSet ds = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlStr); + returnDt = ds.Tables[0]; + + //逻辑说明 + //FIS要货计划都有大众上线时间CP5A:201611011001表示2016年11月1号10点01分上线 + //FIS要货计划都有一个大众顺序号VWSEQ: 018029或是029382,前两位01和02表示东厂和西厂,没有锦衣卫 + //后面四位表示实际顺序号,所以9999台一轮回, + //实际出现的情况有可能出现同一个分钟上线的大众顺序号可能有两个 + //如果出现019999和010001,实际的顺序是019999在前,010001在后,即上一个轮回的最后一条和下一个轮回的第一条 + //如果这样前面的查询语句中就会把010001排在019999前面 + //所以要处理这种情况。 + + //实现方式就是获取数据后,放到两个表中,这两个表相同,遍历第一个表,用记录和后一条记录比较, + //如果大众上线时间相同并且两个顺序号的差值在1000以上,一定是顺序出差, + //差值1000是个估计值,9999与1差值是9998,我们之前1000 + //修改第二个表中的对应的数据 + //极端情况出现一个大众上线时间对一个三个大众顺序号, + //这里一并处理 + //if (returnDt.Rows.Count > 1) + //{ + + // //必须进行第一次循环 + // bool flag = true; + + // while (flag) + // { + // //复制表 + // DataTable dt = returnDt.Copy(); + + // //是否进行了值的交换标记 + // bool isChange = false; + + // for (int i = 0; i < dt.Rows.Count; i++) + // { + + // if (i == dt.Rows.Count - 1) + // continue; + + // //获取当前行对象 + // DataRow dr = dt.Rows[i]; + // string cp5aDr = dr["CP5A"].ToString(); + // int seqDr = Convert.ToInt32(dr["VWSEQ"].ToString().Substring(2)); + + // //获取下一行对象 + // DataRow nextDr = dt.Rows[i + 1]; + // string nextCp5a = nextDr["CP5A"].ToString(); + // int nextSeq = Convert.ToInt32(nextDr["VWSEQ"].ToString().Substring(2)); + + // //如果两行记录的大众上线时间不相同 + // //不需要比较 + // if (cp5aDr != nextCp5a) + // continue; + + // //如果大众上线时间相同并且前后值大于1000, + // //我们默认是 + // if (nextSeq - seqDr > 1000) + // { + // returnDt.Rows[i]["PID"] = nextDr["PID"].ToString(); + // returnDt.Rows[i]["VWSEQ"] = nextDr["VWSEQ"].ToString(); + // returnDt.Rows[i]["PRODNO"] = nextDr["PRODNO"].ToString(); + // returnDt.Rows[i]["CARSETDESC_CN"] = nextDr["CARSETDESC_CN"].ToString(); + // returnDt.Rows[i]["CP5A"] = nextDr["CP5A"].ToString(); + // returnDt.Rows[i]["LINENO"] = nextDr["LINENO"].ToString(); + // returnDt.Rows[i]["KIN"] = nextDr["KIN"].ToString(); + // returnDt.Rows[i]["VIN"] = nextDr["VIN"].ToString(); + // returnDt.Rows[i]["SCANSTATE"] = nextDr["SCANSTATE"].ToString(); + + // returnDt.Rows[i + 1]["PID"] = dr["PID"].ToString(); + // returnDt.Rows[i + 1]["VWSEQ"] = dr["VWSEQ"].ToString(); + // returnDt.Rows[i + 1]["PRODNO"] = dr["PRODNO"].ToString(); + // returnDt.Rows[i + 1]["CARSETDESC_CN"] = dr["CARSETDESC_CN"].ToString(); + // returnDt.Rows[i + 1]["CP5A"] = dr["CP5A"].ToString(); + // returnDt.Rows[i + 1]["LINENO"] = dr["LINENO"].ToString(); + // returnDt.Rows[i + 1]["KIN"] = dr["KIN"].ToString(); + // returnDt.Rows[i + 1]["VIN"] = dr["VIN"].ToString(); + // returnDt.Rows[i + 1]["SCANSTATE"] = dr["SCANSTATE"].ToString(); + + // //设置值的交换标记值为true + // isChange = true; + + // } + + // } + + // //将是否 交换标记值付给外层标记值 + // //如果未进行交换,跳出while循环 + // //如果进行了交换就得再次循环,放在一个大众上线时间对应两个以上大众顺序号的情况 + // flag = isChange; + // } + //} + return returnDt; + + } + catch (System.Exception ex) + { + throw ex; + } + #endregion + } + + //public static DataTable GetFisOrder(int state) + //{ + // DataTable returnVal = new DataTable(); + // string sqlScript = $" select * from V_PP_FISORDER where State = {state}"; + // DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.maindbConnectionString, CommandType.Text, sqlScript); + // if (dataSet.Tables.Count > 0) + // { + // returnVal = dataSet.Tables[0]; + // } + + // return returnVal; + //} + + /// + /// 更改状态 + /// + /// + /// + /// + public static bool UpdateFisOrderState(string pOrderNo,string pBzdCode, int state) + { + string sqlScript = $" select * from T_AW_FisSendState where FisOrderNo = '{pOrderNo}'"; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable dataTable = dataSet.Tables[0]; + string saveSql = string.Empty; + if(dataTable.Rows.Count >0) + { + saveSql = $" update T_AW_FisSendState set State = {state},BZDCode ='{pBzdCode}' where FisOrderNo= '{pOrderNo}'"; + } + else + { + saveSql = $" insert into T_AW_FisSendState(FisOrderNo,State,BZDCode) values('{pOrderNo}',{state},'{pBzdCode}')"; + } + + bool returnVal = false; + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, saveSql); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception ex) + { + //后续加入日志 + throw; + } + + return returnVal; + } + + public static bool SaveSacnOrderRecord(DataRow dataRow) + { + string sqlScript = $" insert into T_AW_FinalSortRecord(BZDCode,ProductCode,[Desc],OrderNo,[LINENO]) " + + $" values('{dataRow["BZDCode"].ToString()}','{dataRow["ProductCode"].ToString()}','{dataRow["Desc"].ToString()}','{dataRow["OrderNo"].ToString()}','{dataRow["LINENO"].ToString()}') "; + + bool returnVal = false; + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + return returnVal; + + + } + public static string GetA3MaterialCodeByBZD(string bzdCode) + { + //productCode = "052 998A4K501H %"; + string pCode = bzdCode.Replace(" ", ""); + string first = pCode.Substring(0, 3); + string companyCode = pCode.Substring(3, 3); + string vt = pCode.Substring(6, 1); + string cc = pCode.Substring(7, 1); + + string sqlScript = $" select * from T_BD_BZDConfig where barcodeFist ='{first}' and Company_code='{companyCode}' and Vehicle_type='{vt}' and configColor='{cc}' "; + //DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.a3dbConnectionString, CommandType.Text, sqlScript); + //DataTable dataTable = dataSet.Tables[0]; + + DataTable dataTable = GetDataTable(sqlScript, Config.bzdConnectionString); + if (dataTable.Rows.Count==0) + { + throw new Exception($"BZD条码{bzdCode}在表T_BD_BZDConfig中没找到物料号"); + } + else if (dataTable.Rows.Count >1) + { + throw new Exception($"BZD条码{bzdCode}在表T_BD_BZDConfig中配置了多个物料号,目标不明确,请检查配置!"); + } + else + { + return dataTable.Rows[0]["MATERIALCODDE"].ToString(); + } + } + + public static string GetA3MaterialCodeByPID(string mpid) + { + //productCode = "052 998A4K501H %"; + //string pCode = bzdCode.Replace(" ", ""); + //string first = pCode.Substring(0, 3); + //string companyCode = pCode.Substring(3, 3); + //string vt = pCode.Substring(6, 1); + //string cc = pCode.Substring(7, 1); + + string sqlScript = $" select * from T_BD_BZDConfig where pid ='{mpid}' "; + //DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.a3dbConnectionString, CommandType.Text, sqlScript); + //DataTable dataTable = dataSet.Tables[0]; + + DataTable dataTable = GetDataTable(sqlScript, Config.bzdConnectionString); + if (dataTable.Rows.Count == 0) + { + throw new Exception($"mpid条码{mpid}在表T_BD_BZDConfig中没找到物料号"); + } + else if (dataTable.Rows.Count > 1) + { + throw new Exception($"mpid条码{mpid}在表T_BD_BZDConfig中配置了多个物料号,目标不明确,请检查配置!"); + } + else + { + return dataTable.Rows[0]["MATERIALCODDE"].ToString(); + } + } + + public static bool IsNoUsedBzdCode(string pBzdCode) + { + string sqlScript = $" select * from T_AW_FisSendState where BZDCode ='{pBzdCode}' "; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + + DataTable dataTable = dataSet.Tables[0]; + if(dataTable.Rows.Count>0) + { + throw new Exception($"BZD条码{pBzdCode}已被使用,请重试!"); + } + else + { + return true; + } + } + + public static DataTable GetMainInfo(string productCode) + { + string sqlScript = $"select * from T_AW_MAIN where EPIDERMISCODE='{productCode}'"; + + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + + DataTable dataTable = dataSet.Tables[0]; + return dataTable; + + } + + /// + /// 根据产品号查询物料号 + /// 查询product表最新一条记录的物料号,然后联合bom查询总成零件号 + /// + /// + /// + public static string GetPMaterialCode(string productCode) + { + string sqlScript = $" select Top 1 MATERIAL_CODE FROM [dbo].[T_AW_PRODUCT] where PRODUCTCODE='{productCode}' order by CREATEDATE desc "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable dataTable = dataSet.Tables[0]; + if(dataTable.Rows.Count >0) + { + string materialCode = dataTable.Rows[0]["MATERIAL_CODE"].ToString(); + + string mainSql = $" select a.MATERIAL_CODE from [T_MD_PBOM] a,[T_MD_PBOM_ITEM] b where a.PBOM_CODE = b.PBOM_CODE and b.MATERIAL_CODE = '{materialCode}'"; + DataSet mainSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, mainSql); + DataTable mainTable = mainSet.Tables[0]; + if(mainTable.Rows.Count == 0) + { + throw new Exception($"T_MD_PBOM_ITEM中没有查询到物料号{materialCode}的配置信息"); + } + else if (mainTable.Rows.Count > 1) + { + throw new Exception($"物料号{materialCode} 在T_MD_PBOM_ITEM表中配置了多条记录,无法确定唯一产品零件号"); + } + else + { + return mainTable.Rows[0]["MATERIAL_CODE"].ToString(); + } + } + else + { + throw new Exception($"T_AW_PRODUCT表中没有查询到条码{productCode}产生的加工记录信息"); + } + + } + public static bool IsBarCodeRepet(string productCode) + { + string sqlScript = $" select * FROM [dbo].[T_AW_MAIN] where EPIDERMISCODE='{productCode}' "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable mainTable = dataSet.Tables[0]; + if (mainTable.Rows.Count == 0) + { + return false; + } + else + { + //planCode = mainTable.Rows[0]["PLAN_NO"].ToString(); + return true; + } + } + public static bool VerifyLastCellOver(string productCode, string lastCellCode) + { + string sqlScript = $" select * FROM [dbo].[T_AW_MAINOPERATION] where PRODUCTCODE='{productCode}' AND WORKCELL_CODE='{lastCellCode}' "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable mainTable = dataSet.Tables[0]; + if(mainTable.Rows.Count == 0) + { + return false; + } + else + { + //planCode = mainTable.Rows[0]["PLAN_NO"].ToString(); + return true; + } + } + /// + /// 根据条码查询计划编号 + /// + /// + /// + public static string GetPlanCode(string productCode) + { + string sqlScript = $" select top 1 PLAN_NO FROM [dbo].[T_AW_PRODUCT] where PRODUCTCODE='{productCode}' AND PLAN_NO is not null "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable mainTable = dataSet.Tables[0]; + + if (mainTable.Rows.Count == 0) + { + return null; + } + else + { + return mainTable.Rows[0]["PLAN_NO"].ToString(); + } + + } + + /// + /// 根据条码查询计划编号 + /// + /// + /// + public static string GetBoraBZDCode(string productCode,string materialCode) + { + string sqlScript = $" SELECT MAINCODE FROM [dbo].[T_AW_MAIN] WHERE EPIDERMISCODE = '{productCode}' AND MATERIAL_CODE = '{materialCode}' "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable mainTable = dataSet.Tables[0]; + + if (mainTable.Rows.Count == 0) + { + return null; + } + else + { + return mainTable.Rows[0]["MAINCODE"].ToString(); + } + + } + /// + /// 根据BZD条码,在BZD库里面查询生产本体条码 + /// + /// + /// + public static string GetA3ProductCodeByBzd(string bzdCode) + { + string sqlScript = $"select ProductCode from T_BD_BZDRecorder where BZDCODE='{bzdCode}'"; + //DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.bzdConnectionString, CommandType.Text, sqlScript); + //DataTable mainTable = dataSet.Tables[0]; + DataTable mainTable = GetDataTable(sqlScript, Config.bzdConnectionString); + if (mainTable.Rows.Count == 0) + { + return null; + } + else + { + return mainTable.Rows[0]["ProductCode"].ToString(); + } + } + + /// + /// 根据BZD条码,在BZD库里面查询生产时间 + /// + /// + /// + public static string GetA3ProductCreateByBzd(string bzdCode) + { + string sqlScript = $"select CREATEDATE from T_BD_BZDRecorder where BZDCODE='{bzdCode}'"; + //DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.bzdConnectionString, CommandType.Text, sqlScript); + //DataTable mainTable = dataSet.Tables[0]; + DataTable mainTable = GetDataTable(sqlScript, Config.bzdConnectionString); + if (mainTable.Rows.Count == 0) + { + return null; + } + else + { + return mainTable.Rows[0]["CREATEDATE"].ToString(); + } + } + + /// + /// 根据BZD条码,在BZD库里面查询生产本体条码 + /// + /// + /// + public static string GetA3MpidCodeByBzd(string bzdCode) + { + string sqlScript = $"select MPID from T_BD_BZDRecorder where BZDCODE='{bzdCode}'"; + //DataSet dataSet = SqlHelper.ExecuteDataset( + // Config.bzdConnectionString, CommandType.Text, sqlScript); + //DataTable mainTable = dataSet.Tables[0]; + DataTable mainTable = GetDataTable(sqlScript, Config.bzdConnectionString); + if (mainTable.Rows.Count == 0) + { + return null; + } + else + { + return mainTable.Rows[0]["Mpid"].ToString(); + } + } + + private static DataTable GetDataTable(string sql,string connStr) + { + DataSet dataSet = SqlHelper.ExecuteDataset( + connStr, CommandType.Text, sql); + DataTable mainTable = dataSet.Tables[0]; + return mainTable; + } + + public static List GetShiftList() + { + List list = new List(); + string sqlScript = "SELECT M.PID ,M.PRODUCESHIFTNAME,M.PRODUCESHIFTTCODE,M.PSSTART,M.PSEND,M.PRODUCELINE,M.MEMO,M.CREATEUSER,M.CREATEDATE,M.UPDATEUSER,M.UPDATEDATE,C.USERNAME AS CREATEUSERNAME,U.USERNAME AS UPDATEUSERNAMEFROM FROM T_BD_PRODUCESHIFT M LEFT JOIN T_QM_USER C ON C.USERID=M.CREATEUSER LEFT JOIN T_QM_USER U ON U.USERID=M.UPDATEUSER "; + DataSet dataSet = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, sqlScript); + DataTable mainTable = dataSet.Tables[0]; + foreach(DataRow dataRow in mainTable.Rows) + { + ProduceShift sf = new ProduceShift(); + sf.PRODUCESHIFTNAME = dataRow["PRODUCESHIFTNAME"].ToString(); + sf.PRODUCESHIFTTCODE = dataRow["PRODUCESHIFTTCODE"].ToString(); + sf.PSSTART = string.IsNullOrEmpty( dataRow["PSSTART"].ToString()) ? DateTime.MinValue : DateTime.Parse(dataRow["PSSTART"].ToString()); + sf.PSEND = string.IsNullOrEmpty(dataRow["PSEND"].ToString()) ? DateTime.MinValue : DateTime.Parse(dataRow["PSEND"].ToString()); + sf.PRODUCELINE = dataRow["PRODUCELINE"].ToString(); + list.Add(sf); + } + return list; + + } + /// + /// 订单挂起 + /// + /// + /// + public static bool UpdateFisSetState(DataRow dataRow) + { + string searchsql = $" select * from T_AW_FisSendState where FisOrderNo='{dataRow["ORDER_NO"]}'"; + DataTable dataTable = SqlHelper.ExecuteDataset( + Config.maindbConnectionString, CommandType.Text, searchsql).Tables[0]; + string insertSql = string.Empty; + if(dataTable.Rows.Count >0) + { + insertSql = $"Update T_AW_FisSendState set State = 9 where ID ={dataTable.Rows[0]["ID"]}"; + } + else + { + insertSql = $"insert into T_AW_FisSendState(FisOrderNo,State,BZDCode,Remark) values ('{dataRow["ORDER_NO"]}',9,'','挂起状态')"; + } + bool returnVal = false; + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, insertSql); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception) + { + //后续加入日志 + throw; + } + + return returnVal; + + } + + public static DataTable GetStoreData(int count=100) + { + //string sql = $"select top {count} * from T_AW_MAIN where PRODUCELINE='A3IPASSY_STORE' order by CREATEDATE desc"; + string sql = $@"select top {count} a.* ,b.MATERIAL_NAME FROM [T_AW_MAIN] a + left join T_MD_MATERIAL b on a.MATERIAL_CODE = b.MATERIAL_CODE + where PRODUCELINE = 'A3IPASSY_STORE' order by CREATEDATE desc"; + + DataTable dataTable = GetDataTable(sql, Config.a3dbConnectionString); + return dataTable; + } + + public static void SaveA3MainRecord(string[] basicData, string bzdCode,string productionCode, string userID,string materialCode,string lineCode) + { + string searchSql = $" select * from T_AW_MAIN where MAINCODE='{bzdCode}'"; + DataTable dataTable = GetDataTable(searchSql,Config.a3dbConnectionString); + if(dataTable.Rows.Count == 0) + { + DataTable materialInitTable = GetMaterialCodeInit(materialCode); + //string produceLine = ""; + string workCellCode = ""; + string workLocCode = ""; + string workCenterCode = ""; + string materialType = ""; + + if (materialInitTable.Rows.Count>0) + { + //produceLine = materialInitTable.Rows[0]["WORKCENTER_CODE_INIT"].ToString(); + + workCellCode = materialInitTable.Rows[0]["WORKCELL_CODE"].ToString(); + workLocCode = materialInitTable.Rows[0]["WORKLOC_CODE"].ToString(); + workCenterCode = materialInitTable.Rows[0]["WORKCENTER_CODE"].ToString(); + materialType = materialInitTable.Rows[0]["MATERIAL_TYPE"].ToString(); + } + + string insertSql = $@"insert into T_AW_MAIN(PID,MAINCODE,EPIDERMISCODE,MACHINECODDE,PROCESSSTATE,STATUS,CURRENTPROCESS,COMPLETEFLAG, + PRODUCELINE,OUTFLAG,COMPLETETIME,CREATEUSER,CREATEDATE,UPDATEUSER,UPDATEDATE,WORKCELL_CODE,WORKLOC_CODE,WORKCENTER_CODE,MATERIAL_TYPE,MATERIAL_CODE) values + ( '{Guid.NewGuid()}','{bzdCode}','{productionCode}','{basicData[0]}','1','0','15','1','{lineCode}','0','{DateTime.Now}','{userID}','{DateTime.Now}','{userID}','{DateTime.Now}', + '{workCellCode}','{workLocCode}','{workCenterCode}','{materialType}','{materialCode}')"; + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.a3dbConnectionString, CommandType.Text, insertSql); + + } + catch (Exception) + { + //后续加入日志 + throw; + } + } + //20210111 DQZhang T_AW_MAIN表已被触发器插入的记录补充字段内容 + else if (dataTable.Rows.Count == 1) + { + DataTable materialInitTable = GetMaterialCodeInit(materialCode); + //string produceLine = ""; + string workCellCode = ""; + string workLocCode = ""; + string workCenterCode = ""; + string materialType = ""; + + if (materialInitTable.Rows.Count > 0) + { + //produceLine = materialInitTable.Rows[0]["WORKCENTER_CODE_INIT"].ToString(); + + workCellCode = materialInitTable.Rows[0]["WORKCELL_CODE"].ToString(); + workLocCode = materialInitTable.Rows[0]["WORKLOC_CODE"].ToString(); + workCenterCode = materialInitTable.Rows[0]["WORKCENTER_CODE"].ToString(); + materialType = materialInitTable.Rows[0]["MATERIAL_TYPE"].ToString(); + } + + string insertSql = $@"UPDATE T_AW_MAIN SET MACHINECODDE='{basicData[0]}',PROCESSSTATE='1',STATUS='0',CURRENTPROCESS='15',COMPLETEFLAG='1', + PRODUCELINE='{lineCode}',OUTFLAG='0',COMPLETETIME='{DateTime.Now}',UPDATEUSER='{userID}',UPDATEDATE='{DateTime.Now}', + WORKCELL_CODE='{workCellCode}',WORKCENTER_CODE='{workCenterCode}',MATERIAL_TYPE='{materialType}' WHERE MAINCODE ='{bzdCode}' "; + + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.a3dbConnectionString, CommandType.Text, insertSql); + + } + catch (Exception) + { + //后续加入日志 + throw; + } + } + + + } + + public static DataTable GetMaterialCodeInit(string materialCode) + { + string sql = $"select b.* FROM T_MD_MATERIAL a,T_BD_MATERIALCODEINIT b where a.MATERIAL_CODE = b.MATERIAL_CODE and a.MATERIAL_TYPE_CODE = b.MATERIAL_TYPE and a.MATERIAL_CODE = '{materialCode}'"; + DataTable dataTable = GetDataTable(sql, Config.a3dbConnectionString); + return dataTable; + } + + /// + /// 查询每天早8:30到第二天8:30的产量 + /// + /// + public static string GetDayYield() + { + + string sql = $@" declare + @tt varchar(20) = format(GetDate(), 'HH:mm') + + if @tt > '08:30' + select count(0) as c from T_AW_MAIN where CREATEDATE > format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(dateadd(day, 1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + else + select count(0) as c from T_AW_MAIN where CREATEDATE > format(dateadd(day, -1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000'"; + DataTable dataTable = GetDataTable(sql, Config.a3dbConnectionString); + + + return dataTable.Rows[0]["c"].ToString(); + } + /// + /// 并线发运 A3每天产量 + /// + /// + public static string GetA3DayYield() + { + + string sql = $@" declare + @tt varchar(20) = format(GetDate(), 'HH:mm') + + if @tt > '08:30' + select count(0) as c from T_AW_MAIN where CREATEDATE > format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(dateadd(day, 1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + else + select count(0) as c from T_AW_MAIN where CREATEDATE > format(dateadd(day, -1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000'"; + DataTable dataTable = GetDataTable(sql, Config.a3dbConnectionString); + + + return dataTable.Rows[0]["c"].ToString(); + } + + /// + /// 并线发运 Bora高配每天产量 + /// + /// + public static string GetBoraHDayYield() + { + + string sql = $@" declare + @tt varchar(20) = format(GetDate(), 'HH:mm') + + if @tt > '08:30' + select count(0) as c from (select a.* ,b.MATERIAL_NAME FROM T_AW_MAIN a left join T_MD_MATERIAL b on a.MATERIAL_CODE = b.MATERIAL_CODE where MATERIAL_NAME like '%豪华%' or MATERIAL_NAME like '%高配%' ) a +where CREATEDATE > format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(dateadd(day, 1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + else + select count(0) as c from (select a.* ,b.MATERIAL_NAME FROM T_AW_MAIN a left join T_MD_MATERIAL b on a.MATERIAL_CODE = b.MATERIAL_CODE where MATERIAL_NAME like '%豪华%' or MATERIAL_NAME like '%高配%' ) a +where CREATEDATE > format(dateadd(day, -1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + and CREATEDATE < format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000'"; + DataTable dataTable = GetDataTable(sql, Config.maindbConnectionString); + + + return dataTable.Rows[0]["c"].ToString(); + } + + /// + /// 并线发运 Bora低配每天产量 + /// + /// + public static string GetBoraLDayYield() + { + + string sql = $@" declare + @tt varchar(20) = format(GetDate(), 'HH:mm') + + if @tt > '08:30' + select count(0) as c from (select a.* ,b.MATERIAL_NAME FROM T_AW_MAIN a left join T_MD_MATERIAL b on a.MATERIAL_CODE = b.MATERIAL_CODE where MATERIAL_NAME like '%舒适%' or MATERIAL_NAME like '%低配%' ) a +where a.CREATEDATE > format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000' + and a.CREATEDATE < format(dateadd(day, 1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + else + select count(0) as c from (select a.* ,b.MATERIAL_NAME FROM T_AW_MAIN a left join T_MD_MATERIAL b on a.MATERIAL_CODE = b.MATERIAL_CODE where MATERIAL_NAME like '%舒适%' or MATERIAL_NAME like '%低配%' ) a +where a.CREATEDATE > format(dateadd(day, -1, GetDate()), 'yyyy-MM-dd') + ' 08:30:00.000' + and a.CREATEDATE < format(GetDate(), 'yyyy-MM-dd') + ' 08:30:00.000'"; + DataTable dataTable = GetDataTable(sql, Config.maindbConnectionString); + + + return dataTable.Rows[0]["c"].ToString(); + } + /// + /// 取消挂起 + /// + /// + /// + public static bool UpdateFisSetStateDisposes(List upRows) + { + List orderNoList = upRows.Select(p => p.Field("ORDER_NO")).ToList(); + string updateSql = $"Update T_AW_FisSendState set State = 0,Remark='取消挂起' where FisOrderNo in ('{string.Join("','", orderNoList)}') and State=9 "; + bool returnVal = false; + try + { + //执行SQL + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, updateSql); + + if (count > 0) + { + returnVal = true; + } + } + catch (Exception ex) + { + //后续加入日志 + throw; + } + + return returnVal; + + } + + //public static bool UpdateFisSetStateDispose(DataRow dataRow) + //{ + // string updateSql = $"Update T_AW_FisSendState set State = 0,Remark='取消挂起' where FisOrderNo ='{dataRow["ORDER_NO"]}' and State=9 "; + // bool returnVal = false; + // try + // { + // //执行SQL + // int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, updateSql); + + // if (count > 0) + // { + // returnVal = true; + // } + // } + // catch (Exception ex) + // { + // //后续加入日志 + // throw; + // } + + // return returnVal; + + //} + + + public static void SaveStartIndex(int startIndex) + { + try + { + string updateSql = $"Update T_MD_StartIndex set [StartIndex]={startIndex}"; + int count = SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, updateSql); + if (count == 0) + { + string insertSql = $" insert into T_MD_StartIndex(StartIndex) values ({startIndex})"; + SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, insertSql); + } + + } + catch + { + throw; + } + } + public static int GetStartIndex() + { + string searchSql = $"select top 1 StartIndex from T_MD_StartIndex "; + DataTable dataTable = GetDataTable(searchSql, Config.maindbConnectionString); + if (dataTable.Rows.Count == 0) return 0; + try + { + return int.Parse(dataTable.Rows[0]["StartIndex"].ToString()); + } + catch + { + return 0; + } + } + } +} diff --git a/QMAPP.BoraUpgrade.Entity/Properties/AssemblyInfo.cs b/QMAPP.BoraUpgrade.Entity/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6499e89 --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("QMAPP.BoraUpgrade.Entity")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QMAPP.BoraUpgrade.Entity")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("eeceb388-1acb-45d0-b9e9-ce8e344773f1")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/QMAPP.BoraUpgrade.Entity/QMAPP.BoraUpgrade.Entity.csproj b/QMAPP.BoraUpgrade.Entity/QMAPP.BoraUpgrade.Entity.csproj new file mode 100644 index 0000000..e316144 --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/QMAPP.BoraUpgrade.Entity.csproj @@ -0,0 +1,58 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {0C8B7A06-ED56-4198-9386-B8EA1D176571} + Library + Properties + QMAPP.BoraUpgrade.Entity + QMAPP.BoraUpgrade.Entity + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QMAPP.BoraUpgrade.Entity/T_AW_PRODUCT.cs b/QMAPP.BoraUpgrade.Entity/T_AW_PRODUCT.cs new file mode 100644 index 0000000..db720ff --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/T_AW_PRODUCT.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Entity +{ + public class T_AW_PRODUCT + { + public string PID { get; set; } + public string PRODUCTTYPE { get; set; } + public string PRODUCTCODE { get; set; } + public string PRODUCTSOURCE { get; set; } + public string MACHINENAME { get; set; } + public string MACHINECODDE { get; set; } + public string MATERIAL_CODE { get; set; } + public string STATUS { get; set; } + public string ISPARENT { get; set; } + public string CURRENTPROCESS { get; set; } + public string PRODUCELINE { get; set; } + public string PRODUCESHIFTNAME { get; set; } + public string PRODUCESHIFTTCODE { get; set; } + public string OUTFLAG { get; set; } + public string USINGSTATE { get; set; } + public Nullable CAPACITY { get; set; } + public Nullable USINGCOUNT { get; set; } + public string CREATEUSER { get; set; } + public Nullable CREATEDATE { get; set; } + public string UPDATEUSER { get; set; } + public Nullable UPDATEDATE { get; set; } + public string WORKCELL_CODE { get; set; } + public string WORKLOC_CODE { get; set; } + public string WORKCENTER_CODE { get; set; } + public string TEAM_CODE { get; set; } + public string ENDOFLINE { get; set; } + public string MATERIAL_TYPE { get; set; } + public string PLAN_NO { get; set; } + } +} diff --git a/QMAPP.BoraUpgrade.Entity/T_CC_PrintCodeRoute.cs b/QMAPP.BoraUpgrade.Entity/T_CC_PrintCodeRoute.cs new file mode 100644 index 0000000..9769ca0 --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/T_CC_PrintCodeRoute.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Entity +{ + public class T_CC_PrintCodeRoute + { + public int PrintCodeRouteID + { + get; + + set; + } + + + public string BarCodeRule + { + get; + + set; + } + + + public string MachineName + { + get; + + set; + } + + public string MachineCode + { + get; + + set; + } + + public string Material_Code + { + get; + + set; + } + + public string WorkCell_Code + { + get; + + set; + } + + + public string WorkLoc_Code + { + get; + + set; + } + + public string WorkCenter + { + get; + + set; + } + + public string Matrail_Type + { + get; + + set; + } + + public bool IsProduct + { + get; + + set; + } + + public bool IsAppend + { + get; + + set; + } + + public int Color + { + get; + + set; + } + + public string MachineID + { + get; + + set; + } + } +} diff --git a/QMAPP.BoraUpgrade.Entity/T_MD_MATERIAL.cs b/QMAPP.BoraUpgrade.Entity/T_MD_MATERIAL.cs new file mode 100644 index 0000000..1bf5baf --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/T_MD_MATERIAL.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Entity +{ + public class T_MD_MATERIAL + { + public string PID { get; set; } + public string MATERIAL_CODE { get; set; } + public string MATERIAL_TYPE_CODE { get; set; } + public string UNIT_CODE { get; set; } + public string MATERIAL_NAME { get; set; } + public string MATERIAL_COMP { get; set; } + public string REMARK { get; set; } + public string CREATEUSER { get; set; } + public DateTime CREATEDATE { get; set; } + public string UPDATEUSER { get; set; } + public string UPDATEDATE { get; set; } + public string OUTSOURCE { get; set; } + public int STD_QTY { get; set; } + public string FLGDEL { get; set; } + public string COLOR { get; set; } + public string HBTYPE { get; set; } + public string PROJECTCODE { get; set; } + public int WEIGHT { get; set; } + public string MATERIAL_SHORT { get; set; } + public string WORKBIN_TYPE { get; set; } + public int CAPACITY { get; set; } + public string FACTORY_CODE { get; set; } + } +} diff --git a/QMAPP.BoraUpgrade.Entity/T_QD_BoraUpgradeRoute.cs b/QMAPP.BoraUpgrade.Entity/T_QD_BoraUpgradeRoute.cs new file mode 100644 index 0000000..7a1834a --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/T_QD_BoraUpgradeRoute.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Entity +{ + /// + /// 青岛宝来升级路由 + /// + public class T_QD_BoraUpgradeRoute + { + /// + /// 主键 + /// + public int BoraRouteID + { + get; + + set; + } + + /// + /// 工作编号 + /// + public string WorkCell_Code + { + get; + + set; + } + + /// + /// 路由正规则 + /// + public string RouteRegular + { + get; + + set; + } + + /// + /// 下一跳路由 + /// + public string NextWorkCell_Code + { + get; + + set; + } + + /// + /// 机器编码 + /// + public string Machine_Code + { + get; + + set; + } + + /// + /// 路由方向 + /// + public int RouteDirection + { + get; + + set; + } + + /// + /// 是否产品码 + /// + public bool IsProductCode + { + get; + + set; + } + + /// + /// 是否清空 + /// + public bool IsClear + { + get; + + set; + } + + /// + /// 是否删除 + /// + public bool IsDeleted + { + get; + + set; + } + + /// + /// 创建时间 + /// + public DateTime CreateTime + { + get; + + set; + } + + + /// + /// 模架号 + /// + public string ModeCode + { + get; + + set; + } + + /// + /// 空采集点数量 + /// + public int EmptyDAICount + { + get; + + set; + } + } +} diff --git a/QMAPP.BoraUpgrade.Entity/T_QD_VirtualMaterial.cs b/QMAPP.BoraUpgrade.Entity/T_QD_VirtualMaterial.cs new file mode 100644 index 0000000..d0466aa --- /dev/null +++ b/QMAPP.BoraUpgrade.Entity/T_QD_VirtualMaterial.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QMAPP.BoraUpgrade.Entity +{ + /// + /// 青岛宝来升级 + /// + public class T_QD_VirtualMaterial + { + public int PID; + + public string WorkCellCode; + + public string MaterialCode; + + public string MaterialType; + } +} diff --git a/QMSolution.sln b/QMSolution.sln index b1c2e23..25227df 100644 --- a/QMSolution.sln +++ b/QMSolution.sln @@ -164,6 +164,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessFileSyncService", "P EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stone.WinModuleTransWare", "APPQ5\Stone.WinModuleTransWare\Stone.WinModuleTransWare\Stone.WinModuleTransWare.csproj", "{3AECE013-AC67-4F6F-9DB4-36577345F428}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QMAPP.BoraUpgrade", "QMAPP.BoraUpgrade", "{9E40BBDD-282A-4381-9263-0758B05B2B01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QMAPP.BoraUpgrade.BLL", "QMAPP.BoraUpgrade.BLL\QMAPP.BoraUpgrade.BLL.csproj", "{0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QMAPP.BoraUpgrade.DAL", "QMAPP.BoraUpgrade.DAL\QMAPP.BoraUpgrade.DAL.csproj", "{10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QMAPP.BoraUpgrade.Common", "QMAPP.BoraUpgrade.Common\QMAPP.BoraUpgrade.Common.csproj", "{2DEB0026-EF98-4E33-A132-2F46B5E646FE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QMAPP.BoraUpgrade.Entity", "QMAPP.BoraUpgrade.Entity\QMAPP.BoraUpgrade.Entity.csproj", "{0C8B7A06-ED56-4198-9386-B8EA1D176571}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -816,6 +826,54 @@ Global {3AECE013-AC67-4F6F-9DB4-36577345F428}.Release|Mixed Platforms.Build.0 = Release|Any CPU {3AECE013-AC67-4F6F-9DB4-36577345F428}.Release|x86.ActiveCfg = Release|Any CPU {3AECE013-AC67-4F6F-9DB4-36577345F428}.Release|x86.Build.0 = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|x86.ActiveCfg = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Debug|x86.Build.0 = Debug|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|Any CPU.Build.0 = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|x86.ActiveCfg = Release|Any CPU + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF}.Release|x86.Build.0 = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|x86.ActiveCfg = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Debug|x86.Build.0 = Debug|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|Any CPU.Build.0 = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|x86.ActiveCfg = Release|Any CPU + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6}.Release|x86.Build.0 = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|x86.ActiveCfg = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Debug|x86.Build.0 = Debug|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|Any CPU.Build.0 = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|x86.ActiveCfg = Release|Any CPU + {2DEB0026-EF98-4E33-A132-2F46B5E646FE}.Release|x86.Build.0 = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|x86.ActiveCfg = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Debug|x86.Build.0 = Debug|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|Any CPU.Build.0 = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|x86.ActiveCfg = Release|Any CPU + {0C8B7A06-ED56-4198-9386-B8EA1D176571}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -889,6 +947,10 @@ Global {EE178BC8-C580-4795-91E9-5687512B9310} = {10B7672E-97CF-4310-B2C8-6122B4662A48} {72A36698-CCFB-4A72-BD12-765F440BE486} = {10B7672E-97CF-4310-B2C8-6122B4662A48} {3AECE013-AC67-4F6F-9DB4-36577345F428} = {2C1B5D21-3E27-4C6A-86A6-DA56AAB311ED} + {0AC97127-BCF1-4FF0-A6F1-73EA38802ECF} = {9E40BBDD-282A-4381-9263-0758B05B2B01} + {10C2F3D0-4ACB-4D41-B7CC-168A55E099D6} = {9E40BBDD-282A-4381-9263-0758B05B2B01} + {2DEB0026-EF98-4E33-A132-2F46B5E646FE} = {9E40BBDD-282A-4381-9263-0758B05B2B01} + {0C8B7A06-ED56-4198-9386-B8EA1D176571} = {9E40BBDD-282A-4381-9263-0758B05B2B01} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {309CB55E-489B-416A-9661-6E854D0F3FC5} diff --git a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config index 30acb50..04e9455 100644 --- a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config +++ b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config @@ -10,7 +10,7 @@ - + @@ -58,36 +58,26 @@ - + - - - - - - - - - + - + - - - - + + + + - @@ -189,7 +179,7 @@ - + @@ -198,7 +188,7 @@ - + @@ -216,7 +206,7 @@ - + @@ -225,7 +215,7 @@ - + @@ -241,9 +231,9 @@ - + - + - +