Browse Source

面料汇总页面

qiuenguang 9 months ago
parent
commit
3558a88b70
1 changed files with 35 additions and 4 deletions
  1. 35 4
      application/api/controller/WorkOrder.php

+ 35 - 4
application/api/controller/WorkOrder.php

@@ -871,7 +871,9 @@ class WorkOrder extends Api
         foreach ($mianliao as $key => $value){
             $data[$key] = [
                 'BOM_工单编号' => $param['订单编号'],
-                'BOM_物料名称' => $value
+                'BOM_物料名称' => $value,
+                'Sys_rq' => date('Y-m-d H:i:s',time()),
+                'Sys_id' => $param['Sys_id']
             ];
         }
         Db::startTrans();
@@ -2143,10 +2145,13 @@ class WorkOrder extends Api
             $this->error('请求错误');
         }
         $param = $this->request->param();
-        if (empty($param) || !isset($param['order'])){
-            $this->error('参数错误');
+        $where = [];
+        if (isset($param['order'])){
+            $where = ['a.BOM_工单编号'=>$param['order']];
+        }
+        if (isset($param['mouth'])){
+            $where = ['a.Sys_rq'=>['like',$param['mouth'].'%']];
         }
-        $where = ['a.BOM_工单编号'=>$param['order']];
         $list = \db('工单_bom资料')
             ->alias('a')
             ->join('工单_基本资料 b','b.订单编号 = a.BOM_工单编号')
@@ -2317,4 +2322,30 @@ class WorkOrder extends Api
         $number = $param['number'].date('Ymd',time()).'-'.$num;
         $this->success('成功',$number);
     }
+
+    /**
+     * 面料汇总左侧菜单
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function getFabricTab()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $list = \db('工单_bom资料')
+            ->field([
+                "DATE_FORMAT(Sys_rq, '%Y-%m') AS month",
+            ])
+            ->group('month')
+            ->order('month DESC')
+            ->select();
+        if (empty($list)){
+            $this->error('未找到数据');
+        }else{
+            $this->success('成功',$list);
+        }
+    }
 }