feat: 添加了供应商报价全部列表功能,并优化了报价更新流程
This commit is contained in:
parent
400d8c1f93
commit
28db13348b
@ -3,6 +3,7 @@
|
||||
namespace app\admin\controller\operation;
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\operation\OpurchaseclassofferAllLists;
|
||||
use app\admin\lists\operation\OpurchaseclassofferLists;
|
||||
use app\api\logic\operation\OpurchaseGoodsOfferLogic;
|
||||
use app\api\validate\OpurchaseGoodsOfferValidate;
|
||||
@ -18,6 +19,13 @@ class OpurchaseGoodsOfferController extends BaseAdminController
|
||||
return $this->dataLists(new OpurchaseclassofferLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应商报价全部列表
|
||||
*/
|
||||
public function all_lists()
|
||||
{
|
||||
return $this->dataLists(new OpurchaseclassofferAllLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 供应商报价日期列表
|
||||
|
@ -170,10 +170,17 @@ class OpurchaseclassController extends BaseAdminController
|
||||
$order_code=$this->request->post('order_code');
|
||||
if($id){
|
||||
Cashierclass::where('id',$id)->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
OpurchaseGoodsOffer::where('order_id',$id)->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
return $this->success('更新成功',[],1,1);
|
||||
}
|
||||
if($order_code){
|
||||
Cashierclass::where('number',$order_code)->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
$find=Cashierclass::where('number',$order_code)->find();
|
||||
if($find){
|
||||
$find->save(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
OpurchaseGoodsOffer::where('order_id',$find['id'])->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
|
||||
}
|
||||
|
||||
return $this->success('更新成功',[],1,1);
|
||||
}
|
||||
return $this->fail('没有任何更新');
|
||||
|
107
app/admin/lists/operation/OpurchaseclassofferAllLists.php
Normal file
107
app/admin/lists/operation/OpurchaseclassofferAllLists.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\operation;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
/**
|
||||
* 采购供应链商户报价
|
||||
* Class OpurchaseclassofferAllLists
|
||||
* @package app\admin\listsoperation
|
||||
*/
|
||||
class OpurchaseclassofferAllLists extends BaseAdminDataLists implements ListsSearchInterface,ListsSortInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/04/27 11:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['is_adopt', 'is_storage', 'is_retrieval'],
|
||||
'between_time' => 'create_time'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return string[]
|
||||
* @date 2021/12/29 10:07
|
||||
* @remark 格式: ['前端传过来的字段名' => '数据库中的字段名'];
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['id' => 'id'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return string[]
|
||||
* @date 2021/12/29 10:06
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['id' => 'desc'];
|
||||
}
|
||||
/**
|
||||
* @notes 获取采购供应链商户报价列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/04/27 11:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$list = OpurchaseGoodsOffer::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->select()->each(function ($item) {
|
||||
$find = Goods::where('id', $item['goods_id'])->with('unitName')->find();
|
||||
if ($find) {
|
||||
$item['goods_name'] = $find['name'];
|
||||
$item['unit_name'] = $find['unit_name'];
|
||||
}
|
||||
if($item['stream_admin_id']){
|
||||
$item['stream_admin_name']=Admin::where('id', $item['stream_admin_id'])->value('name');
|
||||
}else{
|
||||
$item['stream_admin_name']='';
|
||||
}
|
||||
if($item['storage_admin_id']){
|
||||
$item['storage_admin_name']=Admin::where('id', $item['storage_admin_id'])->value('name');
|
||||
}else{
|
||||
$item['storage_admin_name']='';
|
||||
}
|
||||
|
||||
$item['supplier_name'] = Supplier::where('id', $item['supplier_id'])->value('mer_name');
|
||||
})->toArray();
|
||||
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取采购供应链商户报价数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/04/27 11:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ use app\common\model\supplier\SupplierBindGoods;
|
||||
use support\Log;
|
||||
use think\facade\Db;
|
||||
use app\common\service\JgPushService;
|
||||
use app\Request;
|
||||
|
||||
/**
|
||||
* 采购订单逻辑
|
||||
@ -254,6 +255,7 @@ class OpurchaseclassLogic extends BaseLogic
|
||||
$find->notes = $notes;
|
||||
$find->before_nums = $find->nums;
|
||||
$find->nums = $nums;
|
||||
$find->storage_admin_id=Request()->adminId;
|
||||
$price=0;
|
||||
if ($nums != 0) {
|
||||
$price = bcmul($find['price'], $nums, 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user