zoukankan      html  css  js  c++  java
  • 0123工作备份2

    USE [AIS20161026095136]
    GO
    /****** Object: StoredProcedure [dbo].[x_xlh1] Script Date: 2017/1/23 13:08:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    create PROCEDURE [dbo].[x_xlh2]
    @rkwl varchar(50),@rksl int ,@fbillno varchar(50)
    AS
    BEGIN

    declare @FInterid2 int
    declare @FInterid1 int
    declare @fcustid int
    DECLARE @fdcstockid int
    declare @fbase2 varchar(50)
    declare @fbaseproperty varchar(50)
    declare @fbaseproperty2 varchar(50)
    declare @finteger int
    declare @fentryid int
    declare @fitemid int
    declare @fid int
    declare @Fbillno1 varchar(50)
    declare @Fbillno2 varchar(50)
    declare @FbillnoBM varchar(50)
    declare @fdcstockid1 int
    declare @FUnitIDICItem int
    declare @fbillnolen int
    declare @fbiller int
    declare @fitemid1 int
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    select 1
    select top 1 @fcustid=a1.fbase5 from t_bos200000001entry2 a1 inner join t_bos200000001 b1 on a1.fid=b1.fid where b1.fbillno=@fbillno
    select @fbiller=fbiller from t_bos200000001 where fbillno=@fbillno
    -- 出库单单据编号
    select @FbillnoBM =FProjectVal from t_BillCodeRule where FBilltypeID='29' and FProjectID=1
    select @fbillnolen=Flength,@Fbillno1=FProjectVal from t_BillCodeRule where FBilltypeID='29' and FProjectID=3
    select @Fbillno1 = @FbillnoBM + Right('000000'+ @Fbillno1, @FbillnoLen)
    --出库单主键
    exec GetICMaxNum 'ICStockbill',@FInterid2 output ,29,16394

    -- 入库单单据编号
    select @FbillnoBM =FProjectVal from t_BillCodeRule where FBilltypeID='10' and FProjectID=1
    select @fbillnolen=Flength,@Fbillno2=FProjectVal from t_BillCodeRule where FBilltypeID='10' and FProjectID=3
    select @Fbillno2 = @FbillnoBM + Right('000000'+ @Fbillno2, @FbillnoLen)

    select @fid=fid from t_bos200000001 where fbillno=@fbillno
    --回收仓002
    select @fdcstockid1=891
    select * from t_stock
    --入库单主键
    exec GetICMaxNum 'ICStockbill',@FInterid1 output ,10,16394

    select @fitemid=fitemid from t_icitem where FNumber=@rkwl
    select @FUnitIDICItem=funitid from t_ICItem where FItemID=@fitemid

    --发货仓001
    select @fdcstockid=fbase from t_BOS200000001Entry2 a1 inner join t_BOS200000001 b1 on a1.fid=b1.fid
    where b1.FBillNo=@fbillno and a1.fbase5=@fitemid
    --生成入库单
    insert into ICStockBillEntry (FBrNo,FInterID,FEntryID,FItemID,FQtyMust,FQty,FPrice,

    FBatchNo,FAmount,FNote,FAuxPrice,FAuxQty,FAuxQtyMust,
    FSourceEntryID,FSourceTranType,FSourceInterId,FSourceBillNo,
    FICMOInterID,FPPBomEntryID,FOrderInterID,FOrderEntryID,
    FOrderBillNo,FDCStockID,FPlanMode,FFatherProductID,FICMOBillNo,FUnitID)

    values ('0',@FInterid1,1,@fitemid,@rksl,@rksl ,0,
    0,0,'',0,@rksl ,@rksl,
    0,'1007105',@fid,@Fbillno,
    @fid,1,@FInterid2,1,
    @Fbillno,@fdcstockid1,'14036',@fitemid,@Fbillno,@FUnitIDICItem )

    insert into ICStockBill (FBrNo,FInterID,FTranType,FDate,FBillNo,FNote,
    FSupplyID,FFManagerID,FSManagerID,FBillerID,
    FROB,FUpStockWhenSave,FOperDate,FMarketingStyle,
    FSelTranType,FsourceType,
    FPurposeID,FCussentAcctID,FPayCondition
    ,FSettleDate,FDCStockID ,FCheckerID,fstatus,fcheckdate)

    values ('0',@FInterid1,'10',convert(varchar(10),getdate(),120),@Fbillno2,'',
    @fcustid,'','',@fbiller,
    '1','1',null,'12530',
    '','37521'
    ,14190,1104,1000
    ,convert(varchar(10),getdate(),120),@fdcstockid1,16393,1,convert(varchar(10),getdate(),120))
    --更新库存
    update ICInventory set fqty=fqty+@rksl where fitemid=@fitemid and FStockID=@fdcstockid1
    update t_BillCodeRule set FProjectVal=(select Fprojectval from t_BillCodeRule Where FBillTypeID = '10' and FProjectID=3)+1 Where FBillTypeID = '10' and FProjectID=3

    END

  • 相关阅读:
    缓冲流
    properties类
    io流
    异常处理
    file的概述和作用
    map集合和set集合
    js 判断是否是undefined null NaN
    java instanceof 判断是否是String
    ajax获取数据中文乱码问题最简单的完美解决方案
    if else if else if else 的用法
  • 原文地址:https://www.cnblogs.com/xujiating/p/6343875.html
Copyright © 2011-2022 走看看