Browse Source

机加工环节再加个“机加工检验”报工

机加工的生产报工与机加工检验报工也有先后顺序
master
han\hanst 4 weeks ago
parent
commit
9131315d8e
  1. 33
      sql/longchuang_production_plan.sql
  2. 53
      src/main/java/com/xujie/sys/modules/longchuang/service/impl/ProductionPlanServiceImpl.java
  3. 6
      src/main/resources/mapper/longchuang/ProductionPlanMapper.xml
  4. 4
      src/main/resources/mapper/sys/SysMenuDao.xml

33
sql/longchuang_production_plan.sql

@ -165,6 +165,9 @@ go
LC_RENOVATION_ASSY LC_RENOVATION_ASSY
LC_RENOVATION_INSPECT LC_RENOVATION_INSPECT
LC_RENOVATION_PACK LC_RENOVATION_PACK
:
LC_MACHINING_PRODUCTION
LC_MACHINING_INSPECTION
*/ */
update dbo.sys_role set role_type = 'LC_HOME_LIFT_STOCKING' where role_name like '%家用电梯%' and role_name like '%仓库配料%'; update dbo.sys_role set role_type = 'LC_HOME_LIFT_STOCKING' where role_name like '%家用电梯%' and role_name like '%仓库配料%';
@ -180,4 +183,34 @@ update dbo.sys_role set role_type = 'LC_RENOVATION_STOCKING' where role_name lik
update dbo.sys_role set role_type = 'LC_RENOVATION_ASSY' where role_name like '%改造%' and role_name like '%组装%'; update dbo.sys_role set role_type = 'LC_RENOVATION_ASSY' where role_name like '%改造%' and role_name like '%组装%';
update dbo.sys_role set role_type = 'LC_RENOVATION_INSPECT' where role_name like '%改造%' and role_name like '%检验%'; update dbo.sys_role set role_type = 'LC_RENOVATION_INSPECT' where role_name like '%改造%' and role_name like '%检验%';
update dbo.sys_role set role_type = 'LC_RENOVATION_PACK' where role_name like '%改造%' and role_name like '%打包%'; update dbo.sys_role set role_type = 'LC_RENOVATION_PACK' where role_name like '%改造%' and role_name like '%打包%';
update dbo.sys_role set role_type = 'LC_MACHINING_PRODUCTION' where role_name like '%机加工%' and role_name like '%生产%';
update dbo.sys_role set role_type = 'LC_MACHINING_INSPECTION' where role_name like '%机加工%' and role_name like '%检验%';
go
/*
*/
insert into dbo.lc_production_order_node
(order_id, node_code, node_name, sort_no, status, create_time, update_time)
select
n.order_id,
'machiningInspection',
N'机加工检验',
2,
case
when o.status = N'已完成' then N'已完成'
when n.status = N'已完成' then N'进行中'
else N'未开始'
end,
getdate(),
getdate()
from dbo.lc_production_order_node n
inner join dbo.lc_production_order o on o.id = n.order_id and o.order_type = 'MACHINING'
where n.node_code = 'machiningProduction'
and not exists (
select 1
from dbo.lc_production_order_node x
where x.order_id = n.order_id
and x.node_code = 'machiningInspection'
);
go go

53
src/main/java/com/xujie/sys/modules/longchuang/service/impl/ProductionPlanServiceImpl.java

