Browse Source

自动分配机台

qiuenguang 1 year ago
parent
commit
c5a99afcb0
1 changed files with 10 additions and 0 deletions
  1. 10 0
      application/api/controller/WorkOrder.php

+ 10 - 0
application/api/controller/WorkOrder.php

@@ -2144,6 +2144,7 @@ class WorkOrder extends Api
         ];
         $ProcessList = \db('产品_工艺资料')
             ->where($processWhere)
+            ->order('Gy0_yjno,Gy0_gxh')
             ->select();
         if (empty($ProcessList)){
             $this->error('未找到产品工艺资料');
@@ -2156,6 +2157,15 @@ class WorkOrder extends Api
             }else{
                 $rate = \db('dic_lzsh')->where('sys_bh',$value['Gy0_shdh'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->find();
             }
+            //设置默认机台
+            $machineList = \db('设备_基本资料')
+                ->where('生产工序','like','%'.$value['gy0_gxmc'].'%')
+                ->order('设备编号')
+                ->value('设备编号');
+            $ProcessList[$key]['Gy0_sbbh'] = '';
+            if (!empty($machineList)){
+                $ProcessList[$key]['Gy0_sbbh'] = $machineList;
+            }
             $ProcessList[$key]['Gy0_yjno'] = $value['Gy0_yjno'];
             $ProcessList[$key]['Gy0_gdbh'] = $param['workorder'];
             $ProcessList[$key]['Gy0_gxmc'] = $value['gy0_gxmc'];