yangle
2025-04-07 0d59b3fd8050b0f0766be47ed5527d96bd4bf2f7
斯莫尔插件优化
6个文件已添加
40个文件已修改
3个文件已删除
13651 ■■■■■ 已修改文件
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt 1 ●●●● 补丁 | 查看 | 原始文档 | 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/Program.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Config/SQLAPI.config 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Vlog/2025-04-04.txt 11521 ●●●●● 补丁 | 查看 | 原始文档 | 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/bin/Debug/WFormReadData_SMR.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | 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/WFormSynchronizeData_SMR/Form1.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.Designer.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.cs 1228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.resx 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR.csproj 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.rar 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.FormBack.resources 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.CoreCompileInputs.cache 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.FileListAbsolute.txt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs
@@ -326,7 +326,7 @@
                        {
                            if (jsonResult.data[i].propId == 173)
                            {
                                HInSpectQty = jsonResult.data[i].sum;
                                //HInSpectQty = jsonResult.data[i].sum;
                            }
                            else if (jsonResult.data[i].propId == 469)
                            {
@@ -341,8 +341,10 @@
                                HUnRightQty = jsonResult.data[i].sum;
                            }
                        }
                        //通过双方讨论 最终采纳 检验数量=合格+不合格+可疑
                        HInSpectQty = HRightQty + HUnKnowQty + HUnRightQty;
                        string HNumber = "";
                        int HSourceID = 0;
                        string HSourceNumber = "";
@@ -794,7 +796,7 @@
                if (dr == DialogResult.Yes)
                {
                    this.txtHBathNo.ReadOnly = true;
                    this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");
                    //this.txtBegin.Text = "2024-11-21 13:40:27";
                    this.btnBegin.Enabled = false;
                    this.timer.Enabled = true;
@@ -819,7 +821,7 @@
                    // 添加更多键值对,根据您的需要
                });
            JsonResult jsonResult = await getUrl(urls, formData);
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");
            if (cmbEquipFile.SelectedIndex == 1)
            {
@@ -919,8 +921,8 @@
            }
            //this.timer.Enabled = false;
            //TimeDate = "2024-08-19 19:38:14.540";
            //time = "2024-08-19 19:39:14.540";
            //TimeDate = "2025-02-10 13:10:50";
            //time = "2025-02-10 13:11:50";
            JsonEquipmentData jsonResult = await FindDeviceList(Url, token);
            if (jsonResult.code != "0")
@@ -947,7 +949,7 @@
                JsonEquipmentData jsonEquipment = await FindAllDevicePropsDetailByTimeRange(Url, token, nos, TimeDate, time);
                var JsonData = "{\"data\":[";
                CustomWriteLog("01" , DateTime.Now.ToString("yyyy-MM-dd"));
                for (int i = 0; i < jsonEquipment.data.Count; i++)
                {
                    if (jsonEquipment.data[i].deviceNo.Contains("CMR-ZZ-SE-"))
@@ -956,7 +958,9 @@
                        {
                            for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++)
                            {
                                CustomWriteLog("1-" + k + ":" + jsonEquipment.data[i].props[j].datas[k].value, DateTime.Now.ToString("yyyy-MM-dd"));
                                valueData value = JsonConvert.DeserializeObject<valueData>(jsonEquipment.data[i].props[j].datas[k].value);
                                CustomWriteLog("2", DateTime.Now.ToString("yyyy-MM-dd"));
                                if (value.type == "良品")
                                {
                                    JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"螺母是否凸出\",\"HResult\":\"OK\",\"HCount\":1,\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},";
@@ -1004,6 +1008,7 @@
                    }
                }
                CustomWriteLog("02", DateTime.Now.ToString("yyyy-MM-dd"));
                var  EquipmentStaus = await FindDeviceStatusByNos(Url, token, nos);
                for (int i = 0; i < EquipmentStaus.data.Count; i++)
@@ -1013,7 +1018,11 @@
                        || EquipmentStaus.data[i].no.Contains("CMR-ZD-SD")|| EquipmentStaus.data[i].no.Contains("CMR-ZS-SE-"))
                    {
                        string HBegDate = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
                        string HEndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        string HEndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");
                        if (DateTime.Parse(HEndDate).AddMinutes(1).ToString("yyyy-MM-dd") != DateTime.Parse(HEndDate).ToString("yyyy-MM-dd")) {
                            HEndDate= DateTime.Parse(HEndDate).AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00");
                        }
                        JsonResult HEqDate = await FindDeviceStatusTimeByNo(Url, token, EquipmentStaus.data[i].no, HBegDate, HEndDate);
@@ -1086,7 +1095,7 @@
                    }
                }
                CustomWriteLog("03", DateTime.Now.ToString("yyyy-MM-dd"));
                JsonData = JsonData.Substring(0, JsonData.Length - 1);
                JsonData += "]}";
                DataSave(JsonData);
@@ -1259,6 +1268,48 @@
            //光标选中制单人
            this.txtHMaker.Focus();
        }
        private static readonly object lockObj = new object();
        //写日志
        public static void CustomWriteLog(object obj, string FileName, string filePath = "Vlog", bool isAppend = true)
        {
            try
            {
                lock (lockObj)
                {
                    filePath = $@"{filePath}\{FileName}.txt";
                    filePath = AppDomain.CurrentDomain.BaseDirectory + filePath;
                    if (!System.IO.Directory.Exists(Path.GetDirectoryName(filePath)))
                    {
                        System.IO.Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                    }
                    bool fileExists = System.IO.File.Exists(filePath);
                    //不存在 则创建该文件
                    if (!fileExists)
                    {
                        System.IO.File.Create(filePath).Close();
                    }
                    using (StreamWriter writer = new StreamWriter(filePath, isAppend))
                    {
                        //存在的时候才写一行
                        if (fileExists && isAppend)
                        {
                            writer.WriteLine();
                        }
                        var content = obj is string ? obj : JsonConvert.SerializeObject(obj);
                        writer.WriteLine($"{DateTime.Now} {content}");
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
@@ -1361,5 +1412,5 @@
        public string Id { get; set; }
        public string Name { get; set; }
    }
}
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config
@@ -6,7 +6,7 @@
        <add key="sDataBase" value="HX_LMESsys_test"></add>
        <add key="sUser" value="HX_USER"></add>
        <add key="sPassword" value="lc@841022"></add>
        <add key="basePropIds" value="279,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,593, 594, 595, 597, 600, 601, 602, 603, 604, 605,609,608,610,611,612,613,614,615,616,617,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,643"></add>
        <add key="basePropIds" value="173,279,473,474,489,508,513, 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,593, 594, 595, 597, 600, 601, 602, 603, 604, 605,609,608,610,611,612,613,614,615,616,617,618,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,643,645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679"></add>
        <!--内部测试-->
        <!--<add key="sUrl" value="https://30.10.7.6:8066"></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/EquipmentCollectionForm.csproj.AssemblyReference.cache
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt
@@ -3,7 +3,6 @@
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\bin\Debug\EquipmentCollectionForm.pdb
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\bin\Debug\Newtonsoft.Json.dll
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\bin\Debug\Newtonsoft.Json.xml
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.csproj.AssemblyReference.cache
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.EquipmentCollectionForm.resources
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.Properties.Resources.resources
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.csproj.GenerateResource.cache
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/Program.cs
@@ -16,7 +16,7 @@
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ZZ_GlueWeigh());
            Application.Run(new ReadyDataForm());
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs
@@ -112,7 +112,7 @@
            // 
            // timer1
            // 
            this.timer1.Interval = 15000;
            this.timer1.Interval = 10000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // txtHBath
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs
@@ -22,8 +22,7 @@
            InitializeComponent();
        }
        public static int num = 0;
        public static DateTime time = DateTime.Now.AddMinutes(-5);
        //更换条形码
        private void btnGH_Click(object sender, EventArgs e)
@@ -51,6 +50,7 @@
                        string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString();
                        this.txtHBath.Text = HProjectNum.Split('-')[0];
                        this.txtHBardCode.ReadOnly = true;
                        list.Clear();
                    }
                    else {
                        MessageBox.Show(HBillNo + ",流转卡未开工!");
@@ -160,6 +160,7 @@
                ReadCsv();
            }
        }
        public static List<string> list = new List<string>();
        //读取csv格式文件
        private void ReadCsv()
@@ -176,7 +177,7 @@
            //注:斯莫尔组装3 在E盘  _332009
            //其余在D盘 _C332001_2M
            //string csv_file_path = $@"C:\Users\admin\Desktop\新建文件夹 (2)\20231123.csv";
            //string csv_file_path = $@"C:\Users\admin\Desktop\新建文件夹 (2)\250933P9_250403_C332001_2M.csv";
            string csv_file_path = $@"D:\THLCR_Data\{HBath}\{HBath}_{Date}_C332001_2M.csv"; //组装1 组装2路径 
            //string csv_file_path = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009.csv";  //组装3路径
            //15车间缺少路径 D:\DATA SAVE\年\年月\年月日\批次号\数据保存.csv
@@ -189,7 +190,7 @@
            {
                DataTable dt = new DataTable();
                string HTypeName = "无尘";
                //string csv_file_path_Read = @"C:\Users\admin\Desktop\新建文件夹 (2)\20231123_1.csv";
                //string csv_file_path_Read = @"C:\Users\admin\Desktop\新建文件夹 (2)\250933P9_250403_C332001_2M_1.csv";
                string csv_file_path_Read = $@"D:\THLCR_Data\{HBath}\{HBath}_{Date}_C332001_2M_Read.csv"; //组装1 组装2路径 
                //string csv_file_path_Read = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009_Read.csv";  //组装3路径
@@ -229,7 +230,7 @@
                parser.Close();
                //获取当前时间
                DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-120).ToString("yyyy-MM-dd  HH:mm:ss"));
                DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-20).ToString("yyyy-MM-dd  HH:mm:ss"));
                DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd  HH:mm:00"));
                bool flag_1 = false;
                bool flag_2 = false;
