yangle
2024-09-11 c05f5677f4e4296da0b8d9ced577bb5643e64579
数据同步优化
26个文件已修改
4个文件已删除
886 ■■■■ 已修改文件
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs 240 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.Designer.cs 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.cs 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.EquipmentCollectionForm.resources 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs
@@ -47,6 +47,7 @@
            this.txtHMaterNumber = new System.Windows.Forms.TextBox();
            this.HMaterID = new System.Windows.Forms.Label();
            this.timer = new System.Windows.Forms.Timer(this.components);
            this.Time_CLHB = new System.Windows.Forms.Timer(this.components);
            this.SuspendLayout();
            // 
            // cmbEquipFile
@@ -195,6 +196,11 @@
            this.timer.Interval = 60000;
            this.timer.Tick += new System.EventHandler(this.timer_Tick);
            // 
            // Time_CLHB
            //
            this.Time_CLHB.Interval = 3600000;
            this.Time_CLHB.Tick += new System.EventHandler(this.Time_CLHB_Tick);
            //
            // EquipmentCollectionForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
@@ -218,6 +224,7 @@
            this.Controls.Add(this.cmbEquipFile);
            this.Name = "EquipmentCollectionForm";
            this.Text = "设备数据采集";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EquipmentCollectionForm_FormClosing);
            this.Load += new System.EventHandler(this.EquipmentCollectionForm_Load);
            this.ResumeLayout(false);
            this.PerformLayout();
@@ -243,5 +250,6 @@
        private System.Windows.Forms.TextBox txtHMaterNumber;
        private System.Windows.Forms.Label HMaterID;
        private System.Windows.Forms.Timer timer;
        private System.Windows.Forms.Timer Time_CLHB;
    }
}
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs
@@ -32,6 +32,7 @@
            this.txtLj.ReadOnly = true;
            this.btnSave.Enabled = false;
            this.txtHMaterNumber.ReadOnly = true;
            //this.btnRest.Enabled = false;
            bindCbox();
          
        }