@ -65,6 +65,10 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
private static final String ORDER_TYPE_CABLE_COP = "CABLE_COP"; private static final String ORDER_TYPE_CABLE_COP = "CABLE_COP";
private static final String ORDER_TYPE_RENOVATION = "RENOVATION"; private static final String ORDER_TYPE_RENOVATION = "RENOVATION";
private static final String ORDER_TYPE_MACHINING = "MACHINING"; private static final String ORDER_TYPE_MACHINING = "MACHINING";
private static final String MACHINING_NODE_PRODUCTION = "machiningProduction";
private static final String MACHINING_NODE_INSPECTION = "machiningInspection";
private static final String MACHINING_NODE_PRODUCTION_NAME = "机加工生产";
private static final String MACHINING_NODE_INSPECTION_NAME = "机加工检验";
private static final String STATUS_PLAN = "已排产"; private static final String STATUS_PLAN = "已排产";
private static final String STATUS_PROCESSING = "进行中"; private static final String STATUS_PROCESSING = "进行中";
@ -221,8 +225,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
throw new XJException("请先拍照或录制视频"); throw new XJException("请先拍照或录制视频");
} }
String orderType = normalizeOrderType(data.getOrderType()); String orderType = normalizeOrderType(data.getOrderType());
if (ORDER_TYPE_MACHINING.equals(orderType)) {
throw new XJException("机加工报工无需上传影像");
if (ORDER_TYPE_MACHINING.equals(orderType) && !isMachiningInspectionNode(orderType, data.getNodeCode())) {
throw new XJException("机加工仅检验节点支持上传影像");
} }
boolean reportNode = !Boolean.FALSE.equals(data.getReportNode()); boolean reportNode = !Boolean.FALSE.equals(data.getReportNode());
String logNo = reportNode ? reportOrderNode(data, orderType) : validateMediaUploadOnly(data, orderType); String logNo = reportNode ? reportOrderNode(data, orderType) : validateMediaUploadOnly(data, orderType);
@ -352,7 +356,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
productionPlanMapper.updateOrderStatus(reportLog.getOrderNo(), STATUS_PLAN, null, userId); productionPlanMapper.updateOrderStatus(reportLog.getOrderNo(), STATUS_PLAN, null, userId);
} }
if (ORDER_TYPE_CABLE_COP.equals(normalizedOrderType) || ORDER_TYPE_MACHINING.equals(normalizedOrderType)) {
boolean needRollbackQty = ORDER_TYPE_CABLE_COP.equals(normalizedOrderType)
|| isMachiningProductionNode(normalizedOrderType, reportLog.getNodeCode());
if (needRollbackQty) {
BigDecimal reportQty = reportLog.getReportQty() == null ? BigDecimal.ZERO : reportLog.getReportQty(); BigDecimal reportQty = reportLog.getReportQty() == null ? BigDecimal.ZERO : reportLog.getReportQty();
if (reportQty.compareTo(BigDecimal.ZERO) > 0) { if (reportQty.compareTo(BigDecimal.ZERO) > 0) {
productionPlanMapper.decreaseOrderReportQty(reportLog.getOrderNo(), reportQty, userId); productionPlanMapper.decreaseOrderReportQty(reportLog.getOrderNo(), reportQty, userId);
@ -858,7 +864,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
return nodeList; return nodeList;
} }
if (ORDER_TYPE_MACHINING.equals(orderType)) { if (ORDER_TYPE_MACHINING.equals(orderType)) {
nodeList.add(buildNode("machiningProduction", "机加工生产", 1));
nodeList.add(buildNode(MACHINING_NODE_PRODUCTION, MACHINING_NODE_PRODUCTION_NAME, 1));
nodeList.add(buildNode(MACHINING_NODE_INSPECTION, MACHINING_NODE_INSPECTION_NAME, 2));
return nodeList; return nodeList;
} }
if (ORDER_TYPE_HOME_LIFT.equals(orderType)) { if (ORDER_TYPE_HOME_LIFT.equals(orderType)) {
@ -1047,21 +1054,30 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
Long userId = getCurrentUserId(); Long userId = getCurrentUserId();
String userName = getCurrentUserName(); String userName = getCurrentUserName();
productionPlanMapper.updateOrderNodeToDone(data.getOrderNo(), data.getNodeCode(), data.getRemark(), userId); productionPlanMapper.updateOrderNodeToDone(data.getOrderNo(), data.getNodeCode(), data.getRemark(), userId);
if (ORDER_TYPE_CABLE_COP.equals(orderType) || ORDER_TYPE_MACHINING.equals(orderType)) {
BigDecimal reportQty = data.getReportQty() == null ? BigDecimal.ZERO : data.getReportQty();
BigDecimal reportQty = data.getReportQty();
boolean qtyRequired = ORDER_TYPE_CABLE_COP.equals(orderType)
|| isMachiningProductionNode(orderType, data.getNodeCode());
if (qtyRequired) {
reportQty = reportQty == null ? BigDecimal.ZERO : reportQty;
if (reportQty.compareTo(BigDecimal.ZERO) <= 0) { if (reportQty.compareTo(BigDecimal.ZERO) <= 0) {
throw new I18nException("lc.production.report.qty.gt.zero"); throw new I18nException("lc.production.report.qty.gt.zero");
} }
if (ORDER_TYPE_MACHINING.equals(orderType)) {
productionPlanMapper.increaseOrderReportQty(data.getOrderNo(), reportQty, userId);
} else {
} else if (isMachiningInspectionNode(orderType, data.getNodeCode())
&& (reportQty == null || reportQty.compareTo(BigDecimal.ZERO) <= 0)) {
reportQty = BigDecimal.ONE;
}
if (reportQty != null) {
data.setReportQty(reportQty);
}
if (ORDER_TYPE_CABLE_COP.equals(orderType)) {
productionPlanMapper.updateCableCopReportQty( productionPlanMapper.updateCableCopReportQty(
data.getOrderNo(), data.getOrderNo(),
reportQty, reportQty,
order.getTaskQty() == null ? BigDecimal.ZERO : order.getTaskQty(), order.getTaskQty() == null ? BigDecimal.ZERO : order.getTaskQty(),
userId userId
); );
}
} else if (isMachiningProductionNode(orderType, data.getNodeCode())) {
productionPlanMapper.increaseOrderReportQty(data.getOrderNo(), reportQty, userId);
} }
int unDoneCount = productionPlanMapper.countUnDoneOrderNode(data.getOrderNo()); int unDoneCount = productionPlanMapper.countUnDoneOrderNode(data.getOrderNo());
if (unDoneCount > 0) { if (unDoneCount > 0) {
@ -1075,7 +1091,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
data.setReportUserName(userName); data.setReportUserName(userName);
String logNo = generateLogNo(orderType); String logNo = generateLogNo(orderType);
data.setLogNo(logNo); data.setLogNo(logNo);
data.setRemark(ORDER_TYPE_MACHINING.equals(orderType)&&data.getReportQty() != null ? "报工数量:"+data.getReportQty():"");
if (isMachiningProductionNode(orderType, data.getNodeCode()) && data.getReportQty() != null) {
data.setRemark("报工数量:" + data.getReportQty());
}
productionPlanMapper.insertNodeReportLog(data); productionPlanMapper.insertNodeReportLog(data);
return logNo; return logNo;
} }
@ -1448,14 +1466,25 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
return null; return null;
} }
if (ORDER_TYPE_MACHINING.equals(orderType)) { if (ORDER_TYPE_MACHINING.equals(orderType)) {
if ("machiningProduction".equals(nodeCode)) {
if (MACHINING_NODE_PRODUCTION.equals(nodeCode)) {
return "LC_MACHINING_PRODUCTION"; return "LC_MACHINING_PRODUCTION";
} }
if (MACHINING_NODE_INSPECTION.equals(nodeCode)) {
return "LC_MACHINING_INSPECTION";
}
return null; return null;
} }
return null; return null;
} }
private boolean isMachiningProductionNode(String orderType, String nodeCode) {
return ORDER_TYPE_MACHINING.equals(orderType) && MACHINING_NODE_PRODUCTION.equals(nodeCode);
}
private boolean isMachiningInspectionNode(String orderType, String nodeCode) {
return ORDER_TYPE_MACHINING.equals(orderType) && MACHINING_NODE_INSPECTION.equals(nodeCode);
}
private void finishOrder(String orderNo, String orderType) { private void finishOrder(String orderNo, String orderType) {
if (!StringUtils.hasText(orderNo)) { if (!StringUtils.hasText(orderNo)) {
throw new I18nException("lc.production.finish.param.empty"); throw new I18nException("lc.production.finish.param.empty");

6
src/main/resources/mapper/longchuang/ProductionPlanMapper.xml

@ -77,7 +77,9 @@
and a.plan_finish_date <![CDATA[<=]]> #{query.planEndDate} and a.plan_finish_date <![CDATA[<=]]> #{query.planEndDate}
</if> </if>
</where> </where>
order by isnull(a.plan_delivery_date, a.plan_finish_date) asc
order by
case when a.status = '已完成' then 1 else 0 end asc,
isnull(a.plan_delivery_date, a.plan_finish_date) asc
</select> </select>
<select id="queryWorkReportOrderPage" resultType="com.xujie.sys.modules.longchuang.data.ProductionPlanOrderRowData"> <select id="queryWorkReportOrderPage" resultType="com.xujie.sys.modules.longchuang.data.ProductionPlanOrderRowData">
@ -132,7 +134,7 @@
and a.plan_finish_date <![CDATA[<=]]> #{query.planEndDate} and a.plan_finish_date <![CDATA[<=]]> #{query.planEndDate}
</if> </if>
</where> </where>
order by isnull(a.plan_delivery_date, a.plan_finish_date) asc
order by case when a.status = '已完成' then 1 else 0 end asc,isnull(a.plan_delivery_date, a.plan_finish_date) asc
</select> </select>
<select id="queryOrderNodeList" resultType="com.xujie.sys.modules.longchuang.data.ProductionPlanOrderNodeData"> <select id="queryOrderNodeList" resultType="com.xujie.sys.modules.longchuang.data.ProductionPlanOrderNodeData">

4
src/main/resources/mapper/sys/SysMenuDao.xml

@ -88,7 +88,7 @@
<!-- 查询当前用户有的菜单权限 --> <!-- 查询当前用户有的菜单权限 -->
<select id="getUserMenuListByUserId" resultType="com.xujie.sys.modules.sys.entity.SysMenuEntity"> <select id="getUserMenuListByUserId" resultType="com.xujie.sys.modules.sys.entity.SysMenuEntity">
SELECT sm.menu_id, sm.parent_id, sm.name, sm.url, sm.perms, sm.type, sm.icon, sm.order_num
SELECT DISTINCT sm.menu_id, sm.parent_id, sm.name, sm.url, sm.perms, sm.type, sm.icon, sm.order_num
FROM sys_menu sm FROM sys_menu sm
LEFT JOIN sys_role_menu srm ON srm.menu_id = sm.menu_id LEFT JOIN sys_role_menu srm ON srm.menu_id = sm.menu_id
LEFT JOIN sys_user_role sur ON sur.role_id = srm.role_id LEFT JOIN sys_user_role sur ON sur.role_id = srm.role_id
@ -104,7 +104,7 @@
<!-- 查询当前用户有的菜单权限 多语言--> <!-- 查询当前用户有的菜单权限 多语言-->
<select id="getUserMenuListByUserIdWithLanguage" resultType="com.xujie.sys.modules.sys.entity.SysMenuEntity"> <select id="getUserMenuListByUserIdWithLanguage" resultType="com.xujie.sys.modules.sys.entity.SysMenuEntity">
SELECT sm.menu_id, sm.parent_id, ISNULL(sml.language_value, sm.name) as name,
SELECT DISTINCT sm.menu_id, sm.parent_id, ISNULL(sml.language_value, sm.name) as name,
sm.url, sm.perms, sm.type, sm.icon, sm.order_num sm.url, sm.perms, sm.type, sm.icon, sm.order_num
FROM sys_menu sm FROM sys_menu sm
LEFT JOIN sys_object_language_menu sml ON sm.menu_id = sml.menu_id and sml.language_code = #{language} LEFT JOIN sys_object_language_menu sml ON sm.menu_id = sml.menu_id and sml.language_code = #{language}

Loading…
Cancel
Save