@@ -240,7 +241,7 @@
                        DateTime NowTime = DateTime.Parse(item["测试时间"].ToString());
                        string HBadCodeSN = item["序号"].ToString();
                        if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "")
                        if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "" && list.Contains(HBadCodeSN)==false)
                        {
                            string HSourceCode = this.HSouce.Text; //设备编号 组装1 9994 组装2 9995 组装3 9996
@@ -257,9 +258,9 @@
                                string HType = "";
                                int HCount = 1;
                                DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
                                //DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
                                if (ds.Tables[0].Rows.Count == 0)
                                if (true)
                                {
                                    if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1,out flag_2))
                                    {
@@ -267,6 +268,7 @@
                    values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
                                        oCN.RunProc(sql);
                                        ListSelect.Items.Add("条码:" + HBarCode + ",当前日期:" + DateTime.Now.ToString() + ",日期:" + HCreateTime + ",结果:" + HResult);
                                        list.Add(HBarCode);
                                        for (int i = 0; i < dt.Columns.Count; i++)
                                        {
@@ -372,10 +374,17 @@
            }
        }
        public static string AllProcessExchange = "-1";
        public static string AllProcessExchangeHProcExchBillNo = "";
        public static string AllProcessExchangeHProcExchInterID = "";
        public static string AllSNBarcodeProcCtrl = "";
        public static string AllHProcID = "0";
        public static string AllHProName = "";
        public static double AllHQty = 0;
        //根据条码 判断是否保存
        public bool Get_AllowLoadData(string HBarCode,string HProcNumber,bool flag_1,out bool flag_2)
        {
            decimal hqty = 2;
            if (HBarCode.Length != 29 && HBarCode.Length != 50)
            {
                flag_2 = false;
@@ -388,23 +397,28 @@
            if (HBarCode.Length == 29)
            {
                string str1 = HBarCode.Substring(18, 8);
                string str2 = HBarCode.Substring(23, 3);
                DataSet ds = oCN.RunProcReturn("select  HInterID,HBillNo from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%' or HProjectNum like'" + str2 + "-1%' order by HMakeDate desc", "Sc_ProcessExchangeBillMain");
                //判断是否能找到对应的流转卡
                if (ds.Tables[0].Rows.Count > 0)
                {
                     HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    HProcExchInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                }
                else {
                    if (!flag_1)
                //string str2 = HBarCode.Substring(23, 3);
                if (AllProcessExchange != str1) {
                    DataSet ds = oCN.RunProcReturn("select  HInterID,HBillNo from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%' order by HMakeDate desc", "Sc_ProcessExchangeBillMain");
                    //判断是否能找到对应的流转卡
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",流转卡不存在!");
                        AllProcessExchangeHProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                        AllProcessExchangeHProcExchInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
                    flag_2 = true;
                    return false;
                    else
                    {
                        if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                        {
                            time = DateTime.Now;
                            MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",流转卡不存在!");
                        }
                        DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
                        flag_2 = true;
                        return false;
                    }
                    AllProcessExchange = str1;
                }
            }
            //判断长度是否为50位  15车间
@@ -415,11 +429,12 @@
                //判断是否能找到对应的流转卡
                if (ds.Tables[0].Rows.Count > 0)
                {
                    HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    AllProcessExchangeHProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                }
                else {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + ",流转卡不存在!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -429,24 +444,41 @@
                }
            }
            //赋值
            HProcExchBillNo = AllProcessExchangeHProcExchBillNo;
            HProcExchInterID = AllProcessExchangeHProcExchInterID;
            //过站控制
            DataSet ds1 = oCN.RunProcReturn(@"select   b.HProcNo,b.HProcID,p.HName from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID
left join Gy_Process p WITH(NOLOCK) on  b.HProcID=p.HItemID
where a.HBillNo='" + HProcExchBillNo + "'  and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain");
            string HProcID = "0";
            if (ds1.Tables[0].Rows.Count > 0)
            DataSet ds1;
            if ((HProcExchBillNo + HProcNumber) != AllSNBarcodeProcCtrl) {
                //查询工序
                ds1 = oCN.RunProcReturn(@"SELECT  HItemID,HName FROM Gy_Process WHERE HNumber='" + HProcNumber + "'", "Gy_Process");
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    AllHProcID = ds1.Tables[0].Rows[0]["HItemID"].ToString();
                    AllHProName = ds1.Tables[0].Rows[0]["HName"].ToString();
                }
                //查询流转卡数量
                ds1 = oCN.RunProcReturn(@"SELECT  HQty FROM Sc_ProcessExchangeBillSub  where HInterID=" + HProcExchInterID + " and HProcID=" + AllHProcID, "Sc_ProcessExchangeBillSub");
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    AllHQty = double.Parse(ds1.Tables[0].Rows[0]["HQty"].ToString());
                }
                AllSNBarcodeProcCtrl = HProcExchBillNo + HProcNumber;
            }
            string HProcID = AllHProcID;
            string HProName = AllHProName;
            if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
            {
                HProcID = ds1.Tables[0].Rows[0]["HProcID"].ToString();
                string HProName = ds1.Tables[0].Rows[0]["HName"].ToString();
                ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBarCode + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                if (ds1.Tables[0].Rows.Count == 0)
                {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + "工序:" + HProName + ",工序控制查无数据!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + HProName + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -456,8 +488,9 @@
                }
                else if (ds1.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + "工序:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -468,15 +501,22 @@
            }
            //查询出站数量是否超过流转卡数量
            ds1 = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK)
left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID
where b.HInterID={HProcExchInterID} and b.HProcID={HProcID}
group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out");
            ds1 = oCN.RunProcReturn($@"select ({AllHQty}-sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_StationOutBillMain ou WITH(NOLOCK)
where ou.HProcExchInterID={HProcExchInterID} and ou.HProcID={AllHProcID}
group by  ou.HProcExchInterID,ou.HProcExchEntryID,ou.HQty", "Sc_StationOutBillMain");
            if (double.Parse(ds1.Tables[0].Rows[0][0].ToString()) < 0)
            double hqtyOut = AllHQty;
            if (ds1.Tables[0].Rows.Count > 0)
            {
                if (!flag_1)
                hqtyOut = double.Parse(ds1.Tables[0].Rows[0][0].ToString());
            }
            if (hqtyOut <= 0)
            {
                if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                {
                    time = DateTime.Now;
                    MessageBox.Show("流转卡:" + HProcExchBillNo + ",出站数量超过流转卡数量!");
                }
                DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",出站数量超过流转卡数量!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -484,28 +524,33 @@
                return false;
            }
            //增加产线组装追溯单
            DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                //判配件数量是否等于0
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            //拍照工序除外
            if (HProcNumber != "013") {
                //增加产线组装追溯单
                DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    double SYHQty = double.Parse(dataSet.Tables[0].Rows[i]["配件数量"].ToString());
                    string HMaterNamePJ = dataSet.Tables[0].Rows[i]["配件代码"].ToString();
                    string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                    if (SYHQty == 0)
                    //判配件数量是否等于0
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        if (!flag_1)
                        double SYHQty = double.Parse(dataSet.Tables[0].Rows[i]["配件数量"].ToString());
                        string HMaterNamePJ = dataSet.Tables[0].Rows[i]["配件代码"].ToString();
                        string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                        if (SYHQty == 0)
                        {
                            MessageBox.Show("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!");
                            if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                            {
                                time = DateTime.Now;
                                MessageBox.Show("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!");
                            }
                            DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!", DateTime.Now.ToString("yyyy-MM-dd"));
                            flag_2 = true;
                            return false;
                        }
                        DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!", DateTime.Now.ToString("yyyy-MM-dd"));
                        flag_2 = true;
                        return false;
                    }
                }
            }
            flag_2 = false;
            return true;
        }
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs
@@ -176,15 +176,17 @@
                            if (nums == 1)
                            {
                                dr["Characteristic"] = "FAI 3-16-3-" + (i + 1);
                                dr["Actual"] = dt2.Rows[0][dt2.Columns[j]].ToString();
                            }
                            else
                            {
                                dr["Characteristic"] = "FAI 3-16-1-" + (i + 1);
                                dr["Actual"] = dt2.Rows[0][dt2.Columns[j]].ToString();
                            }
                            dr["Actual"] = dt2.Rows[i][dt2.Columns[j]].ToString();
                            dt.Rows.Add(dr);
                            if (dt2.Rows[i][dt2.Columns[j]].ToString() != "") {
                                dt.Rows.Add(dr);
                            }
                            nums++;
                            if (nums == 2)