@@ -44,8 +45,8 @@
            }
            else
            {
                //this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                this.txtBegin.Text = "2024-8-7 15:20:06";
                this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                //this.txtBegin.Text = "2024-09-06 10:52:39";
                this.btnBegin.Enabled = false;
                if (cmbEquipFile.SelectedIndex == 1)
                {
@@ -62,8 +63,9 @@
                MessageBox.Show("请点击开始按钮进行开始确认!");
            }
            else
            { //this.txtEnd.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                this.txtEnd.Text = "2024-8-7 17:20:06";
            {
                this.txtEnd.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                //this.txtEnd.Text = "2024-09-06 11:20:39";
                this.btnEnd.Enabled = false;
                if (cmbEquipFile.SelectedIndex == 1)
@@ -84,6 +86,7 @@
                //路径赋值给文本
                using (OpenFileDialog openFile = new OpenFileDialog())
                {
                    openFile.Multiselect = true; // 允许选择多个文件
                    DialogResult result = openFile.ShowDialog();
                    if (result == DialogResult.OK)
                    {
@@ -93,21 +96,23 @@
                        string selectedFolderPath = openFile.FileName;
                        this.txtLj.Text = selectedFolderPath;
                        objJsonResult = Xt_CSVReadText(selectedFolderPath, 1);
                        objJsonResult = Xt_CSVReadText(openFile.FileNames, 1);
                        dt = objJsonResult.dataTable;
                        if (objJsonResult.code == "0")
                        {
                            MessageBox.Show(objJsonResult.Message);
                        }
                        else {
                        else
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                ListData.Items.Add("底孔直径:" + dt.Rows[i]["BottomHoleDiameter"].ToString() +
                                    ",有无螺牙检测数据:" + dt.Rows[i]["TestingData"].ToString() +
                                    ",有无螺牙检测结果:" + dt.Rows[i]["DetectionResult"].ToString() +
                                ",时间:" + dt.Rows[i]["HDate"].ToString());
                        }
                            }
                        }
                    }
                }
@@ -115,7 +120,7 @@
        }
        //读取CSV文件数据  根据文件路径找到对应文件 并获取对应的数据
        public json Xt_CSVReadText(string FilePath, int num)
        public json Xt_CSVReadText(string[] FilePath, int num)
        {
            try
            {
@@ -124,46 +129,53 @@
                dt.Columns.Add("TestingData");
                dt.Columns.Add("DetectionResult");
                dt.Columns.Add("HDate");
                DataTable dt2 = new DataTable();
                List<string[]> records = new List<string[]>();
                using (StreamReader sr = new StreamReader(FilePath, Encoding.GetEncoding("gb2312")))
                for (int u = 0; u < FilePath.Length; u++)
                {
                    string[] headers = sr.ReadLine()?.Split(',');
                    if (headers != null)
                    using (StreamReader sr = new StreamReader(FilePath[u], Encoding.GetEncoding("gb2312")))
                    {
                        foreach (var header in headers)
                        string[] headers = sr.ReadLine()?.Split(',');
                        if (headers != null && u == 0)
                        {
                            dt2.Columns.Add(header.Trim());
                        }
                    }
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        var values = line.Split(',');
                        DataRow row = dt2.NewRow();
                        for (int i = 0; i < values.Length; i++)
                        {
                            // 这里可能需要添加类型转换和错误处理
                            row[i] = values[i].Trim();
                            foreach (var header in headers)
                            {
                                dt2.Columns.Add(header.Trim());
                            }
                        }
                        dt2.Rows.Add(row);
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            var values = line.Split(',');
                            DataRow row = dt2.NewRow();
                            for (int i = 0; i < values.Length; i++)
                            {
                                // 这里可能需要添加类型转换和错误处理
                                row[i] = values[i].Trim();
                            }
                            dt2.Rows.Add(row);
                        }
                    }
                }
                DateTime HBegin = DateTime.Parse(this.txtBegin.Text);
                DateTime HEnd = DateTime.Parse(this.txtEnd.Text);
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        DataRow dr = dt.NewRow();
                        dr["BottomHoleDiameter"] = dt2.Rows[i][dt2.Columns[j]].ToString();
                        dr["TestingData"] = dt2.Rows[i][dt2.Columns[j + 2]].ToString();
                        dr["DetectionResult"] = dt2.Rows[i][dt2.Columns[j + 4]].ToString();
                        dr["HDate"] = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        dt.Rows.Add(dr);
                        DateTime Now = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString());
                        if (Now >= HBegin && Now <= HEnd) {
                            DataRow dr = dt.NewRow();
                            dr["BottomHoleDiameter"] = dt2.Rows[i][dt2.Columns[j]].ToString();
                            dr["TestingData"] = dt2.Rows[i][dt2.Columns[j + 2]].ToString();
                            dr["DetectionResult"] = dt2.Rows[i][dt2.Columns[j + 4]].ToString();
                            dr["HDate"] = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                            dt.Rows.Add(dr);
                        }
                    }
                }
@@ -256,7 +268,6 @@
                        break;
                }
                this.btnSave.Enabled = false;
            }
        }
@@ -269,6 +280,7 @@
                if (jsonResult.code != "0")
                {
                    this.btnSave.Enabled = true;
                    MessageBox.Show("设备列表报错:" + jsonResult.message);
                }
                else
