304 行
9.0 KiB
PHP
可执行文件
304 行
9.0 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Terminalapi\Controller;
|
|
|
|
use Common\Business\CacheHandle;
|
|
use Common\Business\PurchaseOrder;
|
|
use Common\Business\RetreatOrder;
|
|
use Common\Business\SaleGoods;
|
|
use Common\Business\SerialNumberGoods;
|
|
use Think\Controller;
|
|
use Common\Business\PurchaseGoodsInfo;
|
|
|
|
//[1.7.90]
|
|
|
|
/**
|
|
* 商户采购模块
|
|
* Class PurchaseOrderController
|
|
* @package Terminalapi\Controller
|
|
*/
|
|
class PurchaseOrderController extends Controller
|
|
{
|
|
//采购订单列表
|
|
public function PurchaseOrder()
|
|
{
|
|
$data = I('post.');
|
|
$data['operator_type'] = 3;
|
|
$data['user_type'] = 3;
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$PurchaseOrderClass = new PurchaseOrder();
|
|
$result = $PurchaseOrderClass->orderList($data);
|
|
$result['msg'] = $result['message'];
|
|
$result['data'] = $result['data']['list'];
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购仓库
|
|
public function WarehouseInfo()
|
|
{
|
|
$data = I("post.");
|
|
$where = array(
|
|
'merchantid' => $data['merchantid'],
|
|
'status' => 1
|
|
);
|
|
$supplier = M('retail_supplier')->field("id,supplier_name")->where($where)->order('id desc')->select();
|
|
$map = array(
|
|
'merchant_id' => $data['merchantid'],
|
|
'status' => 1
|
|
);
|
|
$fields = "id,name";
|
|
$warehouse = D('PurchaseWarehouse')->getSelect($map, $page = '', $limit = '', $fields, $order = 'id desc');
|
|
$res['status'] = 1;
|
|
$res['warehouseList'] = $warehouse;
|
|
$res['supplierList'] = $supplier;
|
|
$this->ajaxReturn($res);
|
|
}
|
|
|
|
/*商品信息
|
|
*
|
|
*/
|
|
public function GoodsInfo()
|
|
{
|
|
$content = I("post.");
|
|
$content['merchant_id'] = $content['merchantid'];
|
|
$result = A('Api/Inventory')->getMerchantSaleGoodsList($content);
|
|
$res['status'] = 1;
|
|
$res['msg'] = '查询成功';
|
|
$res['count'] = $result['count'];
|
|
$res['data'] = $result['info'];
|
|
$this->ajaxReturn($res);
|
|
}
|
|
|
|
|
|
//串号验证
|
|
public function serialVerify()
|
|
{
|
|
$data = I('post.');
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$data['user_type'] = 3;
|
|
$SerialClass = new SerialNumberGoods();
|
|
$result = $SerialClass->singleGoodsVerify($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//商品信息2020-11-4
|
|
public function GoodsInfo_v1()
|
|
{
|
|
$data = I('post.');
|
|
$data['operator_type'] = 3;
|
|
$data['user_type'] = 3;
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$data['exists_id_arr'] = isset($data['exists_id_arr']) ? $data['exists_id_arr'] : $data['notInIds'];
|
|
$data['search_info'] = isset($data['search_info']) ? $data['search_info'] : $data['searchText'];
|
|
$SaleGoodsClass = new SaleGoods();
|
|
$result = $SaleGoodsClass->purchaseSearchGoods($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//商品信息2020-11-4
|
|
public function ScanCodeGoods()
|
|
{
|
|
$data = I('post.');
|
|
$data['operator_type'] = 3;
|
|
$data['user_type'] = 3;
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$SaleGoodsClass = new SaleGoods();
|
|
$result = $SaleGoodsClass->purchaseScanCodeGoods($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购入库
|
|
public function PurchaseOperation()
|
|
{
|
|
$data = I('post.');
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$result = A('Api/Inventory')->merchantPurchaseOperation($data);
|
|
if ($result['status'] == 1) {
|
|
//操作日志记录
|
|
$log_data = array(
|
|
'source' => 1,
|
|
'type' => 3,
|
|
'desc' => '采购单-新增',
|
|
'request_data' => json_encode($_POST),
|
|
'operator_id' => $_POST['operator_id'],
|
|
'mer_id' => $data['merchantid']
|
|
);
|
|
action_log_v2($log_data);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购单详情串号信息
|
|
public function detailSerialList()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 3;
|
|
$data['type'] = 1;
|
|
$SerialClass = new SerialNumberGoods();
|
|
$result = $SerialClass->purchaseDetailSerial($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购详情列表
|
|
public function DetailsList()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 3;
|
|
$PurchaseGoodsInfo = new PurchaseGoodsInfo();
|
|
$result = $PurchaseGoodsInfo->basisIdGetPurchaseGoodsList($data);
|
|
$result['msg'] = $result['message'];
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//编辑采购单
|
|
public function PurchaseOrderEdit()
|
|
{
|
|
$data = I("post.");
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$result = A("Api/Inventory")->purchaseOrderEdit($data);
|
|
if ($result['status'] == 1) {
|
|
$log_data = [
|
|
'source' => 1,
|
|
'type' => 3,
|
|
'desc' => '采购单-编辑',
|
|
'request_data' => json_encode($_POST),
|
|
'operator_id' => $_POST['operator_id'],
|
|
'mer_id' => $_POST['merchantid']
|
|
];
|
|
action_log_v2($log_data);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//入库到经营仓
|
|
public function WarehousingOperation()
|
|
{
|
|
$data = I('post.');
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$result = A('Api/Inventory')->MerPurchaseWarehouse($data);
|
|
if (C('IS_SET_REDIS')) {
|
|
$redis_key = 'retail_merchant_id_' . $data['merchant_id'] . '_purchase_order_id_' . $data['id'];
|
|
$CacheClass = new CacheHandle();
|
|
$CacheClass->deleteRedis($redis_key);
|
|
}
|
|
if ($result['status'] == 1) {
|
|
$log_data = array(
|
|
'source' => 1,
|
|
'type' => 3,
|
|
'desc' => '采购单-入库至供给仓/入库单-新增',
|
|
'request_data' => json_encode($_POST),
|
|
'operator_id' => $_POST['operator_id'],
|
|
'mer_id' => $_POST['merchantid']
|
|
);
|
|
action_log_v2($log_data);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购退货单列表
|
|
public function RetreatOrder()
|
|
{
|
|
$data = I('post.');
|
|
$data['operator_type'] = 3;
|
|
$data['user_type'] = 3;
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$RetreatOrderClass = new RetreatOrder();
|
|
$result = $RetreatOrderClass->orderList($data);
|
|
$result['data'] = $result['data']['list'];
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购退货详情串号列表
|
|
public function retreatDetailSerialList()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 3;
|
|
$data['type'] = 2;
|
|
$SerialClass = new SerialNumberGoods();
|
|
$result = $SerialClass->purchaseDetailSerial($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//退货详情
|
|
public function RetreatDetails()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 3;
|
|
$RetreatOrderClass = new RetreatOrder();
|
|
$result = $RetreatOrderClass->detailsList($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购退货可退商品的串码列表
|
|
public function serialList()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 3;
|
|
$data['operator_type'] = 3;
|
|
$SerialClass = new SerialNumberGoods();
|
|
$result = $SerialClass->returnableSerialList($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购退货的可退商品列表
|
|
public function RetreatGoods()
|
|
{
|
|
$content = I("post.");
|
|
$content['user_type'] = 3; //商户
|
|
$content['merchant_id'] = $content['merchantid'];
|
|
$content['exists_id_arr'] = $content['notInIds'] ? $content['notInIds'] : [];
|
|
$PurchaseGoodsClass = new PurchaseGoodsInfo();
|
|
$result = $PurchaseGoodsClass->returnablePurchaseGoodsList($content);
|
|
$result['msg'] = $result['message'];
|
|
$result['data'] = $result['data']['list'];
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
/**
|
|
* 采购退货扫码查询的商品
|
|
*/
|
|
public function returnableScanCodeGoods()
|
|
{
|
|
$data = I('post.');
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$data['user_type'] = 3;
|
|
$GoodsInfoClass = new PurchaseGoodsInfo();
|
|
$result = $GoodsInfoClass->returnablePurchaseScanCodeGoods($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//采购退货操作
|
|
public function RetreatAction()
|
|
{
|
|
$data = I('post.');
|
|
$data['merchant_id'] = $data['merchantid'];
|
|
$result = A("Api/Inventory")->MerRetreatAction($data);
|
|
if ($result['status'] == 1) {
|
|
$log_data = array(
|
|
'source' => 1,
|
|
'type' => 3,
|
|
'desc' => '采购退货管理-新增',
|
|
'request_data' => json_encode($_POST),
|
|
'operator_id' => $_POST['operator_id'],
|
|
'mer_id' => $_POST['merchantid']
|
|
);
|
|
action_log_v2($log_data);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
} |