Browse Source

打印作业通知单

qiuenguang 1 year ago
parent
commit
7f2512ce86
1 changed files with 75 additions and 5 deletions
  1. 75 5
      application/api/controller/WorkOrder.php

+ 75 - 5
application/api/controller/WorkOrder.php

@@ -1040,6 +1040,59 @@ class WorkOrder extends Api
         $this->success('成功',$data);
     }
 
+    /**
+     * 打印作业通知单->工单印件和工序获取
+     * @ApiMethod (GET)
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function PrintCodeList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_印件资料')
+            ->field([
+                'rtrim(yj_Yjno)' => '印件号',
+                'rtrim(yj_yjmc)' => '印件名称'
+            ])
+            ->where('Yj_Gdbh',$param['workOrder'])
+            ->select();
+        $this->success('成功',$list);
+    }
+
+    /**
+     * 打印作业通知单->工艺编号获取
+     * @ApiMethod (GET)
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function ProcessCodeList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_工艺资料')
+            ->field('rtrim(Gy0_gxh) as 工序号')
+            ->where([
+                'Gy0_gdbh' => $param['workOrder'],
+                'Gy0_yjno' => $param['yjno']
+            ])
+            ->select();
+        $this->success('成功',$list);
+    }
     /**
      * 打印作业通知单
      * @ApiMethod (POST)
@@ -1058,7 +1111,7 @@ class WorkOrder extends Api
         if (empty($param)){
             $this->error('参数错误');
         }
-        $data = $this->workOrderDetailGet($param['workOrder']);
+        $data = $this->workOrderDetailGet($param['workOrder'],$param['yjno']);
         if (empty($data)){
             $this->success('未找到工单信息');
         }
@@ -1066,7 +1119,7 @@ class WorkOrder extends Api
         if (empty($materiel)){
             $this->success('未找到物料信息');
         }
-        $printDetail = $this->PrintDetailGet($param['workOrder']);
+        $printDetail = $this->PrintDetailGet($param['workOrder'],$param['yjno'],$param['gxh']);
         if (empty($printDetail)){
             $this->success('未找到工艺信息');
         }
@@ -1088,9 +1141,10 @@ class WorkOrder extends Api
      * @param $workOrder
      * @return mixed
      */
-    public function workOrderDetailGet($workOrder)
+    public function workOrderDetailGet($workOrder,$yjno)
     {
         $sql = "SELECT
+                RTRIM( a.Gd_lx) AS  工单类型,
                 RTRIM( a.Gd_gdbh ) AS 生产批次号,
                 RTRIM( a.销售订单号 ) AS 销售订单号,
                 RTRIM( a.Gd_客户代号 ) AS 客户代号,
@@ -1121,7 +1175,7 @@ class WorkOrder extends Api
                 `工单_基本资料` AS a
                 JOIN `工单_印件资料` AS b ON b.Yj_Gdbh = a.Gd_gdbh 
             WHERE
-                a.Gd_gdbh = '{$workOrder}' AND a.行号 = 1";
+                a.Gd_gdbh = '{$workOrder}' AND a.行号 = 1 AND b.yj_Yjno = '{$yjno}'";
         $list = Db::query($sql);
         if (empty($list)){
             $this->success('未找到订单数据');
@@ -1169,10 +1223,12 @@ class WorkOrder extends Api
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function PrintDetailGet($workOrder)
+    public function PrintDetailGet($workOrder,$yjno,$gxh)
     {
         $where = [
             'Gy0_gdbh' => $workOrder,
+            'Gy0_yjno' => $yjno,
+            'Gy0_gxh'  => ['<=',$gxh]
         ];
         $filed = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
         rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as ls,rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_计划损耗) as 计划损耗,
@@ -1408,4 +1464,18 @@ class WorkOrder extends Api
         $this->success('成功',$list);
     }
 
+
+    //新增印件资料->印件资料添加
+
+//    public function PrintDetailAdd()
+//    {
+//        if (Request::instance()->isPost() === false){
+//            $this->error('请求错误');
+//        }
+//        $param = Request::instance()->post();
+//        if (empty($param)){
+//            $this->error('参数错误');
+//        }
+//
+//    }
 }