@@ -287,6 +299,7 @@
                    jsonResult = await FindDevicePropCalc(url, token, nos, HBegin, HEnd);
                    if (jsonResult.code != "0")
                    {
                        this.btnSave.Enabled = true;
                        MessageBox.Show("数量获取报错:" + jsonResult.message);
                    }
                    else {
@@ -297,7 +310,7 @@
                        for (int i = 0; i < jsonResult.data.Count; i++)
                        {
                            if (jsonResult.data[i].propId == 173)
                            if (jsonResult.data[i].propId == 467)
                            {
                                HInSpectQty = jsonResult.data[i].sum;
                            }
@@ -305,7 +318,7 @@
                            {
                                HRightQty = jsonResult.data[i].sum;
                            }
                            else if (jsonResult.data[i].propId == 606)
                            else if (jsonResult.data[i].propId == 466)
                            {
                                HUnKnowQty = jsonResult.data[i].sum;
                            }
@@ -314,6 +327,8 @@
                                HUnRightQty = jsonResult.data[i].sum;
                            }
                        }
                        string HNumber = "";
                        int HSourceID = 0;
                        string HSourceNumber = "";
@@ -334,11 +349,12 @@
                        DataSet dsSouce = oCN.RunProcReturn("select * from Gy_Source with(nolock) where HNumber='" + HSourceNumber + "'", "Gy_Source");
                        if (dsSouce.Tables[0].Rows.Count == 0)
                        {
                            this.btnSave.Enabled = true;
                            MessageBox.Show("生产资源查无数据!");
                        }
                        else {
                            HSourceID = int.Parse(dsSouce.Tables[0].Rows[0]["HInterID"].ToString());
                            HSourceID = int.Parse(dsSouce.Tables[0].Rows[0]["HItemID"].ToString());
                            //查询检验方案
                            DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal,a.HProcID,b.HInspectInstruMentID
@@ -370,9 +386,15 @@
                                    {
                                        int HLastResult = 1;
                                        string HAnalysisMethod = dataSet.Tables[0].Rows[i]["HAnalysisMethod"].ToString();
                                        decimal HUpLimit = 0;
                                        decimal HDownLimit = 0;
                                        decimal HUpLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HUpLimit"].ToString());
                                        decimal HDownLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HDownLimit"].ToString());
                                        if (HAnalysisMethod == "2")
                                        {
                                            HUpLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HUpLimit"].ToString());
                                            HDownLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HDownLimit"].ToString());
                                        }
                                        for (int j = 0; j < dt.Columns.Count - 1; j++)
                                        {
@@ -466,27 +488,30 @@
                                        ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                                        ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" +
                                        ",HProcID,HBatchNo" +
                                        ",HProcID,HBatchNo,HInSpectQty ,HRightQty ,HUnRightQty ,HUnKnowQty " +
                                        ") " +
                                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                                        "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                                        "," + HSourceID + ",0,'',0,0,0" +
                                        ",'',0," + HMaterID + ",'', " + HLastResults +
                                        ",0,0,'','',0," + HQCSchemeID + ",0,''" +
                                        "," + HProcID + ",'" + HBatchNo + "') ");
                                        "," + HProcID + ",'" + HBatchNo + "',"+ HInSpectQty + ","+ HRightQty + ", "+ HUnRightQty + ", " + HUnKnowQty + ") ");
                                    oCN.Commit();
                                    MessageBox.Show("保存成功!");
                                    //this.btnRest.Enabled = true;
                                }
                                else
                                {
                                    this.btnSave.Enabled = true;
                                    MessageBox.Show("当前物料的检验方案与Excel的列不匹配!");
                                }
                            }
                            else
                            {
                                this.btnSave.Enabled = true;
                                MessageBox.Show("当前物料没有对应的检验方案!");
                            }
                        }
@@ -495,6 +520,7 @@
            }
            catch (Exception e)
            {
                this.btnSave.Enabled = true;
                MessageBox.Show("保存失败!" + e.Message);
            }
        }
