123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class OfficeItems extends Base
- {
- // 新增
- public function save(){
- model('OfficeItems')->add($this->userId);
- HelpHander::success([],'操作成功');
- }
- // 编辑
- public function update(){
- model('OfficeItems')->add($this->userId);
- HelpHander::success([],'操作成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('OfficeItems')->info($id);
- HelpHander::success($ret);
- }
- // 列表
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $cateId = input('cateId/d',0);
- $type = input('type/d',0);
- $ret = model('OfficeItems')->lists($page,$size,$title,$cateId,$this->orgId,$type);
- HelpHander::success($ret);
- }
- // 导出列表
- public function export(){
- $title = input('title','','trim');
- $cateId = input('cateId/d',0);
- $type = input('type/d',0);
- $ret = model('OfficeItems')->export($title,$cateId,$this->orgId,$type);
- HelpHander::success($ret);
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('OfficeItems')->del($id);
- HelpHander::success([],'操作成功');
- }
- // 申领物品列表
- public function receive(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $items = input('items','','trim');
- $startTime = input('startTime','','trim');
- $endTime = input('endTime','','trim');
- $ret = model('OfficeReceive')->lists($page,$size,$title,$items,$startTime,$endTime,$this->orgId);
- HelpHander::success($ret);
- }
- // 修改物品数量
- public function modifyNums(){
- $id = input('id/d',0);
- $nums = input('nums/d',0);
- if($id <= 0||$nums <= 0){
- HelpHander::error('参数错误');
- }
- if($nums <= 0){
- HelpHander::error('修改数量必须大于0');
- }
- $reason = input('reason','','trim');
- if(!$reason){
- HelpHander::error('未填写原因');
- }
- $type = input('type/d',0);
- if(!in_array($type,[0,1])){
- HelpHander::error('类型错误');
- }
- model('OfficeItems')->modifyNums($id,$nums,$reason,$type,$this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 物品入库
- public function modifyNumsReceive(){
- $id = input('id/d',0);
- $nums = input('nums/d',0);
- if($id <= 0||$nums <= 0){
- HelpHander::error('参数错误');
- }
- if($nums <= 0){
- HelpHander::error('修改数量必须大于0');
- }
- $remark = input('remark','','trim');
- model('OfficeItems')->modifyNumsReceive($id,$nums,$remark,$this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 入库记录
- public function inreceipt(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $id = input('id/d',0);
- $ret = model('OfficeItems')->inreceipt($page,$size,$id);
- HelpHander::success($ret);
- }
- // 数量修改日志
- public function numsLog(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $name = input('name','','trim');
- $ret = model('OfficeItems')->numsLog($page,$size,$title,$name,$this->orgId);
- HelpHander::success($ret);
- }
- // 物品入库月统计
- public function tj(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $month = input('month','','trim');
- if(!$month){
- HelpHander::error('请选择月份');
- }
- $ret = model('OfficeItems')->numsTj($page,$size,$title,$month,$this->orgId);
- HelpHander::success($ret);
- }
- public function tjexport(){
- $title = input('title','','trim');
- $month = input('month','','trim');
- if(!$month){
- HelpHander::error('请选择月份');
- }
- $ret = model('OfficeItems')->tjexport($title,$month,$this->orgId);
- HelpHander::success($ret);
- }
- }
|