@@ -330,6 +332,7 @@
        //把数据显示在页面上
        public void ShowData(DataSet ds,string HNumber) {
            string HProcID = this.cmbPro.SelectedValue.ToString();
            //清空网格内容
            ListData.Items.Clear();
            //清空表格内容
@@ -355,7 +358,7 @@
inner join Gy_InspectInstruMent men  with(nolock) on b.HInspectInstruMentID=men.HItemID   and men.HNumber='"+ HNumber + @"'  
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");
where pr.HBillNo='" + this.txtLzk.Text + "' and a.HProcID="+ HProcID, "Gy_QCCheckProjectMain");
                if (dataSet.Tables[0].Rows.Count == 0)
                {
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs
@@ -41,6 +41,7 @@
            this.HSouceName = new System.Windows.Forms.TextBox();
            this.HSouce = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.btnSelectAll = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // btnReadData
@@ -108,7 +109,7 @@
            // 
            // timer1
            // 
            this.timer1.Interval = 15000;
            this.timer1.Interval = 10000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // HSouceName
@@ -136,11 +137,22 @@
            this.label2.TabIndex = 8;
            this.label2.Text = "生产资源";
            // 
            // btnSelectAll
            //
            this.btnSelectAll.Location = new System.Drawing.Point(177, 47);
            this.btnSelectAll.Name = "btnSelectAll";
            this.btnSelectAll.Size = new System.Drawing.Size(114, 35);
            this.btnSelectAll.TabIndex = 11;
            this.btnSelectAll.Text = "检索补漏";
            this.btnSelectAll.UseVisualStyleBackColor = true;
            this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
            //
            // ReadyDataForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 435);
            this.Controls.Add(this.btnSelectAll);
            this.Controls.Add(this.HSouceName);
            this.Controls.Add(this.HSouce);
            this.Controls.Add(this.label2);
@@ -172,6 +184,7 @@
        private System.Windows.Forms.TextBox HSouceName;
        private System.Windows.Forms.TextBox HSouce;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button btnSelectAll;
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs
@@ -24,7 +24,9 @@
            InitializeComponent();
        }
         public static int num = 0;
        public static int SelectTime = 0;
        public static DateTime time = DateTime.Now.AddMinutes(-5);
        public static decimal hqty = 2;
        //读取数据
        private void btnReadData_Click(object sender, EventArgs e)
        {
@@ -40,6 +42,7 @@
                    this.btnReadData.Text = "暂停";
                    this.timer1.Enabled = true;
                    num = 1;
                    SelectTime = -4;
                }
                else if (num == 1)
                {
@@ -111,6 +114,7 @@
            }
        }
        public static List<string> listData = new List<string>();
        //文本读取数据
        public void Read_Txt() {
@@ -122,12 +126,12 @@
            string dataTime = DateTime.Now.ToString("yyyyMMdd");
            ////判断是否有这个文件
            bool flag = File.Exists($@"D:\{year}\{month}\{day}\{dataTime}.txt");
            //bool flag = File.Exists($@"C:\Users\admin\Desktop\新建文件夹 (2)\20241128.txt");
            //bool flag = File.Exists($@"C:\Users\admin\Desktop\新建文件夹 (2)\20250403T拍照.txt");
            if (flag)
            {
                StreamReader stream = new StreamReader($@"D:\{year}\{month}\{day}\{dataTime}.txt", Encoding.GetEncoding("gb2312"));
                //StreamReader stream = new StreamReader($@"C:\Users\admin\Desktop\新建文件夹 (2)\20241128.txt", Encoding.GetEncoding("gb2312"));
                //StreamReader stream = new StreamReader($@"C:\Users\admin\Desktop\新建文件夹 (2)\20250403T拍照.txt", Encoding.GetEncoding("gb2312"));
                string FileData = stream.ReadToEnd();
                stream.Close();
@@ -184,6 +188,11 @@
            }
        }
        public static string AllBeginWork = "-1";
        public static string AllProcessExchange = "-1";
        public static string AllProcessExchangeHProcExchBillNo = "";
        public static string AllProcessExchangeHProcExchInterID = "";
        public void Xt_ReadText(string FileData)
        {
            FileData = FileData.Substring(0, FileData.Length - 1);
@@ -201,21 +210,21 @@
                list.Add(dic);
            }
            //获取当前时间
            DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-4).ToString("yyyy-MM-dd  HH:mm:ss"));
            DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(SelectTime).ToString("yyyy-MM-dd  HH:mm:ss"));
            DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd  HH:mm:00"));
            bool flag_1 = false;
            bool flag_2 = false;
            //循环集合
            for (int i = 0; i < list.Count; i++)
            {
                string HBarCode = list[i]["HBadCodeSN"].ToString();
                DateTime NowTime = DateTime.Parse(list[i]["HDate"].ToString());
                if (NowTime >= ActionTime && NowTime < EndTime && list[i]["HBadCodeSN"].ToString() != "")
                if (NowTime >= ActionTime && NowTime < EndTime && list[i]["HBadCodeSN"].ToString() != "" && listData.Contains(HBarCode)==false)
                {
                    string HSourceCode = list[i]["HSouceNumber"].ToString();
                    string HEmpCode = this.HEmpCode.Text;
                    //string HEmpCode = "";
                    string HType = list[i]["HBadReason"].ToString();
                    string HBarCode = list[i]["HBadCodeSN"].ToString();
                    int HCount = 1;
                    string HCreateTime = list[i]["HDate"].ToString();
                    string HDate = DateTime.Parse(list[i]["HDate"].ToString()).ToString("yyyy-MM-dd");
@@ -223,25 +232,43 @@
                    string HProcNumber = list[i]["HProcNumber"].ToString();
                    int HFlag = 0;
                    DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
                    //DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
                    if (ds.Tables[0].Rows.Count == 0)
                    if (true)
                    {
                        DataSet dataSet;
                        string HProjectNum = HBarCode.Substring(18, 8);
                        DataSet dataSet = oCN.RunProcReturn("select HBillNo from Sc_ProcessExchangeBillMain where HProjectNum='" + HProjectNum + "-1'", "Sc_ProcessExchangeBillMain");
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            string HBillNo = dataSet.Tables[0].Rows[0]["HBillNo"].ToString();
                            dataSet = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBillNo + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
                        if (HBarCode.Contains(AllProcessExchange)==false) {
                            if (dataSet.Tables[0].Rows.Count > 0)
                            dataSet = oCN.RunProcReturn("select HInterID,HBillNo from Sc_ProcessExchangeBillMain where HProjectNum='" + HProjectNum + "-1'", "Sc_ProcessExchangeBillMain");
                            if (dataSet.Tables[0].Rows.Count > 0) {
                                AllProcessExchangeHProcExchBillNo = dataSet.Tables[0].Rows[0]["HBillNo"].ToString();
                                AllProcessExchangeHProcExchInterID = dataSet.Tables[0].Rows[0]["HInterID"].ToString();
                                AllProcessExchange = HProjectNum;
                            }
                        }
                        if (AllProcessExchange == HProjectNum)
                        {
                            if (HBarCode.Contains(AllBeginWork) == false) {
                                dataSet = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + AllProcessExchangeHProcExchBillNo + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
                                if (dataSet.Tables[0].Rows.Count > 0)
                                {
                                    AllBeginWork = HProjectNum;
                                }
                            }
                            if (AllBeginWork == HProjectNum)
                            {
                                if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1, out flag_2))
                                if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1, AllProcessExchangeHProcExchBillNo, AllProcessExchangeHProcExchInterID, out flag_2))
                                {
                                    string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
                                    oCN.RunProc(sql);
                                    ListSelect.Items.Add("条码:" + HBarCode + ",当前日期;"+DateTime.Now.ToString()+",日期:" + HCreateTime + ",结果:" + HResult);
                                    listData.Add(HBarCode);
                                }
                                else
                                {
@@ -250,18 +277,20 @@
                            }
                            else
                            {
                                if (!flag_1)
                                if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                                {
                                    MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",对应的流转卡:" + HBillNo + ",流转卡未开工!");
                                    time = DateTime.Now;
                                    MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",对应的流转卡:" + AllProcessExchangeHProcExchBillNo + ",流转卡未开工!");
                                }
                                DBHelper.CustomWriteLog("条码:" + HBarCode + ",对应的流转卡:" + HBillNo + ",流转卡未开工!", DateTime.Now.ToString("yyyy-MM-dd"));
                                DBHelper.CustomWriteLog("条码:" + HBarCode + ",对应的流转卡:" + AllProcessExchangeHProcExchBillNo + ",流转卡未开工!", DateTime.Now.ToString("yyyy-MM-dd"));
                                flag_1 = true;
                            }
                        }
                        else
                        {
                            if (!flag_1)
                            if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                            {
                                time = DateTime.Now;
                                MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",流转卡不存在!");
                            }
                            DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -332,8 +361,13 @@
        }
        public static string AllSNBarcodeProcCtrl = "";
        public static string AllHProcID = "0";
        public static string AllHProName = "";
        public static double AllHQty = 0;
        //根据条码 判断是否保存
        public bool Get_AllowLoadData(string HBarCode, string HProcNumber, bool flag_1, out bool flag_2)
        public bool Get_AllowLoadData(string HBarCode, string HProcNumber, bool flag_1,string HProcExchBillNo,string HProcExchInterID, out bool flag_2)
        {
            if (HBarCode.Length != 29 && HBarCode.Length != 50)
            {
@@ -342,30 +376,9 @@
            }
            //判断长度是否为29位 无尘车间
            string HProcExchBillNo = "";
            string HProcExchInterID = "";
            if (HBarCode.Length == 29)
            {
                string str1 = HBarCode.Substring(18, 8);
                string str2 = HBarCode.Substring(23, 3);
                DataSet ds = oCN.RunProcReturn("select  HInterID,HBillNo from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%' or HProjectNum like'" + str2 + "-1%' order by HMakeDate desc", "Sc_ProcessExchangeBillMain");
                //判断是否能找到对应的流转卡
                if (ds.Tables[0].Rows.Count > 0)
                {
                    HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    HProcExchInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                }
                else
                {
                    if (!flag_1)
                    {
                        MessageBox.Show(new Form { TopMost = true }, "条码:" + HBarCode + ",流转卡不存在!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
                    flag_2 = true;
                    return false;
                }
            }
            //判断长度是否为50位  15车间
            else if (HBarCode.Length == 50)
@@ -379,8 +392,9 @@
                }
                else
                {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + ",流转卡不存在!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -389,55 +403,75 @@
                    return false;
                }
            }
            DataSet ds1;
            if ((HProcExchBillNo + HProcNumber) != AllSNBarcodeProcCtrl) {
                //查询工序
                ds1 = oCN.RunProcReturn(@"SELECT  HItemID,HName FROM Gy_Process WHERE HNumber='" + HProcNumber + "'", "Gy_Process");
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    AllHProcID = ds1.Tables[0].Rows[0]["HItemID"].ToString();
                    AllHProName = ds1.Tables[0].Rows[0]["HName"].ToString();
                }
                //查询流转卡数量
                ds1 = oCN.RunProcReturn(@"SELECT  HQty FROM Sc_ProcessExchangeBillSub  where HInterID=" + HProcExchInterID + " and HProcID=" + AllHProcID, "Sc_ProcessExchangeBillSub");
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    AllHQty = double.Parse(ds1.Tables[0].Rows[0]["HQty"].ToString());
                }
                AllSNBarcodeProcCtrl = HProcExchBillNo + HProcNumber;
            }
            //过站控制
            DataSet ds1 = oCN.RunProcReturn(@"select   b.HProcNo,b.HProcID,p.HName from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID
left join Gy_Process p WITH(NOLOCK) on  b.HProcID=p.HItemID
where a.HBillNo='" + HProcExchBillNo + "'  and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain");
            string HProcID = "0";
            if (ds1.Tables[0].Rows.Count > 0)
            if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
            {
                HProcID = ds1.Tables[0].Rows[0]["HProcID"].ToString();
                string HProName = ds1.Tables[0].Rows[0]["HName"].ToString();
                ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBarCode + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                //过站控制
                ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBarCode + "'," + AllHProcID, "h_p_Sc_SNBarcodeProcCtrl_S");
                if (ds1.Tables[0].Rows.Count == 0)
                {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        MessageBox.Show("条码:" + HBarCode + "工序:" + HProName + ",工序控制查无数据!");
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + "工序:" + AllHProName + ",工序控制查无数据!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + HProName + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + AllHProName + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    flag_2 = true;
                    return false;
                }
                else if (ds1.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    if (!flag_1)
                    if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                    {
                        MessageBox.Show("条码:" + HBarCode + "工序:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!");
                        time = DateTime.Now;
                        MessageBox.Show("条码:" + HBarCode + "工序:" + AllHProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!");
                    }
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + HProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    DBHelper.CustomWriteLog("条码:" + HBarCode + "工序:" + AllHProcID + "," + ds1.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    flag_2 = true;
                    return false;
                }
            }
            //查询出站数量是否超过流转卡数量
            ds1 = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK)
left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID
where b.HInterID={HProcExchInterID} and b.HProcID={HProcID}
group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out");
                //查询出站数量是否超过流转卡数量
                ds1 = oCN.RunProcReturn($@"select ({AllHQty}-sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_StationOutBillMain ou WITH(NOLOCK)
where ou.HProcExchInterID={HProcExchInterID} and ou.HProcID={AllHProcID}
group by  ou.HProcExchInterID,ou.HProcExchEntryID,ou.HQty", "Sc_StationOutBillMain");
            double hqtyOut = AllHQty;
            if (double.Parse(ds1.Tables[0].Rows[0][0].ToString()) < 0)
            if (ds1.Tables[0].Rows.Count > 0) {
                hqtyOut = double.Parse(ds1.Tables[0].Rows[0][0].ToString());
            }
            if (hqtyOut <= 0)
            {
                if (!flag_1)
                if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                {
                    time = DateTime.Now;
                    MessageBox.Show("流转卡:" + HProcExchBillNo + ",出站数量超过流转卡数量!");
                }
                DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",出站数量超过流转卡数量!", DateTime.Now.ToString("yyyy-MM-dd"));
@@ -445,28 +479,34 @@
                return false;
            }
            //增加产线组装追溯单
            DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
            if (dataSet.Tables[0].Rows.Count > 0)
            //拍照工序除外
            if (HProcNumber != "013")
            {
                //判配件数量是否等于0
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                //增加产线组装追溯单
                DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + AllHProcID, "h_p_Gy_BarCodeBillBomList");
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    double SYHQty = double.Parse(dataSet.Tables[0].Rows[i]["配件数量"].ToString());
                    string HMaterNamePJ = dataSet.Tables[0].Rows[i]["配件代码"].ToString();
                    string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                    if (SYHQty == 0)
                    //判配件数量是否等于0
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        if (!flag_1)
                        double SYHQty = double.Parse(dataSet.Tables[0].Rows[i]["配件数量"].ToString());
                        string HMaterNamePJ = dataSet.Tables[0].Rows[i]["配件代码"].ToString();
                        string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                        if (SYHQty == 0)
                        {
                            MessageBox.Show("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!");
                            if (!flag_1 && (DateTime.Now - time).Minutes > hqty)
                            {
                                time = DateTime.Now;
                                MessageBox.Show("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!");
                            }
                            DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!", DateTime.Now.ToString("yyyy-MM-dd"));
                            flag_2 = true;
                            return false;
                        }
                        DBHelper.CustomWriteLog("流转卡:" + HProcExchBillNo + ",配件条码:" + HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!", DateTime.Now.ToString("yyyy-MM-dd"));
                        flag_2 = true;
                        return false;
                    }
                }
            }
            flag_2 = false;
            return true;
        }
