金蝶旗舰版数据库对接开发流程及思路-出库单自动下推发票

注意:程序中数据库关闭自动提交,事务设置TRANSACTION_READ_UNCOMMITTED:未提交读

1.查询是否下推发票标志:

select fvalue from t_SystemProfile where FCategory='IC' and FKey='MakeSaleInvoAfterOrderAudit'

如果 fvalue等于2,则执行下推发票操作。

2.查询出要下推发票的销售出库单集合

2.1 查询供应链当前年度,用于后续单据赋值

select FValue from t_SystemProfile where FCategory='IC' and FKey='CurrentYear'

2.2查询供应链当前期间,用于后续单据赋值

select FValue from t_SystemProfile where FCategory='IC' and FKey='CurrentPeriod'

2.3查询当前期间是否关帐  0未关 1关,,用于判断是否关账,关账则不再同步

select FValue from t_SystemProfile where FCategory='IC' and FKey='BillStatus'

2.4 判断总金额是否为0,为0则不下推发票:

    SELECT  SUM(FConsignAmount) as amount FROM ICStockBillEntry 
                       WHERE FInterID in ( 
                         select  FInterID from ICStockBill where FBillNo='code'
                         );

ps:code为要下推发票的销售出库单号。

3.获取金蝶发票表当前最大id:

select max(finterid) finterid from icsale

4.根据配置选择生成‘普票’还是'专票':
构建普票编号:   

public String buildFbillnofp()throws Exception{

        String buildOnlyNumber=null;
        int fcurno=0;
        String fpre="";
        SqlServerUtil mysql=new SqlServerUtil();         
        Connection conn=mysql.getConnection();
        synchronized (this){           
            try{
                conn.setAutoCommit(false);
                conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                          
                String ssql=" select fpreletter,fcurno from icbillno where fbillid = 86 ";
                Statement stat = conn.createStatement();
                ResultSet rs=stat.executeQuery(ssql);
                  while(rs.next()) {   
                      f
  • 31
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值