yangle
2024-08-15 0f0d1ce8057cf705bac051b7cc7108b4075659d0
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs
@@ -71,7 +71,7 @@
                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'  and HProcNumber='" + dic["HProcNumber"].ToString() + "'", "Sb_EquipMentCollection_SN");
                    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
@@ -337,8 +337,26 @@
                }
                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 where HInterID='" + HInterID + "'");
                            }
                        }
                    } else {
                        //反写工序出站单的不良数量
                        oCN.RunProc("update Sc_StationOutBillMain  set HBadCount+=1 where HInterID='" + HInterID + "'");
                    }
                }
                else
                {
@@ -641,7 +659,17 @@
                    //判断长度是否为29位
                    if (HBadCodeSN.Length == 29)
                    {
                        string str1 = HBadCodeSN.Substring(23, 3);
                        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)
@@ -656,6 +684,7 @@
                            return 2;
                        }
                    }
                    }
                    else
                    {
                        oCN.RollBack();