init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,298 @@
|
||||
<?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 Common\Model\RetailStoreModel;
|
||||
use Think\Controller;
|
||||
use Common\Business\PurchaseGoodsInfo;
|
||||
|
||||
//[1.7.90]
|
||||
|
||||
/**
|
||||
* 门店采购模块
|
||||
* Class StorePurchaseOrderController
|
||||
* @package Terminalapi\Controller
|
||||
*/
|
||||
class StorePurchaseOrderController extends Controller
|
||||
{
|
||||
//门店采购单列表
|
||||
public function PurchaseOrder()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['operator_type'] = 3;
|
||||
$data['user_type'] = 4;
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$PurchaseOrderClass = new PurchaseOrder();
|
||||
$result = $PurchaseOrderClass->orderList($data);
|
||||
$result['data'] = $result['data']['list'];
|
||||
$result['msg'] = $result['message'];
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//采购仓与供货商信息
|
||||
public function WarehouseInfo()
|
||||
{
|
||||
$data = I("post.");
|
||||
$where['merchant_id'] = $data['merchantid'];
|
||||
$where['store_id'] = $data['storeid'];
|
||||
$where['status'] = 1;
|
||||
$supplier = M('retail_store_supplier')->field("id,supplier_name")->where($where)->order('id desc')->select();
|
||||
$map['merchant_id'] = $data['merchantid'];
|
||||
$map['store_id'] = $data['storeid'];
|
||||
$map['status'] = 1;
|
||||
$fields = "id,name";
|
||||
$warehouse = D('SPurchaseWarehouse')->getSelect($map, $page = '', $limit = '', $fields, $order = 'id desc');
|
||||
$res['status'] = 1;
|
||||
$res['warehouseList'] = $warehouse;
|
||||
$res['supplierList'] = $supplier;
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
|
||||
//采购单详情串号信息
|
||||
public function detailSerialList()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['user_type'] = 4;
|
||||
$data['type'] = 1;
|
||||
$SerialClass = new SerialNumberGoods();
|
||||
$result = $SerialClass->purchaseDetailSerial($data);
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//采购详情
|
||||
public function PurchaseDetails()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['user_type'] = 4;
|
||||
$PurchaseGoodsInfo = new PurchaseGoodsInfo();
|
||||
$result = $PurchaseGoodsInfo->basisIdGetPurchaseGoodsList($data);
|
||||
$result['msg'] = $result['message'];
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//采购选择商品 2021-1-27 已作废
|
||||
public function GoodsInfo()
|
||||
{
|
||||
$data = I("post.");
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$result = A('Api/Inventory')->getStoreSaleGoodsList($data); //获取门店采购商品列表
|
||||
$res['status'] = 1;
|
||||
$res['msg'] = '查询成功';
|
||||
$res['data'] = $result['data']['list'];
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
|
||||
//串号验证
|
||||
public function serialVerify()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$data['user_type'] = 4;
|
||||
$SerialClass = new SerialNumberGoods();
|
||||
$result = $SerialClass->singleGoodsVerify($data);
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//采购选择商品
|
||||
public function goodsList()
|
||||
{
|
||||
$data = I("post.");
|
||||
$data['operator_type'] = 3;
|
||||
$data['user_type'] = 4;
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
//采购入库操作
|
||||
public function PurchaseOperation()
|
||||
{
|
||||
$data = I("post.");
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$result = A('Api/Inventory')->storePurchaseOperation($data);
|
||||
if ($result['status'] == 1) {
|
||||
$log_data = array(
|
||||
'source' => 1,
|
||||
'type' => 4,
|
||||
'desc' => '采购管理-新增',
|
||||
'request_data' => json_encode($_POST),
|
||||
'operator_id' => $data['operator_id'],
|
||||
'mer_id' => $data['storeid']
|
||||
);
|
||||
action_log_v2($log_data);
|
||||
$text['money_total'] = $result['data']['money_total'];
|
||||
$text['goods_species'] = $result['data']['goods_species'];
|
||||
$text['order_number'] = $result['data']['order_number'];
|
||||
$text['operator_id'] = $data['operator_id'];
|
||||
$text['add_time'] = $data['add_time'];
|
||||
$print_parameter = array(
|
||||
'id' => $result['data']['id'],
|
||||
'order_info' => $text,
|
||||
'identity' => 2,
|
||||
'type' => 1,
|
||||
'store_id' => $data['storeid']
|
||||
);
|
||||
A('PayApi/Printer')->inventoryPrint($print_parameter);
|
||||
}
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//编辑采购单提交操作
|
||||
public function PurchaseOrderEdit()
|
||||
{
|
||||
$data = I("post.");
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$res = A("Api/Inventory")->StorePurchaseEdit($data);
|
||||
if ($res['status'] == 1) {
|
||||
$log_data = [
|
||||
'source' => 1,
|
||||
'type' => 4,
|
||||
'desc' => '采购管理-编辑',
|
||||
'request_data' => json_encode($_POST),
|
||||
'operator_id' => $_POST['operator_id'],
|
||||
'mer_id' => $_POST['storeid']
|
||||
];
|
||||
action_log_v2($log_data);
|
||||
}
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
|
||||
//入库到经营仓
|
||||
public function WarehousingOperation()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$result = A('Api/Inventory')->storePurchaseWarehouse($data);
|
||||
if (C('IS_SET_REDIS')) {
|
||||
$redis_key = 'retail_merchant_id_' . $data['merchant_id'] . '_store_id_' . $data['store_id'] . '_purchase_order_id_' . $data['id'];
|
||||
$CacheClass = new CacheHandle();
|
||||
$CacheClass->deleteRedis($redis_key);
|
||||
}
|
||||
if ($result['status'] == 1) {
|
||||
$log_data = array(
|
||||
'source' => 1,
|
||||
'type' => 4,
|
||||
'desc' => '采购单-入库至供给仓/入库单-新增',
|
||||
'request_data' => json_encode($_POST),
|
||||
'operator_id' => $_POST['operator_id'],
|
||||
'mer_id' => $_POST['storeid']
|
||||
);
|
||||
action_log_v2($log_data);
|
||||
}
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//门店采购退货单列表
|
||||
public function RetreatOrder()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['operator_type'] = 3;
|
||||
$data['user_type'] = 4;
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$RetreatOrderClass = new RetreatOrder();
|
||||
$result = $RetreatOrderClass->orderList($data);
|
||||
$result['data'] = $result['data']['list'];
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//详情串号列表
|
||||
public function retreatDetailSerialList()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['user_type'] = 4;
|
||||
$data['type'] = 2;
|
||||
$SerialClass = new SerialNumberGoods();
|
||||
$result = $SerialClass->purchaseDetailSerial($data);
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//门店采购退货单详情
|
||||
public function RetreatDetails()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['user_type'] = 4;
|
||||
$RetreatOrderClass = new RetreatOrder();
|
||||
$result = $RetreatOrderClass->detailsList($data);
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
//采购退货可退商品的串码列表
|
||||
public function serialList()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['user_type'] = 4;
|
||||
$data['operator_type'] = 3;
|
||||
$SerialClass = new SerialNumberGoods();
|
||||
$result = $SerialClass->returnableSerialList($data);
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 采购退货的可退商品列表
|
||||
*/
|
||||
public function RetreatGoods()
|
||||
{
|
||||
$content = I("post.");
|
||||
$content['user_type'] = 4; //门店
|
||||
$content['merchant_id'] = $content['merchantid'];
|
||||
$content['store_id'] = $content['storeid'];
|
||||
$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 RetreatAction()
|
||||
{
|
||||
$data = I('post.');
|
||||
$data['merchant_id'] = $data['merchantid'];
|
||||
$data['store_id'] = $data['storeid'];
|
||||
$result = A("Api/Inventory")->StoreRetreatAction($data);
|
||||
if ($result['status'] == 1) {
|
||||
$log_data = array(
|
||||
'source' => 1,
|
||||
'type' => 4,
|
||||
'desc' => '采购退货管理-新增',
|
||||
'request_data' => json_encode($_POST),
|
||||
'operator_id' => $_POST['operator_id'],
|
||||
'mer_id' => $_POST['storeid']
|
||||
);
|
||||
action_log_v2($log_data);
|
||||
}
|
||||
$this->ajaxReturn($result);
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户