商贸通服装鞋帽版系统忙商贸通服装鞋帽版系统忙
商贸通服装鞋帽版-系统忙
自动编号: | 19600 | 产品版本: | 商贸通服装鞋帽版 | 产品模块: | 库存管理 | 所属行业: | 通用 | 适用产品: | 16 | 关 键 字: | | 问题名称: | 系统忙 | 问题现象: | 在做销售换货单和销售收款单过账时,提示“系统忙,请稍后再试”,请问是怎么解决? | 原因分析: | 如果是销售换货单和销售退货单过账时,提示“系统忙,请稍后再试”, 可以试一下这个脚本,执行前请备份好账套! SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER procedure P_SwapBill @swapbillId int as /* declare @date char(10),@i_unitId int, @Brand_id int, @TaxMoney numeric(24,10),@billtype int, @swaptype varchar(50), @billID int,@CurMoney numeric(24,10),@InsertMoney numeric(24,10),@YhhMoney numeric(24,10) select @date =billdate ,@i_UnitId =unit_id,@billtype = billtype from masterbill where autoid = @swapBillid if @billtype in (4,14) set @swaptype = '销售' if @billtype In (3,61) set @swaptype = '进货' Declare Cur_CurrentMoney cursor for select isnull(Brand_ID,-1),Sum(TaxMoney) AS TaxMoney from (SELECT -1 Brand_ID,abs(Sum(ProductInOut.TaxMoney)) AS TaxMoney FROM ProductInOut INNER JOIN Product ON ProductInOut.Prod_ID = Product.s_ID where bill_id = @swapbillId and ((TaxMoney > 0) and (@swaptype ='销售') or (TaxMon | 解决方案: | 如果是销售换货单和销售退货单过账时,提示“系统忙,请稍后再试”, 可以试一下这个脚本,执行前请备份好账套! SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER procedure P_SwapBill @swapbillId int as /* declare @date char(10),@i_unitId int, @Brand_id int, @TaxMoney numeric(24,10),@billtype int, @swaptype varchar(50), @billID int,@CurMoney numeric(24,10),@InsertMoney numeric(24,10),@YhhMoney numeric(24,10) select @date =billdate ,@i_UnitId =unit_id,@billtype = billtype from masterbill where autoid = @swapBillid if @billtype in (4,14) set @swaptype = '销售' if @billtype In (3,61) set @swaptype = '进货' Declare Cur_CurrentMoney cursor for select isnull(Brand_ID,-1),Sum(TaxMoney) AS TaxMoney from (SELECT -1 Brand_ID,abs(Sum(ProductInOut.TaxMoney)) AS TaxMoney FROM ProductInOut INNER JOIN Product ON ProductInOut.Prod_ID = Product.s_ID where bill_id = @swapbillId and ((TaxMoney > 0) and (@swaptype ='销售') or (TaxMoney < 0) and (@swaptype ='进货') ) and Product.Brand_ID Not In (Select Brand_Id from SwapSet where flg_stop = 0 and unit_id =@i_UnitId and swaptype =@swaptype ) Group by Product.Brand_ID union SELECT isnull(Product.Brand_ID,-1) Brand_ID,abs(Sum(ProductInOut.TaxMoney)) AS TaxMoney FROM ProductInOut INNER JOIN Product ON ProductInOut.Prod_ID = Product.s_ID inner JOIN SwapSet ON Product.Brand_ID = SwapSet.Brand_Id and Swapset.DiffsizeColor = 1 AND ProductInOut.Unit_ID = SwapSet.Unit_Id and swapset.Swaptype = @swaptype and SwapSet.unit_id =@i_UnitId where bill_id = @swapbillId and ((TaxMoney > 0) and (@swaptype ='销售')or (TaxMoney < 0) and (@swaptype ='进货') ) and SwapSet.flg_stop =0 Group by Product.Brand_ID union select isnull(Product.Brand_ID,-1) Brand_ID,Sum(abs(b.TaxMoney)) AS TaxMoney from (SELECT ProductInOut.unit_id ,ProductInOut.Bill_id ,ProductInOut.Prod_id ,-1*Sum(ProductInOut.TaxMoney) AS TaxMoney FROM ProductInOut INNER JOIN Product ON ProductInOut.Prod_ID = Product.s_ID inner JOIN SwapSet ON Swapset.DiffsizeColor =0 and Product.Brand_ID = SwapSet.Brand_Id AND ProductInOut.Unit_ID = SwapSet.Unit_Id and swapset.Swaptype = @swaptype and SwapSet.unit_id =@i_UnitId where bill_id = @swapbillId group by ProductInOut.unit_id ,ProductInOut.Bill_id ,ProductInOut.Prod_id ) b inner join Product On b.Prod_Id = Product.S_Id where ((b.TaxMoney < 0) and (@swaptype ='销售') ) or ((b.TaxMoney > 0) and (@swaptype ='进货') ) group by Product.Brand_ID ) a group by a.Brand_id open Cur_CurrentMoney fetch next from Cur_CurrentMoney into @Brand_id,@TaxMoney while @@FETCH_STATUS=0 begin if @brand_Id = -1 Begin Declare Cur_SetMoney cursor for SELECT Productinout.Bill_Id ,isnull(abs(SUM(ProductInOut.taxMoney)),0) FROM ProductInOut INNER JOIN Masterbill ON ProductInOut.Bill_ID = Masterbill.AutoID INNER JOIN Units ON ProductInOut.Unit_ID = Units.s_Id inner join Product on Product.s_id = ProductInOut.Prod_id LEFT OUTER JOIN SwapSet ON Product.Brand_ID = SwapSet.Brand_Id and Swapset.Unit_Id = ProductInout.Unit_Id and swapset.Swaptype = @swaptype WHERE ProductInOut.Unit_ID = @i_unitId and ( ( @swaptype = '销售' and (Masterbill.BillType IN (1) or (Masterbill.BillType =14 and ProductInout.Prod_Number< 0 ))) or ( @swaptype = '进货' and (Masterbill.BillType IN (0) or (Masterbill.BillType =61 and ProductInout.Prod_Number > 0 ))) ) AND ((Units.SwapLimit = 0) OR (DATEDIFF(day, ProductInOut.BillDate,@Date) < Units.SwapLimit and DATEDIFF(day, ProductInOut.BillDate,@Date) >=0)) and Masterbill.s_syb >= 0 and Swapset.autoid is null group by Productinout.Bill_Id open Cur_SetMoney fetch next from Cur_SetMoney into @billID ,@CurMoney while @@FETCH_STATUS=0 begin select @YhhMoney = isnull(sum(SwapMoney),0) from swapList inner join masterbill on swapList.billid = masterbill.AutoId and Masterbill.s_syb >= 0 inner join Masterbill hhBill on swapList.billid = hhbill.AutoId and hhbill.s_syb >= 0 where billid = @billID and brand_id is null if @swaptype = '销售' Begin set @curMoney = -1 * @curMoney - @YhhMoney end else set @curMoney = @curMoney - @YhhMoney if @TaxMoney >= @CurMoney Begin set @Insertmoney = @CurMoney set @TaxMoney =@TaxMoney - @CurMoney End else Begin set @Insertmoney = @TaxMoney set @TaxMoney = 0 end if @InsertMoney > 0 Begin Insert Into SwapList(BIllId, Brand_Id, swapMoney, HHDbillId) values(@billID,null,@InsertMoney,@swapbillId) if @@Error<>0 Goto error end if @TaxMoney = 0 BREAK fetch next from Cur_SetMoney into @billID ,@CurMoney End if @TaxMoney > 0 Begin Insert Into SwapList(BIllId, Brand_Id, swapMoney, HHDbillId) values(@swapbillId,null,@TaxMoney,@swapbillId) if @@Error<>0 Goto error set @TaxMoney = 0 ; end Close Cur_SetMoney deallocate Cur_SetMoney end Declare Cur_SetMoney cursor for SELECT Productinout.Bill_Id ,isnull(abs(SUM(ProductInOut.taxMoney)),0) FROM ProductInOut INNER JOIN MasterBill ON ProductInOut.Bill_ID = MasterBill.AutoID INNER JOIN Units ON ProductInOut.Unit_ID = Units.s_ID INNER JOIN Product ON Product.s_ID = ProductInOut.Prod_ID INNER JOIN SwapSet ON Product.Brand_ID = SwapSet.Brand_Id and Swapset.Unit_Id = ProductInout.Unit_Id and swapset.Swaptype = @swaptype WHERE ProductInOut.Unit_ID =@i_unitId and Swapset.brand_Id =@Brand_id and ( ( (( @swaptype = '销售' and (Masterbill.BillType IN (1) or (Masterbill.BillType =14 and ProductInout.Prod_Number< 0 ))) or ( @swaptype = '进货' and (Masterbill.BillType IN (0) or (Masterbill.BillType =61 and ProductInout.Prod_Number> 0 ))) ) AND (isnull(Swapset.SwapLimit,0) = 0) AND (MasterBill.s_Syb >= 0) ) OR ( (( @swaptype = '销售' and (Masterbill.BillType IN (1) or (Masterbill.BillType =14 and ProductInout.Prod_Number< 0 ))) or ( @swaptype = '进货' and (Masterbill.BillType IN (0) or (Masterbill.BillType =61 and ProductInout.Prod_Number> 0 ))) ) ) AND (MasterBill.s_Syb >= 0) AND (DATEDIFF(day, ProductInOut.BillDate, @date) <= Swapset.SwapLimit) AND (DATEDIFF(day, ProductInOut.BillDate, @date) >= 0) AND ( (SwapSet.SwapLimitdate is null ) or (ProductInOut.BillDate <= convert(varchar(10),DATEPART(year,convert(varchar(10),@date)))+'-' + isnull(SwapSet.SwapLimitdate,'12-31)'))) ) and ((swapset.SumAdd = 0 and ProductInout.addprod <> 1) or (swapset.SumAdd = 1)) group by Productinout.Bill_Id open Cur_SetMoney fetch next from Cur_SetMoney into @billID, @CurMoney while @@FETCH_STATUS=0 begin select @YhhMoney = isnull(sum(SwapMoney),0) from swapList inner join masterbill on swapList.billid = masterbill.AutoId and Masterbill.s_syb >= 0 inner join Masterbill hhBill on swapList.billid = hhbill.AutoId and hhbill.s_syb >= 0 where billid = @billID and brand_id =@Brand_Id if @swaptype = '销售' set @curMoney = -1 * @curMoney - @YhhMoney else set @cur
温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
|