⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 officemgr.java

📁 oa 源码
💻 JAVA
字号:
package com.redmoon.oa.officeequip;import java.util.Calendar;import cn.js.fan.db.Conn;import cn.js.fan.util.*;import java.sql.*;import cn.js.fan.util.ErrMsgException;import javax.servlet.http.*;public class OfficeMgr {    public OfficeMgr() {    }    public boolean create(HttpServletRequest request) throws ErrMsgException {        boolean re = true;        String measureUnit = "", typeId = "",officeName = "", buyPerson = "", buyDate = "",abstracts = "",storageCount="";        double  price;        officeName = ParamUtil.get(request, "officeName");        typeId = ParamUtil.get(request,"typeId");        if (!StrUtil.isNumeric(typeId))                throw new ErrMsgException("请您选择办公用品类别!\\n");        if (officeName.equals(""))            throw new ErrMsgException("请您输入办公用品名称!\\n");        measureUnit = ParamUtil.get(request, "measureUnit");        buyPerson = ParamUtil.get(request, "buyPerson");        storageCount = ParamUtil.get(request, "storageCount");        if (!StrUtil.isNumeric(storageCount))           throw new ErrMsgException("请输入正确数量!");        buyDate = ParamUtil.get(request, "buyDate");        price = ParamUtil.getDouble(request, "price",0);        if (price==0){                throw new ErrMsgException("请输入正确价格!\\n");        }        abstracts = ParamUtil.get(request,"abstracts");        OfficeDb office = new OfficeDb();        office.setBuyPerson( buyPerson);        office.setMeasureUnit(measureUnit);        office.setOfficeName(officeName);        office.setStorageCount(Integer.parseInt(storageCount));        office.setTypeId(Integer.parseInt(typeId));        office.setPrice(price);        if (buyDate.equals(""))            buyDate="1900-01-01" ;        java.util.Date d = null;        try {            d = DateUtil.parse(buyDate, "yyyy-MM-dd");        } catch (Exception e) {            System.out.println("OfficeMgr create:" + e.getMessage());        }        office.setBuyDate(d);        office.setAbstracts(abstracts);        re = office.create();        return re;    }    public OfficeDb getOfficeDb(int id) {    OfficeDb addr = new OfficeDb();    return addr.getOfficeDb(id);}    public boolean chageStorageCount(HttpServletRequest request) throws ErrMsgException {        boolean re = true;        String abstracts = "";        int id = 0;        try {            id = ParamUtil.getInt(request, "equipId");        }        catch (ErrMsgException e) {            throw new ErrMsgException("请选择用品类别!");        }        int storageCount = 0;        try {            storageCount = ParamUtil.getInt(request,"storageCount");        }catch (ErrMsgException e) {            throw new ErrMsgException("请输入正确数量!");        }        if (id ==0 || storageCount ==0)            throw new ErrMsgException("请您选择办公用品类别!\\n");        OfficeDb otd = getOfficeDb(id);        storageCount = otd.getStorageCount() - storageCount;        if(storageCount<0)           throw new ErrMsgException("库存不够!");        else{            otd.setStorageCount(storageCount);            otd.setAbstracts(abstracts);            re = otd.save();        }        return re;    }    public boolean chStorageCount(HttpServletRequest request) throws          ErrMsgException {      boolean re = true;      int id = ParamUtil.getInt(request, "officeId");      int storageCount = ParamUtil.getInt(request, "count");      OfficeDb odb = new OfficeDb();      odb = odb.getOfficeDb(id);      storageCount = odb.getStorageCount() + storageCount;      odb.setStorageCount(storageCount);      re = odb.save();      return re;  }        public boolean returnChageStorageCount(HttpServletRequest request) throws ErrMsgException {            boolean re = true;            int id = 0;            try {                id = ParamUtil.getInt(request, "officeId");            }            catch (ErrMsgException e) {                throw new ErrMsgException("标识非法!");            }            int storageCount = ParamUtil.getInt(request, "count");            OfficeDb odb =new OfficeDb();            odb = odb.getOfficeDb(id);            storageCount = odb.getStorageCount() + storageCount;            odb.setStorageCount(storageCount);            re = odb.save();            return re;        }        public boolean del(HttpServletRequest request) throws ErrMsgException {           int id = ParamUtil.getInt(request, "id");           OfficeDb OfficeDb = getOfficeDb(id);           if (OfficeDb == null || !OfficeDb.isLoaded())               throw new ErrMsgException("该项已不存在!");           OfficeOpDb ood = new OfficeOpDb();           if (ood.hasOfficeOfType(id)) {            throw new ErrMsgException("此已货品借出,归还货品后才能删除货物!");          }           return OfficeDb.del();        }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -