原创 深度改造K3---产成品入库算法--p_auasoft_iocheck

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

FTranTypeFBillName
1外购入库单
2产品入库单
5委外入库单
10其他入库单
21销售出库单
24领料单
28委外出库单
29其他出库单
40盘盈单
41调拨单
43盘亏单
100成本调整单
101外购入库暂估补差单
102委外加工暂估补差单

本人专业从事管理软件升级与深度改造,范围包括SAP 、INFO、用友及金碟等,欢迎共同讨论,共同进步!

转载请注明出处!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值