ALTER PROCEDURE [dbo].[p_auasoft_iocheck]
@vwkNo AS varchar =30
AS
BEGIN
declare @FItemID int, @FStockID int, @FQty decimal(18,6)
declare @FBatchNo VARCHAR(50),@FDate VARCHAR(50)
declare @FBillNo varchar(50)
declare @FInterID INT,@FUnitID INT,@Row INT
set @Row=1;
exec GetIcMaxNum 'icstockbill',@FInterID output, 1,16394
exec [p_BM_GetBillNo] 2, @FBillNo out
/*
exec GetIcMaxNum 'icstockbill',@FInterID output, 1,16394
select @FInterID
exec [p_BM_GetBillNo] 2, @FBillNo out
select 'pp'+'---'+@FBillNo
*/
set @FDate=convert(varchar,getdate(),121)
INSERT INTO
declare cur Cursor for
SELECT a.FItemID,a.FBatchNo,a.FStockID,a.FQty,b.FUnitID from ICInventory a INNER JOIN t_ICItem b on a.FItemId=b.FItemId where Fqty<0
open cur
fetch cur into @FItemID,@FBatchNo,@FStockID,@FQty,@FUnitID
while @@fetch_status=0
begin
INSERT into ICStockBillEntry(FBrNo,FInterID,FItemID,FEntryID,FQtyMust,FQty,FPrice,FBatchNo,FAmount,FUnitID,
FAuxPrice,FAuxQty,FAuxQtyMust,FQtyActual,FAuxQtyActual,FPlanPrice,FAuxPlanPrice,FSourceEntryID,FCommitQty,FAuxCommitQty,
FKFPeriod,FConsignPrice,FConsignAmount,FProcessCost,FMaterialCost,FTaxAmount,FMapNumber,FOrgBillEntryID,FPlanAmount,
FProcessPrice,FTaxRate,FAmtRef,FAuxPropID,FCost,FPriceRef,FAuxPriceRef,FQtyInvoice,FQtyInvoiceBase,FUnitCost,FSecCoefficient,
FSecQty,FSecCommitQty,FSourceTranType,FSourceInterId,FSourceBillNo,FContractInterID,FContractEntryID,FContractBillNo,
FICMOBillNo,FICMOInterID,FPPBomEntryID,FOrderInterID,FOrderEntryID,FOrderBillNo,FAllHookQTY,FAllHookAmount,FCurrentHookQTY,
FCurrentHookAmount,FStdAllHookAmount,FStdCurrentHookAmount,FSCStockID,FDCStockID,FCostObjGroupID,FCostOBJID,FMaterialCostPrice,
FReProduceType,FBomInterID,FDiscountRate,FDiscountAmount,FSepcialSaleId,FOutCommitQty,FOutSecCommitQty,FDBCommitQty,
FDBSecCommitQty,FAuxQtyInvoice,FOperSN,FCheckStatus,FInStockID,FSaleCommitQty,FSaleSecCommitQty,FSaleAuxCommitQty,
FSelectedProcID,FVWInStockQty,FAuxVWInStockQty,FSecVWInStockQty,FSecInvoiceQty,FCostCenterID,FPlanMode,FMTONo,FSecQtyActual,
FSecQtyMust,FRowClosed,FItemSize,FItemSuite,FPositionNo,FIsVMI,FEntrySupply,FChkPassItem,FSEOutInterID,FSEOutEntryID,
FSEOutBillNo,FConfirmMemEntry,FWebReturnQty,FWebReturnAuxQty,FItemStatementBillNO,FItemStatementEntryID,FItemStatementInterID,
FRealAmount,FRealPrice,FDefaultBaseQty,FDefaultQty,FRealStockBaseQty,FRealStockQty,FDiscardID,FLockFlag,FReturnNoticeBillNO,
FReturnNoticeEntryID,FReturnNoticeInterID,FProductFileQty,FSplitState,FQtySplit,FAuxQtySplit,FAddQty,FAuxAddQty)
VALUES
( 0,@FInterID,@FItemID,@Row,0-@FQty,0-@FQty,0,@FBatchNo,0,@FUnitID,
0,0-@FQty,0,0,0,0,0,1,0,0,
0,0,0,0,0,0,'',0,0,
0,0,0,0,0,0,0,0,0,0,0,
0,0,551,89206,'HB18020078',0,0,'',
@FBillNo,26262,0,0,0,0,0,0,0,
0,0,0,0,@FStockID,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,14036,'',0,
0,0,'','','',0,0,1058,0,0,
'','',0,0,'',0,0,
0,0,0,0,0,0,0,0,'',
0,0,0,'',0,0,0,0 )
set @Row=@Row+1
UPDATE ICInventory set FQty=0 where FItemID=@FItemID and FBatchNo=@FBatchNo and FStockID=@FStockID and FQty<0
fetch cur into @FItemID,@FBatchNo,@FStockID,@FQty,@FUnitID
end
close cur
deallocate cur
END
FTranType | FBillName |
1 | 外购入库单 |
2 | 产品入库单 |
5 | 委外入库单 |
10 | 其他入库单 |
21 | 销售出库单 |
24 | 领料单 |
28 | 委外出库单 |
29 | 其他出库单 |
40 | 盘盈单 |
41 | 调拨单 |
43 | 盘亏单 |
100 | 成本调整单 |
101 | 外购入库暂估补差单 |
102 | 委外加工暂估补差单 |
本人专业从事管理软件升级与深度改造,范围包括SAP 、INFO、用友及金碟等,欢迎共同讨论,共同进步!
转载请注明出处!