qiuenguang 1 жил өмнө
parent
commit
050ee440ab

+ 158 - 0
application/api/controller/Manufacture.php

@@ -900,4 +900,162 @@ class Manufacture extends Api
             $this->error('修改失败');
         }
     }
+
+    /**
+     * 子订单领料派单
+     * @return void
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function processAdd()
+    {
+        if (Request::instance()->post() === false){
+            $this->error('参数错误');
+        }
+        $param = Request::instance()->post();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $data['班组编号'] = $param['班组'];
+        $data['订单编号'] = $param['订单编号'];
+        $data['子订单编号'] = $param['子订单编号'];
+        $data['sys_id'] = $param['Sys_id'];
+        $data['sys_rq'] = date('Y-m-d H:i:s',time());
+        $sql = \db('工单_排程班次')->fetchSql(true)->insert($data);
+        $res = \db()->query($sql);
+        if ($res !== false){
+            $this->success('成功');
+        }else{
+            $this->error('失败');
+        }
+    }
+
+    /**
+     * 车缝班组菜单显示
+     * @return void
+     */
+    public function MachineList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $list = \db('设备_基本资料')
+            ->where('生产工序','车缝')
+            ->column('设备编号');
+        $this->success('成功',$list);
+    }
+
+    /**
+     * 班组生产数据
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function MachineDetail()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_排程班次')
+            ->alias('a')
+            ->join('工单_印件资料 b','b.订单编号 = a.订单编号 AND a.子订单编号 = a.子订单编号')
+            ->join('设备_产量计酬 c','a.订单编号 = c.订单编号 AND a.子订单编号 = c.子订单编号','LEFT')
+            ->field('a.订单编号,a.子订单编号,b.款号,b.颜色,b.船样,b.zdtotal as 制单数,SUM(c.数量) as 已完成')
+            ->where('a.班组编号',$param['machine'])
+            ->where('a.mod_rq',null)
+            ->select();
+        $this->success('成功',$list);
+    }
+
+    /**
+     * 工单审核
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function Approval()
+    {
+        if ($this->request->isPost() === false){
+            $this->error('请求错误');
+        }
+        $param = Request::instance()->post();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $data['审核'] = $param['sys_id'];
+        $data['审核日期'] = date('Y-m-d H:i:s',time());
+        $sql = \db('工单_基本资料')
+            ->where('Uniqid',$param['Uniqid'])
+            ->fetchSql(true)
+            ->update($data);
+        $res = \db()->query($sql);
+        if ($res === false){
+            $this->error('审核失败');
+        }else{
+            $this->success('审核成功');
+        }
+    }
+
+    /**
+     * 订单未审核列表
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function UnapprovalList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (isset($param)){
+            $where['订单编号'] = ['like','%'.$param['search'].'%'];
+        }
+        $where['审核'] = null;
+        $where['审核日期'] = null;
+        $where['Mod_rq'] = null;
+        $list = \db('工单_基本资料')
+            ->where($where)
+            ->select();
+        $this->success('成功',$list);
+    }
+
+    /**
+     * 月度工序产量列表
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function OrderYieldList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if(empty($param)){
+            $this->error('参数错误');
+        }
+        $time = date('Y-m',strtotime($param['mouth']));
+        $list = \db('工单_印件资料')
+            ->alias('a')
+            ->join('工单_基本资料 b','a.订单编号 = b.订单编号')
+            ->join('设备_产量计酬 c','a.订单编号 = c.订单编号 AND a.子订单编号 = c.子订单编号','left')
+            ->field('a.订单编号,a.子订单编号,a.款号,a.颜色,a.zdtotal as 制单总数,a.sctotal as 裁切总数,a.ck_rq as 出库日期,
+            SUM(c.数量) as 车缝产量,c.后道,c.大烫,c.总检,c.包装')
+            ->where('b.Sys_rq','like',$time.'%')
+            ->group('a.子订单编号')
+            ->order('a.Uniqid')
+            ->select();
+        $this->success('成功',$list);
+    }
+
+
 }

+ 32 - 1
application/api/controller/WorkOrder.php

@@ -2184,6 +2184,7 @@ class WorkOrder extends Api
             ->find();
         $xhdata = \db('工单_印件资料')
             ->where('订单编号',$param['order'])
+            ->where('船样',0)
             ->where($where)
             ->field('cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10')
             ->select();
@@ -2199,7 +2200,8 @@ class WorkOrder extends Api
         $processlist = \db('工单_印件资料')
             ->where('订单编号',$param['order'])
             ->where($where)
-            ->field('zdtotal,cm1,cm2,cm3,cm4,cm5,cm6,
+            ->where('船样',0)
+            ->field('子订单编号,颜色,zdtotal,cm1,cm2,cm3,cm4,cm5,cm6,
             cm7,cm8,cm9,cm10,cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
             ->select();
         foreach ($processlist as $key=>$value){
@@ -2219,4 +2221,33 @@ class WorkOrder extends Api
 
     }
 
+    /**
+     * 订单编号自动获取
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function getWorkOrder()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $time =substr( date('Ym',time()),2);
+        $lastOrder = \db('工单_基本资料')
+            ->where('订单编号','like','%'.$time.'%')
+            ->order('Uniqid desc')
+            ->find();
+        $lastNumber = substr($lastOrder['订单编号'],6);
+        $newNumber = (int)$lastNumber + 1;
+        if ($newNumber<10){
+            $newOrder = 'DC'.$time.'00'.$newNumber;
+        }elseif ($newNumber>=10 && $newNumber<100){
+            $newOrder = 'DC'.$time.'0'.$newNumber;
+        }else{
+            $newOrder = 'DC'.$time.$newNumber;
+        }
+        $this->success('成功',$newOrder);
+    }
+
 }