Compare commits
2 Commits
94132ea8da
...
4aa9952b26
| Author | SHA1 | Date | |
|---|---|---|---|
| 4aa9952b26 | |||
| c8ce7a6fa3 |
92
jeecg-boot/db/mes-xsl-final-batch-plan-menu.sql
Normal file
92
jeecg-boot/db/mes-xsl-final-batch-plan-menu.sql
Normal file
@@ -0,0 +1,92 @@
|
||||
-- 终胶计划菜单与权限(挂到「MES密炼工程」目录)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mixer_parent_id = (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
));
|
||||
SET @mixer_parent_id = IFNULL(@mixer_parent_id, '1860000000000000001');
|
||||
|
||||
INSERT INTO sys_permission(
|
||||
id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no,
|
||||
is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time
|
||||
)
|
||||
VALUES (
|
||||
'1860000000000099711', @mixer_parent_id, '终胶计划',
|
||||
'/mes/finalbatchplaninfo',
|
||||
'mes/finalbatchplaninfo/index',
|
||||
'MesXslFinalBatchPlanList', 1, NULL, '1', 35,
|
||||
1, 1, 0, '1', 0, 1, 0, 'admin', NOW()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
url = VALUES(url),
|
||||
component = VALUES(component),
|
||||
component_name = VALUES(component_name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
sort_no = VALUES(sort_no),
|
||||
is_route = VALUES(is_route),
|
||||
is_leaf = VALUES(is_leaf),
|
||||
hidden = VALUES(hidden),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag),
|
||||
keep_alive = VALUES(keep_alive),
|
||||
internal_or_external = VALUES(internal_or_external);
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
|
||||
('1860000000000099712', '1860000000000099711', '新增', 2, 'xslmes:mes_xsl_final_batch_plan:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099713', '1860000000000099711', '编辑', 2, 'xslmes:mes_xsl_final_batch_plan:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099714', '1860000000000099711', '删除', 2, 'xslmes:mes_xsl_final_batch_plan:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099715', '1860000000000099711', '批量删除', 2, 'xslmes:mes_xsl_final_batch_plan:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099716', '1860000000000099711', '导出', 2, 'xslmes:mes_xsl_final_batch_plan:exportXls', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag);
|
||||
|
||||
-- admin 角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN (
|
||||
'1860000000000099711',
|
||||
'1860000000000099712', '1860000000000099713', '1860000000000099714', '1860000000000099715', '1860000000000099716'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
|
||||
-- 强制修复:确保菜单路由与组件路径正确
|
||||
UPDATE sys_permission
|
||||
SET
|
||||
parent_id = @mixer_parent_id,
|
||||
url = '/mes/finalbatchplaninfo',
|
||||
component = 'mes/finalbatchplaninfo/index',
|
||||
component_name = 'MesXslFinalBatchPlanList',
|
||||
menu_type = 1,
|
||||
is_route = 1,
|
||||
is_leaf = 1,
|
||||
hidden = 0,
|
||||
status = '1',
|
||||
del_flag = 0
|
||||
WHERE id = '1860000000000099711';
|
||||
30
jeecg-boot/db/mes-xsl-final-batch-plan-table.sql
Normal file
30
jeecg-boot/db/mes-xsl-final-batch-plan-table.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- 终胶计划建表SQL
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_final_batch_plan` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`source_order_id` varchar(32) DEFAULT NULL COMMENT '来源生产订单ID',
|
||||
`order_serial_no` varchar(500) DEFAULT NULL COMMENT '订单流水',
|
||||
`order_no` varchar(500) DEFAULT NULL COMMENT '订单编号',
|
||||
`production_segment_count` int DEFAULT NULL COMMENT '生产段数',
|
||||
`order_date` date DEFAULT NULL COMMENT '订单日期',
|
||||
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编码',
|
||||
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料信息',
|
||||
`plan_weight` decimal(18,4) DEFAULT NULL COMMENT '计划重量',
|
||||
`per_car_weight` decimal(18,4) DEFAULT NULL COMMENT '每车重量',
|
||||
`planned_car_count` int DEFAULT 0 COMMENT '计划车数',
|
||||
`scheduled_car_count` int DEFAULT 0 COMMENT '已排产车数',
|
||||
`finished_car_count` int DEFAULT 0 COMMENT '完成车数',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0未开始 1进行中 2已完成',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门编码',
|
||||
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT 0 COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxfb_source_order` (`source_order_id`),
|
||||
KEY `idx_mxfb_material_code` (`material_code`),
|
||||
UNIQUE KEY `uk_mxfb_source_order_del` (`source_order_id`, `del_flag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES终胶计划';
|
||||
92
jeecg-boot/db/mes-xsl-master-batch-plan-menu.sql
Normal file
92
jeecg-boot/db/mes-xsl-master-batch-plan-menu.sql
Normal file
@@ -0,0 +1,92 @@
|
||||
-- 母胶计划菜单与权限(挂到「MES密炼工程」目录)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mixer_parent_id = (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
));
|
||||
SET @mixer_parent_id = IFNULL(@mixer_parent_id, '1860000000000000001');
|
||||
|
||||
INSERT INTO sys_permission(
|
||||
id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no,
|
||||
is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time
|
||||
)
|
||||
VALUES (
|
||||
'1860000000000099611', @mixer_parent_id, '母胶计划',
|
||||
'/mes/masterbatchplaninfo',
|
||||
'mes/masterbatchplaninfo/index',
|
||||
'MesXslMasterBatchPlanList', 1, NULL, '1', 34,
|
||||
1, 1, 0, '1', 0, 1, 0, 'admin', NOW()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
url = VALUES(url),
|
||||
component = VALUES(component),
|
||||
component_name = VALUES(component_name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
sort_no = VALUES(sort_no),
|
||||
is_route = VALUES(is_route),
|
||||
is_leaf = VALUES(is_leaf),
|
||||
hidden = VALUES(hidden),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag),
|
||||
keep_alive = VALUES(keep_alive),
|
||||
internal_or_external = VALUES(internal_or_external);
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
|
||||
('1860000000000099612', '1860000000000099611', '新增', 2, 'xslmes:mes_xsl_master_batch_plan:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099613', '1860000000000099611', '编辑', 2, 'xslmes:mes_xsl_master_batch_plan:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099614', '1860000000000099611', '删除', 2, 'xslmes:mes_xsl_master_batch_plan:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099615', '1860000000000099611', '批量删除', 2, 'xslmes:mes_xsl_master_batch_plan:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099616', '1860000000000099611', '导出', 2, 'xslmes:mes_xsl_master_batch_plan:exportXls', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag);
|
||||
|
||||
-- admin 角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN (
|
||||
'1860000000000099611',
|
||||
'1860000000000099612', '1860000000000099613', '1860000000000099614', '1860000000000099615', '1860000000000099616'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
|
||||
-- 强制修复:确保菜单路由与组件路径正确
|
||||
UPDATE sys_permission
|
||||
SET
|
||||
parent_id = @mixer_parent_id,
|
||||
url = '/mes/masterbatchplaninfo',
|
||||
component = 'mes/masterbatchplaninfo/index',
|
||||
component_name = 'MesXslMasterBatchPlanList',
|
||||
menu_type = 1,
|
||||
is_route = 1,
|
||||
is_leaf = 1,
|
||||
hidden = 0,
|
||||
status = '1',
|
||||
del_flag = 0
|
||||
WHERE id = '1860000000000099611';
|
||||
30
jeecg-boot/db/mes-xsl-master-batch-plan-table.sql
Normal file
30
jeecg-boot/db/mes-xsl-master-batch-plan-table.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- 母胶计划建表SQL
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_master_batch_plan` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`source_order_id` varchar(32) DEFAULT NULL COMMENT '来源生产订单ID',
|
||||
`order_serial_no` varchar(500) DEFAULT NULL COMMENT '订单流水号',
|
||||
`order_no` varchar(500) DEFAULT NULL COMMENT '订单编号',
|
||||
`production_segment_count` int DEFAULT NULL COMMENT '生产段数',
|
||||
`order_date` date DEFAULT NULL COMMENT '订单日期',
|
||||
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编号',
|
||||
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料名称',
|
||||
`plan_weight` decimal(18,4) DEFAULT NULL COMMENT '计划重量',
|
||||
`per_car_weight` decimal(18,4) DEFAULT NULL COMMENT '每车重量',
|
||||
`planned_car_count` int DEFAULT 0 COMMENT '计划车数',
|
||||
`scheduled_car_count` int DEFAULT 0 COMMENT '已排产车数',
|
||||
`finished_car_count` int DEFAULT 0 COMMENT '完成车数',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0未开始 1进行中 2已完成',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门编码',
|
||||
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT 0 COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmbp_source_order` (`source_order_id`),
|
||||
KEY `idx_mxmbp_material_code` (`material_code`),
|
||||
UNIQUE KEY `uk_mxmbp_source_order_del` (`source_order_id`, `del_flag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES母胶计划';
|
||||
@@ -51,7 +51,8 @@ INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, st
|
||||
('1860000000000099513', '1860000000000099511', '编辑', 2, 'xslmes:mes_xsl_production_order:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099514', '1860000000000099511', '删除', 2, 'xslmes:mes_xsl_production_order:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099515', '1860000000000099511', '批量删除', 2, 'xslmes:mes_xsl_production_order:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099516', '1860000000000099511', '导出', 2, 'xslmes:mes_xsl_production_order:exportXls', '1', '1', 0, 'admin', NOW())
|
||||
('1860000000000099516', '1860000000000099511', '导出', 2, 'xslmes:mes_xsl_production_order:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099517', '1860000000000099511', '拆分', 2, 'xslmes:mes_xsl_production_order:split', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
@@ -67,7 +68,7 @@ SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW()
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN (
|
||||
'1860000000000099511',
|
||||
'1860000000000099512', '1860000000000099513', '1860000000000099514', '1860000000000099515', '1860000000000099516'
|
||||
'1860000000000099512', '1860000000000099513', '1860000000000099514', '1860000000000099515', '1860000000000099516', '1860000000000099517'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
|
||||
64
jeecg-boot/db/mes-xsl-production-order-split-permission.sql
Normal file
64
jeecg-boot/db/mes-xsl-production-order-split-permission.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
-- 生产订单「拆分」按钮权限补丁
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 优先按组件路径定位“生产订单”菜单
|
||||
SET @prod_menu_id = (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE component = 'mes/productionorderinfo/index'
|
||||
AND menu_type = 1
|
||||
AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
);
|
||||
|
||||
-- 兜底:按URL定位
|
||||
SET @prod_menu_id = IFNULL(@prod_menu_id, (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE url = '/mes/productionorderinfo'
|
||||
AND menu_type = 1
|
||||
AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
));
|
||||
|
||||
-- 再兜底:按名称定位
|
||||
SET @prod_menu_id = IFNULL(@prod_menu_id, (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE name = '生产订单'
|
||||
AND menu_type = 1
|
||||
AND del_flag = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
));
|
||||
|
||||
-- 若找不到页面菜单,回退到约定ID(你现有脚本中使用)
|
||||
SET @prod_menu_id = IFNULL(@prod_menu_id, '1860000000000099511');
|
||||
|
||||
-- 写入/修复“拆分”按钮权限
|
||||
INSERT INTO sys_permission (
|
||||
id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time
|
||||
) VALUES (
|
||||
'1860000000000099517', @prod_menu_id, '拆分', 2, 'xslmes:mes_xsl_production_order:split', '1', '1', 0, 'admin', NOW()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag);
|
||||
|
||||
-- 给admin角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', '1860000000000099517', NOW(), '127.0.0.1'
|
||||
FROM dual
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission
|
||||
WHERE role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND permission_id = '1860000000000099517'
|
||||
);
|
||||
@@ -0,0 +1,114 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslFinalBatchPlan;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFinalBatchPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Tag(name = "终胶计划")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslFinalBatchPlan")
|
||||
public class MesXslFinalBatchPlanController
|
||||
extends JeecgController<MesXslFinalBatchPlan, IMesXslFinalBatchPlanService> {
|
||||
|
||||
@Autowired private IMesXslFinalBatchPlanService finalBatchPlanService;
|
||||
|
||||
@Operation(summary = "终胶计划-分页列表查询")
|
||||
@GetMapping("/list")
|
||||
public Result<IPage<MesXslFinalBatchPlan>> queryPageList(
|
||||
MesXslFinalBatchPlan model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslFinalBatchPlan> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<MesXslFinalBatchPlan> pageList = finalBatchPlanService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "终胶计划-添加")
|
||||
@Operation(summary = "终胶计划-添加")
|
||||
@RequiresPermissions("xslmes:mes_xsl_final_batch_plan:add")
|
||||
@PostMapping("/add")
|
||||
public Result<String> add(@RequestBody MesXslFinalBatchPlan model) {
|
||||
fillDerivedFields(model);
|
||||
finalBatchPlanService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "终胶计划-编辑")
|
||||
@Operation(summary = "终胶计划-编辑")
|
||||
@RequiresPermissions("xslmes:mes_xsl_final_batch_plan:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslFinalBatchPlan model) {
|
||||
fillDerivedFields(model);
|
||||
finalBatchPlanService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "终胶计划-通过id删除")
|
||||
@Operation(summary = "终胶计划-通过id删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_final_batch_plan:delete")
|
||||
@DeleteMapping("/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
finalBatchPlanService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "终胶计划-批量删除")
|
||||
@Operation(summary = "终胶计划-批量删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_final_batch_plan:deleteBatch")
|
||||
@DeleteMapping("/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
finalBatchPlanService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "终胶计划-通过id查询")
|
||||
@GetMapping("/queryById")
|
||||
public Result<MesXslFinalBatchPlan> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslFinalBatchPlan entity = finalBatchPlanService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_final_batch_plan:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslFinalBatchPlan model) {
|
||||
return super.exportXls(request, model, MesXslFinalBatchPlan.class, "终胶计划");
|
||||
}
|
||||
|
||||
private void fillDerivedFields(MesXslFinalBatchPlan model) {
|
||||
BigDecimal planWeight = model.getPlanWeight();
|
||||
BigDecimal perCarWeight = model.getPerCarWeight();
|
||||
if (planWeight == null || perCarWeight == null || perCarWeight.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
model.setPlannedCarCount(0);
|
||||
return;
|
||||
}
|
||||
model.setPlannedCarCount(planWeight.divide(perCarWeight, 0, RoundingMode.CEILING).intValue());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMasterBatchPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Tag(name = "母胶计划")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslMasterBatchPlan")
|
||||
public class MesXslMasterBatchPlanController
|
||||
extends JeecgController<MesXslMasterBatchPlan, IMesXslMasterBatchPlanService> {
|
||||
|
||||
@Autowired private IMesXslMasterBatchPlanService masterBatchPlanService;
|
||||
|
||||
@Operation(summary = "母胶计划-分页列表查询")
|
||||
@GetMapping("/list")
|
||||
public Result<IPage<MesXslMasterBatchPlan>> queryPageList(
|
||||
MesXslMasterBatchPlan model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslMasterBatchPlan> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<MesXslMasterBatchPlan> pageList = masterBatchPlanService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "母胶计划-添加")
|
||||
@Operation(summary = "母胶计划-添加")
|
||||
@RequiresPermissions("xslmes:mes_xsl_master_batch_plan:add")
|
||||
@PostMapping("/add")
|
||||
public Result<String> add(@RequestBody MesXslMasterBatchPlan model) {
|
||||
fillDerivedFields(model);
|
||||
masterBatchPlanService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "母胶计划-编辑")
|
||||
@Operation(summary = "母胶计划-编辑")
|
||||
@RequiresPermissions("xslmes:mes_xsl_master_batch_plan:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslMasterBatchPlan model) {
|
||||
fillDerivedFields(model);
|
||||
masterBatchPlanService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "母胶计划-通过id删除")
|
||||
@Operation(summary = "母胶计划-通过id删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_master_batch_plan:delete")
|
||||
@DeleteMapping("/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
masterBatchPlanService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "母胶计划-批量删除")
|
||||
@Operation(summary = "母胶计划-批量删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_master_batch_plan:deleteBatch")
|
||||
@DeleteMapping("/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
masterBatchPlanService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "母胶计划-通过id查询")
|
||||
@GetMapping("/queryById")
|
||||
public Result<MesXslMasterBatchPlan> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslMasterBatchPlan entity = masterBatchPlanService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_master_batch_plan:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslMasterBatchPlan model) {
|
||||
return super.exportXls(request, model, MesXslMasterBatchPlan.class, "母胶计划");
|
||||
}
|
||||
|
||||
private void fillDerivedFields(MesXslMasterBatchPlan model) {
|
||||
BigDecimal planWeight = model.getPlanWeight();
|
||||
BigDecimal perCarWeight = model.getPerCarWeight();
|
||||
if (planWeight == null || perCarWeight == null || perCarWeight.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
model.setPlannedCarCount(0);
|
||||
return;
|
||||
}
|
||||
model.setPlannedCarCount(planWeight.divide(perCarWeight, 0, RoundingMode.CEILING).intValue());
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
|
||||
@Tag(name = "生产订单")
|
||||
@RestController
|
||||
@@ -92,6 +93,15 @@ public class MesXslProductionOrderController
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@AutoLog(value = "生产订单-拆分生成母胶计划")
|
||||
@Operation(summary = "生产订单-拆分生成母胶计划")
|
||||
@RequiresPermissions("xslmes:mes_xsl_production_order:split")
|
||||
@PostMapping("/split")
|
||||
public Result<MesXslMasterBatchPlan> split(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslMasterBatchPlan plan = mesXslProductionOrderService.splitToMasterBatchPlan(id);
|
||||
return Result.OK("拆分成功", plan);
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_production_order:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslProductionOrder model) {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 终胶计划
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_final_batch_plan")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES终胶计划")
|
||||
public class MesXslFinalBatchPlan implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "来源生产订单ID")
|
||||
private String sourceOrderId;
|
||||
|
||||
@Excel(name = "订单流水号", width = 20)
|
||||
private String orderSerialNo;
|
||||
|
||||
@Excel(name = "订单编号", width = 20)
|
||||
private String orderNo;
|
||||
|
||||
@Excel(name = "生产段数", width = 12)
|
||||
private Integer productionSegmentCount;
|
||||
|
||||
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
|
||||
@Excel(name = "物料编码", width = 20)
|
||||
private String materialCode;
|
||||
|
||||
@Excel(name = "MES胶料信息", width = 20)
|
||||
private String mesMaterialName;
|
||||
|
||||
@Excel(name = "计划重量", width = 15)
|
||||
private BigDecimal planWeight;
|
||||
|
||||
@Excel(name = "每车重量", width = 15)
|
||||
private BigDecimal perCarWeight;
|
||||
|
||||
@Excel(name = "计划车数", width = 12)
|
||||
private Integer plannedCarCount;
|
||||
|
||||
@Excel(name = "已排产车数", width = 12)
|
||||
private Integer scheduledCarCount;
|
||||
|
||||
@Excel(name = "完成车数", width = 12)
|
||||
private Integer finishedCarCount;
|
||||
|
||||
@Excel(name = "状态", width = 12, replace = {"未开始_0", "进行中_1", "已完成_2"})
|
||||
private Integer status;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 母胶计划
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_master_batch_plan")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES母胶计划")
|
||||
public class MesXslMasterBatchPlan implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "来源生产订单ID")
|
||||
private String sourceOrderId;
|
||||
|
||||
@Excel(name = "订单流水号", width = 20)
|
||||
private String orderSerialNo;
|
||||
|
||||
@Excel(name = "订单编号", width = 20)
|
||||
private String orderNo;
|
||||
|
||||
@Excel(name = "生产段数", width = 12)
|
||||
private Integer productionSegmentCount;
|
||||
|
||||
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date orderDate;
|
||||
|
||||
@Excel(name = "物料编号", width = 20)
|
||||
private String materialCode;
|
||||
|
||||
@Excel(name = "MES胶料名称", width = 20)
|
||||
private String mesMaterialName;
|
||||
|
||||
@Excel(name = "计划重量", width = 15)
|
||||
private BigDecimal planWeight;
|
||||
|
||||
@Excel(name = "每车重量", width = 15)
|
||||
private BigDecimal perCarWeight;
|
||||
|
||||
@Excel(name = "计划车数", width = 12)
|
||||
private Integer plannedCarCount;
|
||||
|
||||
@Excel(name = "已排产车数", width = 12)
|
||||
private Integer scheduledCarCount;
|
||||
|
||||
@Excel(name = "完成车数", width = 12)
|
||||
private Integer finishedCarCount;
|
||||
|
||||
@Excel(name = "状态", width = 12, replace = {"未开始_0", "进行中_1", "已完成_2"})
|
||||
private Integer status;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslFinalBatchPlan;
|
||||
|
||||
public interface MesXslFinalBatchPlanMapper extends BaseMapper<MesXslFinalBatchPlan> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
|
||||
public interface MesXslMasterBatchPlanMapper extends BaseMapper<MesXslMasterBatchPlan> {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslFinalBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
|
||||
public interface IMesXslFinalBatchPlanService extends IService<MesXslFinalBatchPlan> {
|
||||
|
||||
MesXslFinalBatchPlan generateFromProductionOrder(MesXslProductionOrder productionOrder);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
|
||||
public interface IMesXslMasterBatchPlanService extends IService<MesXslMasterBatchPlan> {
|
||||
|
||||
MesXslMasterBatchPlan generateFromProductionOrder(MesXslProductionOrder productionOrder);
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
|
||||
public interface IMesXslProductionOrderService extends IService<MesXslProductionOrder> {}
|
||||
public interface IMesXslProductionOrderService extends IService<MesXslProductionOrder> {
|
||||
|
||||
MesXslMasterBatchPlan splitToMasterBatchPlan(String id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslFinalBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslFinalBatchPlanMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFinalBatchPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslFinalBatchPlanServiceImpl
|
||||
extends ServiceImpl<MesXslFinalBatchPlanMapper, MesXslFinalBatchPlan>
|
||||
implements IMesXslFinalBatchPlanService {
|
||||
|
||||
@Autowired private MesMaterialMapper mesMaterialMapper;
|
||||
|
||||
@Override
|
||||
public MesXslFinalBatchPlan generateFromProductionOrder(MesXslProductionOrder productionOrder) {
|
||||
if (productionOrder == null || StringUtils.isBlank(productionOrder.getId())) {
|
||||
throw new JeecgBootException("生产订单不存在,无法拆分终胶计划");
|
||||
}
|
||||
MesXslFinalBatchPlan exists =
|
||||
this.getOne(new LambdaQueryWrapper<MesXslFinalBatchPlan>().eq(MesXslFinalBatchPlan::getSourceOrderId, productionOrder.getId()));
|
||||
if (exists != null) {
|
||||
return exists;
|
||||
}
|
||||
|
||||
MesMaterial finalMaterial = resolveFinalMaterial(productionOrder.getMaterialCode());
|
||||
if (finalMaterial == null) {
|
||||
throw new JeecgBootException("未找到对应终胶物料,请确认MES物料编码");
|
||||
}
|
||||
|
||||
BigDecimal planWeight = productionOrder.getPlanQty() == null ? BigDecimal.ZERO : productionOrder.getPlanQty();
|
||||
BigDecimal perCarWeight = BigDecimal.ZERO;
|
||||
int planCarCount = calcPlanCarCount(planWeight, perCarWeight);
|
||||
|
||||
MesXslFinalBatchPlan plan = new MesXslFinalBatchPlan();
|
||||
plan.setSourceOrderId(productionOrder.getId());
|
||||
plan.setOrderSerialNo(buildOrderSerialNo(productionOrder));
|
||||
plan.setOrderNo(productionOrder.getProductionOrderNo());
|
||||
plan.setProductionSegmentCount(productionOrder.getProcessSegmentCount());
|
||||
plan.setOrderDate(productionOrder.getOrderDate());
|
||||
plan.setMaterialCode(finalMaterial.getMaterialCode());
|
||||
plan.setMesMaterialName(finalMaterial.getMaterialName());
|
||||
plan.setPlanWeight(planWeight);
|
||||
plan.setPerCarWeight(perCarWeight);
|
||||
plan.setPlannedCarCount(planCarCount);
|
||||
plan.setScheduledCarCount(0);
|
||||
plan.setFinishedCarCount(0);
|
||||
plan.setStatus(0);
|
||||
this.save(plan);
|
||||
return plan;
|
||||
}
|
||||
|
||||
private MesMaterial resolveFinalMaterial(String mesMaterialCode) {
|
||||
if (StringUtils.isBlank(mesMaterialCode)) {
|
||||
return null;
|
||||
}
|
||||
return mesMaterialMapper.selectOne(
|
||||
new LambdaQueryWrapper<MesMaterial>()
|
||||
.eq(MesMaterial::getMaterialCode, mesMaterialCode.trim())
|
||||
.last("LIMIT 1"));
|
||||
}
|
||||
|
||||
private String buildOrderSerialNo(MesXslProductionOrder productionOrder) {
|
||||
String orderNo = StringUtils.defaultIfBlank(productionOrder.getProductionOrderNo(), productionOrder.getId());
|
||||
return orderNo + "-F-" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private int calcPlanCarCount(BigDecimal planWeight, BigDecimal perCarWeight) {
|
||||
if (planWeight == null || perCarWeight == null || perCarWeight.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return planWeight.divide(perCarWeight, 0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMasterBatchPlanMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMasterBatchPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslMasterBatchPlanServiceImpl
|
||||
extends ServiceImpl<MesXslMasterBatchPlanMapper, MesXslMasterBatchPlan>
|
||||
implements IMesXslMasterBatchPlanService {
|
||||
|
||||
@Autowired private MesMaterialMapper mesMaterialMapper;
|
||||
|
||||
@Override
|
||||
public MesXslMasterBatchPlan generateFromProductionOrder(MesXslProductionOrder productionOrder) {
|
||||
if (productionOrder == null || StringUtils.isBlank(productionOrder.getId())) {
|
||||
throw new JeecgBootException("生产订单不存在,无法拆分");
|
||||
}
|
||||
MesMaterial motherMaterial = resolveMotherMaterial(productionOrder.getMaterialCode());
|
||||
if (motherMaterial == null) {
|
||||
throw new JeecgBootException("未找到对应母胶物料(优先B1,其次B2)");
|
||||
}
|
||||
|
||||
MesXslMasterBatchPlan exists =
|
||||
this.getOne(new LambdaQueryWrapper<MesXslMasterBatchPlan>().eq(MesXslMasterBatchPlan::getSourceOrderId, productionOrder.getId()));
|
||||
if (exists != null) {
|
||||
return exists;
|
||||
}
|
||||
|
||||
BigDecimal planWeight = productionOrder.getPlanQty() == null ? BigDecimal.ZERO : productionOrder.getPlanQty();
|
||||
BigDecimal perCarWeight = BigDecimal.ZERO;
|
||||
int planCarCount = calcPlanCarCount(planWeight, perCarWeight);
|
||||
|
||||
MesXslMasterBatchPlan plan = new MesXslMasterBatchPlan();
|
||||
plan.setSourceOrderId(productionOrder.getId());
|
||||
plan.setOrderSerialNo(buildOrderSerialNo(productionOrder));
|
||||
plan.setOrderNo(productionOrder.getProductionOrderNo());
|
||||
plan.setProductionSegmentCount(productionOrder.getProcessSegmentCount());
|
||||
plan.setOrderDate(productionOrder.getOrderDate());
|
||||
plan.setMaterialCode(motherMaterial.getMaterialCode());
|
||||
plan.setMesMaterialName(motherMaterial.getMaterialName());
|
||||
plan.setPlanWeight(planWeight);
|
||||
plan.setPerCarWeight(perCarWeight);
|
||||
plan.setPlannedCarCount(planCarCount);
|
||||
plan.setScheduledCarCount(0);
|
||||
plan.setFinishedCarCount(0);
|
||||
plan.setStatus(0);
|
||||
this.save(plan);
|
||||
return plan;
|
||||
}
|
||||
|
||||
private MesMaterial resolveMotherMaterial(String mesMaterialCode) {
|
||||
if (StringUtils.isBlank(mesMaterialCode)) {
|
||||
return null;
|
||||
}
|
||||
String code = mesMaterialCode.trim();
|
||||
List<String> candidates = buildMotherCandidates(code);
|
||||
for (String c : candidates) {
|
||||
MesMaterial found =
|
||||
mesMaterialMapper.selectOne(
|
||||
new LambdaQueryWrapper<MesMaterial>()
|
||||
.eq(MesMaterial::getMaterialCode, c)
|
||||
.last("LIMIT 1"));
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> buildMotherCandidates(String code) {
|
||||
List<String> list = new ArrayList<>(2);
|
||||
if (code.length() > 1 && (code.startsWith("F") || code.startsWith("f"))) {
|
||||
String suffix = code.substring(1);
|
||||
list.add("B1" + suffix);
|
||||
list.add("B2" + suffix);
|
||||
} else {
|
||||
list.add("B1" + code);
|
||||
list.add("B2" + code);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private String buildOrderSerialNo(MesXslProductionOrder productionOrder) {
|
||||
String orderNo = StringUtils.defaultIfBlank(productionOrder.getProductionOrderNo(), productionOrder.getId());
|
||||
return orderNo + "-" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private int calcPlanCarCount(BigDecimal planWeight, BigDecimal perCarWeight) {
|
||||
if (planWeight == null || perCarWeight == null || perCarWeight.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return planWeight.divide(perCarWeight, 0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,45 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslFinalBatchPlanService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMasterBatchPlan;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslProductionOrderMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMasterBatchPlanService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProductionOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslProductionOrderServiceImpl
|
||||
extends ServiceImpl<MesXslProductionOrderMapper, MesXslProductionOrder>
|
||||
implements IMesXslProductionOrderService {}
|
||||
implements IMesXslProductionOrderService {
|
||||
|
||||
@Autowired private IMesXslMasterBatchPlanService masterBatchPlanService;
|
||||
@Autowired private IMesXslFinalBatchPlanService finalBatchPlanService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MesXslMasterBatchPlan splitToMasterBatchPlan(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
throw new JeecgBootException("生产订单ID不能为空");
|
||||
}
|
||||
MesXslProductionOrder order = this.getById(id.trim());
|
||||
if (order == null) {
|
||||
throw new JeecgBootException("生产订单不存在");
|
||||
}
|
||||
if (order.getSplitStatus() != null && order.getSplitStatus() == 1) {
|
||||
throw new JeecgBootException("该生产订单已拆分,无需重复操作");
|
||||
}
|
||||
MesXslMasterBatchPlan plan = masterBatchPlanService.generateFromProductionOrder(order);
|
||||
finalBatchPlanService.generateFromProductionOrder(order);
|
||||
MesXslProductionOrder update = new MesXslProductionOrder();
|
||||
update.setId(order.getId());
|
||||
update.setSplitStatus(1);
|
||||
this.updateById(update);
|
||||
return plan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
-- MES 母胶计划
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_master_batch_plan` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`source_order_id` varchar(32) DEFAULT NULL COMMENT '来源生产订单ID',
|
||||
`order_serial_no` varchar(500) DEFAULT NULL COMMENT '订单流水号',
|
||||
`order_no` varchar(500) DEFAULT NULL COMMENT '订单编号',
|
||||
`production_segment_count` int DEFAULT NULL COMMENT '生产段数',
|
||||
`order_date` date DEFAULT NULL COMMENT '订单日期',
|
||||
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编号',
|
||||
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料名称',
|
||||
`plan_weight` decimal(18,4) DEFAULT NULL COMMENT '计划重量',
|
||||
`per_car_weight` decimal(18,4) DEFAULT NULL COMMENT '每车重量',
|
||||
`planned_car_count` int DEFAULT 0 COMMENT '计划车数',
|
||||
`scheduled_car_count` int DEFAULT 0 COMMENT '已排产车数',
|
||||
`finished_car_count` int DEFAULT 0 COMMENT '完成车数',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0未开始 1进行中 2已完成',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmbp_source_order` (`source_order_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES母胶计划';
|
||||
@@ -0,0 +1,27 @@
|
||||
-- MES 终胶计划
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_final_batch_plan` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`source_order_id` varchar(32) DEFAULT NULL COMMENT '来源生产订单ID',
|
||||
`order_serial_no` varchar(500) DEFAULT NULL COMMENT '订单流水',
|
||||
`order_no` varchar(500) DEFAULT NULL COMMENT '订单编号',
|
||||
`production_segment_count` int DEFAULT NULL COMMENT '生产段数',
|
||||
`order_date` date DEFAULT NULL COMMENT '订单日期',
|
||||
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编码',
|
||||
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料信息',
|
||||
`plan_weight` decimal(18,4) DEFAULT NULL COMMENT '计划重量',
|
||||
`per_car_weight` decimal(18,4) DEFAULT NULL COMMENT '每车重量',
|
||||
`planned_car_count` int DEFAULT 0 COMMENT '计划车数',
|
||||
`scheduled_car_count` int DEFAULT 0 COMMENT '已排产车数',
|
||||
`finished_car_count` int DEFAULT 0 COMMENT '完成车数',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0未开始 1进行中 2已完成',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxfb_source_order` (`source_order_id`),
|
||||
UNIQUE KEY `uk_mxfb_source_order_del` (`source_order_id`, `del_flag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES终胶计划';
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslFinalBatchPlanList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslFinalBatchPlanList from '../../xslmes/mesXslFinalBatchPlan/MesXslFinalBatchPlanList.vue';
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<MesXslMasterBatchPlanList />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MesXslMasterBatchPlanList from '../../xslmes/mesXslMasterBatchPlan/MesXslMasterBatchPlanList.vue';
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslFinalBatchPlan/list',
|
||||
save = '/xslmes/mesXslFinalBatchPlan/add',
|
||||
edit = '/xslmes/mesXslFinalBatchPlan/edit',
|
||||
deleteOne = '/xslmes/mesXslFinalBatchPlan/delete',
|
||||
deleteBatch = '/xslmes/mesXslFinalBatchPlan/deleteBatch',
|
||||
queryById = '/xslmes/mesXslFinalBatchPlan/queryById',
|
||||
exportXls = '/xslmes/mesXslFinalBatchPlan/exportXls',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -0,0 +1,68 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
function statusText(v: unknown) {
|
||||
if (v === 1) return '进行中';
|
||||
if (v === 2) return '已完成';
|
||||
return '未开始';
|
||||
}
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '未开始', value: 0 },
|
||||
{ label: '进行中', value: 1 },
|
||||
{ label: '已完成', value: 2 },
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '订单流水', align: 'center', dataIndex: 'orderSerialNo', width: 180 },
|
||||
{ title: '订单编号', align: 'center', dataIndex: 'orderNo', width: 150 },
|
||||
{ title: '生产段数', align: 'center', dataIndex: 'productionSegmentCount', width: 100 },
|
||||
{ title: '订单日期', align: 'center', dataIndex: 'orderDate', width: 130 },
|
||||
{ title: '物料编码', align: 'center', dataIndex: 'materialCode', width: 130 },
|
||||
{ title: 'MES胶料信息', align: 'center', dataIndex: 'mesMaterialName', width: 150 },
|
||||
{ title: '计划重量', align: 'center', dataIndex: 'planWeight', width: 110 },
|
||||
{ title: '每车重量', align: 'center', dataIndex: 'perCarWeight', width: 110 },
|
||||
{ title: '计划车数', align: 'center', dataIndex: 'plannedCarCount', width: 100 },
|
||||
{ title: '已排产车数', align: 'center', dataIndex: 'scheduledCarCount', width: 110 },
|
||||
{ title: '完成车数', align: 'center', dataIndex: 'finishedCarCount', width: 100 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'status', width: 100, customRender: ({ text }) => statusText(text) },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100 },
|
||||
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 170 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '订单流水', field: 'orderSerialNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '订单编号', field: 'orderNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '物料编码', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: 'MES胶料信息', field: 'mesMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'Select',
|
||||
componentProps: { options: statusOptions },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'sourceOrderId', component: 'Input', show: false },
|
||||
{ label: '订单流水', field: 'orderSerialNo', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '订单编号', field: 'orderNo', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '生产段数', field: 'productionSegmentCount', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{
|
||||
label: '订单日期',
|
||||
field: 'orderDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, disabled: true },
|
||||
},
|
||||
{ label: '物料编码', field: 'materialCode', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: 'MES胶料信息', field: 'mesMaterialName', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '计划重量', field: 'planWeight', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{ label: '每车重量', field: 'perCarWeight', component: 'InputNumber', componentProps: { min: 0 } },
|
||||
{ label: '计划车数', field: 'plannedCarCount', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{ label: '已排产车数', field: 'scheduledCarCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
|
||||
{ label: '完成车数', field: 'finishedCarCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
|
||||
{ label: '状态', field: 'status', component: 'Select', componentProps: { options: statusOptions } },
|
||||
];
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_final_batch_plan:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslFinalBatchPlanModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslFinalBatchPlanModal from './modules/MesXslFinalBatchPlanModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslFinalBatchPlan.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslFinalBatchPlan.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '终胶计划',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: true },
|
||||
actionColumn: { width: 120, fixed: 'right' },
|
||||
},
|
||||
exportConfig: { name: '终胶计划', url: getExportUrl },
|
||||
});
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, reload);
|
||||
}
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_final_batch_plan:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_final_batch_plan:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="920px" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslFinalBatchPlan.data';
|
||||
import { saveOrUpdate } from '../MesXslFinalBatchPlan.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue({ ...data.record });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增终胶计划' : unref(isDetail) ? '终胶计划详情' : '编辑终胶计划',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMasterBatchPlan/list',
|
||||
save = '/xslmes/mesXslMasterBatchPlan/add',
|
||||
edit = '/xslmes/mesXslMasterBatchPlan/edit',
|
||||
deleteOne = '/xslmes/mesXslMasterBatchPlan/delete',
|
||||
deleteBatch = '/xslmes/mesXslMasterBatchPlan/deleteBatch',
|
||||
queryById = '/xslmes/mesXslMasterBatchPlan/queryById',
|
||||
exportXls = '/xslmes/mesXslMasterBatchPlan/exportXls',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
@@ -0,0 +1,68 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
function statusText(v: unknown) {
|
||||
if (v === 1) return '进行中';
|
||||
if (v === 2) return '已完成';
|
||||
return '未开始';
|
||||
}
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '未开始', value: 0 },
|
||||
{ label: '进行中', value: 1 },
|
||||
{ label: '已完成', value: 2 },
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '订单流水号', align: 'center', dataIndex: 'orderSerialNo', width: 180 },
|
||||
{ title: '订单编号', align: 'center', dataIndex: 'orderNo', width: 150 },
|
||||
{ title: '生产段数', align: 'center', dataIndex: 'productionSegmentCount', width: 100 },
|
||||
{ title: '订单日期', align: 'center', dataIndex: 'orderDate', width: 130 },
|
||||
{ title: '物料编号', align: 'center', dataIndex: 'materialCode', width: 130 },
|
||||
{ title: 'MES胶料名称', align: 'center', dataIndex: 'mesMaterialName', width: 150 },
|
||||
{ title: '计划重量', align: 'center', dataIndex: 'planWeight', width: 110 },
|
||||
{ title: '每车重量', align: 'center', dataIndex: 'perCarWeight', width: 110 },
|
||||
{ title: '计划车数', align: 'center', dataIndex: 'plannedCarCount', width: 100 },
|
||||
{ title: '已排产车数', align: 'center', dataIndex: 'scheduledCarCount', width: 110 },
|
||||
{ title: '完成车数', align: 'center', dataIndex: 'finishedCarCount', width: 100 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'status', width: 100, customRender: ({ text }) => statusText(text) },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100 },
|
||||
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 170 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '订单流水号', field: 'orderSerialNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '订单编号', field: 'orderNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '物料编号', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'Select',
|
||||
componentProps: { options: statusOptions },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'sourceOrderId', component: 'Input', show: false },
|
||||
{ label: '订单流水号', field: 'orderSerialNo', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '订单编号', field: 'orderNo', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '生产段数', field: 'productionSegmentCount', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{
|
||||
label: '订单日期',
|
||||
field: 'orderDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, disabled: true },
|
||||
},
|
||||
{ label: '物料编号', field: 'materialCode', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input', componentProps: { disabled: true } },
|
||||
{ label: '计划重量', field: 'planWeight', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{ label: '每车重量', field: 'perCarWeight', component: 'InputNumber', componentProps: { min: 0 } },
|
||||
{ label: '计划车数', field: 'plannedCarCount', component: 'InputNumber', componentProps: { disabled: true } },
|
||||
{ label: '已排产车数', field: 'scheduledCarCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
|
||||
{ label: '完成车数', field: 'finishedCarCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
|
||||
{ label: '状态', field: 'status', component: 'Select', componentProps: { options: statusOptions } },
|
||||
];
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_master_batch_plan:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMasterBatchPlanModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslMasterBatchPlanModal from './modules/MesXslMasterBatchPlanModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslMasterBatchPlan.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMasterBatchPlan.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '母胶计划',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: true },
|
||||
actionColumn: { width: 120, fixed: 'right' },
|
||||
},
|
||||
exportConfig: { name: '母胶计划', url: getExportUrl },
|
||||
});
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, reload);
|
||||
}
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_master_batch_plan:edit' }];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_master_batch_plan:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="920px" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslMasterBatchPlan.data';
|
||||
import { saveOrUpdate } from '../MesXslMasterBatchPlan.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 12 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue({ ...data.record });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增母胶计划' : unref(isDetail) ? '母胶计划详情' : '编辑母胶计划',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -7,6 +7,7 @@ enum Api {
|
||||
deleteOne = '/xslmes/mesXslProductionOrder/delete',
|
||||
deleteBatch = '/xslmes/mesXslProductionOrder/deleteBatch',
|
||||
queryById = '/xslmes/mesXslProductionOrder/queryById',
|
||||
split = '/xslmes/mesXslProductionOrder/split',
|
||||
exportXls = '/xslmes/mesXslProductionOrder/exportXls',
|
||||
}
|
||||
|
||||
@@ -22,4 +23,7 @@ export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ?
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const splitToMasterBatchPlan = (params, handleSuccess) =>
|
||||
defHttp.post({ url: Api.split, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslProductionOrderModal from './modules/MesXslProductionOrderModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslProductionOrder.data';
|
||||
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslProductionOrder.api';
|
||||
import { batchDelete, deleteOne, getExportUrl, list, splitToMasterBatchPlan } from './MesXslProductionOrder.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
@@ -65,11 +65,22 @@
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
|
||||
}
|
||||
async function handleSplit(record) {
|
||||
await splitToMasterBatchPlan({ id: record.id }, reload);
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
function getTableAction(record) {
|
||||
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_production_order:edit' }];
|
||||
return [
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_production_order:edit' },
|
||||
{
|
||||
label: '拆分',
|
||||
onClick: handleSplit.bind(null, record),
|
||||
auth: 'xslmes:mes_xsl_production_order:split',
|
||||
ifShow: () => record.splitStatus !== 1,
|
||||
},
|
||||
];
|
||||
}
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user