select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty, f_pregrossweight, f_warehouseid, f_prenetweight, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC, f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, f_marks, create_by, create_time, update_by, f_volumnblc, update_time, remark, f_business_type, f_originalbilldate from t_whgenleg
    
    
    
    
    
        insert into t_whgenleg
        
            f_accyear,
            f_accmonth,
            f_corpid,
            f_mblno,
            f_originalbillno,
            f_warehouse_locationid,
            f_goodsid,
            f_trademodeid,
            f_preqty,
            f_pregrossweight,
            f_warehouseid,
            f_prenetweight,
            f_chargedate,
            f_volumnD,
            f_qtyD,
            f_billingway,
            f_grossweightD,
            f_netweightD,
            f_volumnC,
            f_qtyC,
            f_grossweightC,
            f_qtyblc,
            f_grossweightblc,
            f_netweightC,
            f_netweightblc,
            f_cntrno,
            f_status,
            del_flag,
            f_marks,
            create_by,
            create_time,
            update_by,
            f_volumnblc,
            update_time,
            remark,
            f_business_type,
            f_originalbilldate,
        
        
            #{fAccyear},
            #{fAccmonth},
            #{fCorpid},
            #{fMblno},
            #{fOriginalbillno},
            #{fWarehouseLocationid},
            #{fGoodsid},
            #{fTrademodeid},
            #{fPreqty},
            #{fPregrossweight},
            #{fWarehouseid},
            #{fPrenetweight},
            #{fChargedate},
            #{fVolumnd},
            #{fQtyd},
            #{fBillingway},
            #{fGrossweightd},
            #{fNetweightd},
            #{fVolumnc},
            #{fQtyc},
            #{fGrossweightc},
            #{fQtyblc},
            #{fGrossweightblc},
            #{fNetweightc},
            #{fNetweightblc},
            #{fCntrno},
            #{fStatus},
            #{delFlag},
            #{fMarks},
            #{createBy},
            #{createTime},
            #{updateBy},
            #{fVolumnblc},
            #{updateTime},
            #{remark},
            #{fBusinessType},
            #{fOriginalbilldate},
        
    
    
        update t_whgenleg
        
            f_accyear = #{fAccyear},
            f_accmonth = #{fAccmonth},
            f_corpid = #{fCorpid},
            f_mblno = #{fMblno},
            f_originalbillno = #{fOriginalbillno},
            f_warehouse_locationid = #{fWarehouseLocationid},
            f_goodsid = #{fGoodsid},
            f_trademodeid = #{fTrademodeid},
            f_preqty = #{fPreqty},
            f_pregrossweight = #{fPregrossweight},
            f_warehouseid = #{fWarehouseid},
            f_prenetweight = #{fPrenetweight},
            f_chargedate = #{fChargedate},
            f_volumnD = #{fVolumnd},
            f_qtyD = #{fQtyd},
            f_billingway = #{fBillingway},
            f_grossweightD = #{fGrossweightd},
            f_netweightD = #{fNetweightd},
            f_volumnC = #{fVolumnc},
            f_qtyC = #{fQtyc},
            f_grossweightC = #{fGrossweightc},
            f_qtyblc = #{fQtyblc},
            f_grossweightblc = #{fGrossweightblc},
            f_netweightC = #{fNetweightc},
            f_netweightblc = #{fNetweightblc},
            f_cntrno = #{fCntrno},
            f_status = #{fStatus},
            del_flag = #{delFlag},
            f_marks = #{fMarks},
            create_by = #{createBy},
            create_time = #{createTime},
            update_by = #{updateBy},
            f_volumnblc = #{fVolumnblc},
            update_time = #{updateTime},
            remark = #{remark},
            f_business_type = #{fBusinessType},
            f_originalbilldate = #{fOriginalbilldate},
        
        where f_id = #{fId}
    
    
        update t_whgenleg
        
            /*判断是否入库*/
            
                f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
                f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
                f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
                f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
                f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
            
            /*判断是否撤销入库*/
            
                f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
                f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
                f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
                f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
                f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
            
            /*判断是否出库*/
            
                f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
                f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
                f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
                f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
                f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
            
            /*判断是否撤销出库*/
            
                f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
                f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
                f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
                f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
                f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
            
            -- update_by = NOW()
        
        where f_id = #{map.whgenlegId}
    
    
    
        update t_whgenleg
        
            /*判断是否入库*/
            
                f_volumnD = f_volumnD + #{map.warehousebillsitems.fQty},
                f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fAmount},
                f_grossweightblc = f_grossweightblc + #{map.warehousebillsitems.fQty}
            
            /*判断是否撤销入库*/
            
                f_volumnD = f_volumnD - #{map.warehousebillsitems.fQty},
                f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fAmount},
                f_grossweightblc = f_grossweightblc - #{map.warehousebillsitems.fQty}
            
            /*判断是否出库*/
            
                f_netweightC = f_netweightC + #{map.warehousebillsitems.fQty},
                f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fAmount}
            
            /*判断是否撤销出库*/
            
                f_netweightC = f_netweightC - #{map.warehousebillsitems.fQty},
                f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fAmount}
            
            -- update_by = NOW()
        
        where f_id = #{map.whgenlegId}
    
    
        delete from t_whgenleg where f_id = #{fId}
    
    
        delete from t_whgenleg where f_id in
        
            #{fId}