|
|
@@ -411,11 +411,21 @@ class Manufacture extends Api
|
|
|
'Gy0_yjno' => $data['printCode'],
|
|
|
'Gy0_gxh' => $data['processCode']
|
|
|
];
|
|
|
+ $result = \db('工单_工艺资料')->where($where)->field('Gy0_sj1')->find();
|
|
|
+ if ($result['Gy0_sj1']>'1900-01-01 00:00:00'){
|
|
|
+ $this->error('该工单已经是制程中');
|
|
|
+ }
|
|
|
$lastTime = \db('工单_工艺资料')
|
|
|
->where(['Gy0_sbbh'=>$where['Gy0_sbbh'],'Gy0_sj2'=>['<>','1900-01-01 00:00:00'],'Gy0_sj2'=>['<','2099-01-01 00:00:00']])
|
|
|
->field('rtrim(Gy0_sj2) as sj2')
|
|
|
->order('Gy0_sj2 desc')
|
|
|
->find();
|
|
|
+ $date = date('Y-m-d H:i:00',time());
|
|
|
+ if ($lastTime['sj2'] < $date){
|
|
|
+ $newTime = $date;
|
|
|
+ }else{
|
|
|
+ $newTime = $lastTime['sj2'];
|
|
|
+ }
|
|
|
$row = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
|
->field('rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_小时产能) as 小时产能,rtrim(Gy0_辅助工时) as 辅助工时')
|
|
|
@@ -427,7 +437,7 @@ class Manufacture extends Api
|
|
|
$sql = \db('工单_工艺资料')
|
|
|
->where($where)
|
|
|
->fetchSql(true)
|
|
|
- ->update(['Gy0_sj1'=>$lastTime['sj2'],'Gy0_sj2'=>$endTime,'Mod_rq'=>date('Y-m-d H:i:s',time())]);
|
|
|
+ ->update(['Gy0_sj1'=>$newTime,'Gy0_sj2'=>$endTime,'Mod_rq'=>date('Y-m-d H:i:s',time())]);
|
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
|
$this->success('成功');
|
|
|
@@ -781,7 +791,6 @@ class Manufacture extends Api
|
|
|
'b.PD_WG' => '1900-01-01 00:00:00'
|
|
|
])
|
|
|
->group('a.Gd_gdbh')
|
|
|
- ->cache(true,720)
|
|
|
->select();
|
|
|
if (empty($list)){
|
|
|
$this->success('',[]);
|