mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-13 01:05:42 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
@@ -37,8 +37,8 @@ class taskmgr_interface_storage{
|
||||
}
|
||||
|
||||
//存储数据成文件
|
||||
public function save($source_file, $task_id, &$url){
|
||||
return self::$__storageObj->save($source_file, $task_id, $url);
|
||||
public function save($source_file, $task_id, &$url, $extName = ''){
|
||||
return self::$__storageObj->save($source_file, $task_id, $url, $extName);
|
||||
}
|
||||
|
||||
//读取文件获取数据
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 自动任务入口类
|
||||
*
|
||||
@@ -126,16 +125,16 @@ class taskmgr_rpc_entrance{
|
||||
|
||||
/**
|
||||
*
|
||||
* 验证签名函数
|
||||
* 验证签名函数(支持新旧token平滑切换)
|
||||
* @param array $params
|
||||
*/
|
||||
private function validate($params){
|
||||
|
||||
$sign = $params['taskmgr_sign'];
|
||||
unset($params['taskmgr_sign']);
|
||||
$local_sign = taskmgr_rpc_sign::gen_sign($params);
|
||||
|
||||
if(!$local_sign || $sign != $local_sign){
|
||||
|
||||
// 使用新的验证方法,支持新旧token同时验证
|
||||
if(!taskmgr_rpc_sign::validate_sign($params, $sign)){
|
||||
return false;
|
||||
}else{
|
||||
unset($params['task_type']);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//加载配置信息
|
||||
require_once(dirname(__FILE__) . '/../../config/config.php');
|
||||
class taskmgr_rpc_sign{
|
||||
@@ -23,9 +22,35 @@ class taskmgr_rpc_sign{
|
||||
*
|
||||
* 生成签名算法函数
|
||||
* @param array $params
|
||||
* @param string $token 可选,指定使用的token,默认使用REQ_TOKEN
|
||||
*/
|
||||
static public function gen_sign($params){
|
||||
return strtoupper(md5(strtoupper(md5(self::assemble($params))).REQ_TOKEN));
|
||||
static public function gen_sign($params, $token = null){
|
||||
$useToken = $token !== null ? $token : REQ_TOKEN;
|
||||
return strtoupper(md5(strtoupper(md5(self::assemble($params))).$useToken));
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证签名(支持新旧token同时验证,用于平滑切换)
|
||||
* @param array $params 参数数组(不包含taskmgr_sign)
|
||||
* @param string $sign 待验证的签名
|
||||
* @return bool 验证是否通过
|
||||
*/
|
||||
static public function validate_sign($params, $sign){
|
||||
// 先尝试用新token验证
|
||||
$newSign = self::gen_sign($params);
|
||||
if($sign === $newSign){
|
||||
return true;
|
||||
}
|
||||
|
||||
// 如果配置了旧token,尝试用旧token验证(用于平滑切换)
|
||||
if(defined('REQ_TOKEN_OLD') && REQ_TOKEN_OLD){
|
||||
$oldSign = self::gen_sign($params, REQ_TOKEN_OLD);
|
||||
if($sign === $oldSign){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,4 +70,4 @@ class taskmgr_rpc_sign{
|
||||
}
|
||||
return $sign;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 文件生成存储抽象类
|
||||
*
|
||||
@@ -24,6 +23,8 @@
|
||||
|
||||
abstract class taskmgr_storage_abstract {
|
||||
|
||||
protected $_extName = '';
|
||||
|
||||
//saas定义的是用户域名
|
||||
private function kvprefix() {
|
||||
return (defined('KV_PREFIX')) ? KV_PREFIX : 'default';
|
||||
@@ -31,6 +32,15 @@ abstract class taskmgr_storage_abstract {
|
||||
|
||||
//根据参数生成文件名
|
||||
public function _ident($key){
|
||||
|
||||
if ($this->_extName) {
|
||||
return md5(microtime().$this->kvprefix()).$key.'.'.$this->_extName;
|
||||
}
|
||||
|
||||
return md5(microtime().$this->kvprefix()).$key.'.csv';
|
||||
}
|
||||
}
|
||||
|
||||
public function setExtName($extName) {
|
||||
$this->_extName = $extName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,25 +20,17 @@
|
||||
* @author kamisama.xia@gmail.com
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
class taskmgr_storage_ftp extends taskmgr_storage_abstract implements taskmgr_storage_interface
|
||||
{
|
||||
|
||||
private static $_storageConn = null;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* connect
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
if (!isset(self::$_storageConn)) {
|
||||
@@ -69,14 +61,19 @@ class taskmgr_storage_ftp extends taskmgr_storage_abstract implements taskmgr_st
|
||||
|
||||
/**
|
||||
* 向远程ftp上传保存生成文件
|
||||
*
|
||||
*
|
||||
* @param string $source_file 源文件含路径
|
||||
* @param string $task_id 目标文件名命名传入参数
|
||||
* @param string $url 生成目标文件路径
|
||||
* @return boolean true/false
|
||||
*/
|
||||
public function save($source_file, $task_id, &$url)
|
||||
public function save($source_file, $task_id, &$url, $extName = '')
|
||||
{
|
||||
// 设置扩展名
|
||||
if ($extName) {
|
||||
$this->setExtName($extName);
|
||||
}
|
||||
|
||||
//存储的目的地文件路径
|
||||
$destination_file = $this->_get_ident($task_id);
|
||||
|
||||
@@ -98,7 +95,7 @@ class taskmgr_storage_ftp extends taskmgr_storage_abstract implements taskmgr_st
|
||||
|
||||
/**
|
||||
* 向远程ftp下载文件到本地
|
||||
*
|
||||
*
|
||||
* @param string $url 远程源文件
|
||||
* @param string $local_file 本地目标文件
|
||||
* @return boolean true/false
|
||||
@@ -120,7 +117,7 @@ class taskmgr_storage_ftp extends taskmgr_storage_abstract implements taskmgr_st
|
||||
|
||||
/**
|
||||
* 向远程ftp删除指定文件
|
||||
*
|
||||
*
|
||||
* @param string $url 远程源文件
|
||||
*/
|
||||
public function delete($url)
|
||||
@@ -169,10 +166,6 @@ class taskmgr_storage_ftp extends taskmgr_storage_abstract implements taskmgr_st
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* __destruct
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
ftp_close(self::$_storageConn);
|
||||
|
||||
@@ -81,8 +81,12 @@ class taskmgr_storage_sftp extends taskmgr_storage_abstract implements taskmgr_s
|
||||
* @param string $url 生成目标文件路径
|
||||
* @return boolean true/false
|
||||
*/
|
||||
public function save($source_file, $task_id, &$url)
|
||||
public function save($source_file, $task_id, &$url, $extName = '')
|
||||
{
|
||||
if ($extName) {
|
||||
$this->setExtName($extName);
|
||||
}
|
||||
|
||||
//存储的目的地文件路径
|
||||
$destination_file = $this->_get_ident($task_id);
|
||||
|
||||
|
||||
@@ -17,11 +17,36 @@
|
||||
|
||||
class taskmgr_whitelist
|
||||
{
|
||||
static private $whiteObj = [];
|
||||
|
||||
public static function initWhitelist($taskName)
|
||||
{
|
||||
if(empty(self::$whiteObj)) {
|
||||
$path = __DIR__.'/whitelist';
|
||||
foreach (glob($path.'/*.php') as $file_name) {
|
||||
require_once $file_name;
|
||||
$class_name = 'taskmgr_whitelist_'.basename($file_name,'.php');
|
||||
try{
|
||||
self::$whiteObj[] = new $class_name();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
$task = [];
|
||||
foreach (self::$whiteObj as $obj) {
|
||||
if(method_exists($obj,$taskName)) {
|
||||
$task = array_merge($task,$obj->{$taskName}());
|
||||
}
|
||||
}
|
||||
return $task;
|
||||
}
|
||||
|
||||
//进队列业务逻辑处理任务
|
||||
public static function task_list()
|
||||
{
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('task_list');
|
||||
$_tasks = array(
|
||||
'autochk' => array(
|
||||
'method' => 'wms_autotask_task_check',
|
||||
'threadNum' => 5,
|
||||
@@ -100,12 +125,14 @@ class taskmgr_whitelist
|
||||
'timeout' => 180,
|
||||
),
|
||||
);
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
//定时任务,线程数不允许修改
|
||||
public static function timer_list()
|
||||
{
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('timer_list');
|
||||
$_tasks = array(
|
||||
'misctask' => array('method' => 'ome_autotask_timer_misctask', 'threadNum' => 1), // 系统定时任务分、时、天、周、月任务
|
||||
'inventorydepth' => array('method' => 'ome_autotask_timer_inventorydepth', 'threadNum' => 1), // 库存回写
|
||||
// 'batchfill' => array('method' => 'ome_autotask_timer_batchfill', 'threadNum' => 1), // 订单补单任务
|
||||
@@ -148,7 +175,7 @@ class taskmgr_whitelist
|
||||
|
||||
'sync_branch_freeze_decr' => array('method'=>'ome_autotask_timer_branchfreezedecr', 'threadNum' => 1), // 后置仓更新冻结
|
||||
'sync_sku_freeze_decr' => array('method'=>'ome_autotask_timer_skufreezedecr', 'threadNum' => 1), // 后置商品更新冻结
|
||||
'check_freeze_store' => array('method'=>'monitor_autotask_timer_checkfreezestore', 'threadNum' => 1), // 对比ome_branch_product和basic_material_stock_freeze
|
||||
'check_freeze_store' => array('method'=>'monitor_autotask_timer_checkfreezestore', 'threadNum' => 1, 'retry' => false, 'timeout' => 600), // 对比ome_branch_product和basic_material_stock_freeze
|
||||
// 'clean_freeze_queue' => array('method'=>'monitor_autotask_timer_cleanfreezequeue', 'threadNum' => 1), // 清理冻结队列
|
||||
|
||||
'ediws_accountorders'=>array('method'=>'ediws_autotask_timer_accountorders', 'threadNum' => 1),// EDI实销实结明细
|
||||
@@ -162,16 +189,19 @@ class taskmgr_whitelist
|
||||
'sync_shop_skus'=>array('method'=>'inventorydepth_autotask_timer_shopskus', 'threadNum' => 1, 'timeout' => 180),// 下载缓存商品
|
||||
'check_order_is_delivery' => array('method'=>'monitor_autotask_timer_checkorderisdelivery', 'threadNum' => 1),
|
||||
'o2oundelivery' => array('method'=>'monitor_autotask_timer_o2oundelivery', 'threadNum'=>1),
|
||||
// 'retry_delivery_cancel_to_wms'=>array('method'=>'ome_autotask_timer_retrydeliverycancel', 'threadNum' => 1),// 重试推送wms发货单取消
|
||||
'retry_delivery_cancel_to_wms'=>array('method'=>'ome_autotask_timer_retrydeliverycancel', 'threadNum' => 1),// 重试推送wms发货单取消
|
||||
'ediws_fixaccountorders'=>array('method'=>'ediws_autotask_timer_fixaccountorders', 'threadNum' => 1),// EDI实销实结明细补拉任务
|
||||
'invoice_queryinvoicelist' => array('method' => 'invoice_autotask_timer_queryinvoicelist', 'threadNum' => 1),
|
||||
'platform_timeliness' => array('method' => 'ome_autotask_timer_platform_timeliness', 'threadNum' => 1),// 平台时效检查
|
||||
);
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
//初始化域名进任务队列,这里的命名规范就是实际连的队列任务+domainqueue生成这个初始化任务的数组值,线程数不允许修改
|
||||
public static function init_list()
|
||||
{
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('init_list');
|
||||
$_tasks = array(
|
||||
'misctaskdomainqueue' => array(
|
||||
'threadNum' => 1,
|
||||
'rule' => '*/30 * * * * *',
|
||||
@@ -377,10 +407,10 @@ class taskmgr_whitelist
|
||||
'threadNum' => 1,
|
||||
'rule' => '0 0 * * * *',
|
||||
),
|
||||
// 'retry_delivery_cancel_to_wms'=>array(
|
||||
// 'threadNum' => 1,
|
||||
// 'rule' => '0 */5 * * * *',
|
||||
// ),
|
||||
'retry_delivery_cancel_to_wms'=>array(
|
||||
'threadNum' => 1,
|
||||
'rule' => '0 */5 * * * *',
|
||||
),
|
||||
'ediws_fixaccountorders'=>array(
|
||||
'threadNum' => 1,
|
||||
'rule' => '0 0 3 * * *',
|
||||
@@ -393,13 +423,19 @@ class taskmgr_whitelist
|
||||
'threadNum' => 1,
|
||||
'rule' => '0 */15 * * * *',
|
||||
),
|
||||
'platform_timelinessdomainqueue' => array(
|
||||
'threadNum' => 1,
|
||||
'rule' => '0 */20 * * * *',
|
||||
),
|
||||
);
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
//导出任务
|
||||
public static function export_list()
|
||||
{
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('export_list');
|
||||
$_tasks = array(
|
||||
'exportsplit' => array(
|
||||
'method' => 'ome_autotask_export_exportsplit',
|
||||
'threadNum' => 5,
|
||||
@@ -436,12 +472,14 @@ class taskmgr_whitelist
|
||||
'name' => '导出文件生成队列',
|
||||
),
|
||||
);
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
//rpc任务
|
||||
public static function rpc_list()
|
||||
{
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('rpc_list');
|
||||
$_tasks = array(
|
||||
'omecallback' => array('method' => 'ome_autotask_rpc_omecallback', 'threadNum' => 5),
|
||||
'wmscallback' => array('method' => 'ome_autotask_rpc_wmscallback', 'threadNum' => 5),
|
||||
'wmsrpc' => array(
|
||||
@@ -455,10 +493,12 @@ class taskmgr_whitelist
|
||||
'name' => '收单队列',
|
||||
),
|
||||
);
|
||||
}
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
public static function finance_list(){
|
||||
return $_tasks = array(
|
||||
$task = self::initWhitelist('finance_list');
|
||||
$_tasks = array(
|
||||
'billapidownload' => array('method'=>'financebase_autotask_task_process', 'threadNum'=>1), //财务下载任务
|
||||
'billassign' => array('method'=>'financebase_autotask_task_process', 'threadNum'=>1), //账单导入分派任务
|
||||
'billjdwalletassign' => array('method'=>'financebase_autotask_task_process', 'threadNum'=>1), //京东钱包导入分派任务
|
||||
@@ -486,6 +526,7 @@ class taskmgr_whitelist
|
||||
'jitaftersale' => array('method'=>'billcenter_autotask_timer_aftersales', 'threadNum' => 1), // JIT售后单
|
||||
|
||||
);
|
||||
return array_merge($_tasks, $task);
|
||||
}
|
||||
|
||||
//全部任务
|
||||
|
||||
Reference in New Issue
Block a user