【优化】实收退导入界面

【新增】快捷菜单功能入口

【新增】爱库存电子面单获取
This commit is contained in:
chenping
2026-04-21 22:36:45 +08:00
parent 8b4b4cc49f
commit b20d422532
45 changed files with 2367 additions and 191 deletions

View File

@@ -146,6 +146,10 @@ define('STORE_WAYBILL_ADRESS', 'store.waybill.i.search'); //抖音订购地址
define('STORE_WAYBILL_GET', 'store.waybill.i.get'); //电子面单获取
define('STORE_STANDARD_DY_TEMPLATE', 'store.waybill.template.get'); //抖音获取模板
define('STORE_WAYBILL_PRINTDATA', 'store.waybill.printdata'); //抖音获取打印数据
// 爱库存等矩阵取号method 与 STORE_WAYBILL_GET 相同,语义区分便于检索)
define('STORE_WAYBILL_DY_GET', 'store.waybill.i.get');
// 矩阵生成打印控件签名 params爱库存 prepare/sign 的 sign 阶段)
define('STORE_API_SIGN_GET', 'store.api.sign.get');
// 小红书电子面单
define('STORE_STANDARD_XHS_TEMPLATE', 'store.waybill.stdtemplates.get'); //小红书获取模板

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
<?php
/**
* @author ykm 2026-03
* @describe 爱库存模板数据获取
*/
class erpapi_logistics_matrix_aikucun_request_template extends erpapi_logistics_request_template
{
public function syncUserTpl()
{
$this->title = '获取爱库存用户模板';
$params = ['version' => '2.0'];
$rs = $this->requestCall(STORE_WAYBILL_USER_TEMPLATE, $params);
if ($rs['rsp'] == 'succ' && $rs['data']) {
$resData = json_decode($rs['data'], 1);
$rs['data'] = [];
$templateList = $this->extractTemplateList($resData);
foreach ($templateList as $k => $v) {
$outTemplateId = isset($v['customTemplateCode']) ? $v['customTemplateCode'] : '';
if (!$outTemplateId) {
continue;
}
$tplSelect = isset($v['customParams']) && is_array($v['customParams']) ? array_filter($v['customParams']) : [];
$width = '';
$height = '';
$templateCode = isset($v['parentTemplateCode']) ? $v['parentTemplateCode'] : '';
if ($templateCode && preg_match('/_(\d+)_(\d+)(?:_|$)/', $templateCode, $match)) {
$width = $match[1];
$height = $match[2];
}
$rs['data'][] = array(
'tpl_index' => 'user' . '-' . $outTemplateId,
'cp_code' => $v['cpCode'],
'out_template_id' => $outTemplateId,
'template_name' => $v['customTemplateName'] . '(爱库存)',
'template_type' => 'aikucun_user',
'template_select' => $tplSelect,
'template_data' => json_encode($v),
'template_width' => $width,
'template_height' => $height,
);
}
} else {
$rs['data'] = [];
}
return $rs;
}
public function syncStandardTpl()
{
$this->title = '获取爱库存标准模板';
$params = ['version' => '2.0'];
$rs = $this->requestCall(STORE_WAYBILL_STANDARD_TEMPLATE, $params);
if ($rs['rsp'] == 'succ' && $rs['data']) {
$resData = json_decode($rs['data'], 1);
$rs['data'] = [];
$templateList = $this->extractTemplateList($resData);
foreach ($templateList as $k => $v) {
$width = '';
$height = '';
$templateCode = isset($v['templateCode']) ? $v['templateCode'] : '';
if ($templateCode && preg_match('/_(\d+)_(\d+)(?:_|$)/', $templateCode, $match)) {
$width = $match[1];
$height = $match[2];
}
$rs['data'][] = array(
'tpl_index' => 'standard' . '-' . $v['templateId'],
'cp_code' => $v['cpCode'],
'out_template_id' => $v['templateId'],
'template_name' => $v['templateName'] . '(爱库存)',
'template_type' => 'aikucun_standard',
'template_data' => json_encode($v),
'template_width' => $width,
'template_height' => $height,
);
}
} else {
$rs['data'] = [];
}
return $rs;
}
private function extractTemplateList($resData)
{
$result = [];
$data = isset($resData['data']) ? $resData['data'] : [];
// 仅按爱库存当前返回结构解析data[] -> logisticsCode + templateList[]
if (is_array($data)) {
foreach ($data as $group) {
$cpCode = isset($group['logisticsCode']) ? $group['logisticsCode'] : '';
if (empty($group['templateList']) || !is_array($group['templateList'])) {
continue;
}
foreach ($group['templateList'] as $tpl) {
$tpl['cpCode'] = $cpCode;
$result[] = $tpl;
}
}
}
return $result;
}
}

View File

@@ -111,8 +111,12 @@ class erpapi_shop_matrix_taobao_request_delivery extends erpapi_shop_request_del
// 淘宝直销、分销是否是国补订单的发货回写
$order_id = $sdf['orderinfo']['order_id'];
$isGuobu = kernel::single('ome_bill_label')->getBillLabelInfo($order_id, 'order', 'SOMS_GB');
if ($isGuobu && ($isGuobu['label_value'] & 0x0040 || $isGuobu['label_value'] & 0x0080)) {
if ($sdf['feature'] && !$param['feature']) $param['feature'] = $sdf['feature'];
if ($isGuobu) {
if ($isGuobu['label_value'] & 0x0040 || $isGuobu['label_value'] & 0x0080) {
if ($sdf['feature'] && !$param['feature']) $param['feature'] = $sdf['feature'];
} else {
unset($param['feature']);
}
}
//同城配场景

View File

@@ -116,8 +116,12 @@ class erpapi_shop_matrix_tmall_request_delivery extends erpapi_shop_request_deli
// 淘宝直销、分销是否是国补订单的发货回写
$order_id = $sdf['orderinfo']['order_id'];
$isGuobu = kernel::single('ome_bill_label')->getBillLabelInfo($order_id, 'order', 'SOMS_GB');
if ($isGuobu && ($isGuobu['label_value'] & 0x0040 || $isGuobu['label_value'] & 0x0080)) {
if ($sdf['feature'] && !$param['feature']) $param['feature'] = $sdf['feature'];
if ($isGuobu) {
if ($isGuobu['label_value'] & 0x0040 || $isGuobu['label_value'] & 0x0080) {
if ($sdf['feature'] && !$param['feature']) $param['feature'] = $sdf['feature'];
} else {
unset($param['feature']);
}
}
//同城配场景