@@ -482,5 +522,23 @@
                e.Cancel = true;
            }
        }
        private void btnSelectAll_Click(object sender, EventArgs e)
        {
            if (num == 0)
            {
                if (MessageBox.Show("是否启用检索补漏?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    SelectTime = -90;
                    Read_Txt();
                }
            }
            else if (num == 1)
            {
                MessageBox.Show("请先点击暂停按钮!");
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Config/SQLAPI.config
@@ -2,14 +2,14 @@
<configuration>
    <appSettings>
        <!--斯莫尔-->
        <add key="sServer" value="30.10.7.6"></add>
        <!--<add key="sServer" value="30.10.7.6"></add>
        <add key="sDataBase" value="HX_LMESsys_test"></add>
        <add key="sUser" value="HX_USER"></add>
        <add key="sPassword" value="lc@841022"></add>
        <add key="sPassword" value="lc@841022"></add>-->
        <!--47-->
        <!--<add key="sServer" value="47.96.97.237,15127"></add>
        <add key="sServer" value="47.96.97.237,15127"></add>
        <add key="sDataBase" value="HX_LMESsys"></add>
        <add key="sUser" value="HX_USER"></add>
        <add key="sPassword" value="lc@841022"></add>-->
        <add key="sPassword" value="lc@841022"></add>
    </appSettings>
</configuration>
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Vlog/2025-04-04.txt
New file
Diff too large
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/bin/Debug/WFormReadData_SMR.rar
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
@@ -36,4 +36,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.csproj.AssemblyReference.cache
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
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs
@@ -38,7 +38,7 @@
            // timer1
            // 
            timer1.Enabled = true;
            timer1.Interval = 15000;
            timer1.Interval = 5000;
            timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // btnReadData
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -24,8 +25,11 @@
        //读取数据
        private void btnReadData_Click(object sender, EventArgs e)
        {
            DataTable list = oCN.RunProcReturn("select  * from Sb_EquipMentCollection_SN  WITH(NOLOCK) where HFlag=0  order by HCreateTime", "Sb_EquipMentCollection_SN").Tables[0];
            Stopwatch timer = new Stopwatch();
            timer.Start();
            CustomWriteLog("1.计时器开始:"+timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
            DataTable list = oCN.RunProcReturn("select top 150 * from Sb_EquipMentCollection_SN  WITH(NOLOCK) where HFlag=0  order by HCreateTime", "Sb_EquipMentCollection_SN").Tables[0];
          
            //循环集合
            for (int i = 0; i < list.Rows.Count; i++)
@@ -36,7 +40,7 @@
                string HCreateTime = list.Rows[i]["HCreateTime"].ToString();
                //开始事务
                oCN.BeginTran();
                CustomWriteLog("2.循环开始:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (HResult == "OK")
                {
                    flag=HResultOK(list.Rows[i]);
@@ -46,6 +50,7 @@
                    flag = HResultNG(list.Rows[i]);
                }
                CustomWriteLog("2-1.循环结束:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (flag) {
                    oCN.RunProc("update Sb_EquipMentCollection_SN set HFlag=1 where HBarCode='" + HBadCodeSN + "' and HCreateTime='"+ HCreateTime + "'");
                    //结束事务
@@ -53,16 +58,25 @@
                }
              
            }
            CustomWriteLog("3.结束计时:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
            timer.Stop();//结束计时
        }
        public bool HResultOK(DataRow dic)
        {
            try
            {
                Stopwatch timer = new Stopwatch();
                timer.Start();
                CustomWriteLog("2.1.开始ok:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                bool flag = false;
                string HBadCodeSN = dic["HBarCode"].ToString();
                HBadCodeSN = TM_ZH(HBadCodeSN);
                int num = SNHBardCodeList(HBadCodeSN);
                CustomWriteLog("2.2.条码生成:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (num == 0)
                {
@@ -74,11 +88,17 @@
                    DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN  WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' and HCreateTime<'" + dic["HCreateTime"].ToString() + "' and HResult='NG'", "Sb_EquipMentCollection_SN");
                    //查询出站单是否包含条码
                    DataSet ds1 = oCN.RunProcReturn(@"select a.HSourceID,a.HProcID,* from Sc_StationOutBillMain a WITH(NOLOCK)
                    //                    DataSet ds1 = oCN.RunProcReturn(@"select a.HSourceID,a.HProcID,* from Sc_StationOutBillMain a WITH(NOLOCK)
                    //inner join Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID
                    //left join Gy_Source s WITH(NOLOCK) on a.HSourceID=s.HItemID
                    //left join Gy_Process p WITH(NOLOCK) on a.HProcID=p.HItemID
                    //where  p.HNumber='" + dic["HProcNumber"].ToString() + "' and sn.HBarCode='" + HBadCodeSN + "'", "Sc_StationOutBillSub_SN");
                    DataSet ds1 = oCN.RunProcReturn(@"select a.HProcID from Sc_StationOutBillMain a WITH(NOLOCK)
inner join Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID
left join Gy_Source s WITH(NOLOCK) on a.HSourceID=s.HItemID
left join Gy_Process p WITH(NOLOCK) on a.HProcID=p.HItemID
where  p.HNumber='" + dic["HProcNumber"].ToString() + "' and sn.HBarCode='" + HBadCodeSN + "'", "Sc_StationOutBillSub_SN");
                    if (ds.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows.Count == 0)
                    {
@@ -101,6 +121,9 @@
                {
                    flag = false;
                }
                CustomWriteLog("2.5.结束计时:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                timer.Stop();//结束计时
                return flag;
            }
@@ -156,10 +179,15 @@
        {
            try
            {
                Stopwatch timer = new Stopwatch();
                timer.Start();
                CustomWriteLog("2.1.1.出站单新增开始:" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                //获取绑定流转卡
                DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                string HProcNumber = dic["HProcNumber"].ToString();
                CustomWriteLog("2.1.2.绑定流转卡:"+ HProcNumber+"----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
@@ -167,6 +195,8 @@
                {
                    HSourceID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产资源ID
                }
                CustomWriteLog("2.1.3.获取生产资源:" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                //查询职员
                ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
@@ -177,6 +207,8 @@
                    HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                    HEmpName = ds.Tables[0].Rows[0]["HName"].ToString();
                }
                CustomWriteLog("2.1.4.查询职员信息:" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                long HDeptID = 0;
                long HPRDOrgIDs = 0;
@@ -196,12 +228,16 @@
                    HDeptID = 0;
                }
                CustomWriteLog("2.1.5.获取客户信息:" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                ds = oCN.RunProcReturn(@"select   a.HWorkShopID,b.HProcNo,b.HProcID,a.HMaterID,a.HQty,a.HInterID,HEntryID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,b.HCenterID  from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID
left join Gy_Process p WITH(NOLOCK) on  b.HProcID=p.HItemID 
where a.HBillNo='" + HProcExchBillNo + "'  and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain");
                CustomWriteLog("2.1.6.查询流转卡信息:" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                string sExeReturnInfo = "";
                long HMainInterID = 0;
@@ -272,30 +308,36 @@
                string HBillNo = "";
                int HShiftsID = 0;
                CustomWriteLog("2.1.7给字段赋值 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                DataSet set= oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + HWorkShopID + "," + HCenterID, "h_p_Gy_GetWorkShiftInfo");
                if (set.Tables[0].Rows.Count > 0) {
                    HShiftsID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
                }
                ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                CustomWriteLog("2.1.8获取班次信息 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                //ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                //if (ds.Tables[0].Rows.Count == 0)
                //{
                //    oCN.RollBack();
                //    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                //    return false;
                //}
                //else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                //{
                //    oCN.RollBack();
                //    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                //    return false;
                //}
                //判断当前流转卡的出站单 是否有数据
                ds = oCN.RunProcReturn(@"select  * from Sc_StationOutBillMain a WITH(NOLOCK)
left join Gy_Process p WITH(NOLOCK) on  a.HProcID=p.HItemID
where HProcExchBillNo='" + HProcExchBillNo + "' and p.HNumber='" + HProcNumber + "' and CONVERT(varchar(10),HDate,20) ='" + DateTime.Now.ToString("yyyy-MM-dd") + "'", "Sc_StationOutBillMain");
                CustomWriteLog("2.1.9获取是否有出站单 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (ds.Tables[0].Rows.Count != 0)
                {
@@ -332,8 +374,11 @@
                 "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + ","+ HShiftsID + ") ");
                }
                CustomWriteLog("2.1.10 出站单新增 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (HResult == "OK")
                {
                    CustomWriteLog("2.1.11 条码反写 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    ds = oCN.RunProcReturn("select  * from Sc_StationOutBillSub_SN WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN");
                    string HMakeTime = dic["HCreateTime"].ToString();
@@ -343,9 +388,11 @@
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcNumber + ",出站时间:" + HMakeTime, "TM" + DateTime.Now.ToString("yyyy-MM-dd"));
                    //反写工序出站单的合格数量
                    oCN.RunProc("update Sc_StationOutBillMain  set HQty+=1  where HInterID='" + HInterID + "'");
                    CustomWriteLog("2.1.12 条码反写 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else if (HResult == "NG")
                {
                    CustomWriteLog("2.1.13 不合格反写 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    ds = oCN.RunProcReturn("select  * from Sc_QualityReportBillSub WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' order by HMakeDate desc", "Sc_QualityReportBillSub");
                    if (ds.Tables[0].Rows.Count > 0) {
@@ -358,14 +405,16 @@
                            if (DateTime.Parse(HBadDate) < DateTime.Parse(HRepairDate)) {
                                //反写工序出站单的不良数量
                                oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1 where HInterID='" + HInterID + "'");
                                oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1,HWasterQty_Work+=1 where HInterID='" + HInterID + "'");
                            }
                        }
                    } else {
                        //反写工序出站单的不良数量
                        oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1 where HInterID='" + HInterID + "'");
                        oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1,HWasterQty_Work+=1 where HInterID='" + HInterID + "'");
                    }
                    CustomWriteLog("2.1.14 不合格反写 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else
                {
@@ -374,18 +423,29 @@
                    return false;
                }
                //查询出站数量是否超过流转卡数量
                ds = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK)
left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID
where b.HInterID={HProcExchInterID} and b.HEntryID={HProcExchEntryID}
group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out");
                //                //查询出站数量是否超过流转卡数量
                //                ds = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK)
                //left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID
                //where b.HInterID={HProcExchInterID} and b.HEntryID={HProcExchEntryID}
                //group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out");
                if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0)
                //                if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0)
                //                {
                //                    oCN.RollBack();
                //                    CustomWriteLog("流转卡:"+ HProcExchBillNo + ",出站数量超过流转卡数量!", DateTime.Now.ToString("yyyy-MM-dd"));
                //                    return false;
                //                }
                CustomWriteLog("2.1.15 反写结束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                //增加工序判断
                if (HProcNumber == "013")
                {
                    oCN.RollBack();
                    CustomWriteLog("流转卡:"+ HProcExchBillNo + ",出站数量超过流转卡数量!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                    return true;
                }
                CustomWriteLog("2.1.16 工艺参数绑定 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                bool flag = false;
@@ -397,12 +457,17 @@
                    CustomWriteLog("系统参数保存失败,条码:" + HBadCodeSN, DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                CustomWriteLog("2.1.17 工艺参数绑定结束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                //增加产线组装追溯单
                DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                CustomWriteLog("2.1.18 产线组装追溯单查询 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    CustomWriteLog("2.1.19 产线组装追溯单数量判断 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    //判配件数量是否等于0
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
@@ -415,6 +480,7 @@
                            return false;
                        }
                    }
                    CustomWriteLog("2.1.20 产线组装追溯单数量判断结束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    //查询职员
@@ -425,6 +491,8 @@
                        HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                        HMakers = ds.Tables[0].Rows[0]["HName"].ToString();
                    }
                    CustomWriteLog("2.1.21 职员查询 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    Int64 HInterID1 = CreateBillID("3727", ref sExeReturnInfo);
                    string HBillNo1 = CreateBillCode_Prod("3727", ref sExeReturnInfo, true);
@@ -437,6 +505,9 @@
,'{HBillNo1}','1','{HMakers}',getdate(),{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}'
,{HICMOInterID},'{HICMOBillNo}','{HBadCodeSN}',{HMaterID},0,'汇报',{HPRDOrgIDs})";
                    oCN.RunProc(sql);
                    CustomWriteLog("2.1.22 保存主表 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
@@ -451,8 +522,11 @@
                ,0,0,getdate(),'{HBarCodes}','{HBadCodeSN}','') ";
                        oCN.RunProc(sq2);
                    }
                }
                    CustomWriteLog("2.1.23 保存子表 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                }
                CustomWriteLog("2.1.24计时器结束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                timer.Stop();//结束计时
                return true;
            }
            catch (Exception e)
@@ -469,11 +543,11 @@
            try
            {
                //获取绑定流转卡
                DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                DataSet ds = oCN.RunProcReturn(@"select HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                string HProcNumber = dic["HProcNumber"].ToString();
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                ds = oCN.RunProcReturn("select HItemID from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
@@ -481,7 +555,7 @@
                }
                //查询职员
                ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                ds = oCN.RunProcReturn("select HItemID from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                long HEmpIDs = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
@@ -523,26 +597,26 @@
                long HInterID = 0;
                string HBillNo = "";
                ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                //ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                //if (ds.Tables[0].Rows.Count == 0)
                //{
                //    oCN.RollBack();
                //    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                //    return false;
                //}
                //else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                //{
                //    oCN.RollBack();
                //    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                //    return false;
                //}
                ds = oCN.RunProcReturn("select  * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID=" + HProcExchInterID + " and HMainSourceEntryID=" + HProcExchEntryID, "Sc_AssemblyBillMain");
                ds = oCN.RunProcReturn("select  HDate from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID=" + HProcExchInterID + " and HMainSourceEntryID=" + HProcExchEntryID, "Sc_AssemblyBillMain");
                DateTime HDate=DateTime.Now;
                //当产品没有配件的时候 查询 不良记录
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ds = oCN.RunProcReturn("select  * from Sc_QualityReportBillSub WITH(NOLOCK) where HProcExchInterID=" + HProcExchInterID + " and HProcExchEntryID=" + HProcExchEntryID+ " and HBarCode='" + HBadCodeSN + "'", "Sc_AssemblyBillMain");
                    ds = oCN.RunProcReturn("select HMakeDate from Sc_QualityReportBillSub WITH(NOLOCK) where HProcExchInterID=" + HProcExchInterID + " and HProcExchEntryID=" + HProcExchEntryID+ " and HBarCode='" + HBadCodeSN + "'", "Sc_AssemblyBillMain");
                    HDate = DateTime.Parse(ds.Tables[0].Rows[0]["HMakeDate"].ToString());
                }
                else {
@@ -563,7 +637,7 @@
                }
                //判断当前流转卡的出站单 是否有数据
                ds = oCN.RunProcReturn(@"select  * from Sc_StationOutBillMain a WITH(NOLOCK)
                ds = oCN.RunProcReturn(@"select  HInterID,HBillNo from Sc_StationOutBillMain a WITH(NOLOCK)
left join Gy_Process p WITH(NOLOCK) on  a.HProcID=p.HItemID
where HProcExchBillNo='" + HProcExchBillNo + "' and p.HNumber='" + HProcNumber + "' and CONVERT(varchar(10),HDate,20) ='" + HDate.ToString("yyyy-MM-dd") + "'", "Sc_StationOutBillMain");
@@ -575,7 +649,7 @@
                if (HResult == "OK")
                {
                    ds = oCN.RunProcReturn("select  * from Sc_StationOutBillSub_SN  WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN");
                    ds = oCN.RunProcReturn("select  HInterID,HEntryID from Sc_StationOutBillSub_SN  WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN");
                    string HMakeTime = dic["HCreateTime"].ToString();
                    oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)
@@ -958,7 +1032,7 @@
                }
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                ds = oCN.RunProcReturn("select HItemID from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
@@ -994,7 +1068,7 @@
,HMaterID,HUnitID,HRemark,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType
,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
,HQty,HResult,HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HProcID) 
values({HInterID},1,'{HBillNo}',{HEmpID},'{HBarCode}',0,'','{HMaker}','{HMakeDate}'
values({HInterID},1,'{HBillNo}',{HEmpID},'{HBarCode}',219,'','{HMaker}','{HMakeDate}'
,{HMaterID},{ HUnitID},'',{HSourceID},{ HICMOInterID},{ HICMOEntryID},'{HICMOBillNo}',0
,0,0,'','',0,0
,1,'{HResult}',{ HProcExchInterID},{ HProcExchEntryID},'{ HProcExchBillNo}'," + HProcID + ")");
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.Designer.cs
New file
@@ -0,0 +1,72 @@

namespace WFormSynchronizeData_SMR
{
    partial class FormBack
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.Windows.Forms.Timer timer1;
            this.btnReadData = new System.Windows.Forms.Button();
            timer1 = new System.Windows.Forms.Timer(this.components);
            this.SuspendLayout();
            //
            // timer1
            //
            timer1.Enabled = true;
            timer1.Interval = 5000;
            timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // btnReadData
            //
            this.btnReadData.Location = new System.Drawing.Point(77, 49);
            this.btnReadData.Name = "btnReadData";
            this.btnReadData.Size = new System.Drawing.Size(114, 35);
            this.btnReadData.TabIndex = 0;
            this.btnReadData.Text = "读取数据";
            this.btnReadData.UseVisualStyleBackColor = true;
            this.btnReadData.Click += new System.EventHandler(this.btnReadData_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(299, 155);
            this.Controls.Add(this.btnReadData);
            this.Name = "Form1";
            this.Text = "Form1";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.Button btnReadData;
    }
}
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.cs
New file
@@ -0,0 +1,1228 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace WFormSynchronizeData_SMR
{
    public partial class FormBack : Form
    {
        public DBHelper oCN = new DBHelper();
        public FormBack()
        {
            InitializeComponent();
        }
        //读取数据
        private void btnReadData_Click(object sender, EventArgs e)
        {
            DataTable list = oCN.RunProcReturn("select  * from Sb_EquipMentCollection_SN  WITH(NOLOCK) where HFlag=0  order by HCreateTime", "Sb_EquipMentCollection_SN").Tables[0];
            //循环集合
            for (int i = 0; i < list.Rows.Count; i++)
            {
                bool flag = false;
                string HResult = list.Rows[i]["HResult"].ToString();
                string HBadCodeSN = list.Rows[i]["HBarCode"].ToString();
                string HCreateTime = list.Rows[i]["HCreateTime"].ToString();
                //开始事务
                oCN.BeginTran();
                if (HResult == "OK")
                {
                    flag=HResultOK(list.Rows[i]);
                }
                else if (HResult == "NG")
                {
                    flag = HResultNG(list.Rows[i]);
                }
                if (flag) {
                    oCN.RunProc("update Sb_EquipMentCollection_SN set HFlag=1 where HBarCode='" + HBadCodeSN + "' and HCreateTime='"+ HCreateTime + "'");
                    //结束事务
                    oCN.Commit();
                }
            }
        }
        public bool HResultOK(DataRow dic)
        {
            try
            {
                bool flag = false;
                string HBadCodeSN = dic["HBarCode"].ToString();
                HBadCodeSN = TM_ZH(HBadCodeSN);
                int num = SNHBardCodeList(HBadCodeSN);
                if (num == 0)
                {
                    flag = getOutBillAdd(dic, HBadCodeSN, "OK");
                }
                else if (num == 1)
                {
                    //判断这个条码之前的状态是否为NG
                    DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN  WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' and HCreateTime<'" + dic["HCreateTime"].ToString() + "' and HResult='NG'", "Sb_EquipMentCollection_SN");
                    //查询出站单是否包含条码
                    DataSet ds1 = oCN.RunProcReturn(@"select a.HSourceID,a.HProcID,* from Sc_StationOutBillMain a WITH(NOLOCK)
inner join Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID
left join Gy_Source s WITH(NOLOCK) on a.HSourceID=s.HItemID
left join Gy_Process p WITH(NOLOCK) on a.HProcID=p.HItemID
where  p.HNumber='" + dic["HProcNumber"].ToString() + "' and sn.HBarCode='" + HBadCodeSN + "'", "Sc_StationOutBillSub_SN");
                    if (ds.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows.Count == 0)
                    {
                        flag = getOKOutBillAdd(dic, HBadCodeSN, "OK");
                    }
                    else
                    {
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            flag = true;
                            //oCN.RollBack();
                        }
                        else
                        {
                            flag = getOutBillAdd(dic, HBadCodeSN, "OK");
                        }
                    }
                }
                else if (num == 2)
                {
                    flag = false;
                }
                return flag;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                string HBadCodeSN = dic["HBarCode"].ToString();
                CustomWriteLog("条码:" + HBadCodeSN + ",错误原因:" + e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        public bool HResultNG(DataRow dic)
        {
            try
            {
                bool flag = false;
                int num = 0;
                string HBadCodeSN = dic["HBarCode"].ToString();
                HBadCodeSN = TM_ZH(HBadCodeSN);
                num = SNHBardCodeList(HBadCodeSN);
                if (num == 0 || num == 1)
                {
                    flag = getOutBillAdd(dic, HBadCodeSN, "NG");
                    if (flag)
                    {
                        //新增不良汇报
                        flag = getBadBillAdd(dic);
                        //反写条码状态
                        oCN.RunProc("update Gy_BarCodeBill set HStatus='不良',HRemark='" + dic["HType"].ToString() + "' where HBarCode='" + HBadCodeSN + "'");
                    }
                }
                else if (num == 2)
                {
                    flag = false;
                }
                return flag;
            }
            catch (Exception e)
            {
                //回滚事务
                oCN.RollBack();
                string HBadCodeSN = dic["HBarCode"].ToString();
                CustomWriteLog("条码:" + HBadCodeSN + ",错误原因:"+e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        //新增出站汇报单
        public bool getOutBillAdd(DataRow dic, string HBadCodeSN, string HResult)
        {
            try
            {
                //获取绑定流转卡
                DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                string HProcNumber = dic["HProcNumber"].ToString();
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HSourceID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产资源ID
                }
                //查询职员
                ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                long HEmpIDs = 0;
                string HEmpName = "";
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                    HEmpName = ds.Tables[0].Rows[0]["HName"].ToString();
                }
                long HDeptID = 0;
                long HPRDOrgIDs = 0;
                string sReturn = "";
                if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔")
                {
                    HDeptID = 389505;
                    HPRDOrgIDs = 100199;
                }
                else {
                    //ds = oCN.RunProcReturn("select * from Gy_Department where HNumber='" + dic["HDeptNumber"].ToString() + "' ", "Gy_Department");
                    //if (ds.Tables[0].Rows.Count != 0)
                    //{
                    //    HDeptID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产部门
                    //}
                    HDeptID = 0;
                }
                ds = oCN.RunProcReturn(@"select   a.HWorkShopID,b.HProcNo,b.HProcID,a.HMaterID,a.HQty,a.HInterID,HEntryID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,b.HCenterID  from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID
left join Gy_Process p WITH(NOLOCK) on  b.HProcID=p.HItemID
where a.HBillNo='" + HProcExchBillNo + "'  and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain");
                string sExeReturnInfo = "";
                long HMainInterID = 0;
                string BillType = "3791";
                string HBillSubType = "3791";
                string HWorkShopID= ds.Tables[0].Rows[0]["HWorkShopID"].ToString();
                int HBillStatus = 1;
                string HMaker = HEmpName;//制单人
                string HMouldNum = "";//模穴号
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = "";//备注
                string HSourceName = "";//生产资源名称
                double HPieceQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());//进站PCS数
                double HWasterQty = 0;//报废数量
                double HPlanPieceQty = 0;//进站PNL数
                double HBadPNL = 0;//报废PNL数
                long HICMOInterID = long.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());//任务单ID
                long HICMOEntryID = long.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());//任务单ID
                string HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();//任务单
                int HProcPlanInterID = 0;
                int HProcPlanEntryID = 0;
                string HProcPlanBillNo = "";
                long HProcExchInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString());
                long HProcExchEntryID = long.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString());
                long HMaterID = long.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());//产品ID
                long HProcID = long.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());//当前工序ID
                double HICMOQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());//任务单数量
                double HPlanQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());//移交PNL数
                DateTime HStationOutTime = DateTime.Now;//汇报时间
                long HPayProcID = 0;//核算工序ID
                long HGroupID = 22;//班组ID 白班
                long HEmpID = HEmpIDs;//操作员ID
                long HEmpID2 = HEmpIDs;////操作员2ID
                string HBarCode = HProcExchBillNo;//条形码
                string HAddr = "";
                string HBarCodeMaker = "";
                long HSourceID2 = 0;//生产资源2ID
                long HSourceID3 = 0;//生产资源3ID
                long HSourceID4 = 0;//生产资源4ID
                long HSourceID5 = 0;//生产资源5ID
                long HSupID = 0;
                double HQty = 0;//合格数量
                double HPrice = 0;
                double HMoney = 0;
                double HBadCount = 0;//不良数量
                long HCenterID = long.Parse(ds.Tables[0].Rows[0]["HCenterID"].ToString());//工作中心ID
                string HProcNo = ds.Tables[0].Rows[0]["HProcNo"].ToString();//流水号
                string HOrderProcNO = "";//订单跟踪号
                string HSourceNameList = "";//设备清单
                string HMainSourceBillType = "3790";
                bool HLastSubProc = false;//转下工序
                long HEmpID3 = 0;//操作员3ID
                long HEmpID4 = 0;//操作员4ID
                long HEmpID5 = 0;//操作员5ID
                double HDSQty = 0;//折弯刀数
                double HChongQty = 0;//NCT冲次数
                double HPriceRate = 0;//系数
                double HWorkTimes = 0;//工时
                long HQCCheckID = 0;//检验员ID
                long HPRDOrgID = HPRDOrgIDs;//组织ID
                double HmaterOutqty = 0;//白坯发布
                double HProcPriceRate = 0;//工价系数
                int HTemporaryAreaID = 0;//暂放区
                long HInterID = 0;
                string HBillNo = "";
                int HShiftsID = 0;
                DataSet set= oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + HWorkShopID + "," + HCenterID, "h_p_Gy_GetWorkShiftInfo");
                if (set.Tables[0].Rows.Count > 0) {
                    HShiftsID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
                }
                ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                //判断当前流转卡的出站单 是否有数据
                ds = oCN.RunProcReturn(@"select  * from Sc_StationOutBillMain a WITH(NOLOCK)
left join Gy_Process p WITH(NOLOCK) on  a.HProcID=p.HItemID
where HProcExchBillNo='" + HProcExchBillNo + "' and p.HNumber='" + HProcNumber + "' and CONVERT(varchar(10),HDate,20) ='" + DateTime.Now.ToString("yyyy-MM-dd") + "'", "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString());
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();//递入type得到的单据号
                }
                if (ds.Tables[0].Rows.Count == 0)
                {
                    HInterID = CreateBillID("3791", ref sExeReturnInfo);//递入type得到的单据ID
                    HBillNo = CreateBillCode_Prod("3791", ref sExeReturnInfo, true);//递入type得到的单据号
                    long HMainSourceInterID = HInterID;//递入type得到的单据ID
                    string HMainSourceBillNo = HBillNo;//递入type得到的单据号
                    oCN.RunProc("Insert Into Sc_StationOutBillMain " +
                   "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" +
                   ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" +
                   ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
                   ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID,HPayProcID" +
                   ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" +
                   ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" +
                   ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
                   ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
                   ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HShiftsID" +
                   ") " +
                   " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                   "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
                   "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID +
                   ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + "," + HPayProcID +
                   "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + "," + HSourceID2 + "," + HSourceID3 + "," + HSourceID4 + "," + HSourceID5 +
                   "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" +
                   "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
                   "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
                 "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + ","+ HShiftsID + ") ");
                }
                if (HResult == "OK")
                {
                    ds = oCN.RunProcReturn("select  * from Sc_StationOutBillSub_SN WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN");
                    string HMakeTime = dic["HCreateTime"].ToString();
                    oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)
values({ HInterID}, '{ HBillNo}', {(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)}, '{HBadCodeSN}', 1, '"+ HMakeTime + "', '', " + HProcExchInterID + "," + HProcExchEntryID + ", '" + HProcExchBillNo + "', '', 0, 0)");
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcNumber + ",出站时间:" + HMakeTime, "TM" + DateTime.Now.ToString("yyyy-MM-dd"));
                    //反写工序出站单的合格数量
                    oCN.RunProc("update Sc_StationOutBillMain  set HQty+=1  where HInterID='" + HInterID + "'");
                }
                else if (HResult == "NG")
                {
                    ds = oCN.RunProcReturn("select  * from Sc_QualityReportBillSub WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' order by HMakeDate desc", "Sc_QualityReportBillSub");
                    if (ds.Tables[0].Rows.Count > 0) {
                        string HBadDate = ds.Tables[0].Rows[0]["HMakeDate"].ToString();
                        ds = oCN.RunProcReturn("select  * from Sc_SourceLineRepairBillMain WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' order by HMakeDate desc", "Sc_SourceLineRepairBillMain");
                        if (ds.Tables[0].Rows.Count > 0) {
                            string HRepairDate = ds.Tables[0].Rows[0]["HMakeDate"].ToString();
                            if (DateTime.Parse(HBadDate) < DateTime.Parse(HRepairDate)) {
                                //反写工序出站单的不良数量
                                oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1,HWasterQty_Work+=1 where HInterID='" + HInterID + "'");
                            }
                        }
                    } else {
                        //反写工序出站单的不良数量
                        oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1,HWasterQty_Work+=1 where HInterID='" + HInterID + "'");
                    }
                }
                else
                {
                    oCN.RollBack();
                    CustomWriteLog("结果不为OK或NG!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                //查询出站数量是否超过流转卡数量
                ds = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK)
left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID
where b.HInterID={HProcExchInterID} and b.HEntryID={HProcExchEntryID}
group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out");
                if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("流转卡:"+ HProcExchBillNo + ",出站数量超过流转卡数量!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                bool flag = false;
                flag = AddXt_XtRoutBill(HInterID, HBillNo, HBadCodeSN);
                if (!flag)
                {
                    oCN.RollBack();
                    CustomWriteLog("系统参数保存失败,条码:" + HBadCodeSN, DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                //增加产线组装追溯单
                DataSet dataSet = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + HProcExchBillNo + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    //判配件数量是否等于0
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        double SYHQty = double.Parse(dataSet.Tables[0].Rows[i]["配件数量"].ToString());
                        string HMaterNamePJ = dataSet.Tables[0].Rows[i]["配件代码"].ToString();
                        string HMaterBarCode = dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                        if (SYHQty == 0) {
                            oCN.RollBack();
                            CustomWriteLog("配件条码:"+ HMaterBarCode + ",配件代码:" + HMaterNamePJ + ",数量为0!", DateTime.Now.ToString("yyyy-MM-dd"));
                            return false;
                        }
                    }
                    //查询职员
                    ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                    string HMakers = "";
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                        HMakers = ds.Tables[0].Rows[0]["HName"].ToString();
                    }
                    Int64 HInterID1 = CreateBillID("3727", ref sExeReturnInfo);
                    string HBillNo1 = CreateBillCode_Prod("3727", ref sExeReturnInfo, true);
                    //保存生产组装单主表
                    string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo
,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID)
values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{HInterID1},getdate()
,'{HBillNo1}','1','{HMakers}',getdate(),{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}'
,{HICMOInterID},'{HICMOBillNo}','{HBadCodeSN}',{HMaterID},0,'汇报',{HPRDOrgIDs})";
                    oCN.RunProc(sql);
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        string HMaterIDs = dataSet.Tables[0].Rows[i]["HMaterID"].ToString();
                        string HBarCodes =  dataSet.Tables[0].Rows[i]["HBarCode"].ToString();
                        //子表存储
                        string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
                ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
                values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
                ,'',{ HMaterIDs},0,0,0,1
                ,0,0,getdate(),'{HBarCodes}','{HBadCodeSN}','') ";
                        oCN.RunProc(sq2);
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog(e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        //新增返修OK出站汇报单
        public bool getOKOutBillAdd(DataRow dic, string HBadCodeSN, string HResult)
        {
            try
            {
                //获取绑定流转卡
                DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                string HProcNumber = dic["HProcNumber"].ToString();
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HSourceID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产资源ID
                }
                //查询职员
                ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                long HEmpIDs = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                }
                long HDeptID = 0;
                long HPRDOrgIDs = 0;
                string sReturn = "";
                if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔")
                {
                    HDeptID = 389505;
                    HPRDOrgIDs = 100199;
                }
                else
                {
                    //ds = oCN.RunProcReturn("select * from Gy_Department where HNumber='" + dic["HDeptNumber"].ToString() + "' ", "Gy_Department");
                    //if (ds.Tables[0].Rows.Count != 0)
                    //{
                    //    HDeptID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产部门
                    //}
                    HDeptID = 0;
                }
                ds = oCN.RunProcReturn(@"select   b.HProcNo,b.HProcID,a.HMaterID,a.HQty,a.HInterID,HEntryID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo
                from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
                inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID
                left join Gy_Process p WITH(NOLOCK) on  b.HProcID=p.HItemID
                where a.HBillNo='" + HProcExchBillNo + "'  and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain");
                long HICMOInterID = long.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());//任务单ID
                long HICMOEntryID = long.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());//任务单ID
                string HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();//任务单
                long HProcExchInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString());
                long HProcExchEntryID = long.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString());
                long HMaterID = long.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());//产品ID
                long HProcID = long.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());//当前工序ID
                long HInterID = 0;
                string HBillNo = "";
                ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + ",工序控制查无数据!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2")
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:" + HProcID + "," + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                ds = oCN.RunProcReturn("select  * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID=" + HProcExchInterID + " and HMainSourceEntryID=" + HProcExchEntryID, "Sc_AssemblyBillMain");
                DateTime HDate=DateTime.Now;
                //当产品没有配件的时候 查询 不良记录
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ds = oCN.RunProcReturn("select  * from Sc_QualityReportBillSub WITH(NOLOCK) where HProcExchInterID=" + HProcExchInterID + " and HProcExchEntryID=" + HProcExchEntryID+ " and HBarCode='" + HBadCodeSN + "'", "Sc_AssemblyBillMain");
                    HDate = DateTime.Parse(ds.Tables[0].Rows[0]["HMakeDate"].ToString());
                }
                else {
                    HDate = DateTime.Parse(ds.Tables[0].Rows[0]["HDate"].ToString());
                }
                //查询是否有返修记录
                ds = oCN.RunProcReturn(@"select a.HBarCode,a.HProcess,b.HSourceInterID,b.HSourceEntryID,b.HRepairResult from Sc_SourceLineRepairBillMain a WITH(NOLOCK)
inner join Sc_SourceLineRepairBillSub b WITH(NOLOCK) on a.HInterID = b.HInterID
where a.HBarCode = '" + HBadCodeSN + "' and  a.HProcess ="+ HProcID + " and  b.HSourceInterID ="+ HProcExchInterID + " " +
"and b.HSourceEntryID="+ HProcExchEntryID + " and b.HRepairResult = 'OK'", "Sc_SourceLineRepairBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBadCodeSN + ",无返修记录", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                //判断当前流转卡的出站单 是否有数据
                ds = oCN.RunProcReturn(@"select  * from Sc_StationOutBillMain a WITH(NOLOCK)
left join Gy_Process p WITH(NOLOCK) on  a.HProcID=p.HItemID
where HProcExchBillNo='" + HProcExchBillNo + "' and p.HNumber='" + HProcNumber + "' and CONVERT(varchar(10),HDate,20) ='" + HDate.ToString("yyyy-MM-dd") + "'", "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString());
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();//递入type得到的单据号
                }
                if (HResult == "OK")
                {
                    ds = oCN.RunProcReturn("select  * from Sc_StationOutBillSub_SN  WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN");
                    string HMakeTime = dic["HCreateTime"].ToString();
                    oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)
values({ HInterID}, '{ HBillNo}', {(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)}, '{HBadCodeSN}', 1, '" + HMakeTime + "', '', " + HProcExchInterID + "," + HProcExchEntryID + ", '" + HProcExchBillNo + "', '', 0, 0)");
                    CustomWriteLog("条码:" + HBadCodeSN + "工序:"+ HProcNumber + ",出站时间:" + HMakeTime, "TM" + DateTime.Now.ToString("yyyy-MM-dd"));
                    //反写工序出站单的合格数量
                    //oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1  where HInterID='" + HInterID + "'");
                    oCN.RunProc("update Sc_StationOutBillMain set HQty+=1  where HInterID='" + HInterID + "'");
                    //反写条码状态
                    oCN.RunProc("update Gy_BarCodeBill set HStatus=''  where HBarCode='" + HBadCodeSN + "'");
                }
                else
                {
                    oCN.RollBack();
                    CustomWriteLog("结果不为OK!", DateTime.Now.ToString("yyyy-MM-dd"));
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog(e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        //保存系统参数到出站单
        public bool AddXt_XtRoutBill(long HInterID, string HBillNo,string HBadCodeSN) {
            string sql = "";
            try
            {
                 DataSet ds = oCN.RunProcReturn(@"select a.HProcExchInterID,a.HProcExchEntryID,a.HProcExchBillNo,a.HProcID,p.HNumber from Sc_StationOutBillMain a WITH(NOLOCK)
left join Gy_Process p WITH(NOLOCK)  on a.HProcID=p.HItemID where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_StationOutBillMain");
                string HProcExchInterID = ds.Tables[0].Rows[0]["HProcExchInterID"].ToString();
                string HProcExchEntryID = ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString();
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
                string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
                string HProcNum = ds.Tables[0].Rows[0]["HNumber"].ToString();
                //注:因为 组装 拍照 时间间隔比较短  所以目前只明确组装工序才可以保存工艺参数 之后如果有其他工序的话  需要增加工序字段
                if (HProcID == "88"|| HProcNum=="005") {
                    ds = oCN.RunProcReturn(@"select  s.HItemID HMouldID,t.HItemID HTechParamID,HCount,HCreateTime,a.HResult from  Sb_EquipMentCollectionTechParam_SN a WITH(NOLOCK)
inner join Gy_Source s WITH(NOLOCK) on a.HSourceCode=s.HNumber
inner join Gy_TechnologyParameter t WITH(NOLOCK) on a.HType=t.HName
where a.HFlag=0 and a.HBarCode='" + HBadCodeSN + "'", "Sb_EquipMentCollectionTechParam_SN");
                    //注:当前只有一道工序有参数 如果有多道工序的话 需要增加 工序的过滤
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            string HMouldID = ds.Tables[0].Rows[i]["HMouldID"].ToString();
                            string HTechParamID = ds.Tables[0].Rows[i]["HTechParamID"].ToString();
                            string HCount = ds.Tables[0].Rows[i]["HCount"].ToString();
                            string HGetTime = ds.Tables[0].Rows[i]["HCreateTime"].ToString();
                            string HResult = ds.Tables[0].Rows[i]["HResult"].ToString();
                            DataSet dataSet = oCN.RunProcReturn("select * from Sc_StationOutBillSub_TechParam WITH(NOLOCK) where HInterID=" + HInterID + " and HBillNo_bak='" + HBillNo + "'", "Sc_StationOutBillSub_TechParam");
                            sql = "insert into Sc_StationOutBillSub_TechParam(HInterID,HBillNo_bak,HEntryID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HTechParamID,HRelValue,HGetTime,HBarCode,HMouldID,HRemark)" +
                                $"values({HInterID},'{HBillNo}',{(dataSet.Tables[0].Rows.Count + 1)},{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}',{HTechParamID},{HCount},'{HGetTime}','{HBadCodeSN}',{HMouldID},'{HResult}')";
                            oCN.RunProc(sql);
                        }
                        oCN.RunProc("update Sb_EquipMentCollectionTechParam_SN set HFlag=1 where HBarCode='" + HBadCodeSN + "'");
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog("工艺参数保存:" + sql + e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        //条码解析
        public int SNHBardCodeList(string HBadCodeSN)
        {
            try
            {
                DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                //判断条码是否存在条码档案
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                    DataSet dataTable = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HBillNo='" + HSourceBillNo + "'", "Sc_ProcessExchangeBillMain");
                    //判断条码的源单 流转卡是否被删除
                    if (dataTable.Tables[0].Rows.Count == 0)
                    {
                        //如果源单已经删除  则条码也删除重新生成
                        oCN.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'");
                        //重新查询条码档案 进入新增方法
                        ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill");
                    }
                }
                //判断条码是否在数据库里
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //判断长度是否为29位 无尘车间
                    if (HBadCodeSN.Length == 29)
                    {
                        string str1 = HBadCodeSN.Substring(18, 8);
                        ds = oCN.RunProcReturn("select  * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain");
                        //判断是否能找到对应的流转卡
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                            get_HBardBillSave(HBadCodeSN, HProcExchBillNo);
                        }
                        else
                        {
                            str1 = HBadCodeSN.Substring(23, 3);
                            ds = oCN.RunProcReturn("select  * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain");
                            //判断是否能找到对应的流转卡
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                                get_HBardBillSave(HBadCodeSN, HProcExchBillNo);
                            }
                            else
                            {
                                oCN.RollBack();
                                CustomWriteLog("条码:" + HBadCodeSN + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
                                return 2;
                            }
                        }
                    }
                    //判断长度是否为50位  15车间
                    else if (HBadCodeSN.Length == 50)
                    {
                        string str1 = HBadCodeSN.Substring(42, 8);
                        ds = oCN.RunProcReturn("select  * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain");
                        //判断是否能找到对应的流转卡
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                            get_HBardBillSave(HBadCodeSN, HProcExchBillNo);
                        }
                        else
                        {
                            oCN.RollBack();
                            CustomWriteLog("条码:" + HBadCodeSN + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd"));
                            return 2;
                        }
                    }
                    else
                    {
                        oCN.RollBack();
                        CustomWriteLog("条码:" + HBadCodeSN + ",长度不等于29位!", DateTime.Now.ToString("yyyy-MM-dd"));
                        return 2;
                    }
                }
                else
                {
                    return 1;
                }
                return 0;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog("条码:" + HBadCodeSN + "," + e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return 2;
            }
        }
        //新增条码数据
        public void get_HBardBillSave(string HBarCode, string HProcExchBillNo)
        {
            try
            {
                //查询流转卡数据
                DataSet dataSet = oCN.RunProcReturn(@"select  a.HPRDORGID, m.HModel 物料规格,m.HName 名物料称,a.HBillNo,a.HInterID,a.HMaterID,m.HNumber 物料代码,o.HNumber 组织代码,a.HUnitID,u.HNumber 单位代码 from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
left join Gy_Material m WITH(NOLOCK) on a.HMaterID=m.HItemID
left join Xt_ORGANIZATIONS o WITH(NOLOCK) on a.HPRDORGID=o.HItemID
left join Gy_Unit u WITH(NOLOCK) on a.HUnitID=u.HItemID
where HBillNo='" + HProcExchBillNo + "'", "Sc_ProcessExchangeBillMain");
                //判断流转卡不能为空
                if (HBarCode.Trim() == "")
                {
                    oCN.RollBack();
                    CustomWriteLog("条码:" + HBarCode + ",流转卡不能为空!", DateTime.Now.ToString("yyyy-MM-dd"));
                }
                //日期获取方式
                string sDate = DateTime.Now.ToString();
                string HWei = "0";      //尾数
                string HBarCodeType = "唯一条码";
                Int64 HMaterID = int.Parse(dataSet.Tables[0].Rows[0]["HMaterID"].ToString());
                Int64 HAuxPropID = 0;
                Int64 HUnitID = int.Parse(dataSet.Tables[0].Rows[0]["HUnitID"].ToString());
                double HQty2 = 1;
                string HBatchNo2 = "";
                Int64 HSupID = 0;
                Int64 HGroupID = 0;
                int HPrintQty = 0;
                Int64 HSourceInterID = int.Parse(dataSet.Tables[0].Rows[0]["HInterID"].ToString());
                Int64 HSourceEntryID = 1;
                string HSourceBillNo = dataSet.Tables[0].Rows[0]["HBillNo"].ToString();
                string HSourceBillType = "3772";
                Int64 HBarcodeNo = 0;       //托号
                Int64 HBarcodeQtys = 0;     //总托数
                Int64 HDeptID = 0;
                Int64 HWhID = 0;
                Int64 HSPID = 0;
                string HRemark = "";
                string HMaterName = dataSet.Tables[0].Rows[0]["名物料称"].ToString();
                string HMaterModel = dataSet.Tables[0].Rows[0]["物料规格"].ToString();
                string HPinfan = "";
                string HMTONo = "";
                Int64 HCusID = 0;
                string HCusType = "";
                DateTime HEndDate = DateTime.Now;
                string HWorkLineName = "";
                string HSeOrderBillNo = "";
                string HInnerBillNo = "";
                bool HGiveAwayFlag = false;
                Int64 HEntryID = 1;
                string sExeReturnInfo = "";
                Int64 HInterID = CreateBillID_Prod("85", ref sExeReturnInfo);
                int HOrgID = int.Parse(dataSet.Tables[0].Rows[0]["HPRDORGID"].ToString());
                string HCoilNO2 = "";
                string HFurnaceNO2 = "";
                string HFactory2 = "";
                decimal HAuxQty2 = 0;
                string HheatNO2 = "";
                oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                   ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                   ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                                   ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                                   ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                                   ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                   ",HGiveAwayFlag " +
                                   ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                                   ",HProduceDate,HExpiryDate " +
                                   ") values ("
                                   + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                   + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
                                   + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
                                   + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                                   + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                                   + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
                                   + ", " + BoolToString(HGiveAwayFlag)
                                   + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')");
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog("条码:" + HBarCode + "," + e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
            }
        }
        //条码补充
        public string TM_ZH(string HBadCodeSN)
        {
            try
            {
                //HBadCodeSN = "P1" + HBadCodeSN;
                //HBadCodeSN = HBadCodeSN.Substring(0, 13) + ":" + HBadCodeSN.Substring(13, 15);
                return HBadCodeSN;
            }
            catch (Exception e)
            {
                CustomWriteLog("条码:" + HBadCodeSN + "," + e.Message, DateTime.Now.ToString("yyyy-MM-dd"));
                return "";
            }
        }
        //定时读取数据
        private void timer1_Tick(object sender, EventArgs e)
        {
            DataTable list = oCN.RunProcReturn("select top 100 * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HFlag=0  order by HCreateTime asc", "Sb_EquipMentCollection_SN").Tables[0];
            //循环集合
            for (int i = 0; i < list.Rows.Count; i++)
            {
                bool flag = false;
                string HResult = list.Rows[i]["HResult"].ToString();
                string HBadCodeSN = list.Rows[i]["HBarCode"].ToString();
                string HCreateTime = list.Rows[i]["HCreateTime"].ToString();
                //HBadCodeSN = "P1099081-00-E:SDU324292189300";
                //HResult = "OK";
                //开始事务
                oCN.BeginTran();
                 if (HResult == "OK")
                {
                    flag = HResultOK(list.Rows[i]);
                }
                else if (HResult == "NG")
                {
                    flag = HResultNG(list.Rows[i]);
                }
                if (flag)
                {
                    oCN.RunProc("update Sb_EquipMentCollection_SN set HFlag=1 where HBarCode='" + HBadCodeSN + "' and HCreateTime='" + HCreateTime + "'");
                    //结束事务
                    oCN.Commit();
                }
            }
        }
        //新增不良汇报单
        public bool getBadBillAdd(DataRow dic) {
            try
            {
                //查询职员
                DataSet ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee");
                long HEmpIDs = 0;
                string HMakers = "";
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID
                    HMakers = ds.Tables[0].Rows[0]["HName"].ToString();
                }
                long HDeptID = 0;//车间
                string sReturn = "";
                if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔")
                {
                    HDeptID = 389505;
                }
                else
                {
                    //ds = oCN.RunProcReturn("select * from Gy_Department where HNumber='" + dic["HDeptNumber"].ToString() + "' ", "Gy_Department");
                    //if (ds.Tables[0].Rows.Count != 0)
                    //{
                    //    HDeptID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产部门
                    //}
                    HDeptID = 0;
                }
                string HProcExchInterID = "0";
                string HProcExchEntryID = "0";
                string HProcExchBillNo = "";
                long HMaterID = 0;
                long HProcID = 0;
                long HUnitID = 0;
                long HICMOInterID = 0;
                long HICMOEntryID = 0;
                string HICMOBillNo = "";
                ds = oCN.RunProcReturn(@"select b.HProcID, HMaterID,HUnitID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,HBillNo,a.HInterID,b.HEntryID,a.HBillNo from Sc_ProcessExchangeBillMain a WITH(NOLOCK)
inner join Sc_ProcessExchangeBillSub b  WITH(NOLOCK) on a.HInterID=b.HInterID
left join Gy_Process p WITH(NOLOCK) on b.HProcID=p.HItemID
where HBillNo=(select HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + dic["HBarCode"].ToString() + "') and p.HNumber='" + dic["HProcNumber"].ToString() + "'  ", "Sc_ProcessExchangeBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());
                    HUnitID = int.Parse(ds.Tables[0].Rows[0]["HUnitID"].ToString());
                    HICMOInterID = int.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());
                    HICMOEntryID = int.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());
                    HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();
                    HProcExchInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                    HProcExchEntryID = ds.Tables[0].Rows[0]["HEntryID"].ToString();
                    HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());
                }
                ds = oCN.RunProcReturn("select * from Gy_Source WITH(NOLOCK) where HNumber='" + dic["HSourceCode"].ToString() + "' ", "Gy_Source");
                long HSourceID = 0;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HSourceID = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//生产资源ID
                }
                string sExeReturnInfo = "";
                long HInterID = CreateBillID("3717", ref sExeReturnInfo);//递入type得到的单据ID
                string HBillNo = CreateBillCode_Prod("3717", ref sExeReturnInfo, true);//递入type得到的单据号
                DateTime HDate = DateTime.Parse(dic["HCreateTime"].ToString());//日期
                string HRemark = "";//备注
                long HEmpID = HEmpIDs;//质检员
                long HGroupID = 22;//班组ID 白班
                string HMaker = HMakers;//制单人
                long HMainSourceInterID = HICMOInterID;
                long HMainSourceEntryID = HICMOEntryID;
                string HMainSourceBillNo = HICMOBillNo;
                //主表
                oCN.RunProc(@"Insert Into Sc_QualityReportBillMain
(HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate
,HYear,HPeriod,HRemark,HMaker,HMakeDate
,HEmpID,HGroupID,HDeptID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo)
                        values('3717','3717',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                ",'" + HEmpID + "'," + HGroupID + "," + HDeptID + "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "') ");
                string HBarCode = dic["HBarCode"].ToString();
                string HMakeDate = dic["HCreateTime"].ToString();
                string HResult = dic["HResult"].ToString();
                oCN.RunProc($@"Insert into Sc_QualityReportBillSub
(HInterID,HENTRYID,HBillNo_bak,HEmpID,HBarCode,HBadReasonID,HAddr,HMaker,HMakeDate
,HMaterID,HUnitID,HRemark,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType
,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
,HQty,HResult,HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HProcID)
values({HInterID},1,'{HBillNo}',{HEmpID},'{HBarCode}',219,'','{HMaker}','{HMakeDate}'
,{HMaterID},{ HUnitID},'',{HSourceID},{ HICMOInterID},{ HICMOEntryID},'{HICMOBillNo}',0
,0,0,'','',0,0
,1,'{HResult}',{ HProcExchInterID},{ HProcExchEntryID},'{ HProcExchBillNo}'," + HProcID + ")");
                return true;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                CustomWriteLog("报错原因:" + e.Message + "!", DateTime.Now.ToString("yyyy-MM-dd"));
                return false;
            }
        }
        #region 基础方法
        //查询系统参数
        public string GetSingleSystemParameter(string sKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet DsSub;
                //循环
                DsSub = oCN.RunProcReturn("Select  HValue from Xt_SystemParameter with(nolock) Where HKey='" + sKey + "'  ", "Xt_SystemParameter");
                if (DsSub == null || DsSub.Tables[0].Rows.Count == 0)
                {
                    sReturn = "找不到该参数!";
                    return "";
                }
                else
                {
                    return isStrNull(DsSub.Tables[0].Rows[0]["HValue"]);
                }
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        public static Int64 CreateBillID_Prod(string BillCode, ref string sReturn)
        {
            try
            {
                string BillType = "";
                DataSet Ds;
                DBHelper oCn = new DBHelper();
                Int64 lID;
                Ds = oCn.RunProcReturn("exec h_p_Xt_GetMaxBillID '" + BillCode + "'", "h_p_Xt_GetMaxBillID");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    lID = -1;
                }
                else
                {
                    lID = isLong(Ds.Tables[0].Rows[0]["HBillNo"]);
                }
                oCn.CnClose();
                oCn.CnDispose();
                oCn = null;
                Ds = null;
                return lID;
            }
            catch (Exception e)
            {
                return -2;
            }
        }
        //判断是否是INT64
        public static Int64 isLong(object message)
        {
            try
            {
                return Convert.ToInt64(message);
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        //布尔转为字符
        public static string BoolToString(object b)
        {
            try
            {
                if (Convert.ToBoolean(b))
                    return "1";
                else
                    return "0";
            }
            catch (Exception e)
            {
                return "0";
            }
        }
        public static Int64 CreateBillID(string BillCode, ref string sReturn)
        {
            string BillType = "";
            DataSet Ds;
            DBHelper oCn = new DBHelper();
            Int64 lID;
            Ds = oCn.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + BillCode.Trim() + "'", "Gy_BillNumber");
            if (Ds.Tables[0].Rows.Count != 0)
            {
                lID = isLong(Ds.Tables[0].Rows[0]["IDNow"].ToString());
                BillType = Ds.Tables[0].Rows[0]["BillType"].ToString().Trim();
            }
            else
            {
                lID = 0;
            }
            //同类型单据 自增1
            if (BillType.Trim() != "")
            {
                oCn.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'");
            }
            oCn.CnClose();
            oCn.CnDispose();
            oCn = null;
            Ds = null;
            return lID;
        }
        //得到最大单据号
        //得到最大单据号 存储过程
        public static string CreateBillCode_Prod(string BillCode, ref string sReturn, bool Add)
        {
            try
            {
                string BillType = "";
                DataSet Ds;
                DBHelper oCn = new DBHelper();
                string sBIllNO;
                Ds = oCn.RunProcReturn("exec h_p_Xt_GetMaxBillNo '" + BillCode + "'", "h_p_Xt_GetMaxBillNo");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sBIllNO = "ERROR";
                }
                else
                {
                    sBIllNO = isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                }
                oCn.CnClose();
                oCn.CnDispose();
                oCn = null;
                Ds = null;
                return sBIllNO;
            }
            catch (Exception e)
            {
                return "ERROR";
            }
        }
        //判断是否NULL
        public static string isStrNull(object message)
        {
            try
            {
                if (message == null)
                {
                    return "";
                }
                else
                {
                    return message.ToString().Trim();
                }
            }
            catch (Exception e)
            {
                return "";
            }
        }
        private static readonly object lockObj = new object();
        //写日志
        public static void CustomWriteLog(object obj, string FileName, string filePath = "Vlog", bool isAppend = true)
        {
            try
            {
                lock (lockObj)
                {
                    filePath = $@"{filePath}\{FileName}.txt";
                    filePath = AppDomain.CurrentDomain.BaseDirectory + filePath;
                    if (!System.IO.Directory.Exists(Path.GetDirectoryName(filePath)))
                    {
                        System.IO.Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                    }
                    bool fileExists = System.IO.File.Exists(filePath);
                    //不存在 则创建该文件
                    if (!fileExists)
                    {
                        System.IO.File.Create(filePath).Close();
                    }
                    using (StreamWriter writer = new StreamWriter(filePath, isAppend))
                    {
                        //存在的时候才写一行
                        if (fileExists && isAppend)
                        {
                            writer.WriteLine();
                        }
                        var content = obj is string ? obj : JsonConvert.SerializeObject(obj);
                        writer.WriteLine($"{DateTime.Now} {content}");
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        #endregion
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("确定要关闭吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/FormBack.resx
New file
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="timer1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
  </metadata>
</root>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR.csproj
@@ -78,6 +78,12 @@
  </ItemGroup>
  <ItemGroup>
    <Compile Include="DBHelper.cs" />
    <Compile Include="FormBack.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FormBack.Designer.cs">
      <DependentUpon>FormBack.cs</DependentUpon>
    </Compile>
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
@@ -86,6 +92,9 @@
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="FormBack.resx">
      <DependentUpon>FormBack.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application
@@ -14,7 +14,7 @@
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>NwsnDbVCDNVDElH7jYILJi/+IuwqOdTyHQpbl8yBMWM=</dsig:DigestValue>
        <dsig:DigestValue>qqmoxxkJSiYt11EOtxwjCp8UCVICLSHpeYHEJyCvRZ0=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest
@@ -54,14 +54,14 @@
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="50176">
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="72192">
      <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>O9Cwdsqhg57KrTVWUE/D7CTOjFMM3ip5ZKLlYjwO908=</dsig:DigestValue>
        <dsig:DigestValue>1tOLZNgSrL6rNHUXRrWcDZVcoiUanJf2ZdQGY2W8+Hs=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.rar
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.FormBack.resources
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application
@@ -14,7 +14,7 @@
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>NwsnDbVCDNVDElH7jYILJi/+IuwqOdTyHQpbl8yBMWM=</dsig:DigestValue>
        <dsig:DigestValue>qqmoxxkJSiYt11EOtxwjCp8UCVICLSHpeYHEJyCvRZ0=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
f7ccc1601152e0c83a15b610ea22c397a1c50bff
6e7e5ec0e6ae0214de89541c1d16e704fdf73567
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.FileListAbsolute.txt
@@ -21,7 +21,6 @@
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\bin\Debug\WFormSynchronizeData_SMR.pdb
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\bin\Debug\Newtonsoft.Json.dll
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\bin\Debug\Newtonsoft.Json.xml
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.AssemblyReference.cache
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.Form1.resources
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.Properties.Resources.resources
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.GenerateResource.cache
@@ -31,3 +30,5 @@
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.CopyComplete
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.exe
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.pdb
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.FormBack.resources
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.AssemblyReference.cache
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.GenerateResource.cache
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest
@@ -54,14 +54,14 @@
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="50176">
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="72192">
      <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>O9Cwdsqhg57KrTVWUE/D7CTOjFMM3ip5ZKLlYjwO908=</dsig:DigestValue>
        <dsig:DigestValue>1tOLZNgSrL6rNHUXRrWcDZVcoiUanJf2ZdQGY2W8+Hs=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb
Binary files differ