no commit message
This commit is contained in:
@@ -9,7 +9,8 @@ class beifenClassModel extends Model
|
||||
$alltabls = $this->db->getalltable();
|
||||
$nobeifne = array(''.PREFIX.'log',''.PREFIX.'logintoken',''.PREFIX.'kqanay',''.PREFIX.'email_cont',''.PREFIX.'dailyfx',''.PREFIX.'todo',''.PREFIX.'city',''.PREFIX.'kqjcmd'); //不备份的表;
|
||||
|
||||
$beidir = ''.UPDIR.'/data/'.date('Y.m.d.H.i.s').'.'.rand(1000,9999).'';
|
||||
$beidir = ''.UPDIR.'/data/'.date('Y.m.d.H.i.s').'.';
|
||||
$beidir .= substr(str_shuffle(md5($this->rock->jm->getRandkey())),0,15);
|
||||
foreach($alltabls as $tabs){
|
||||
if(in_array($tabs, $nobeifne))continue;
|
||||
$rows = $this->db->getall('select * from `'.$tabs.'`');
|
||||
|
||||
@@ -5,21 +5,15 @@ class flow_caigouClassModel extends flowModel
|
||||
|
||||
|
||||
private $goodsobj;
|
||||
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
//审核完成处理,要通知仓库管理员出入库
|
||||
//审核完成处理,是否直接出入库
|
||||
protected function flowcheckfinsh($zt){
|
||||
/*
|
||||
m('goodss')->update('status='.$zt.'',"`mid`='$this->id'");
|
||||
$aid = '0';
|
||||
$rows = m('goodss')->getall("`mid`='$this->id'",'aid');
|
||||
foreach($rows as $k=>$rs)$aid.=','.$rs['aid'].'';
|
||||
m('goods')->setstock($aid);
|
||||
*/
|
||||
if($zt==1)m('goods')->chukuopts($this->id, $this->modename);
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
|
||||
@@ -8,14 +8,9 @@ class flow_goodlyClassModel extends flowModel
|
||||
$this->goodsobj = m('goods');
|
||||
}
|
||||
|
||||
//审核完成处理
|
||||
//审核完成处理,是否直接出入库
|
||||
protected function flowcheckfinsh($zt){
|
||||
/*
|
||||
m('goodss')->update('status='.$zt.'',"`mid`='$this->id'");
|
||||
$aid = '0';
|
||||
$rows = m('goodss')->getall("`mid`='$this->id'",'aid');
|
||||
foreach($rows as $k=>$rs)$aid.=','.$rs['aid'].'';
|
||||
m('goods')->setstock($aid);*/
|
||||
if($zt==1)m('goods')->chukuopts($this->id, $this->modename);
|
||||
}
|
||||
|
||||
//作废或删除时
|
||||
@@ -37,7 +32,7 @@ class flow_goodlyClassModel extends flowModel
|
||||
if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
|
||||
if($lx==1){
|
||||
$rows[$k]['aid'] = $name;
|
||||
$rows[$k]['count'] = 0-$rs['count']; //负数显示为正数
|
||||
//$rows[$k]['count'] = 0-$rs['count']; //负数显示为正数
|
||||
if(isset($rs['lygh'])){
|
||||
$rows[$k]['lygh']=arrvalue($lygya, $rs['lygh']);
|
||||
|
||||
|
||||
@@ -280,6 +280,7 @@ class flow_meetClassModel extends flowModel
|
||||
{
|
||||
$rows = $this->getall("`state` in(0,1) and `type`=0 and `startdt` like '".$this->rock->date."%' and `status`=1");
|
||||
$time = time();
|
||||
$tplnum = m('option')->getval('meetsmstpltx', 'meettodo');
|
||||
foreach($rows as $k=>$rs){
|
||||
$this->adminmodel->setcompanyid($rs['comid']); //设置对应单位id
|
||||
$zt = $rs['state'];
|
||||
@@ -304,7 +305,7 @@ class flow_meetClassModel extends flowModel
|
||||
$this->meettodos($rs, '您好,会议即将在'.$ssj.'分钟后的'.$dts[1].'开始,请准时参加。');//快到时间通知
|
||||
|
||||
//短信通知
|
||||
if($ssj<6)$this->sendsms($rs, 'meettodo', array(
|
||||
if($ssj<6)$this->sendsms($rs, $tplnum, array(
|
||||
'fenz' => ''.$ssj.'',
|
||||
'title' => $rs['title'],
|
||||
'time' => $dts[1],
|
||||
|
||||
@@ -3,6 +3,7 @@ class flow_workClassModel extends flowModel
|
||||
{
|
||||
private $absfile = false;
|
||||
private $statearr;
|
||||
private $updatexm= false;
|
||||
|
||||
public function initModel()
|
||||
{
|
||||
@@ -107,7 +108,11 @@ class flow_workClassModel extends flowModel
|
||||
$zt = 0;
|
||||
if(!isempt($this->rs['distid']))$zt = 3;//待执行的状态值
|
||||
$this->updatestatus($zt);
|
||||
|
||||
if($this->updatexm)m('work')->updateproject($this->rs['projectid']);
|
||||
}
|
||||
|
||||
protected function flowcheckfinsh($zt){
|
||||
if($this->updatexm)m('work')->updateproject($this->rs['projectid']);
|
||||
}
|
||||
|
||||
protected function flowaddlog($a)
|
||||
|
||||
@@ -260,4 +260,95 @@ class goodsClassModel extends Model
|
||||
return $varr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接操作出入库
|
||||
*/
|
||||
public function chukuopts($mid, $mknum)
|
||||
{
|
||||
$isru = m('option')->getval('wpautostock');
|
||||
if($isru!='1')return;
|
||||
$barr = $this->chukuopt($mid);
|
||||
if(!$barr['success'])m('log')->addlogs('直接出入库', $mknum.'('.$mid.'):'.$barr['msg'], 2);
|
||||
}
|
||||
public function chukuopt($mid, $depotid=0)
|
||||
{
|
||||
$mrs = m('goodm')->getone("`id`='$mid' and `status`=1");
|
||||
if(!$mrs)return returnerror('该单据还未审核完成,不能出入库操作');
|
||||
$comid = $mrs['comid'];
|
||||
|
||||
if($depotid==0){
|
||||
$where = '1=1';
|
||||
if(ISMORECOM){
|
||||
$where = 'comid='.$comid.'';
|
||||
}
|
||||
$grs = m('godepot')->getone($where);
|
||||
if(!$grs)return returnerror('没有创建仓库');
|
||||
$depotid = $grs['id'];
|
||||
}
|
||||
|
||||
$mtype = (int)$mrs['type']; //3就是调拨
|
||||
$typv = (int)$mrs['type'];
|
||||
|
||||
$typa = explode(',', '1,0,1,0,0,0');
|
||||
$kina = explode(',', '0,0,1,3,1,4');
|
||||
|
||||
if(!isset($typa[$typv]) || !isset($kina[$typv]))return returnerror('为设置出入库类型');
|
||||
$type = $typa[$typv];
|
||||
$kind = $kina[$typv];
|
||||
|
||||
|
||||
//if($mtype==3 && $depotid==$mrs['custid'])return returnerror('调拨出入库仓库不能相同');
|
||||
|
||||
$ndbs = m('goodn');
|
||||
|
||||
//读取已入库数量
|
||||
$arwos = $ndbs->getall('`mid`='.$mid.' and `couns`<`count`');
|
||||
|
||||
if(!$arwos)return returnerror('子表没用可出入库得');
|
||||
|
||||
$arr['applydt'] = $this->rock->date;
|
||||
$arr['type'] = $type;
|
||||
$arr['kind'] = $kind;
|
||||
$arr['depotid'] = $depotid;
|
||||
$arr['explain'] = '';
|
||||
$arr['uid'] = $this->adminid;
|
||||
$arr['optid'] = $this->adminid;
|
||||
$arr['optdt'] = $this->rock->now;
|
||||
$arr['comid'] = $comid;
|
||||
$arr['optname'] = $this->adminname;
|
||||
$arr['status'] = 1;
|
||||
$arr['mid'] = $mid;
|
||||
|
||||
$aid = '0';
|
||||
|
||||
foreach($arwos as $k1=>$rs1){
|
||||
$count = floatval($rs1['count']) - floatval($rs1['couns']);
|
||||
if($count<=0)continue;
|
||||
$arr['type'] = $type;
|
||||
$arr['depotid'] = $depotid;
|
||||
$arr['aid'] = $rs1['aid'];
|
||||
$arr['count'] = $count;
|
||||
if($type==1)$arr['count'] = 0 - $arr['count'];//出库为负数
|
||||
|
||||
$ussid = $this->db->record('[Q]goodss', $arr);
|
||||
|
||||
if($ussid){
|
||||
$ndbs->update('`couns`=`count`', $rs1['id']);
|
||||
}
|
||||
|
||||
if($mtype==3){
|
||||
$arr['depotid'] = $mrs['custid']; //仓库
|
||||
$arr['type'] = 1; //出库
|
||||
$arr['count'] = 0 - $count;
|
||||
$this->db->record('[Q]goodss', $arr);
|
||||
}
|
||||
|
||||
$aid.=','.$rs1['aid'].'';
|
||||
}
|
||||
|
||||
if($aid!='0')$this->setstock($aid);
|
||||
$this->upstatem($mid);
|
||||
return returnsuccess();
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,18 @@ class workClassModel extends Model
|
||||
|
||||
return $to;
|
||||
}
|
||||
|
||||
//更新对应项目进度
|
||||
public function updateproject($id)
|
||||
{
|
||||
$id = (int)$id;
|
||||
if($id==0)return;
|
||||
$zshu = $this->rows('`projectid`='.$id.' and `status`<>5');
|
||||
$wcshu = $this->rows('`projectid`='.$id.' and `status`=1');
|
||||
$blix = '0';
|
||||
if($zshu>0){
|
||||
$blix = ($wcshu/$zshu) *100;
|
||||
}
|
||||
m('project')->update('progress='.$blix.'', $id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user