新增采购订单入库/出库功能,优化零售订单审核及小票打印
This commit is contained in:
parent
35dd4b1140
commit
99a26c2ba6
@ -6,13 +6,16 @@ namespace app\admin\controller\operation;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\operation\OpurchaseclassLists;
|
||||
use app\admin\lists\operation\OpurchaseclassofferLists;
|
||||
use app\admin\lists\retail\CashierclassStreamLists;
|
||||
use app\admin\logic\operation\OpurchaseclassLogic;
|
||||
use app\admin\validate\operation\OpurchaseclassValidate;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsLabel;
|
||||
use app\common\model\opurchase\Opurchaseclass;
|
||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||
use app\common\model\opurchase\Opurchaseinfo;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
@ -126,6 +129,47 @@ class OpurchaseclassController extends BaseAdminController
|
||||
|
||||
return $this->dataLists(new OpurchaseclassofferLists());
|
||||
}
|
||||
/**
|
||||
* @notes 采购订单入库列表
|
||||
*/
|
||||
public function storage_list()
|
||||
{
|
||||
$this->request->__set('storage_list',1);
|
||||
return $this->dataLists(new OpurchaseclassofferLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 采购订单出库列表
|
||||
*/
|
||||
public function stream_list()
|
||||
{
|
||||
$id=$this->request->get('id');
|
||||
$order_arr= Opurchaseclass::where('id',$id)->where('is_mer',2)->value('order_arr');
|
||||
$arr=Opurchaseclass::where('id','in',explode(',',$order_arr))->where('is_mer',1)->value('order_arr');
|
||||
if($arr){
|
||||
$this->request->__set('class_value',['id'=>explode(',',$arr)]);
|
||||
$this->request->__set('class_key',['in'=>'id']);
|
||||
}
|
||||
return $this->dataLists(new CashierclassStreamLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 采购订单设置已出库
|
||||
*/
|
||||
public function stream_update()
|
||||
{
|
||||
$id=$this->request->get('id');
|
||||
$order_code=$this->request->get('order_code');
|
||||
if($id){
|
||||
Cashierclass::where('id',$id)->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
return $this->success('更新成功');
|
||||
}
|
||||
if($order_code){
|
||||
Cashierclass::where('number',$order_code)->update(['is_stream'=>1,'stream_admin_id'=>$this->request->adminId,'stream_time'=>time()]);
|
||||
return $this->success('更新成功');
|
||||
}
|
||||
return $this->fail('没有任何更新');
|
||||
}
|
||||
/**
|
||||
* @notes 推送给供应商报价
|
||||
* @return \think\response\Json
|
||||
|
@ -8,6 +8,7 @@ use app\admin\lists\retail\CashierclassLists;
|
||||
use app\admin\logic\retail\CashierclassLogic;
|
||||
use app\admin\validate\retail\CashierclassValidate;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
/**
|
||||
* 零售订单控制器
|
||||
@ -62,22 +63,22 @@ class CashierclassController extends BaseAdminController
|
||||
}
|
||||
return $this->fail(CashierclassLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 审核零售订单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function auditing()
|
||||
{
|
||||
$params = (new CashierclassValidate())->post()->goCheck('auditing');
|
||||
$result = CashierclassLogic::auditing($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('审核成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CashierclassLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 审核零售订单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function auditing()
|
||||
{
|
||||
$params = (new CashierclassValidate())->post()->goCheck('auditing');
|
||||
$result = CashierclassLogic::auditing($params, $this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('审核成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CashierclassLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -113,15 +114,29 @@ class CashierclassController extends BaseAdminController
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function set_print(){
|
||||
$id=$this->request->get('id');
|
||||
if($id){
|
||||
$res=Cashierclass::where('id',$id)->update(['is_print'=>1]);
|
||||
if($res){
|
||||
public function set_print()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
if ($id) {
|
||||
$res = Cashierclass::where('id', $id)->update(['is_print' => 1]);
|
||||
if ($res) {
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
}
|
||||
return $this->fail('设置失败');
|
||||
return $this->success('设置失败');
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @notes 打印小票
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function prints()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
if (!$id) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
Redis::send('push-platform-print', ['order_id' => $id]);
|
||||
return $this->success('正在打印中');
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearch
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['is_adopt'],
|
||||
'=' => ['is_adopt', 'is_storage', 'order_id'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -47,34 +47,51 @@ class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearch
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where=[];
|
||||
$is_mer=$this->request->get('is_mer',0);
|
||||
$id=$this->request->get('id',0);
|
||||
$type=$this->request->get('type','all');
|
||||
if($type==1){
|
||||
$where[]=['is_adopt','=',0];
|
||||
}elseif($type==2){
|
||||
$where[]=['is_adopt','=',1];
|
||||
$where = [];
|
||||
$is_mer = $this->request->get('is_mer', 0);
|
||||
$id = $this->request->get('id', 0);
|
||||
$type = $this->request->get('type', 'all');
|
||||
if ($type == 1) {
|
||||
$where[] = ['is_adopt', '=', 0];
|
||||
} elseif ($type == 2) {
|
||||
$where[] = ['is_adopt', '=', 1];
|
||||
}
|
||||
if($id){
|
||||
$where[]=['order_id','=',$id];
|
||||
if ($id) {
|
||||
$where[] = ['order_id', '=', $id];
|
||||
}
|
||||
if($this->request->supplierId>0){
|
||||
$where[]=['supplier_id','=',$this->request->supplierId];
|
||||
if ($this->request->supplierId > 0) {
|
||||
$where[] = ['supplier_id', '=', $this->request->supplierId];
|
||||
}
|
||||
$this->where=$where;
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->orderRaw("goods_id, CASE WHEN price = 0 THEN 999999999 ELSE price END ASC")
|
||||
->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'];
|
||||
}
|
||||
$item['supplier_name'] = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||
})->toArray();
|
||||
$this->where = $where;
|
||||
if ($this->request->__get('storage_list') == 1) {
|
||||
$list = OpurchaseGoodsOffer::where($this->searchWhere)
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('update_time', 'desc')
|
||||
->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'];
|
||||
}
|
||||
$item['supplier_name'] = Supplier::where('id', $item['supplier_id'])->value('mer_name');
|
||||
})->toArray();
|
||||
} else {
|
||||
$list = OpurchaseGoodsOffer::where($this->searchWhere)
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->orderRaw("goods_id, CASE WHEN price = 0 THEN 999999999 ELSE price END ASC")
|
||||
->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'];
|
||||
}
|
||||
$item['supplier_name'] = Supplier::where('id', $item['supplier_id'])->value('mer_name');
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
@ -88,5 +105,4 @@ class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearch
|
||||
{
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)->where($this->where)->count();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
79
app/admin/lists/retail/CashierclassStreamLists.php
Normal file
79
app/admin/lists/retail/CashierclassStreamLists.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\retail;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\User;
|
||||
|
||||
|
||||
/**
|
||||
* 零售订单出库列表
|
||||
* Class CashierclassLists
|
||||
* @package app\admin\listsretail
|
||||
*/
|
||||
class CashierclassStreamLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
$search= [
|
||||
'=' => [],
|
||||
];
|
||||
return $search;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取零售订单出库列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Cashierclass::where($this->searchWhere)
|
||||
->field(['id', 'merchant', 'store_id', 'uid', 'number', 'total', 'deduction_price', 'actual', 'money', 'pay_type', 'type', 'auditinguser', 'auditingtime','create_time','is_stream','stream_admin_id','stream_time'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$merchant = Merchant::field('mer_name')->where('mer_id',$data['merchant'])->findOrEmpty();
|
||||
$user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$data['auditinguser'])->findOrEmpty();
|
||||
$stream_admin_name = Admin::where('id',$data['stream_admin_id'])->value('name');
|
||||
$admin = Admin::field('name')->where('id',$data['auditinguser'])->findOrEmpty();
|
||||
$data['merchant_name'] = !$merchant->isEmpty() ? $merchant['mer_name'] : '';
|
||||
$data['user_name'] = !$user->isEmpty() ? $user['nickname'] : '';
|
||||
$data['auditinguser_name'] = !$admin->isEmpty() ? $admin['name'] : '';
|
||||
$data['stream_admin_name'] = $stream_admin_name??'';
|
||||
$data['stream_time'] = $stream_admin_name?date('Y-m-d H:i:s',$data['stream_time']):'';
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取零售订单出库数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 09:57
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Cashierclass::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -54,12 +54,14 @@ class CashierinfoLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
$cashier = Cashierclass::field('number')->where('id',$data['pid'])->findOrEmpty();
|
||||
$room = Db::name('room')->where('id',$data['room'])->find();
|
||||
$warehouse = Warehouse::field('name')->where('id',$data['warehouse'])->findOrEmpty();
|
||||
$unit=Db::name('unit')->where('id',$data['unit'])->value('name');
|
||||
$goods = Goods::field('name,imgs')->where('id',$data['goods'])->findOrEmpty();
|
||||
$data['cashier_number'] = !$cashier->isEmpty() ? $cashier['number'] : '';
|
||||
$data['room_data'] = !empty($room) ? $room : [];
|
||||
$data['warehouse_name'] = !$warehouse->isEmpty() ? $warehouse['name'] : '';
|
||||
$data['goods_name'] = !$goods->isEmpty() ? $goods['name'] : '';
|
||||
$data['imgs'] = !$goods->isEmpty() ? $goods['imgs'] : '';
|
||||
$data['unit_name'] =$unit??'';
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
@ -25,7 +25,11 @@ trait ListsSearchTrait
|
||||
$class_key=$this->request->__get('class_key');
|
||||
if($class_key!==null){
|
||||
foreach($class_key as $key => $value){
|
||||
array_push($search[$key], $value); // 添加class_key的搜索条件
|
||||
if(isset($search[$key])){
|
||||
array_push($search[$key], $value); // 添加class_key的搜索条件
|
||||
}else{
|
||||
$search[$key] = [$value]; // 创建新的搜索条件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class WeChatMnpService
|
||||
'out_trade_no'=>$order_id,
|
||||
'mchid'=>config('payment.wechat.default.mch_id')
|
||||
],
|
||||
'logistics_type'=>4,
|
||||
'logistics_type'=>2,
|
||||
'delivery_mode'=>'UNIFIED_DELIVERY',
|
||||
'shipping_list'=>[
|
||||
['item_desc'=>'商品']
|
||||
|
Loading…
x
Reference in New Issue
Block a user