1
zrg
2025-10-21 0910a653b936af52e97633c70f6d6dee3f3f5a2b
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÑéÊÕÈë¿â/Kf_ProductInBillController.cs
@@ -1672,39 +1672,39 @@
                // åˆ¤æ–­ æ•°æ®åº“中是否存在id和单据号相等的打单据,存在,则重建,只有id号相等,则申请新的id号
                // var ds1 = oCn.RunProcReturn($@"
                // select hmainid HInterID, å•据号 HBillNO from h_v_Kf_ProductInBillList where hmainid = {mainList[0].HInterID}
                // ", "h_v_Kf_ProductInBillList");
                // var HInterID_Old = mainList[0].HInterID;
                // if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null)
                // {
                //     if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase))
                //     {
                //         string sql = string.Empty;
                //         sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
                //         oCn.RunProc(sql);
                //         sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
                //         oCn.RunProc(sql);
                //     }
                //     else
                //     {
                //         // é‡æ–°ç”³è¯·HInterID
                //         var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1202", ref DBUtility.ClsPub.sExeReturnInfo);
                //         mainList[0].HInterID = HInterID_Exch;
                //
                //         foreach (var oSub in subList)
                //         {
                //             oSub.HInterID = HInterID_Exch;
                //         }
                //
                //     }
                // }
                var ds1 = oCn.RunProcReturn($@"
                select hmainid HInterID, å•据号 HBillNO from h_v_Kf_ProductInBillList where hmainid = {mainList[0].HInterID}
                ", "h_v_Kf_ProductInBillList");
                var HInterID_Old = mainList[0].HInterID;
                if (ds1.Tables[0].Rows.Count > 0 && ds1.Tables[0].Rows[0]["HInterID"] != null)
                {
                    if (string.Equals(ds1.Tables[0].Rows[0]["HBillNo"].ToString(), mainList[0].HBillNo, StringComparison.OrdinalIgnoreCase))
                    {
                        string sql = string.Empty;
                        sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
                        oCn.RunProc(sql);
                        sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
                        oCn.RunProc(sql);
                    }
                    else
                    {
                        // é‡æ–°ç”³è¯·HInterID
                        var HInterID_Exch = DBUtility.ClsPub.CreateBillID("1202", ref DBUtility.ClsPub.sExeReturnInfo);
                        mainList[0].HInterID = HInterID_Exch;
                        foreach (var oSub in subList)
                        {
                            oSub.HInterID = HInterID_Exch;
                        }
                    }
                }
                string sql = string.Empty;
                sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
                oCn.RunProc(sql);
                sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
                oCn.RunProc(sql);
                // string sql = string.Empty;
                // sql = $"delete Kf_ICStockBillMain where HinterID = {mainList[0].HInterID}";
                // oCn.RunProc(sql);
                // sql = $"delete Kf_ICStockBillSub where HinterID = {mainList[0].HInterID}";
                // oCn.RunProc(sql);
                // ä¸»è¡¨
                oCn.RunProc($@"Insert Into Kf_ICStockBillMain 
                (