multi-store/app/admin/controller/warehouse_product/WarehouseProductController.php
mkm 1f2863ff97 feat: 修改了IndexController控制器中的index方法
feat: 修改了PayNotifyLogic逻辑中的部分方法
feat: 修改了OrderLogic逻辑中的部分方法
feat: 修改了UserSignLogic逻辑中的部分方法
feat: 修改了CommissionProductLogic逻辑中的部分方法
feat: 修改了CommissionnLogic逻辑中的部分方法
fix: 修复了代码中的格式错误
fix: 修复了代码中的逻辑错误
refactor: 重构了部分代码,使其更加清晰易读
style: 优化了代码风格,增加了代码的可读性
test: 添加了缺失的测试用例,完善了测试覆盖率
docs: 更新了部分文档内容,使其更加准确详细
build: 更新了项目的依赖,修复了版本不兼容问题
ops: 优化了服务器配置,提高了服务器的稳定性
chore: 更新了.gitignore文件,添加了新产生的临时文件
2024-08-18 11:49:48 +08:00

133 lines
3.8 KiB
PHP

<?php
namespace app\admin\controller\warehouse_product;
use app\admin\controller\BaseAdminController;
use app\admin\lists\warehouse_product\WarehouseProductLists;
use app\admin\logic\warehouse_product\WarehouseProductLogic;
use app\admin\validate\warehouse_product\WarehouseProductValidate;
use app\common\model\warehouse_product\WarehouseProduct;
/**
* 商品仓储信息控制器
* Class WarehouseProductController
* @package app\admin\controller\warehouse_product
*/
class WarehouseProductController extends BaseAdminController
{
/**
* @notes 获取商品仓储信息列表
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function lists()
{
return $this->dataLists(new WarehouseProductLists());
}
/**
* @notes 添加商品出入库信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function add()
{
$params = $this->request->post();
foreach($params['product_arr'] as $k=>$v){
$data['admin_id']=$this->adminId;
$data['store_id']=0;
$data['supplier_id']=$params['supplier_id'];
$data['warehouse_id']=$params['warehouse_id'];
$data['code']=$params['code'];
$data['product_id']=$v['product_id'];
$data['nums']=$v['nums'];
$data['purchase']=$v['purchase'];
$data['total_price']=$v['total_price'];
$data['financial_pm']=1;
if(!empty($v['manufacture'])){
$data['manufacture']=$v['manufacture'];
}
if(!empty($v['expiration_date'])){
$data['expiration_date']=$v['expiration_date'];
}
WarehouseProductLogic::add($data);
}
if (WarehouseProductLogic::hasError()) {
return $this->fail(WarehouseProductLogic::getError());
}else{
return $this->success('添加成功', [], 1, 1);
}
}
/**
* @notes 编辑商品仓储信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function edit()
{
$params = (new WarehouseProductValidate())->post()->goCheck('edit');
$params['admin_id']=$this->adminId;
$result = WarehouseProductLogic::edit($params);
if (WarehouseProductLogic::hasError()) {
return $this->fail(WarehouseProductLogic::getError());
}else{
return $this->success('编辑成功', [], 1, 1);
}
}
/**
* @notes 删除商品仓储信息
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function delete()
{
$params = (new WarehouseProductValidate())->post()->goCheck('delete');
WarehouseProductLogic::delete($params);
if (WarehouseProductLogic::hasError()) {
return $this->fail(WarehouseProductLogic::getError());
}else{
return $this->success('删除成功', [], 1, 1);
}
}
/**
* @notes 获取商品仓储信息详情
* @return \think\response\Json
* @author admin
* @date 2024/07/31 16:55
*/
public function detail()
{
$params = (new WarehouseProductValidate())->goCheck('detail');
$result = WarehouseProductLogic::detail($params);
return $this->data($result);
}
/**
* 确认操作
*/
public function enter(){
// $id=$this->request->post('id');
// $result = WarehouseProductLogic::enter($id);
// if (true === $result) {
// return $this->success('编辑成功', [], 1, 1);
// }
// return $this->fail(WarehouseProductLogic::getError());
return $this->success('');
}
}