ming #1

Merged
liufumingren merged 558 commits from ming into main 2026-11-18 16:13:25 +08:00
48 changed files with 165 additions and 141 deletions
Showing only changes of commit 358fef0f71 - Show all commits

View File

@ -1253,6 +1253,7 @@ function sanitizeTemplatePrivateFields(value, warnings, currentKey = '') {
* @param {string[]} warnings 风险提示列表。 * @param {string[]} warnings 风险提示列表。
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param {string} customDataTemplateURL 自定义区模板地址默认值。 * @param {string} customDataTemplateURL 自定义区模板地址默认值。
* @param extraCustomLines
*/ */
function applyKuaishouExpressFieldMapping(platform, skeleton, orderExpress, orderDelivery, warnings, policyConfig, customDataTemplateURL, extraCustomLines = []) { function applyKuaishouExpressFieldMapping(platform, skeleton, orderExpress, orderDelivery, warnings, policyConfig, customDataTemplateURL, extraCustomLines = []) {
if (platform !== 'kuaishou') { if (platform !== 'kuaishou') {
@ -1402,6 +1403,7 @@ function applyKuaishouExpressFieldMapping(platform, skeleton, orderExpress, orde
* @param {Object} orderExpress 快递单对象。 * @param {Object} orderExpress 快递单对象。
* @param {Object} orderDelivery 订单对象。 * @param {Object} orderDelivery 订单对象。
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param extraCustomLines
*/ */
function applyPddExpressFieldMapping(platform, skeleton, orderExpress, orderDelivery, policyConfig, extraCustomLines = []) { function applyPddExpressFieldMapping(platform, skeleton, orderExpress, orderDelivery, policyConfig, extraCustomLines = []) {
if (platform !== 'pdd') { if (platform !== 'pdd') {
@ -1724,6 +1726,7 @@ function applyDouyinExpressFieldMapping(platform, skeleton, orderExpress, orderD
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param {string} customControlTemplateURL 菜鸟自定义区模板地址。 * @param {string} customControlTemplateURL 菜鸟自定义区模板地址。
* @param {string[]} warnings 风险提示列表。 * @param {string[]} warnings 风险提示列表。
* @param extraCustomLines
*/ */
function applyCainiaoExpressFieldMapping( function applyCainiaoExpressFieldMapping(
platform, platform,
@ -1934,6 +1937,7 @@ function resolveXhsMainContentFromPrintinfo(printinfo, warnings = []) {
* @param {Object} orderDelivery 订单对象。 * @param {Object} orderDelivery 订单对象。
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param {string[]} warnings 风险提示列表。 * @param {string[]} warnings 风险提示列表。
* @param extraCustomLines
*/ */
function applyXhsExpressFieldMapping( function applyXhsExpressFieldMapping(
platform, platform,
@ -2036,6 +2040,7 @@ function applyXhsExpressFieldMapping(
* @param {Object} orderExpress 快递单对象。 * @param {Object} orderExpress 快递单对象。
* @param {Object} orderDelivery 订单对象。 * @param {Object} orderDelivery 订单对象。
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param extraCustomLines
*/ */
function applySphExpressFieldMapping( function applySphExpressFieldMapping(
platform, platform,
@ -2176,6 +2181,7 @@ function resolveJdTemplateUrlFromOrderExpress(orderExpress) {
* @param {Object} policyConfig 策略配置对象。 * @param {Object} policyConfig 策略配置对象。
* @param {Object} templateSample 模板样例对象。 * @param {Object} templateSample 模板样例对象。
* @param {string[]} warnings 风险提示列表。 * @param {string[]} warnings 风险提示列表。
* @param extraCustomLines
*/ */
function applyJdExpressFieldMapping( function applyJdExpressFieldMapping(
platform, platform,

View File

@ -71,7 +71,7 @@ module.exports = app => {
/** /**
* 根据 business_type 获取关联表名 * 根据 business_type 获取关联表名
* @param {string} businessType 业务类型 * @param {string} businessType 业务类型
* @returns {string|null} 关联表名 * @return {string|null} 关联表名
*/ */
function getBusinessTable(businessType) { function getBusinessTable(businessType) {
return BUSINESS_TYPES[businessType]?.table || null; return BUSINESS_TYPES[businessType]?.table || null;
@ -81,7 +81,7 @@ module.exports = app => {
* 校验 business_type + business_sub_type 组合是否合法 * 校验 business_type + business_sub_type 组合是否合法
* @param {string} businessType 业务类型 * @param {string} businessType 业务类型
* @param {string} businessSubType 业务子类型 * @param {string} businessSubType 业务子类型
* @returns {boolean} 是否合法 * @return {boolean} 是否合法
*/ */
function isValidSubType(businessType, businessSubType) { function isValidSubType(businessType, businessSubType) {
const def = BUSINESS_TYPES[businessType]; const def = BUSINESS_TYPES[businessType];

View File

@ -151,7 +151,7 @@ class expressInterfaceService extends MainService {
// 并行调用 getShopExpressList,构建 Map<shopId, expressList> // 并行调用 getShopExpressList,构建 Map<shopId, expressList>
const shopExpressMap = new Map(); const shopExpressMap = new Map();
const shopResults = await Promise.all( const shopResults = await Promise.all(
shopIds.map(async (shopId) => { shopIds.map(async shopId => {
try { try {
const shopExpressResult = await ctx.service.systemMethods.index.getShopExpressList({ const shopExpressResult = await ctx.service.systemMethods.index.getShopExpressList({
shop_id: shopId, shop_id: shopId,

View File

@ -51,6 +51,7 @@ class StoreWarehouseWarehouseService extends MainService {
/** /**
* 仓库侧发起签约。 * 仓库侧发起签约。
* @param data
*/ */
async sign(data = {}) { async sign(data = {}) {
const targetService = this.service && this.service.systems && this.service.systems.storeWarehouse; const targetService = this.service && this.service.systems && this.service.systems.storeWarehouse;
@ -68,6 +69,7 @@ class StoreWarehouseWarehouseService extends MainService {
/** /**
* 仓库侧确认签约。 * 仓库侧确认签约。
* @param data
*/ */
async confirmSign(data = {}) { async confirmSign(data = {}) {
const targetService = this.service && this.service.systems && this.service.systems.storeWarehouse; const targetService = this.service && this.service.systems && this.service.systems.storeWarehouse;

View File

@ -14,6 +14,7 @@ class WorkbenchService extends MainService {
/** /**
* 工作台列表(分页 + 筛选) * 工作台列表(分页 + 筛选)
* @param data
*/ */
async list(data) { async list(data) {
const { service } = this; const { service } = this;
@ -27,6 +28,7 @@ class WorkbenchService extends MainService {
/** /**
* 工作台详情 * 工作台详情
* @param data
*/ */
async detail(data) { async detail(data) {
const { service } = this; const { service } = this;
@ -42,6 +44,7 @@ class WorkbenchService extends MainService {
/** /**
* 创建工作台 * 创建工作台
* @param data
*/ */
async create(data) { async create(data) {
const { service } = this; const { service } = this;
@ -55,6 +58,7 @@ class WorkbenchService extends MainService {
/** /**
* 更新工作台 * 更新工作台
* @param data
*/ */
async update(data) { async update(data) {
const { service } = this; const { service } = this;
@ -70,6 +74,7 @@ class WorkbenchService extends MainService {
/** /**
* 删除工作台(软删除) * 删除工作台(软删除)
* @param data
*/ */
async delete(data) { async delete(data) {
const { service } = this; const { service } = this;
@ -102,6 +107,7 @@ class WorkbenchService extends MainService {
/** /**
* 工作台绑定摄像头 * 工作台绑定摄像头
* @param data
*/ */
async bindCamera(data) { async bindCamera(data) {
const { service } = this; const { service } = this;
@ -117,6 +123,7 @@ class WorkbenchService extends MainService {
/** /**
* 检查条码是否已存在 * 检查条码是否已存在
* @param data
*/ */
async checkBarcode(data) { async checkBarcode(data) {
const { service } = this; const { service } = this;

View File

@ -1161,7 +1161,7 @@ class DeliveryOrderService extends Service {
isUrgency, isUrgency,
invoiceFlag, invoiceFlag,
receiverInfo, receiverInfo,
sourceOrderCode sourceOrderCode,
} = deliveryOrder; } = deliveryOrder;
const policyConfig = await this.getStoreWarehousePolicyConfig(info.storeId, info.warehouseId); const policyConfig = await this.getStoreWarehousePolicyConfig(info.storeId, info.warehouseId);

View File

@ -780,8 +780,8 @@ class ExpressPlatformService extends MainService {
labelformat: listByWarehousePlatformCode.labelformat || '', labelformat: listByWarehousePlatformCode.labelformat || '',
extraInfo: ExpressList.find(item => item.code === listByWarehousePlatformCode.sys_express_code)?.polyapi_extra_info || '', extraInfo: ExpressList.find(item => item.code === listByWarehousePlatformCode.sys_express_code)?.polyapi_extra_info || '',
}; };
console.log("matchedPlatform.platid",matchedPlatform.platid); console.log('matchedPlatform.platid', matchedPlatform.platid);
console.log("startPlayload",playload); console.log('startPlayload', playload);
if (Number(matchedPlatform.platid) === 673) { if (Number(matchedPlatform.platid) === 673) {
playload.BizVersion = '2'; playload.BizVersion = '2';
@ -919,7 +919,7 @@ class ExpressPlatformService extends MainService {
api: 'Differ.JH.Logistics.PostOrder', api: 'Differ.JH.Logistics.PostOrder',
response: JSON.stringify(result), response: JSON.stringify(result),
}); });
console.log("分配运单号结果",result); console.log('分配运单号结果', result);
// 统一处理:不再依赖顶层 code,直接从 results 逐条提取 issuccess 和 submessage // 统一处理:不再依赖顶层 code,直接从 results 逐条提取 issuccess 和 submessage
{ {
@ -1109,14 +1109,14 @@ class ExpressPlatformService extends MainService {
eCustomerCode: '', eCustomerCode: '',
remark: '', remark: '',
selleruserid: '', selleruserid: '',
printno: "", printno: '',
iscloudprint: 'false', iscloudprint: 'false',
needprintdetail: 'false', needprintdetail: 'false',
extenddata: '', extenddata: '',
providercode: String(item.procode || item.realcpcode || item.logisticcompanycode || ''), providercode: String(item.procode || item.realcpcode || item.logisticcompanycode || ''),
packageno: '', packageno: '',
fontsize: '', fontsize: '',
platorderno: "", platorderno: '',
sipshopid: 0, sipshopid: 0,
})); }));
console.log('京东批量打印请求参数', JSON.stringify({ console.log('京东批量打印请求参数', JSON.stringify({

View File

@ -1599,6 +1599,8 @@ class stockStoreService extends Service {
* @param {Object} sortParams - 排序参数 * @param {Object} sortParams - 排序参数
* @param {string} sortParams.sortField - 排序字段,默认'create_at' * @param {string} sortParams.sortField - 排序字段,默认'create_at'
* @param {string} sortParams.sortOrder - 排序方式,默认'DESC' * @param {string} sortParams.sortOrder - 排序方式,默认'DESC'
* @param externalWarehouseId
* @param externalStoreId
* @return {Promise<Object>} 返回查询结果 * @return {Promise<Object>} 返回查询结果
*/ */
async getWarehouseStock(where, pageParams = {}, sortParams = {}, externalWarehouseId = 0, externalStoreId = 0) { async getWarehouseStock(where, pageParams = {}, sortParams = {}, externalWarehouseId = 0, externalStoreId = 0) {

View File

@ -328,6 +328,9 @@ class StorageReportService extends Service {
* @param {number[]} [options.storeIds=[]] 货主ID列表 * @param {number[]} [options.storeIds=[]] 货主ID列表
* @param {number[]} [options.spaceIds=[]] 库位ID列表 * @param {number[]} [options.spaceIds=[]] 库位ID列表
* @param {boolean} [options.includeBarcode=false] 是否加载条码映射 * @param {boolean} [options.includeBarcode=false] 是否加载条码映射
* @param options.entryOrderIds
* @param options.orderIds
* @param options.warehouseId
* @return {Promise<Object>} 映射对象 * @return {Promise<Object>} 映射对象
*/ */
async loadReportReferenceMaps({ async loadReportReferenceMaps({

View File

@ -92,6 +92,8 @@ class StoreExpressBindingPolicyService extends Service {
/** /**
* 校验快递编码是否存在。 * 校验快递编码是否存在。
* @param {string} expressCode 快递编码 * @param {string} expressCode 快递编码
* @param value
* @param fieldName
* @return {Promise<string>} 标准化快递编码 * @return {Promise<string>} 标准化快递编码
*/ */
normalizeJsonArray(value, fieldName) { normalizeJsonArray(value, fieldName) {

View File

@ -1852,6 +1852,7 @@ class SettingStoreWarehouseService extends Service {
/** /**
* 精简签约对象,仅保留前端需要的字段。 * 精简签约对象,仅保留前端需要的字段。
* @param serialized
*/ */
trimContract(serialized) { trimContract(serialized) {
return { return {
@ -2198,7 +2199,7 @@ class SettingStoreWarehouseService extends Service {
const accountIds = Array.from(accountIdSet).filter(id => Number.isFinite(id) && id > 0); const accountIds = Array.from(accountIdSet).filter(id => Number.isFinite(id) && id > 0);
// 批量查询账号姓名 // 批量查询账号姓名
let accountNameMap = {}; const accountNameMap = {};
if (accountIds.length > 0) { if (accountIds.length > 0) {
try { try {
const accounts = await ctx.model.Account.findAll({ const accounts = await ctx.model.Account.findAll({

View File

@ -5,7 +5,7 @@ module.exports = {
// 紧急修复:将 wms_order_delivery_1000028 自增值提升至 15000+ // 紧急修复:将 wms_order_delivery_1000028 自增值提升至 15000+
// 原因:表重建后 AUTO_INCREMENT 被重置为 151,与历史水位差距过大 // 原因:表重建后 AUTO_INCREMENT 被重置为 151,与历史水位差距过大
await queryInterface.sequelize.query( await queryInterface.sequelize.query(
"ALTER TABLE wms_order_delivery_1000028 AUTO_INCREMENT = 15000" 'ALTER TABLE wms_order_delivery_1000028 AUTO_INCREMENT = 15000'
); );
}, },

View File

@ -13,7 +13,7 @@ module.exports = {
}); });
}, },
down: async (queryInterface) => { down: async queryInterface => {
await queryInterface.removeColumn(TABLE_NAME, 'type'); await queryInterface.removeColumn(TABLE_NAME, 'type');
}, },
}; };

View File

@ -149,7 +149,7 @@ module.exports.up = async queryInterface => {
} }
console.log( console.log(
`[Migration] 面单余额导出权限迁移完成:` + '[Migration] 面单余额导出权限迁移完成:' +
`新增 ${NEW_PERMISSIONS.length} 条权限,授权 ${TARGET_ROLE_IDS.length} 个角色` `新增 ${NEW_PERMISSIONS.length} 条权限,授权 ${TARGET_ROLE_IDS.length} 个角色`
); );
}; };

View File

@ -21,7 +21,7 @@ module.exports = {
// 2. 查询刚插入的权限 ID // 2. 查询刚插入的权限 ID
const [ rows ] = await queryInterface.sequelize.query( const [ rows ] = await queryInterface.sequelize.query(
`SELECT id FROM wms_permission WHERE path IN ('print_computer.list', 'print_computer.update', 'print_computer.delete') ORDER BY id` 'SELECT id FROM wms_permission WHERE path IN (\'print_computer.list\', \'print_computer.update\', \'print_computer.delete\') ORDER BY id'
); );
const ids = rows.map(r => r.id); const ids = rows.map(r => r.id);
if (ids.length !== 3) { if (ids.length !== 3) {

View File

@ -20,7 +20,7 @@ module.exports = {
// 2. 查询刚插入的权限 ID // 2. 查询刚插入的权限 ID
const [ rows ] = await queryInterface.sequelize.query( const [ rows ] = await queryInterface.sequelize.query(
`SELECT id FROM wms_permission WHERE path IN ('print_computer.setRecording', 'print_computer.cancelRecording') ORDER BY id` 'SELECT id FROM wms_permission WHERE path IN (\'print_computer.setRecording\', \'print_computer.cancelRecording\') ORDER BY id'
); );
const ids = rows.map(r => r.id); const ids = rows.map(r => r.id);
if (ids.length !== 2) { if (ids.length !== 2) {

View File

@ -29,7 +29,7 @@ module.exports = {
} }
}, },
down: async (queryInterface) => { down: async queryInterface => {
const tableInfo = await queryInterface.describeTable('wms_inbox_group'); const tableInfo = await queryInterface.describeTable('wms_inbox_group');
if (tableInfo.express_interfaces) { if (tableInfo.express_interfaces) {

View File

@ -18,7 +18,7 @@ module.exports = {
}, },
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
down: async (queryInterface) => { down: async queryInterface => {
const tableInfo = await queryInterface.describeTable('wms_inbox_message'); const tableInfo = await queryInterface.describeTable('wms_inbox_message');
if (tableInfo.ai_thoughts) { if (tableInfo.ai_thoughts) {
await queryInterface.removeColumn('wms_inbox_message', 'ai_thoughts'); await queryInterface.removeColumn('wms_inbox_message', 'ai_thoughts');

View File

@ -29,7 +29,7 @@ module.exports = {
} }
}, },
down: async (queryInterface) => { down: async queryInterface => {
const columns = await queryInterface.describeTable(TABLE); const columns = await queryInterface.describeTable(TABLE);
if (columns.express_code) { if (columns.express_code) {

View File

@ -12,7 +12,7 @@
* 授权角色:经理(8)、仓库组-主管(26)、客服组-主管(28)、生产组-主管(29)、客服组-员工(30) * 授权角色:经理(8)、仓库组-主管(26)、客服组-主管(28)、生产组-主管(29)、客服组-员工(30)
*/ */
module.exports = { module.exports = {
up: async (queryInterface) => { up: async queryInterface => {
// ===== 第一步:写入权限行 ===== // ===== 第一步:写入权限行 =====
const perms = [ const perms = [
[ 504, 'storage.stockout.list', '出库单列表' ], [ 504, 'storage.stockout.list', '出库单列表' ],
@ -50,7 +50,7 @@ module.exports = {
} }
}, },
down: async (queryInterface) => { down: async queryInterface => {
// 移除授权 // 移除授权
const roleIds = [ 8, 26, 28, 29, 30 ]; const roleIds = [ 8, 26, 28, 29, 30 ];
const permIdStr = '504, 505, 506, 507'; const permIdStr = '504, 505, 506, 507';

View File

@ -38,7 +38,7 @@ module.exports = {
} }
}, },
down: async (queryInterface) => { down: async queryInterface => {
const columns = await queryInterface.describeTable(TABLE); const columns = await queryInterface.describeTable(TABLE);
if (columns.express_name) { if (columns.express_name) {

View File

@ -94,7 +94,7 @@ async function grantPermission(conn, permId, envLabel) {
try { try {
perms = JSON.parse(record.permissions); perms = JSON.parse(record.permissions);
} catch { } catch {
results.push({ role, status: 'error', msg: `permissions JSON 解析失败` }); results.push({ role, status: 'error', msg: 'permissions JSON 解析失败' });
continue; continue;
} }

View File

@ -127,7 +127,7 @@ async function main() {
console.log('═══════════════════════════════════════'); console.log('═══════════════════════════════════════');
console.log(` 权限 ID: ${permIdNum}`); console.log(` 权限 ID: ${permIdNum}`);
console.log(` 目标角色: ${CS_CHAIN_ROLES.map(r => `${r.name}(${r.id})`).join(' → ')}`); console.log(` 目标角色: ${CS_CHAIN_ROLES.map(r => `${r.name}(${r.id})`).join(' → ')}`);
console.log(` 通配符角色(跳过): id=7,2 (已有 *)`); console.log(' 通配符角色(跳过): id=7,2 (已有 *)');
console.log('═══════════════════════════════════════\n'); console.log('═══════════════════════════════════════\n');
// ── 开发环境:查询权限信息 ── // ── 开发环境:查询权限信息 ──

View File

@ -7,6 +7,7 @@ const PendingOrderService = require('../../../../../app/service/systemMethods/or
* 创建 manualWaybill 操作日志回归测试上下文。 * 创建 manualWaybill 操作日志回归测试上下文。
* *
* 仅覆盖 operationLog.createOperationLog 的 businessId 传入值。 * 仅覆盖 operationLog.createOperationLog 的 businessId 传入值。
* @param options
*/ */
function createManualWaybillLogHarness(options = {}) { function createManualWaybillLogHarness(options = {}) {
const calls = { const calls = {
@ -103,14 +104,14 @@ function createManualWaybillLogHarness(options = {}) {
}, },
}); });
service.buildOrderWhere = (orderIds) => ({ service.buildOrderWhere = orderIds => ({
id: { [ctx.app.Sequelize.Op.in]: orderIds }, id: { [ctx.app.Sequelize.Op.in]: orderIds },
warehouse_id: warehouseId, warehouse_id: warehouseId,
}); });
service.success = (msg, data) => ({ code: 0, msg, data }); service.success = (msg, data) => ({ code: 0, msg, data });
service.syncOrderIds = (payload) => { service.syncOrderIds = payload => {
calls.syncOrderIdsPayload = payload; calls.syncOrderIdsPayload = payload;
return Promise.resolve(); return Promise.resolve();
}; };