|
@@ -3,7 +3,7 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\cxinv\command;
|
|
|
|
|
|
-use app\cxinv\model\ProductFz;use app\cxinv\model\ProductOnlog;use app\cxinv\model\ProductSeal;use think\console\Command;
|
|
|
+use app\cxinv\model\FinancialManager;use app\cxinv\model\ProductFz;use app\cxinv\model\ProductOnlog;use app\cxinv\model\ProductSeal;use think\console\Command;
|
|
|
use think\console\Input;
|
|
|
use think\console\input\Argument;
|
|
|
use think\console\input\Option;
|
|
@@ -37,13 +37,24 @@ class MakeSeal extends Command
|
|
|
}
|
|
|
|
|
|
public function makeSeal($item){
|
|
|
- $lastMonth = date('Ym',strtotime('-1 month',strtotime($item['fz_date'])));
|
|
|
- $ist = ProductFz::where([['fz_date','=',$lastMonth],['status','=',2],['company_code','=',$item['company_code']]])->findOrEmpty();
|
|
|
- if($ist->isEmpty()){
|
|
|
+ var_dump($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){
|
|
|
$item['status']=3;
|
|
|
$item['remark']=$lastMonth.'未封账';
|
|
|
(new ProductFz)->save($item);
|
|
|
+ return;
|
|
|
};
|
|
|
+ $mamger= FinancialManager::where(function($query) use($item){
|
|
|
+ $query->whereOr([[['buyer_code','=',$item['company_code']],['type','in',[1,3]]],[['seller_code','=',$item['company_code']],['type','in',[2,4]]]]);
|
|
|
+ })->where(["status"=>1,"fz_date"=>$item['fz_date']])->findOrEmpty();
|
|
|
+ if(!$mamger->isEmpty()){
|
|
|
+ $item['status']=3;
|
|
|
+ $item['remark']="出入库【{$mamger['id']}】未处理";
|
|
|
+ (new ProductFz)->save($item);
|
|
|
+ return;
|
|
|
+ }
|
|
|
(new ProductSeal)->saveAll($this->getProductLog($item,$ist->id));
|
|
|
$item['status']=2;
|
|
|
$item['remark']='';
|