|
|
@@ -1062,5 +1062,39 @@ class Manufacture extends Api
|
|
|
$this->success('成功',$list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 月度工序产量左侧菜单
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function dateList()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ // 查询并按月份统计
|
|
|
+ $result = Db::name('工单_基本资料')
|
|
|
+ ->field("DATE_FORMAT(Sys_rq, '%Y-%m') as month")
|
|
|
+ ->group("DATE_FORMAT(Sys_rq, '%Y-%m')")
|
|
|
+ ->select();
|
|
|
+ $list = $this->array_flatten($result);
|
|
|
+ $this->success('成功',$list);
|
|
|
+ }
|
|
|
+
|
|
|
+ function array_flatten($array) {
|
|
|
+ $result = [];
|
|
|
+ foreach ($array as $value) {
|
|
|
+ if (is_array($value)) {
|
|
|
+ $result = array_merge($result, $this->array_flatten($value));
|
|
|
+ } else {
|
|
|
+ $result[] = $value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|