Browse Source

关联的申购申请单

zhanglinxin 1 year ago
parent
commit
8280bbbfff

+ 2 - 2
application/api/controller/Approveinfo.php

@@ -436,7 +436,7 @@ class Approveinfo extends Base
      *     @Apidoc\Returned("id", type="integer", desc="ID"),
      *     @Apidoc\Returned("reason", type="string", desc="合同编号"),
      * )
-     * @Apidoc\Returned("apply", type="array", desc="关联的采购审批单 module=3 && apply_id > 0",
+     * @Apidoc\Returned("apply", type="array", desc="关联的申购申请单 module=3,9 && apply_id > 0",
      *     @Apidoc\Returned("id", type="integer", desc="ID"),
      *     @Apidoc\Returned("order_no", type="string", desc="审批编号"),
      * )
@@ -501,7 +501,7 @@ class Approveinfo extends Base
      *     @Apidoc\Returned("name", type="string", desc="用户姓名"),
      *     @Apidoc\Returned("desc", type="string", desc="备注"),
      * )
-     * @Apidoc\Returned("apply", type="array", desc="关联的采购审批单 module=3 && apply_id > 0",
+     * @Apidoc\Returned("apply", type="array", desc="关联的申购申请单 module=3,9 && apply_id > 0",
      *     @Apidoc\Returned("id", type="integer", desc="ID"),
      *     @Apidoc\Returned("order_no", type="string", desc="审批编号"),
      * )

+ 1 - 1
application/approve/controller/ApproveInfo.php

@@ -169,7 +169,7 @@ class ApproveInfo extends Controller
             $this->title = $this->get_module_list[$data['module']] . '详情';
             $this->get_type_list = CommonService::get_type_list($data['module']);
         }
-        p($data->toArray());
+//        p($data->toArray());
         return $this->fetch('form', ['vo' => $data]);
     }
 

+ 11 - 0
application/approve/view/approve_info/form_3.html

@@ -91,6 +91,17 @@
                     </div>
                 </div>
 
+                {notempty name='vo.apply'}
+                <div class="layui-form-item">
+                    <label class="layui-form-label color-green font-w7">采购审批单</label>
+                    <div class="layui-input-block">
+                        <input name="" placeholder="" value="{$vo.apply.order_no|default='--'}"
+                               class="layui-input border-0" disabled>
+                        <p class="help-block"><a href="admin.html#{:url('edit')}?id={$vo.apply.id}" target="_blank">查看</a></p>
+                    </div>
+                </div>
+                {/notempty}
+
                 {notempty name='vo.stock_goods'}
                 <div class="layui-form-item">
                     <label class="layui-form-label color-green font-w7">入库商品</label>

+ 15 - 8
application/common/service/ApproveInfoService.php

@@ -74,8 +74,8 @@ class ApproveInfoService
                 except('非审批驳回状态无法操作');
             }
         } else {
-            // 9=合同呈批申请
-            if ($module == CommonConstant::MODULE_9) {
+            // 3=入库申请,9=合同呈批申请
+            if (in_array($module, [CommonConstant::MODULE_3, CommonConstant::MODULE_9])) {
                 // 存在申购申请单 判断申购申请单
                 if ($params['apply_id'] > 0) {
                     $apply = ApproveInfo::field('id')
@@ -1069,8 +1069,8 @@ class ApproveInfoService
                             ->where('is_deleted', CommonConstant::IS_DELETED_0)
                             ->where('apply_id', $info['id'])
                             ->select();
-                        $info['contract'] = $contract;
                     }
+                    $info['contract'] = $contract;
                     break;
                 case CommonConstant::MODULE_3:
                     if ($type == 'detail') {
@@ -1079,16 +1079,15 @@ class ApproveInfoService
                         $info->stock_goods;
                     }
 
-                    // 关联的采购审批
+                    // 关联的申购申请
                     $apply = null;
-                    if($info['apply_id']>0){
+                    if($info['apply_id'] > 0){
                         $apply = ApproveInfo::field('id,order_no')
                             ->where('module', CommonConstant::MODULE_1)
                             ->where('status', CommonConstant::STATUS_3)
                             ->where('is_deleted', CommonConstant::IS_DELETED_0)
                             ->find($info['apply_id']);
                     }
-
                     $info['apply'] = $apply;
                     break;
                 case CommonConstant::MODULE_4:
@@ -1105,9 +1104,17 @@ class ApproveInfoService
                         $info->peer_user;
                     }
                     break;
-                case CommonConstant::MODULE_8:
-                    if ($type == 'detail') {
+                case CommonConstant::MODULE_9:
+                    // 关联的申购申请单
+                    $apply = null;
+                    if($info['apply_id'] > 0){
+                        $apply = ApproveInfo::field('id,order_no')
+                            ->where('module', CommonConstant::MODULE_1)
+                            ->where('status', CommonConstant::STATUS_3)
+                            ->where('is_deleted', CommonConstant::IS_DELETED_0)
+                            ->find($info['apply_id']);
                     }
+                    $info['apply'] = $apply;
                     break;
             }
         }