@@ -605,7 +631,7 @@
        public async Task<JsonEquipmentData> FindAllDevicePropsDetailByTimeRange(string url, string token,string nos, string HBegin, string HEnd)
        {
            nos = nos.Replace(",", "\",\"");
            string stringJson = "{\"token\":\"" + token + "\",\"deviceNos\":[\"" + nos + "\"],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\",\"basePropIds\":[473,474,600,601,602,603,604,605,576,577,578,562,563,564,565,566,567]}";
            string stringJson = "{\"token\":\"" + token + "\",\"deviceNos\":[\"" + nos + "\"],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\",\"basePropIds\":[473,474,489,508, 562, 563, 564, 565, 566, 567, 568, 569, 570,571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 597, 600, 601, 602, 603, 604, 605, 593, 594, 595]}";
            //设备列表接口
            string urls = url + EquipmentType.Nine;
@@ -618,7 +644,7 @@
        //获取不良数,合数数,可疑数 总数
        public async Task<JsonEquipmentData> FindDevicePropCalc(string url, string token,string nos,string HBegin,string HEnd)
        {
            string stringJson = "{\"token\":\"" + token + "\",\"deviceNo\":\"" + nos + "\",\"propIds\":[173,469,470,606],\"beginTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}";
            string stringJson = "{\"token\":\"" + token + "\",\"deviceNo\":\"" + nos + "\",\"propIds\":[466,467,469,470],\"beginTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}";
            var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json");
            string urls = url + EquipmentType.Seven;
            JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST");
@@ -634,6 +660,18 @@
            string stringJson = "{\"token\":\"" + token + "\",\"nos\":[" + nos + "]}";
            var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json");
            string urls = url + EquipmentType.Three;
            JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST");
            return jsonResult;
        }
        //获取设备时间段产量
        public async Task<JsonEquipmentData> FindProdByNosAndTime(string url, string token, string nos, string HBegin, string HEnd)
        {
            nos = nos.Replace(",", "\",\"");
            nos = "\"" + nos + "\"";
            string stringJson = "{\"token\":\"" + token + "\",\"nos\":[" + nos + "],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}";
            var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json");
            string urls = url + EquipmentType.Four;
            JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST");
            return jsonResult;
        }
@@ -675,6 +713,7 @@
                    this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    this.btnBegin.Enabled = false;
                    this.timer.Enabled = true;
                    this.Time_CLHB.Enabled = true;
                }
            }
        }
@@ -731,8 +770,8 @@
                    }
                }
                nos = nos.Substring(0, nos.Length - 1);
                TimeDate = "2024-08-14 08:30:39";
                time = "2024-08-14 15:05:39";
                //TimeDate = "2024-08-14 08:30:39";
                //time = "2024-08-14 15:05:39";
                JsonEquipmentData jsonEquipment = await FindAllDevicePropsDetailByTimeRange(Url, token, nos, TimeDate, time);
@@ -792,8 +831,8 @@
            }
            //this.timer.Enabled = false;
            //TimeDate = "2024-08-14 17:00:39";
            //time = "2024-08-14 17:05:39";
            //TimeDate = "2024-08-19 19:38:14.540";
            //time = "2024-08-19 19:39:14.540";
            JsonEquipmentData jsonResult = await FindDeviceList(Url, token);
            if (jsonResult.code != "0")
@@ -827,7 +866,7 @@
                    {
                        for (int j = 0; j < jsonEquipment.data[i].props.Count; j++)
                        {
                            for (int k = 0; k < jsonEquipment.data[0].props[j].datas.Count; k++)
                            for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++)
                            {
                                valueData value = JsonConvert.DeserializeObject<valueData>(jsonEquipment.data[i].props[j].datas[k].value);
                                if (value.type == "良品")
@@ -852,7 +891,7 @@
                                JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"良品数\",\"HResult\":\"OK\",\"HCount\":" + data.data[j].sum + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
                            }
                            //不良数
                            else if (data.data[i].propId == 470)
                            else if (data.data[j].propId == 470)
                            {
                                JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"NG数量\",\"HResult\":\"NG\",\"HCount\":" + data.data[j].sum + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
                            }
@@ -863,8 +902,16 @@
                        {
                            for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++)
                            {
                                JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"" + jsonEquipment.data[i].props[j].propName + "\",\"HResult\":\"\",\"HCount\":" + jsonEquipment.data[i].props[j].datas[k].value + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
                                JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"" + jsonEquipment.data[i].props[j].propName + "\",\"HResult\":\""+ jsonEquipment.data[i].props[j].datas[k].value + "\",\"HCount\":1,\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
                            }
                        }
                        JsonEquipmentData data = await FindProdByNosAndTime(Url, token, jsonEquipment.data[i].deviceNo, TimeDate, time);
                        for (int j = 0; j < data.data.Count; j++)
                        {
                            JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"生产数量\",\"HResult\":\"OK\",\"HCount\":" + data.data[j].prod + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
                        }
                    }
                }
