// 消耗 @Test public void testUseUp() throws BusinessException, SQLException { StockActionDao.getStockAndDetail(mStaff, null, null); Department deptIn; List<Department> depts = DepartmentDao.getDepartments4Inventory(mStaff); if (depts.isEmpty()) { throw new BusinessException(DeptError.DEPT_NOT_EXIST); } else { deptIn = depts.get(2); } // Map<Object, Object> params = new HashMap<Object, Object>(); // params.put(SQLUtil.SQL_PARAMS_EXTRA, " AND M.restaurant_id = " + mStaff.getRestaurantId()); List<Material> materials = MaterialDao.getByCond(mStaff, null); if (materials.isEmpty()) { throw new BusinessException(MaterialError.SELECT_NOT_ADD); } InsertBuilder builder = StockAction.InsertBuilder.newDamage(mStaff.getRestaurantId()) .setOperatorId((int) mStaff.getId()) .setOperator(mStaff.getName()) .setOriStockId("bbb111") .setOriStockDate(DateUtil.parseDate("2013-09-26 12:12:12")) .setComment("use_up") .setDeptIn(deptIn.getId()) .setCateType(MaterialCate.Type.MATERIAL) .addDetail(new StockActionDetail(materials.get(0).getId(), 1.5f, 10)) .addDetail(new StockActionDetail(materials.get(2).getId(), 1.5f, 8)); testInsert(builder); }