浏览代码

出入库记录

afa 5 月之前
父节点
当前提交
2d37056a78
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 0 1
      app/api/controller/Index.php
  2. 3 2
      app/api/service/StockService.php
  3. 2 1
      app/api/validate/Stock.php

+ 0 - 1
app/api/controller/Index.php

@@ -53,7 +53,6 @@ class Index extends Base
                              break;
                   }
             }
-        
             $this->success('ok', $result);
       }
 

+ 3 - 2
app/api/service/StockService.php

@@ -19,7 +19,7 @@ class StockService {
             $result = [];
             foreach ($data['variety'] as $item) 
             {
-                  if(count($item) != 3 || empty(floatval($item['num'])))  throw new \Exception('参数有误!');
+                  if(count($item) != 4 || empty(floatval($item['num'])))  throw new \Exception('参数有误!');
                   $weight = ($data['type']== '2') ? -$item['num']: $item['num'];
                 
                   //根据品种扣除库存
@@ -32,7 +32,8 @@ class StockService {
                         'type'            => $data['type'],
                         'variety_id'      => $item['variety_id'],
                         'change'          => $item['num'],
-                        'after'           => $stock
+                        'after'           => $stock,
+                        'remark'          => $item['remark']
                   ];
             }
             return $result;

+ 2 - 1
app/api/validate/Stock.php

@@ -8,7 +8,8 @@ class Stock extends Validate
     protected $rule =   [
         'type_id'  => 'require|string',
         'type'     => 'require|number',
-        'variety'  => 'require',    
+        'variety'  => 'require',  
+          
     ];
     
     protected $message  =   [