Merge pull request 'feat: 修改了仓库产品列表的搜索条件' (#107) from dev into main
Reviewed-on: #107
This commit is contained in:
commit
7488faa2e7
@ -29,7 +29,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['warehouse_id', 'product_id', 'financial_pm'],
|
||||
'=' => ['warehouse_id', 'financial_pm','store_id'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -52,12 +52,15 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
->select()->each(function ($item){
|
||||
if($item->financial_pm==0){
|
||||
$item->financial_pm_name='出库';
|
||||
if($item->store_id>0){
|
||||
$item->financial_pm_name='出库=>'.SystemStore::where('id',$item->store_id)->value('name');
|
||||
}
|
||||
}else{
|
||||
$item->financial_pm_name='入库';
|
||||
}
|
||||
if($item->store_id>0){
|
||||
$item->system_store_name=SystemStore::where('id',$item->store_id)->value('name');
|
||||
}else{
|
||||
$item->system_store_name='';
|
||||
|
||||
}
|
||||
if($item->status==0){
|
||||
$item->status_name='未确认';
|
||||
}elseif($item->status==1){
|
||||
|
@ -118,7 +118,7 @@ class WarehouseProductLogic extends BaseLogic
|
||||
|
||||
$find = WarehouseProduct::where('id', $id)->find();
|
||||
$find->status = 1;
|
||||
$find->batch = WarehouseProduct::where(['product_id' => $find['product_id'], 'warehouse_id' => $find['warehouse_id'], 'financial_pm' => $financial_pm])->count();
|
||||
$find->batch = WarehouseProduct::where(['product_id' => $find['product_id'], 'warehouse_id' => $find['warehouse_id'], 'financial_pm' => $financial_pm,'store_id'=>$find['store_id']])->count();
|
||||
$find->save();
|
||||
|
||||
$storege = WarehouseProductStorege::where('warehouse_id', $find['warehouse_id'])->where('product_id', $find['product_id'])->find();
|
||||
|
@ -62,6 +62,9 @@
|
||||
"ext-event": "For better performance. "
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"": "extend/"
|
||||
},
|
||||
"psr-4": {
|
||||
"": "./",
|
||||
"app\\": "./app",
|
||||
@ -83,4 +86,4 @@
|
||||
"support\\Plugin::uninstall"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
178
extend/liankenet/CloudPrinter.php
Normal file
178
extend/liankenet/CloudPrinter.php
Normal file
@ -0,0 +1,178 @@
|
||||
<?php
|
||||
namespace liankenet;
|
||||
|
||||
class ApiException extends \Exception
|
||||
{
|
||||
}
|
||||
|
||||
class HttpException extends \Exception
|
||||
{
|
||||
}
|
||||
|
||||
class CloudPrinter
|
||||
{
|
||||
// 声明属性
|
||||
public $api_key = getenv('CLOUD_PRINTER_API_KEY');
|
||||
public $server = "https://cloud.wisiyilink.com/";
|
||||
public $timeout = 10;
|
||||
public $debug = false;
|
||||
public $device_id = getenv('CLOUD_PRINTER_DEVICE_ID');
|
||||
public $device_key = getenv('CLOUD_PRINTER_DEVICE_KEY');
|
||||
|
||||
public function CloudPrinter($api_key, $device_id, $device_key, $debug = false, $timeout = 10)
|
||||
{
|
||||
$this->api_key = $api_key;
|
||||
$this->timeout = $timeout;
|
||||
$this->device_id = $device_id;
|
||||
$this->device_key = $device_key;
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
||||
private function requests($method, $endpoint, $fields = array(), $content_type = 'application/json')
|
||||
{
|
||||
if ($method == 'POST' && $content_type == 'application/json') {
|
||||
$fields = json_encode($fields);
|
||||
}
|
||||
$curl = curl_init();
|
||||
|
||||
$headers = array(
|
||||
"ApiKey: " . $this->api_key
|
||||
);
|
||||
if ($method == "POST") {
|
||||
array_push($headers, 'Content-Type: ' . $content_type);
|
||||
}
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $this->server . $endpoint,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_MAXREDIRS => 1,
|
||||
CURLOPT_TIMEOUT => $this->timeout,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLINFO_HEADER_OUT => $this->debug,
|
||||
CURLOPT_VERBOSE => $this->debug,
|
||||
CURLOPT_CUSTOMREQUEST => $method,
|
||||
CURLOPT_POSTFIELDS => $fields,
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
$info = curl_getinfo($curl);
|
||||
if ($this->debug) {
|
||||
print_r($info);
|
||||
}
|
||||
|
||||
if (false === $response) {
|
||||
die(curl_error($curl));
|
||||
throw new Exception(curl_error($curl), curl_errno($curl));
|
||||
} else if ($info['http_code'] != 200) {
|
||||
throw new HttpException(curl_error($curl), $info['http_code']);
|
||||
}
|
||||
$data = json_decode($response);
|
||||
if ($data->code != 200) {
|
||||
throw new ApiException($data->msg, $data->code);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDeviceInfo()
|
||||
/*
|
||||
* 设备信息
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
);
|
||||
$response = $this->requests("GET", 'api/device/device_info?' . http_build_query($data));
|
||||
return $response->data;
|
||||
}
|
||||
|
||||
public function asyncRefreshDeviceInfo()
|
||||
/*
|
||||
* 异步刷新设备信息,包括打印机信息
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
);
|
||||
$response = $this->requests("GET", 'api/device/async_refresh_device_info?' . http_build_query($data));
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getPrinterList()
|
||||
/*
|
||||
* 打印机列表
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
);
|
||||
$response = $this->requests("GET", 'api/external_api/printer_list?' . http_build_query($data));
|
||||
return $response->data->row;
|
||||
}
|
||||
|
||||
public function getPrinterParams($printer_model)
|
||||
/**
|
||||
* 打印参数
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
"printerModel" => $printer_model,
|
||||
);
|
||||
$response = $this->requests("GET", 'api/print/printer_params?' . http_build_query($data));
|
||||
return $response->data;
|
||||
}
|
||||
|
||||
public function addJob($device_port, $printer_model, $paper_size, $file, $optional_array = array())
|
||||
/*
|
||||
* 发起打印任务
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
"devicePort" => $device_port,
|
||||
"printerModel" => $printer_model,
|
||||
"dmPaperSize" => $paper_size,
|
||||
"jobFile" => $file
|
||||
);
|
||||
$data = array_merge($data, $optional_array);
|
||||
$response = $this->requests("POST", 'api/print/job', $data, "multipart/form-data");
|
||||
return $response->data;
|
||||
}
|
||||
|
||||
public function getJobStatus($device_port, $task_id)
|
||||
/*
|
||||
* 获取任务状态
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
"devicePort" => $device_port,
|
||||
"task_id" => $task_id,
|
||||
);
|
||||
$response = $this->requests("GET", 'api/print/job?' . http_build_query($data));
|
||||
return $response->data;
|
||||
}
|
||||
|
||||
public function cancelJob($device_port, $task_id)
|
||||
/*
|
||||
* 取消任务
|
||||
*/
|
||||
{
|
||||
$data = array(
|
||||
"deviceId" => $this->device_id,
|
||||
"deviceKey" => $this->device_key,
|
||||
"devicePort" => $device_port,
|
||||
"task_id" => $task_id,
|
||||
);
|
||||
$response = $this->requests("DELETE", 'api/print/job?' . http_build_query($data));
|
||||
return $response;
|
||||
}
|
||||
}
|
1
vendor/composer/autoload_namespaces.php
vendored
1
vendor/composer/autoload_namespaces.php
vendored
@ -8,4 +8,5 @@ $baseDir = dirname($vendorDir);
|
||||
return array(
|
||||
'Pimple' => array($vendorDir . '/pimple/pimple/src'),
|
||||
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
|
||||
'' => array($baseDir . '/extend'),
|
||||
);
|
||||
|
5
vendor/composer/autoload_static.php
vendored
5
vendor/composer/autoload_static.php
vendored
@ -683,6 +683,10 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc
|
||||
),
|
||||
);
|
||||
|
||||
public static $fallbackDirsPsr0 = array (
|
||||
0 => __DIR__ . '/../..' . '/extend',
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
|
||||
@ -714,6 +718,7 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc::$prefixDirsPsr4;
|
||||
$loader->fallbackDirsPsr4 = ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc::$fallbackDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc::$prefixesPsr0;
|
||||
$loader->fallbackDirsPsr0 = ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc::$fallbackDirsPsr0;
|
||||
$loader->classMap = ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user