@@ -935,6 +982,91 @@
                                  ",工艺参数值:" + data.data[i].HResult);
            }
        }
        //定时生成产量汇报单
        private async void Time_CLHB_Tick(object sender, EventArgs e)
        {
            string Url = DBHelper.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "Config/SQLAPI.config", "sUrl");
            string urls = Url + EquipmentType.One;
            // 准备要发送的表单数据
            var formData = new FormUrlEncodedContent(new[]
            {
                    new KeyValuePair<string, string>("userName", "admin"),
                    new KeyValuePair<string, string>("password", "admin")
                    // 添加更多键值对,根据您的需要
                });
            JsonResult jsonResult = await getUrl(urls, formData);
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string token = jsonResult.data.token;
            JsonEquipmentData jsonEquipment = await FindDeviceList(Url, token);
            if (jsonEquipment.code != "0")
            {
                MessageBox.Show("设备列表报错:" + jsonEquipment.message);
            }
            else
            {
                string nos = "";
                //获取去设备编码
                for (int i = 0; i < jsonEquipment.data.Count; i++)
                {
                    if (jsonEquipment.data[i].no.Contains("CMR-ZS-SE"))
                    {
                        nos += "''" + jsonEquipment.data[i].no + "'',";
                    }
                    else if (jsonEquipment.data[i].no.Contains("CMR_ZZ_SE_"))
                    {
                        nos += "''" + jsonEquipment.data[i].no + "'',";
                    }
                }
                nos = nos.Substring(0, nos.Length - 1);
                //this.Time_CLHB.Enabled = false;
                DataSet ds = oCN.RunProcReturn("exec h_p_Sc_TimeICMOReporList '" + nos + "'", "h_p_Sc_TimeICMOReporList");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        nos = dt.Rows[i]["设备编码"].ToString();
                        string HICMInterID = dt.Rows[i]["HInterID"].ToString();
                        string HBegDate = DateTime.Parse(dt.Rows[i]["日期"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        string HEndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        jsonEquipment = await FindProdByNosAndTime(Url, token, nos, HBegDate, HEndDate);
                        if (decimal.Parse(jsonEquipment.data[0].prod) > 0) {
                            oCN.RunProc("exec h_p_Sc_AddTimeICMORepor " + HICMInterID + "," + jsonEquipment.data[0].prod+",'"+ HEndDate + "'");
                        }
                    }
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[1];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        nos = dt.Rows[i]["设备编码"].ToString();
                        string HICMInterID = dt.Rows[i]["HInterID"].ToString();
                        string HBegDate = DateTime.Parse(dt.Rows[i]["开始日期"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        string HEndDate = DateTime.Parse(dt.Rows[i]["结束日期"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        jsonEquipment = await FindProdByNosAndTime(Url, token, nos, HBegDate, HEndDate);
                        if (decimal.Parse(jsonEquipment.data[0].prod) > 0)
                        {
                            oCN.RunProc("exec h_p_Sc_AddTimeICMORepor " + HICMInterID + "," + jsonEquipment.data[0].prod + ",'" + HEndDate + "'");
                        }
                    }
                }
            }
        }
        private void EquipmentCollectionForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("确定要关闭吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
    }
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj
@@ -12,6 +12,21 @@
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
    <PublishUrl>publish\</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Disk</InstallFrom>
    <UpdateEnabled>false</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <UseApplicationTrust>false</UseApplicationTrust>
    <BootstrapperEnabled>true</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
@@ -88,5 +103,17 @@
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
      <Visible>False</Visible>
      <ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user
@@ -2,5 +2,13 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectView>ProjectFiles</ProjectView>
    <PublishUrlHistory />
    <InstallUrlHistory />
    <SupportUrlHistory />
    <UpdateUrlHistory />
    <BootstrapperUrlHistory />
    <ErrorReportUrlHistory />
    <FallbackCulture>zh-CN</FallbackCulture>
    <VerifyUploadedFiles>false</VerifyUploadedFiles>
  </PropertyGroup>
</Project>
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx
@@ -120,4 +120,7 @@
  <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
  </metadata>
  <metadata name="Time_CLHB.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>125, 17</value>
  </metadata>
</root>
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config
@@ -6,8 +6,8 @@
        <add key="sDataBase" value="HX_LMESsys_test"></add>
        <add key="sUser" value="HX_USER"></add>
        <add key="sPassword" value="lc@841022"></add>
        <!--<add key="sUrl" value="https://preview.nps.iiot.youngsunnb.com"></add>--><!--内部测试-->
        <add key="sUrl" value="https://hzsme.nps.iiot.youngsunnb.com/"></add><!--斯莫尔外网测试-->
        <add key="sUrl" value="http://30.10.7.6:8066"></add><!--内部测试-->
        <!--<add key="sUrl" value="https://hzsme.nps.iiot.youngsunnb.com/"></add>--><!--斯莫尔外网测试-->
        <!--47-->
        <!--<add key="sServer" value="47.96.97.237,15127"></add>
        <add key="sDataBase" value="HX_LMESsys"></add>
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.Designer.cs
File was deleted
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.cs
File was deleted
WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.resx
File was deleted
WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs
@@ -16,7 +16,7 @@
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new EquipmentCollectionForm());
            Application.Run(new ReadCoordinateExcelFrom());
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs
@@ -55,8 +55,8 @@
                        string selectedFolderPath = folderBrowserDialog.SelectedPath;
                        // 使用 selectedFolderPath 进行后续操作,例如显示在文本框中  
                        this.txtLj.Text = selectedFolderPath;
                        GetCSV_Read(selectedFolderPath);
                        //GetExcel_Read(selectedFolderPath);
                        //GetCSV_Read(selectedFolderPath);
                        GetExcel_Read(selectedFolderPath);
                    }
                }
            }
