wuggemail@foxmail.com 3 months ago
parent
commit
047caceb51

+ 1 - 1
app/cxinv/command/MakeSeal.php

@@ -47,7 +47,7 @@ class MakeSeal extends Command
     public function makeSeal($item){
         $lastMonth = date('Y-m',strtotime('-1 month',strtotime($item['fz_date'])));
         $ist = ProductFz::where([['fz_date','=',$lastMonth],['company_code','=',$item['company_code']]])->findOrEmpty();
-        if(!$ist->isEmpty()&& $ist['status']!=2){
+        if(!$ist->isEmpty()&& $ist['status']!=0){
             return false;
         };
         (new ProductSeal)->saveAll($this->getProductLog($item,$ist->id));

+ 5 - 0
app/cxinv/controller/FinancialManager.php

@@ -6,6 +6,7 @@ namespace app\cxinv\controller;
 
 use app\cxinv\model\FinancialCheck as FinancialCheck;
 use app\cxinv\model\ManagerProduct;
+use app\cxinv\model\ProductFz;
 use think\App;
 class FinancialManager extends Base{
     public function __construct(App $app) {
@@ -146,6 +147,10 @@ class FinancialManager extends Base{
             if($item['cat_code']!='' && $item['inv_cat_code']!=''){
                 $item['cat_diff'] = $item['cat_code']==$item['inv_cat_code']?1:2;
             }
+            $companyCode= in_array($item['type'],['2','4'])?$item['seller_code']:$item['buyer_code'];
+            $fz_date = ProductFz::where(['company_code'=>$companyCode,'fz_date'=>$item['fz_date']])->findOrEmpty();
+            if($fz_date->isEmpty()) return error("请先生成封账单");
+            if($fz_date->status!=0) return error("{$item['fz_date']}封账状态不可用");
             $item['apply_id']=$this->uid;
             $item['apply_name']=$this->uname;
             $item['code']= makeNo("PM", count($list)==1?"":str_pad(strval($key),4,0,STR_PAD_LEFT));

+ 4 - 2
app/cxinv/controller/FinancialSeal.php

@@ -39,10 +39,11 @@ class FinancialSeal extends Base{
     }
     //0解封 1封账中 2 封账完成 3 封账失败
     public function status(){
-        $params = $this->request->param(["id"=>"","status"=>""],"post","trim");
+        $params = $this->request->param(["id"=>"","status"=>"","remark"=>""],"post","trim");
         $valid=$this->validate($params,[
             'id'=>'require',
-            'status'=>'require|in:0,1,2,3'
+            'status'=>'require|in:0,1,2,3,4',
+           'remark'=>'max:255'
         ]);
         if($valid!==true) return error($valid);
         $row = $this->model->findOrEmpty($params['id']);
@@ -62,6 +63,7 @@ class FinancialSeal extends Base{
             if(!$mamger->isEmpty()) return error(FinancialManager::$ManagerType[$mamger['type']]."【{$mamger['id']}】未处理");
         }
         $row->status=$params['status'];
+        $row->remark=$params['remark'];
         $row->apply_id=$this->uid;
         $row->apply_name=$this->uname;
         $as = $row->save();