|
|
@@ -557,4 +557,85 @@ class PrintingPlate extends Api
|
|
|
$this->success('删除成功');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报废印版左侧菜单
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function getPrintDateList()
|
|
|
+ {
|
|
|
+ if (!$this->request->isGet()) {
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = db('产品_印版库')
|
|
|
+ ->field([
|
|
|
+ 'YEAR(报废日期) as year',
|
|
|
+ 'DATE_FORMAT(报废日期, "%Y-%m") as month',
|
|
|
+ 'DATE_FORMAT(报废日期, "%Y-%m-%d") as day'
|
|
|
+ ])
|
|
|
+ ->where('报废日期', '<>', '1900-01-01 00:00:00')
|
|
|
+ ->group('day')
|
|
|
+ ->order('day desc')
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ if (empty($result)) {
|
|
|
+ $this->success('成功', []);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建层次结构
|
|
|
+ $data = [];
|
|
|
+ foreach ($result as $item) {
|
|
|
+ if (empty($item['year']) || empty($item['month']) || empty($item['day'])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $year = (string)$item['year'];
|
|
|
+ $month = $item['month'];
|
|
|
+ $day = $item['day'];
|
|
|
+
|
|
|
+ if (!isset($data[$year])) {
|
|
|
+ $data[$year] = [];
|
|
|
+ }
|
|
|
+ if (!isset($data[$year][$month])) {
|
|
|
+ $data[$year][$month] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $data[$year][$month][] = $day;
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('成功', $data);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取报废印版资料
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function getPrintdata()
|
|
|
+ {
|
|
|
+ if (!$this->request->isGet()) {
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (empty($param)) {
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $list = db('产品_印版库')
|
|
|
+ ->where('报废日期', 'like', $param['date'].'%')
|
|
|
+ ->group('存货编码')
|
|
|
+ ->select();
|
|
|
+ if (empty($list)) {
|
|
|
+ $this->error('未获取数据');
|
|
|
+ }else{
|
|
|
+ $this->success('成功', $list);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|