|
@@ -37,19 +37,20 @@ class Fill extends Base
|
|
|
$param=$this->request->param(["cat_id"=>"","start"=>"",'end'=>'',"fillCode"=>"","status"=>"","good_name"=>"",
|
|
|
"spuCode"=>"","companyNo"=>"","customerCode"=>"","is_compliance"=>"","page"=>1,"size"=>15],"post","trim");
|
|
|
$where=[];
|
|
|
- $param['companyNo']==""??$where[]=["companyNo","like","%{$param['companyNo']}%"];
|
|
|
- $param['customerCode']==""??$where[]=["customerCode","like","%{$param['customerCode']}%"];
|
|
|
- $param['fillCode']==""??$where[]=["fillCode","like","%{$param['fillCode']}%"];
|
|
|
- $param['good_name']==""??$where[]=["good_name","like","%{$param['good_name']}%"];
|
|
|
- $param['spuCode']==""??$where[]=["spuCode","like","%{$param['spuCode']}%"];
|
|
|
- $param['is_compliance']===""??$where[]=["is_compliance","=",$param['is_compliance']];
|
|
|
- $param['cat_id']===""??$where[]=["cat_id","=",$param['cat_id']];
|
|
|
- $param['status']===""??$where[]=["status","=",$param['status']];
|
|
|
- $list=$this->model->with(["unit","cat","brand"])
|
|
|
+ $param['companyNo']==""?:$where[]=["companyNo","like","%{$param['companyNo']}%"];
|
|
|
+ $param['customerCode']==""?:$where[]=["customerCode","like","%{$param['customerCode']}%"];
|
|
|
+ $param['fillCode']==""?:$where[]=["fillCode","like","%{$param['fillCode']}%"];
|
|
|
+ $param['good_name']==""?:$where[]=["good_name","like","%{$param['good_name']}%"];
|
|
|
+ $param['spuCode']==""?:$where[]=["spuCode","like","%{$param['spuCode']}%"];
|
|
|
+ $param['is_compliance']===""?:$where[]=["is_compliance","=",$param['is_compliance']];
|
|
|
+ $param['cat_id']===""?:$where[]=["cat_id","=",$param['cat_id']];
|
|
|
+ $param['status']===""?:$where[]=["status","=",$param['status']];
|
|
|
+
|
|
|
+ $list=$this->model->with(["unitT","cat","brand"])
|
|
|
->where($where)
|
|
|
->order("id desc")
|
|
|
->paginate(["list_rows"=>$param['size'],"page"=>$param['page']]);
|
|
|
- $this->success("获取成功",["list"=>$list->items(),"count"=>$list->items()]);
|
|
|
+ $this->success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -108,9 +109,9 @@ class Fill extends Base
|
|
|
"origin_price"=>$origin_price,
|
|
|
"apply_id"=>$this->uid,
|
|
|
"apply_name"=>$this->uname,
|
|
|
- "status"=>2,
|
|
|
- "companyName"=>$company[$param['companyNo']]??"",
|
|
|
- "customerName"=>$company[$param['customerCode']]??"",
|
|
|
+ "status"=>1,
|
|
|
+ "companyName"=>$company[$param['companyNo']]?:"",
|
|
|
+ "customerName"=>$company[$param['customerCode']]?:"",
|
|
|
];
|
|
|
$create= array_merge($data,$param,$goodinfo->toArray());
|
|
|
BbcFill::create($create);
|
|
@@ -176,8 +177,8 @@ class Fill extends Base
|
|
|
$head=new Headquarters();
|
|
|
$company = $head->where(['code'=>$param['customerCode']])->findOrEmpty();
|
|
|
if($company->isEmpty())$this->error('未找到相关客户名称信息');
|
|
|
- if($info->fill_type!=3) $good =(new \app\admin\model\Good())->where(["spuCode",$info->spuCode])->findOrEmpty();
|
|
|
- else $good=(new GoodZixun())->where(['spuCode',$info->spuCode])->findOrEmpty();
|
|
|
+ if($info->fill_type!=3) $good =(new \app\admin\model\Good())->where(["spuCode"=>$info->spuCode])->findOrEmpty();
|
|
|
+ else $good=(new ConsultBids())->where(['spuCode'=>$info->spuCode])->findOrEmpty();
|
|
|
if($good->isEmpty())$this->error('未找到商品信息');
|
|
|
$supplier = (new Supplier())->where(["code"=>$info->supplierNo])->findOrEmpty();
|
|
|
if($supplier->isEmpty())$this->error('未找到供应商信息');
|
|
@@ -241,7 +242,7 @@ class Fill extends Base
|
|
|
'status' => 0,
|
|
|
'is_del' => 0,
|
|
|
'proof_id' => 0,
|
|
|
- 'other_orderNo' => $info->filingCode,
|
|
|
+ 'other_orderNo' => $info->fillCode,
|
|
|
'workNo' => '',
|
|
|
'poNo' => '',
|
|
|
'use_order' => 0,
|
|
@@ -262,6 +263,8 @@ class Fill extends Base
|
|
|
];
|
|
|
$this->model->startTrans();
|
|
|
try{
|
|
|
+ $ist =$this->model->lock(true)->findOrEmpty($param['id']);
|
|
|
+ if($ist->wtrans_num< $transNum)throw new \Exception('报备单可转单数量不足!');
|
|
|
$order=Sale::create($orderInfo);
|
|
|
if($order->id==false) throw new \Exception("订单创建失败");
|
|
|
$Addr=(new OrderAddr())->saveAll($orderArr);
|
|
@@ -277,25 +280,25 @@ class Fill extends Base
|
|
|
foreach ($Addr as $item){
|
|
|
$outCode= make("DF");
|
|
|
$out=[
|
|
|
- 'orderCode' => $orderCode,
|
|
|
- 'outCode' => $outCode,
|
|
|
- 'apply_id' => $this->uid,
|
|
|
- 'apply_name' => $this->uname,
|
|
|
- 'addrid' => $item->id,
|
|
|
- 'post_name' => '',
|
|
|
- 'post_code' => '',
|
|
|
- 'post_fee' => 0,
|
|
|
- 'sendtime' => date('Y-m-d H:i:s'),
|
|
|
- 'send_num' => $item->receipt_quantity,
|
|
|
- 'check_num' => 0,
|
|
|
- 'error_num' => 0,
|
|
|
- 'wsm_code' => '',
|
|
|
- 'order_type' =>1,
|
|
|
- 'send_status' => 1,
|
|
|
- 'status' => 1,
|
|
|
- 'addtime' => date('Y-m-d H:i:s'),
|
|
|
- 'updatetime' => date('Y-m-d H:i:s')
|
|
|
- ];
|
|
|
+ 'orderCode' => $orderCode,
|
|
|
+ 'outCode' => $outCode,
|
|
|
+ 'apply_id' => $this->uid,
|
|
|
+ 'apply_name' => $this->uname,
|
|
|
+ 'addrid' => $item->id,
|
|
|
+ 'post_name' => '',
|
|
|
+ 'post_code' => '',
|
|
|
+ 'post_fee' => 0,
|
|
|
+ 'sendtime' => date('Y-m-d H:i:s'),
|
|
|
+ 'send_num' => $item->receipt_quantity,
|
|
|
+ 'check_num' => 0,
|
|
|
+ 'error_num' => 0,
|
|
|
+ 'wsm_code' => '',
|
|
|
+ 'order_type' =>1,
|
|
|
+ 'send_status' => 1,
|
|
|
+ 'status' => 1,
|
|
|
+ 'addtime' => date('Y-m-d H:i:s'),
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
$outinfo=OrderOut::create($out);
|
|
|
if($outinfo->isEmpty())throw new \Exception('发货单创建失败');
|
|
|
OrderOutChild::makeChild($outCode);
|
|
@@ -311,8 +314,12 @@ class Fill extends Base
|
|
|
event('ProcessOrder',$event);
|
|
|
}
|
|
|
}
|
|
|
- $this->model->commit();
|
|
|
- //非库存数据需要生成采购单 异步监听事件处理 需要注意采购单生成失败无法回滚
|
|
|
+ $ist->transfer_num +=$transNum;
|
|
|
+ $ist->status=$ist->transfer_num >= $ist->good_num?3:2;
|
|
|
+ $upd=$ist->save();
|
|
|
+ if($upd==false)throw new \Exception('报备单更新失败');
|
|
|
+ $this->model->commit();
|
|
|
+ //非库存数据需要生成采购单 异步监听事件处理 需要注意采购单生成失败无法回滚
|
|
|
if($info->fill_type!==1){
|
|
|
event("CgdCreate",$orderCode);
|
|
|
}
|
|
@@ -339,7 +346,7 @@ class Fill extends Base
|
|
|
public function ZixunCreate()
|
|
|
{
|
|
|
$param=$this->request->param(["bidNo"=>"","sale_price"=>"","manager"=>"","managerid"=>"","good_num"=>"",
|
|
|
- "proof_type"=>"",'proof_url'=>'',],"post","trim");
|
|
|
+ "proof_type"=>"",'proof_url'=>'',"remark"=>""],"post","trim");
|
|
|
$valid = Validate::rule([
|
|
|
"bidNo|咨询竞价单号"=>"require",
|
|
|
"sale_price|商品单价"=>"require|float|gt:0",
|
|
@@ -375,7 +382,7 @@ class Fill extends Base
|
|
|
'origin_price'=>$info->total_fee,
|
|
|
'apply_id'=>$this->uid,
|
|
|
'apply_name'=>$this->uname,
|
|
|
- 'status'=>2,
|
|
|
+ 'status'=>1,
|
|
|
'companyNo'=>$zxinfo->companyNo,
|
|
|
'companyName'=>$zxinfo->companyName,
|
|
|
'customerCode'=>$zxinfo->khNo,
|
|
@@ -384,11 +391,12 @@ class Fill extends Base
|
|
|
'supplierName'=>$info->supplierName,
|
|
|
'is_compliance'=>0,
|
|
|
'plat_code'=>'',
|
|
|
+ 'fill_remark'=>$param['remark'],
|
|
|
'manager'=>$param['manager'],
|
|
|
'managerid'=>$param['managerid'],
|
|
|
];
|
|
|
- $info=BbcFill::create($data);
|
|
|
- if($info->id==false) throw new \Exception('报备单创建失败');
|
|
|
+ $bbcCre=BbcFill::create($data);
|
|
|
+ if($bbcCre->id==false) throw new \Exception('报备单创建失败');
|
|
|
BargainOrder::update(["status"=>4],['bidsNo' =>$param['bidNo'],'is_del'=>0,'status'=>0]);
|
|
|
$info->status=6;
|
|
|
$up =$info->save();
|
|
@@ -446,7 +454,7 @@ class Fill extends Base
|
|
|
$this->model->commit();
|
|
|
}catch (\Exception $exception){
|
|
|
$this->model->rollback();
|
|
|
- $this->error($exception->getMessage());
|
|
|
+ $this->error($exception->getMessage().$exception->getLine());
|
|
|
}
|
|
|
$this->success("报备单生成成功",["fillCode"=>$data['fillCode']]);
|
|
|
}
|