tags: SSM整合与阅读项目
阅读SSM项目之scm【第二篇】
采购商品
采购表buy_order:
单号bo_id,供货商sup_id,仓库sh_id,收货日期bo_date,应付(实付+欠款+优惠)bo_payable,实付bo_paid,欠款bo_Arrears,原始单号bo_original_id,备注bo_remark,经办人bo_attn,操作员operator。复制代码
采购明细表buy_order_detail:
编号bod_id:商品名称goods_id,单位goods_unit,数量 bod_amount,进价bod_buy_price,总金额(可无)bod_total_price, 采购单号bo_id,手机串号列表(##分隔)bod_IMEI复制代码
账务表account_records:
编号ad_id,供货商编号sup_id,日期ad_date,单号(不同类型单号不一样)ad_order_id,类型(业务类型)ad_bus_type,应付ad_payable, 实付ad_paid,欠款ad_arrears,优惠金额ad_discount,经办人ad_attn,操作员ad_operator。备注ad_remark复制代码
数据在插入的时候涉及到了这三张的数据库表:
至于我们的财务表的数据是用于拓展的,属性的信息基本是在采购表中获取:
public int insertBuyOrder(BuyOrder buyOrder) throws Exception { // TODO Auto-generated method stub System.out.println("service.buyOrder:"+buyOrder); int i = 0; //生成采购单号,bo表示采购业务 //bo --商品采购 //ro --商品退货 // String boId ="bo"+UUID.randomUUID().toString().replace("-", ""); System.out.println("boIduuid:"+boId); //设置采购单号 buyOrder.setBoId(boId); i = buyOrderMapper.insert(buyOrder); //设置采购明细主键及与采购单的外键值 for(BuyOrderDetail bod : buyOrder.getBuyOrderDetails()){ bod.setBodId(UUID.randomUUID().toString().replace("-", "")); bod.setBoId(boId); } buyOrderDetailMapper.insertList(buyOrder.getBuyOrderDetails()); AccountRecords accountRecords = new AccountRecords(); // 生成并设置怅务记录的主键 accountRecords.setArId(String.valueOf("ar"+UUID.randomUUID().toString().replace("-", ""))); accountRecords.setArAttn(buyOrder.getBoAttn()); accountRecords.setArArrears(buyOrder.getBoArrears()); //bo表示商品采购,可以在参数表中加入相关内容 accountRecords.setArBusType("bo"); accountRecords.setArDate(buyOrder.getBoDate()); //优惠金额:用应付金额减去实付金额再减去欠款 accountRecords.setArDiscount(buyOrder.getBoPayable().subtract(buyOrder.getBoPaid()).subtract(buyOrder.getBoArrears())); accountRecords.setArOperator(buyOrder.getBoOperator()); //采购单号 accountRecords.setArOrderId(buyOrder.getBoId()); accountRecords.setArPaid(buyOrder.getBoPaid()); accountRecords.setArPayable(buyOrder.getBoPayable()); accountRecords.setArRemark(buyOrder.getBoRemark()); accountRecords.setSupId(buyOrder.getSupId()); accountRecordsMapper.insert(accountRecords); return i; }复制代码
如果您觉得这篇文章帮助到了您,可以给作者一点鼓励