wugg 3 months ago
parent
commit
802470f5f0

+ 3 - 1
app/cxinv/controller/FinancialProducts.php

@@ -278,6 +278,8 @@ class FinancialProducts extends Base{
             'product_id'=>$param['product_id'],
             'check_num'=>$param['check_num'],
             'diff_num'=>$diff_num,
+            'stock_num'=>$product->residue_stock??"0",
+            'unit_price'=>$product->unit_price,
             'diff_fee'=>bcmul($diff_num,$product->unit_price,8),
             'check_type'=>$param['check_type'],
             'fz_date'=>$param['fz_date'],
@@ -306,7 +308,7 @@ class FinancialProducts extends Base{
         if(!empty($param['start']) && !empty($param['end'])) $where[]=['product_check.create_time','between',[startTime($param['start']),endTime($param['end'])]];
         if($param['skuCode']!=="") $where[]=['product.skuCode','like','%'.$param['skuCode'].'%'];
         if($param['buyer_code']!=="") $where[]=['product.buyer_code','=',$param['buyer_code']];
-        $list = ProductCheck::withJoin(['product'],'LEFT')
+        $list = ProductCheck::with(['product'=>['ProductStock']])->withJoin(['product'],'LEFT')
         ->where($where)
         ->order('id desc')
         ->paginate(['page'=>$param['page'],'list_rows'=>$param['size']]);

+ 1 - 1
app/cxinv/controller/FinancialSeal.php

@@ -34,7 +34,7 @@ class FinancialSeal extends Base{
         $getLastMonth= date("Ym",strtotime("-1 month"));
         if($row['fz_date']!=$getLastMonth && $params['status']==0) return error('非上月数据不可解封');
         if($params['status']==1){
-            $montah =  date('Ym',strtotime($row['fz_date'],'-1 month'));
+            $montah =  strtotime('-1 month',strtotime($row['fz_date']));
             $lasMonth= $this->model->where('fz_date',$montah)->where('company_code',$row->company_code)->findOrEmpty();
             if(!$lasMonth->isEmpty()&& $lasMonth['status']!=2) return error($montah.'数据未封账');
         }

+ 2 - 0
app/cxinv/model/ManagerProduct.php

@@ -38,6 +38,7 @@ class ManagerProduct extends Base{
               'order_item_id'=>$model->manager_id,
               'product_id'=>$model->product_id,
               'num'=>$model->num,
+              "fz_date"=>$manager->fz_date,
               'unit_price'=>$product->unit_price,
               'rate'=>$manager->inv_tax,
               'apply_id'=>$manager->apply_id,
@@ -49,6 +50,7 @@ class ManagerProduct extends Base{
                       "type"=>$model['type'],
                       'order_item_id'=>$model->manager_id,
                       'product_id'=>$item->child_id,
+                       'fz_date'=>$manager->fz_date,
                       'num'=>bcmul($item->child_num,$model->num,8),
                       'unit_price'=>$item->products->unit_price??0,
                       'rate'=>$item->products->cat_tax,

+ 6 - 2
app/cxinv/model/ProductCheck.php

@@ -8,10 +8,13 @@ use think\Model;class ProductCheck extends Base
         'id'  =>'bigint',//
         'checkCode'  =>'varchar',//盘点编号
         'product_id'  =>'bigint',//财务商品id
-        'check_num'  =>'bigint',//盘点数量
-        'diff_num'  =>'bigint',//盈亏数量
+        'check_num'  =>'decimal',//盘点数量
+        'diff_num'  =>'decimal',//盈亏数量
+        'stock_num'=>'decimal',//盘点库存数量'
+        'unit_price'=>'decimal',//单价
         'is_diff'  =>'tinyint',//1盘盈0盘亏
         'check_type'  =>'tinyint',//1数据盘点2调整单
+        'fz_date'=>'varchar',//盘点月份
         'apply_id'  =>'int',//盘点人
         'apply_name'  =>'varchar',//
         'create_time'  =>'datetime',//
@@ -63,6 +66,7 @@ use think\Model;class ProductCheck extends Base
                   'type'=>$model->is_diff==1?3:4,
                   'order_item_id'=>$model->id,
                   'product_id'=>$id,
+                  'fz_date'=>$model->fz_date,
                   'num'=>abs($model->diff_num),
                   'unit_price'=>$product->unit_price,
                   'rate'=>$product->cat_tax,

+ 0 - 20
app/cxinv/model/ProductOutlog.php

@@ -1,20 +0,0 @@
-<?php
-namespace app\cxinv\model;
-
-class ProductOutlog extends Base
-{
-//设置字段信息
-    protected $schema = [
-        'id'  =>'bigint',//
-        'order_item_id'  =>'bigint',//关联明细采购单id
-        'product_id'  =>'bigint',//商品id
-        'first_out_time'  =>'datetime',//第一次入账
-        'out_time'  =>'datetime',//入账时间
-        'num'  =>'int',//入账数量
-        'unit_price'  =>'decimal',//单价
-        'status'  =>'tinyint',//
-        'apply_id'  =>'int',//
-        'apply_name'  =>'varchar',//
-        'create_time'  =>'datetime',//
-       ];
-}