月结库存流水修正过程
<p>月结库存流水修正过程</p><p>首先根据物资是否有barcode分为两部分进行修正。</p><p> 有barcode: </p><p> a)有barcode的物资按照仓库,barcode进行对5月流水进行汇总统计,取数量等于1的为5月新增barcode,数量等于-1的为5月消耗barcode,忽略数量等于0的。</p><p> b)在4月结存库存的基础上,按照第一个的结果进行增加和删除记录</p><p> 无barcode的:</p><p> a)根据仓库,物料,批次以及单位对5月流水进行汇总,取数量大于0的为5月新增的物资,小于0的为出库/消耗物资</p><p> b)在4月结存库存的基础,按照计算结果,增加或者减少物资数量,如果物资数量为0则进行删除</p><p> 特殊物资处理:</p><p> 文具库5月有对非贴签物资进行处理,但是没有增加对应流水,造成在系统内部,流水和库存不符合的问题。</p><p> 处理方式:按照物资实际出入量,在4月的基础上修正这部分物资的库存</p><p>相关sql:<img src="http://bbs.cs126.cn/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif"/><a href="/ueditor/php/upload/file/20170606/1496714722482887.txt" title="月结库存处理sql.txt" style="line-height: 16px; font-size: 12px; color: rgb(0, 102, 204);">月结库存处理sql.txt</a></p><p> <br/></p> <p>确认sql:</p><p>select * from ( </p><p> select material_id,sum(jit.jit_stock_sum_qty * jit.unite_price) a,'201705'</p><p> from tb_usc_monthly_balance_dtl_jit jit</p><p> where jit.account_period = '201705'</p><p> and jit.wh_id = '100109'</p><p> group by material_id</p><p> union </p><p> select material_id,sum(jit.jit_stock_sum_qty * jit.unite_price),'201704'</p><p> from tb_usc_monthly_balance_dtl_jit jit</p><p> where jit.account_period = '201704'</p><p> and jit.wh_id = '100109'</p><p> group by material_id</p><p> union </p><p> select material_id,sum(t.quantity*t.trade_price),'flow'</p><p> from tb_usc_monthly_balance_dtl_flw t</p><p> where t.account_period='201705' </p><p> and t.wh_to_id='100109'</p><p> group by material_id) t</p><p> where t.a!=0</p><p> order by 1,3</p><p><br/></p>
页:
[1]