@@ -342,7 +342,7 @@
                DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal 
from Sc_ProcessExchangeBillMain pr with(nolock)
inner join Gy_QCCheckProjectMain a with(nolock) on pr.HMaterID=a.HMaterID
inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and  b.HInspectInstruMentID=2
inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and  b.HInspectInstruMentID=1
left join Gy_Material m with(nolock) on a.HMaterID=m.HItemID
left join Gy_QCCheckItem ch with(nolock) on b.HQCCheckItemID=ch.HItemID  
where pr.HBillNo='" + this.txtLzk.Text + "'", "Gy_QCCheckProjectMain");
WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj
@@ -97,12 +97,6 @@
  </ItemGroup>
  <ItemGroup>
    <Compile Include="DBHelper.cs" />
    <Compile Include="EquipmentCollectionForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="EquipmentCollectionForm.Designer.cs">
      <DependentUpon>EquipmentCollectionForm.cs</DependentUpon>
    </Compile>
    <Compile Include="json.cs" />
    <Compile Include="ReadCoordinateExcelFrom.cs">
      <SubType>Form</SubType>
@@ -124,9 +118,6 @@
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="EquipmentCollectionForm.resx">
      <DependentUpon>EquipmentCollectionForm.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.EquipmentCollectionForm.resources
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
ff37b5b974b9759f5393c18ff0271ab5fa98580b
bcb81c71ebfb37915287aeccf3d336ac1f15b1d6
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
@@ -34,4 +34,3 @@
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.CopyComplete
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.exe
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.pdb
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.EquipmentCollectionForm.resources
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
Binary files differ