86 行
3.6 KiB
PHP
可执行文件
86 行
3.6 KiB
PHP
可执行文件
<?php
|
|
namespace Terminalapi\Controller;
|
|
use Common\Business\RefuseWarehousing;
|
|
use Think\Controller;
|
|
//[1.4.98]
|
|
class RefuseWarehousingController extends Controller
|
|
{
|
|
/**
|
|
* 门店入库单的拒收操作
|
|
*/
|
|
public function storeRefuseWarehousing()
|
|
{
|
|
$data = I("post.");
|
|
$store_id = $data['storeid'];
|
|
$merchant_id = $data['merchantid'];
|
|
if (C('IS_SET_REDIS')) {
|
|
$ApiRedis = new \Addons\Api\RedisController();
|
|
$key_name = "Retail_merchant_id_" . $merchant_id . "_store_id_" . $store_id . "_warehousing_id_" . $data['warehousing_id'];
|
|
if ($ApiRedis::$redis->exists($key_name)) {
|
|
$res['status'] = 0;
|
|
$res['msg'] = "正在入库,请勿重复操作";
|
|
$this->ajaxReturn($res);
|
|
}
|
|
$ApiRedis::$redis->setex($key_name, 60, $data['warehousing_id']);
|
|
}
|
|
$refuse = new RefuseWarehousing();
|
|
$result = $refuse->refuseMerchantAllocation(
|
|
[
|
|
'operator_id' => $data['operator_id'], //操作人id
|
|
'warehousing_id' => $data['warehousing_id'], //入库单id
|
|
'stock_out_id' => $data['stock_out_id'], //出库单id
|
|
'type' => $data['type'], //入库类型
|
|
'store_id' => $store_id, //门店id
|
|
'merchant_id' => $merchant_id, //商户id
|
|
]
|
|
);
|
|
if (C('IS_SET_REDIS')) {
|
|
$ApiRedis::$redis->delete($key_name);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
//调拨单拒收
|
|
public function refuse()
|
|
{
|
|
$data = I("post.");
|
|
$store_id = $data['storeid'];
|
|
$merchant_id = $data['merchantid'];
|
|
if (C('IS_SET_REDIS')) {
|
|
$ApiRedis = new \Addons\Api\RedisController();
|
|
$key_name = "Retail_merchant_id_" . $merchant_id . "_store_id_" . $store_id . "_warehousing_id_" . $data['warehousing_id'];
|
|
if ($ApiRedis::$redis->exists($key_name)) {
|
|
$res['status'] = 0;
|
|
$res['msg'] = "正在入库,请勿重复操作";
|
|
$this->ajaxReturn($res);
|
|
}
|
|
$ApiRedis::$redis->setex($key_name, 60, $data['warehousing_id']);
|
|
}
|
|
$refuse = new RefuseWarehousing();
|
|
$result = $refuse->refuseMerchantAllocation(
|
|
[
|
|
'operator_id' => $data['operator_id'], //操作人id
|
|
'warehousing_id' => $data['warehousing_id'], //入库单id
|
|
'stock_out_id' => $data['stock_out_id'], //出库单id
|
|
'type' => 6, //申请调拨
|
|
'store_id' => $store_id, //门店id
|
|
'merchant_id' => $merchant_id //商户id
|
|
]
|
|
);
|
|
if ($result['status'] == 1) {
|
|
$AllocationOrderModel = new \Common\Model\AllocationOrderModel();
|
|
$update = array(
|
|
'refuse_goods_species' => $result['data']['refuse_goods_species'],
|
|
'refuse_total_cost_money' => $result['data']['refuse_total_cost_money'],
|
|
'refuse_total_stock_money' => $result['data']['refuse_total_stock_money'],
|
|
'refuse_status' => 2,
|
|
'refuse_time' => time()
|
|
);
|
|
$AllocationOrderModel->updateData(array('id' => $data['id']), $update);
|
|
}
|
|
if (C('IS_SET_REDIS')) {
|
|
$ApiRedis::$redis->delete($key_name);
|
|
}
|
|
$this->ajaxReturn($result);
|
|
}
|
|
} |