feat: add ERP material issue outbound callback
This commit is contained in:
1 parent
3da4bddb98
commit
eda824cea7
13 files changed
+587
-20
No files matched your search
@@ -0,0 +1,22 @@
|
||||
-- ERP事项一:领料出库接口
|
||||
-- 执行范围:default(线边库)和 cp(成品库)都执行。
|
||||
-- 原因:InventoryTransaction 是两套数据库共用的实体模型。
|
||||
-- 脚本可重复执行。
|
||||
|
||||
SET @column_exists = (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'InventoryTransaction'
|
||||
AND COLUMN_NAME = 'UploadErpFlag'
|
||||
);
|
||||
|
||||
SET @ddl = IF(
|
||||
@column_exists = 0,
|
||||
'ALTER TABLE `InventoryTransaction` ADD COLUMN `UploadErpFlag` INT NULL COMMENT ''ERP回传状态:0失败,1成功''',
|
||||
'SELECT ''InventoryTransaction.UploadErpFlag already exists'' AS Message'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @ddl;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- ERP事项一:领料出库失败自动补传Job
|
||||
-- 执行范围:仅 default(线边库)执行。
|
||||
-- 默认暂停;真实ERP联调通过后再启用。
|
||||
-- 脚本可重复执行。
|
||||
|
||||
INSERT INTO `SysJob`
|
||||
(`JobName`, `JobGroup`, `MethodName`, `MethodParams`, `CronExpression`,
|
||||
`LastFireTime`, `NextFireTime`, `MisfirePolicy`, `Status`, `Remark`,
|
||||
`CreateTime`, `CreateBy`, `UpdateTime`, `UpdateBy`)
|
||||
SELECT
|
||||
'AddOtherOutJob', 'AddOtherOutJob', NULL, NULL, '0 */1 * * * ?',
|
||||
NULL, NULL, NULL, 0, 'ERP领料出库失败自动补传',
|
||||
NOW(), 'system', NULL, NULL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `SysJob` WHERE `JobName` = 'AddOtherOutJob'
|
||||
);
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
ERP事项一:修复库存交易页面不显示“补传ERP领料出库”按钮
|
||||
执行范围:仅 default(线边库)数据库。
|
||||
原因:RetryAddOtherOut 已在代码中实现,但未注册到 WTM 页面功能权限。
|
||||
脚本可重复执行。
|
||||
*/
|
||||
|
||||
SET @inventory_transaction_page_id = (
|
||||
SELECT `ID`
|
||||
FROM `frameworkmenus`
|
||||
WHERE `ClassName` = 'HHWMS.Web.Controllers,InventoryTransaction'
|
||||
AND (`MethodName` IS NULL OR `MethodName` = '')
|
||||
ORDER BY `ShowOnMenu` DESC, `DisplayOrder`
|
||||
LIMIT 1
|
||||
);
|
||||
|
||||
INSERT INTO `frameworkmenus`
|
||||
(`ID`, `PageName`, `ActionName`, `ModuleName`, `FolderOnly`, `IsInherit`,
|
||||
`ClassName`, `MethodName`, `Domain`, `ShowOnMenu`, `IsPublic`, `DisplayOrder`,
|
||||
`IsInside`, `TenantAllowed`, `Url`, `Icon`, `ParentId`)
|
||||
SELECT
|
||||
UUID(),
|
||||
'补传ERP领料出库',
|
||||
'补传ERP领料出库',
|
||||
`ModuleName`,
|
||||
0,
|
||||
0,
|
||||
`ClassName`,
|
||||
'RetryAddOtherOut',
|
||||
`Domain`,
|
||||
0,
|
||||
0,
|
||||
(
|
||||
SELECT COALESCE(MAX(child.`DisplayOrder`), 0) + 1
|
||||
FROM `frameworkmenus` child
|
||||
WHERE child.`ParentId` = @inventory_transaction_page_id
|
||||
),
|
||||
1,
|
||||
`TenantAllowed`,
|
||||
'/inventory/InventoryTransaction/RetryAddOtherOut',
|
||||
NULL,
|
||||
`ID`
|
||||
FROM `frameworkmenus`
|
||||
WHERE `ID` = @inventory_transaction_page_id
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `frameworkmenus`
|
||||
WHERE `ClassName` = 'HHWMS.Web.Controllers,InventoryTransaction'
|
||||
AND `MethodName` = 'RetryAddOtherOut'
|
||||
);
|
||||
|
||||
UPDATE `frameworkmenus`
|
||||
SET `PageName` = '补传ERP领料出库',
|
||||
`ActionName` = '补传ERP领料出库',
|
||||
`Url` = '/inventory/InventoryTransaction/RetryAddOtherOut'
|
||||
WHERE `ClassName` = 'HHWMS.Web.Controllers,InventoryTransaction'
|
||||
AND `MethodName` = 'RetryAddOtherOut';
|
||||
|
||||
SET @retry_add_other_out_menu_id = (
|
||||
SELECT `ID`
|
||||
FROM `frameworkmenus`
|
||||
WHERE `ClassName` = 'HHWMS.Web.Controllers,InventoryTransaction'
|
||||
AND `MethodName` = 'RetryAddOtherOut'
|
||||
LIMIT 1
|
||||
);
|
||||
|
||||
/* 只给原本已经有“库存交易”页面权限的角色增加补传权限。 */
|
||||
INSERT INTO `functionprivileges`
|
||||
(`ID`, `RoleCode`, `MenuItemId`, `Allowed`, `TenantCode`,
|
||||
`CreateTime`, `CreateBy`, `UpdateTime`, `UpdateBy`)
|
||||
SELECT
|
||||
UUID(),
|
||||
page_privilege.`RoleCode`,
|
||||
@retry_add_other_out_menu_id,
|
||||
1,
|
||||
page_privilege.`TenantCode`,
|
||||
NOW(),
|
||||
'system',
|
||||
NULL,
|
||||
NULL
|
||||
FROM `functionprivileges` page_privilege
|
||||
WHERE page_privilege.`MenuItemId` = @inventory_transaction_page_id
|
||||
AND page_privilege.`Allowed` = 1
|
||||
AND @retry_add_other_out_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `functionprivileges` existing_privilege
|
||||
WHERE existing_privilege.`RoleCode` = page_privilege.`RoleCode`
|
||||
AND existing_privilege.`MenuItemId` = @retry_add_other_out_menu_id
|
||||
AND (existing_privilege.`TenantCode` <=> page_privilege.`TenantCode`)
|
||||
);
|
||||
|
||||
SELECT
|
||||
menu.`ID`,
|
||||
menu.`PageName`,
|
||||
menu.`MethodName`,
|
||||
menu.`Url`,
|
||||
privilege.`RoleCode`,
|
||||
privilege.`Allowed`
|
||||
FROM `frameworkmenus` menu
|
||||
LEFT JOIN `functionprivileges` privilege ON privilege.`MenuItemId` = menu.`ID`
|
||||
WHERE menu.`ClassName` = 'HHWMS.Web.Controllers,InventoryTransaction'
|
||||
AND menu.`MethodName` = 'RetryAddOtherOut'
|
||||
ORDER BY privilege.`RoleCode`;
|
||||
Reference in new issue
Block a user