From 6974fa79faeaebf09f40b7f3fe68a5a7bb22f99e Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 14 Nov 2023 11:56:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E7=82=B9=E6=A3=80?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/domain/dto/WCSDTO.java | 54 ++++++++ .../java/com/op/device/domain/EquPlan.java | 10 +- .../op/device/mapper/DeviceTaskMapper.java | 2 +- .../mapper/EquCheckItemDetailMapper.java | 4 + .../device/mapper/EquOrderDetailMapper.java | 6 + .../op/device/mapper/EquOrderEquMapper.java | 5 + .../com/op/device/mapper/EquOrderMapper.java | 2 + .../device/mapper/EquOrderPersonMapper.java | 4 + .../device/mapper/EquOrderStandardMapper.java | 4 + .../op/device/mapper/EquPlanDetailMapper.java | 3 + .../service/impl/DeviceTaskServiceImpl.java | 129 ++++++++++++++++-- .../mapper/device/DeviceTaskMapper.xml | 14 +- .../device/EquCheckItemDetailMapper.xml | 6 +- .../mapper/device/EquOrderDetailMapper.xml | 26 +++- .../mapper/device/EquOrderEquMapper.xml | 14 +- .../mapper/device/EquOrderMapper.xml | 9 +- .../mapper/device/EquOrderPersonMapper.xml | 21 ++- .../mapper/device/EquOrderStandardMapper.xml | 23 +++- .../mapper/device/EquPlanDetailMapper.xml | 7 +- .../mapper/device/EquPlanEquMapper.xml | 7 +- .../mapper/device/EquPlanPersonMapper.xml | 6 +- .../mapper/device/EquPlanStandardMapper.xml | 7 +- .../op/open/controller/OpenController.java | 13 ++ .../java/com/op/open/mapper/OpenMapper.java | 3 + .../java/com/op/open/service/OpenService.java | 4 + .../op/open/service/impl/OpenServiceImpl.java | 7 + .../main/resources/mapper/open/OpenMapper.xml | 12 ++ 27 files changed, 361 insertions(+), 41 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java index 7e84e659..7829d084 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java @@ -29,6 +29,12 @@ public class WCSDTO { private String spec; private String productionState; private List stationNos; + private String workorderId; + private String bucketCode; + private String materialCode; + private String materialName; + private String shiftId; + private String workorderCode; public List getStationNos() { return stationNos; @@ -161,4 +167,52 @@ public class WCSDTO { public void setData(List data) { this.data = data; } + + public String getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(String workorderId) { + this.workorderId = workorderId; + } + + public String getBucketCode() { + return bucketCode; + } + + public void setBucketCode(String bucketCode) { + this.bucketCode = bucketCode; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getShiftId() { + return shiftId; + } + + public void setShiftId(String shiftId) { + this.shiftId = shiftId; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java index f2c9f5ed..12eb7404 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java @@ -143,14 +143,14 @@ public class EquPlan extends BaseEntity { // 是否停机保养 private String shutDown; - private String planEquCode; + private String planEquId; - public String getPlanEquCode() { - return planEquCode; + public String getPlanEquId() { + return planEquId; } - public void setPlanEquCode(String planEquCode) { - this.planEquCode = planEquCode; + public void setPlanEquId(String planEquId) { + this.planEquId = planEquId; } public String getUpkeep() { diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java index b78756b2..fbdda61a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java @@ -20,5 +20,5 @@ public interface DeviceTaskMapper { List getPlans(EquPlan equPlan); - EquOrder getNewTaskOrder(EquOrder equOrder); + EquOrder getNewTaskOrder(EquPlan quPlan); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java index 39b52b3b..b04c2d89 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java @@ -3,6 +3,8 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquCheckItemDetail; +import com.op.device.domain.EquOrder; +import org.apache.ibatis.annotations.Mapper; /** * 检查项详情Mapper接口 @@ -10,6 +12,7 @@ import com.op.device.domain.EquCheckItemDetail; * @author wws * @date 2023-10-10 */ +@Mapper public interface EquCheckItemDetailMapper { /** * 查询检查项详情 @@ -91,4 +94,5 @@ public interface EquCheckItemDetailMapper { * @return */ List selectCheckItemDetailByItemCode(String itemCode); + } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java index 7dc3458c..37e62743 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderDetailMapper.java @@ -3,6 +3,9 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquOrderDetail; +import com.op.device.domain.EquPlanDetail; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 计划工单详情-检查项信息Mapper接口 @@ -10,6 +13,7 @@ import com.op.device.domain.EquOrderDetail; * @author Open Platform * @date 2023-10-23 */ +@Mapper public interface EquOrderDetailMapper { /** * 查询计划工单详情-检查项信息 @@ -72,4 +76,6 @@ public interface EquOrderDetailMapper { * @return */ List selectEquOrderDetailByOrderCode(String orderCode); + + int insertEquOrderDetails(@Param("list") List details); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquMapper.java index 19802e6f..1cd90aa4 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquMapper.java @@ -3,6 +3,8 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquOrderEqu; +import com.op.device.domain.EquPlanEqu; +import org.apache.ibatis.annotations.Param; /** * 计划工单-设备Mapper接口 @@ -65,4 +67,7 @@ public interface EquOrderEquMapper { * @return */ EquOrderEqu selectEquOrderEquListByParentCode(String orderCode); + + int insertEquOrderEqus(@Param("list") List equs); + } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java index 0cb79b49..6e251af6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquOrder; +import com.op.device.domain.EquPlan; import com.op.device.domain.dto.PDADTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -118,4 +119,5 @@ public interface EquOrderMapper { * @return */ List selectTodayTask(PDADTO pdadto); + } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java index 214e9001..daad4389 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderPersonMapper.java @@ -3,6 +3,8 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquOrderPerson; +import com.op.device.domain.EquPlanPerson; +import org.apache.ibatis.annotations.Param; /** * 计划工单-人员Mapper接口 @@ -65,4 +67,6 @@ public interface EquOrderPersonMapper { * @return */ List selectEquOrderPersonByOrderCode(String orderCode); + + int insertEquOrderPlans(@Param("list") List persons); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java index b1ef62a5..8ce6b309 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderStandardMapper.java @@ -5,6 +5,8 @@ import java.util.List; import com.op.common.core.domain.BaseFileData; import com.op.device.domain.EquOrder; import com.op.device.domain.EquOrderStandard; +import com.op.device.domain.EquPlanStandard; +import org.apache.ibatis.annotations.Param; /** * 计划工单-标准Mapper接口 @@ -80,4 +82,6 @@ public interface EquOrderStandardMapper { * @return */ public List selectPdaEquOrderList(EquOrder equOrder); + + int insertEquOrderStandards(@Param("list") List standards); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquPlanDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquPlanDetailMapper.java index 57f8330f..620d2b32 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquPlanDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquPlanDetailMapper.java @@ -2,6 +2,7 @@ package com.op.device.mapper; import java.util.List; +import com.op.device.domain.EquPlan; import com.op.device.domain.EquPlanDetail; /** @@ -84,4 +85,6 @@ public interface EquPlanDetailMapper { * @return */ List selectEquPlanDetailListByParentCode(String code); + + List selectPlanDetailList(EquPlan plan); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index a4962019..c9af8a20 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -1,6 +1,8 @@ package com.op.device.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.common.security.utils.SecurityUtils; import com.op.device.domain.*; @@ -10,8 +12,10 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Date; import java.util.List; import static com.op.common.core.web.domain.AjaxResult.error; @@ -32,6 +36,26 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { @Autowired private EquOrderMapper equOrderMapper; + @Autowired + private EquOrderDetailMapper equOrderDetailMapper; + + @Autowired + private EquPlanDetailMapper equPlanDetailMapper; + + @Autowired + private EquPlanEquMapper equPlanEquMapper; + @Autowired + private EquOrderEquMapper equOrderEquMapper; + + @Autowired + private EquPlanStandardMapper equPlanStandardMapper; + @Autowired + private EquOrderStandardMapper equOrderStandardMapper; + + @Autowired + private EquPlanPersonMapper equPlanPersonMapper; + @Autowired + private EquOrderPersonMapper equOrderPersonMapper; /** * 根据点检计划生成点检任务 * **/ @@ -42,13 +66,12 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { equPlan.setPlanType("spotInspection"); List plans = deviceTaskMapper.getPlans(equPlan); for(EquPlan plan:plans){ - if("day".equals(plan.getPlanLoopType())){ - EquOrder order = new EquOrder(); - order.setPlanType("spotInspection"); - EquOrder hasTask = deviceTaskMapper.getNewTaskOrder(order); - if(hasTask==null || Integer.parseInt(plan.getPlanLoop())<= hasTask.getDays()){ - //生成点检计划 - this.createSpotCheckPlan(plan); + EquOrder hasTask = deviceTaskMapper.getNewTaskOrder(plan); + if(hasTask==null || Integer.parseInt(plan.getPlanLoop())<= hasTask.getDays()){ + //生成点检计划 + int m = this.createSpotCheckPlan(plan); + if(m==0){ + error("equ_order相关添加失败"); } } } @@ -57,13 +80,95 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { } private int createSpotCheckPlan(EquPlan plan){ - /**equ_order**/ + Date nowtime = DateUtils.getNowDate(); + String createBy = SecurityUtils.getUsername(); + int sce = 0; + /**equ_plan->equ_order********************************************************************/ EquOrder order = new EquOrder(); + //源->目标 BeanUtils.copyProperties(plan,order); - equOrderMapper.insertEquOrder(order); - /**equ_order_detail**/ - List details = new ArrayList<>(); + order.setOrderId(IdUtils.fastSimpleUUID()); + order.setCreateBy(createBy); + order.setCreateTime(nowtime); + // 流水号 + String serialNum = String.format("%03d",equOrderMapper.selectSerialNumber()); + String orderCode = "O"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum; + order.setOrderCode(orderCode); + /**equ_order**/ + sce = equOrderMapper.insertEquOrder(order); + + /**equ_plan_equ->equ_order_equ*************************************************************/ + EquPlanEqu equPlanEqu = new EquPlanEqu(); + equPlanEqu.setId(plan.getPlanEquId()); + List equs = equPlanEquMapper.selectEquPlanEquList(equPlanEqu); + if(CollectionUtils.isEmpty(equs)){ + return 0; + } + String orderEquId = IdUtils.fastSimpleUUID(); + //equs一定就一个实值 + for(EquPlanEqu equ:equs){ + equ.setId(orderEquId); + equ.setCreateTime(nowtime); + equ.setCreateBy(createBy); + equ.setDelFlag("0"); + equ.setCode(orderCode); + } + sce = equOrderEquMapper.insertEquOrderEqus(equs); + /**equ_plan_detail->equ_order_detail*******************************************************/ + EquPlanDetail itqo = new EquPlanDetail(); + itqo.setParentCode(plan.getPlanEquId()); + itqo.setDelFlag("0"); + List details = equPlanDetailMapper.selectEquPlanDetailList(itqo); + if(CollectionUtils.isEmpty(details)){ + return 0; + } - return 0; + List standards = new ArrayList<>(); + List standards0 = null; + for(EquPlanDetail itme:details){ + String detailId = IdUtils.fastSimpleUUID(); + EquPlanStandard standardqo = new EquPlanStandard(); + //equ_plan_detail的id + standardqo.setParentCode(itme.getId()); + standards0 = equPlanStandardMapper.selectEquPlanStandardList(standardqo); + for(EquPlanStandard standard:standards0) { + standard.setId(IdUtils.fastSimpleUUID()); + standard.setCreateTime(nowtime); + standard.setCreateBy(createBy); + standard.setDelFlag("0"); + standard.setPlanCode(orderCode); + standard.setParentCode(detailId); + } + standards.addAll(standards0); + + itme.setId(detailId); + itme.setCreateTime(nowtime); + itme.setCreateBy(createBy); + itme.setDelFlag("0"); + itme.setParentCode(orderEquId); + } + sce = equOrderDetailMapper.insertEquOrderDetails(details); + /**equ_plan_standard->equ_order_standard*******************************************************/ + if(CollectionUtils.isEmpty(standards)){ + return 0; + } + sce = equOrderStandardMapper.insertEquOrderStandards(standards); + /**equ_plan_person->equ_order_person*********************************************************/ + EquPlanPerson equPlanPerson = new EquPlanPerson(); + equPlanPerson.setPlanCode(plan.getPlanCode()); + List persons = equPlanPersonMapper.selectEquPlanPersonList(equPlanPerson); + if(CollectionUtils.isEmpty(persons)){ + return 0; + } + + for(EquPlanPerson person:persons){ + person.setId(IdUtils.fastSimpleUUID()); + person.setCreateTime(nowtime); + person.setCreateBy(createBy); + person.setDelFlag("0"); + person.setPlanCode(orderCode); + } + sce = equOrderPersonMapper.insertEquOrderPlans(persons); + return sce; } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml index be468d21..29c262a3 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml @@ -5,7 +5,8 @@ select top 1 order_code orderCode, create_time createTime, - DATEDIFF (day, create_time, GETDATE()) days + DATEDIFF (day, create_time, GETDATE()) days + DATEDIFF (week, create_time, GETDATE()) days + DATEDIFF (month, create_time, GETDATE()) days + DATEDIFF (month, create_time, GETDATE())/3 days + DATEDIFF (year, create_time, GETDATE()) days from equ_order - where plan_type = #{planType} + where plan_type = #{planType} and plan_code = #{planCode} order by create_time desc diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml index 7d6a5679..03432131 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -25,7 +25,9 @@ - select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, detail_unit, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by, detail_code from equ_check_item_detail + select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, + detail_unit, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by, detail_code + from equ_check_item_detail @@ -106,6 +109,25 @@ #{updateTime}, + + insert into equ_order_detail + ( + id, parent_code, + item_code, item_name, item_method, + item_type, item_type_name, factroy_code, del_flag, + create_by, create_time + ) + VALUES + + ( + #{item.id},#{item.parentCode}, + #{item.itemCode},#{item.itemName},#{item.itemMethod}, + #{item.itemType},#{item.itemTypeName},#{item.factroyCode},#{item.delFlag}, + #{item.createBy},#{item.createTime} + ) + + + update equ_order_detail @@ -141,4 +163,4 @@ #{id} - \ No newline at end of file + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquMapper.xml index 1461f653..4802141e 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquMapper.xml @@ -89,6 +89,18 @@ #{updateTime}, + + insert into equ_order_equ( + id,order_code,equipment_code, equipment_name, + factory_code,del_flag, create_by, create_time + )values + + ( + #{item.id},#{item.code},#{item.equipmentCode},#{item.equipmentName}, + #{item.factoryCode},#{item.delFlag},#{item.createBy},#{item.createTime} + ) + + update equ_order_equ @@ -121,4 +133,4 @@ #{id} - \ No newline at end of file + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml index 9ac2d48b..f0b80d74 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml @@ -42,7 +42,12 @@ - select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,upkeep,calculation_rule,shut_down,order_inspect,repair_code,work_code from equ_order + select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, + plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, + order_cost, plan_person, order_cost_time, order_sign_person, + factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, + update_by, update_time,upkeep,calculation_rule,shut_down,order_inspect,repair_code,work_code + from equ_order @@ -80,6 +82,21 @@ #{updateTime}, + + insert into equ_order_person + ( + id, order_code, user_id, user_name, factory_code, + del_flag, create_by, create_time + ) + VALUES + + ( + #{item.id},#{item.planCode}, + #{item.userId},#{item.userName},#{item.factroyCode}, + #{item.delFlag},#{item.createBy},#{item.createTime} + ) + + update equ_order_person @@ -110,4 +127,4 @@ #{id} - \ No newline at end of file + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml index 46ef8be5..7aefabaf 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderStandardMapper.xml @@ -37,7 +37,11 @@ - select id, code, parent_code, order_code, standard_type, standard_name, detail_up_limit, detail_down_limit, detail_unit, detail_reach, actual_value, detail_error, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,error_flag,fault_type,repair_reach,repair_value,repair_picture from equ_order_standard + select id, code, parent_code, order_code, standard_type, standard_name, detail_up_limit, detail_down_limit, + detail_unit, detail_reach, actual_value, detail_error, factory_code, attr1, attr2, attr3, + del_flag, create_by, create_time, update_by, update_time,picture_path,error_flag,fault_type,repair_reach, + repair_value,repair_picture + from equ_order_standard - \ No newline at end of file + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquPlanDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquPlanDetailMapper.xml index 7ab78a50..0caa0b00 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquPlanDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquPlanDetailMapper.xml @@ -28,7 +28,10 @@ - select id, code, plan_id,plan_code, parent_code, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_detail + select id, code, plan_id,plan_code, parent_code, item_code, item_name, item_method, item_type, + item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, + create_by, create_time, update_by, update_time + from equ_plan_detail + and id = #{id} and code = #{code} and plan_code = #{planCode} and parent_code = #{parentCode} @@ -129,4 +132,4 @@ update equ_plan_equ set del_flag = '1' where plan_code = #{planCode} - \ No newline at end of file + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquPlanPersonMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquPlanPersonMapper.xml index 029fc492..3313dc4d 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquPlanPersonMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquPlanPersonMapper.xml @@ -21,7 +21,9 @@ - select id, plan_code, user_id, user_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_person + select id, plan_code, user_id, user_name, factory_code, attr1, attr2, attr3, del_flag, + create_by, create_time, update_by, update_time + from equ_plan_person @@ -155,4 +158,4 @@ update equ_plan_standard set del_flag = '1' where plan_code = #{planCode} - \ No newline at end of file + diff --git a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java index 3af445eb..ca6c18b4 100644 --- a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java +++ b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java @@ -57,6 +57,19 @@ public class OpenController extends BaseController { return success(openService.reportWork(mesReportWork)); } + /**获取料罐信息**/ + @PostMapping("/getLGInfo") + public AjaxResult getLGInfo(@RequestBody WCSDTO wcsDTO) { + if(StringUtils.isBlank(wcsDTO.getReqTime())){ + return error("[reqTime] is null"); + } + if(StringUtils.isBlank(wcsDTO.getFactory())){ + return error("[factory] is null"); + } + + return success(openService.getLGInfo(wcsDTO)); + } + public static void main(String args[]){ System.out.println(DateUtils.getDate()); } diff --git a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java index 9b7462dd..9ab9d523 100644 --- a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java +++ b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java @@ -1,6 +1,7 @@ package com.op.open.mapper; import com.op.system.api.domain.SysSapLog; +import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; import com.op.system.api.domain.mes.ProOrderWorkorderDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; @@ -38,5 +39,7 @@ public interface OpenMapper { void updateWorkOrderStatus(MesReportWorkDTO work); ProOrderWorkorderDTO getOrderByCode(String workorderCode); + + List getLGInfo(WCSDTO wcsDTO); } diff --git a/op-modules/op-open/src/main/java/com/op/open/service/OpenService.java b/op-modules/op-open/src/main/java/com/op/open/service/OpenService.java index 8a069cca..10ce38f5 100644 --- a/op-modules/op-open/src/main/java/com/op/open/service/OpenService.java +++ b/op-modules/op-open/src/main/java/com/op/open/service/OpenService.java @@ -4,6 +4,8 @@ import com.op.common.core.domain.R; import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; +import java.util.List; + /** * 订单Service接口 * @@ -15,4 +17,6 @@ public interface OpenService { WCSDTO requestDestinationStations(WCSDTO wcsdto); R reportWork(MesReportWorkDTO mesReportWork); + + List getLGInfo(WCSDTO wcsDTO); } diff --git a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java index f999e6e7..bb3562c5 100644 --- a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java +++ b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java @@ -210,6 +210,12 @@ public class OpenServiceImpl implements OpenService { return R.ok(); } + @Override + public List getLGInfo(WCSDTO wcsDTO) { + DynamicDataSourceContextHolder.push("ds_"+wcsDTO.getFactory());// 这是数据源的key + return openMapper.getLGInfo(wcsDTO); + } + // //根据工单子单编码获取最顶级订单的母单 // private ProOrderWorkorderDTO getTopOrder(String workorderCode) { // //pro_order_workorder @@ -222,6 +228,7 @@ public class OpenServiceImpl implements OpenService { // } + public static void main(String args[]){ DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDate today = LocalDate.now(); diff --git a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml index 2ce1131e..4fd58e39 100644 --- a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml +++ b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml @@ -109,5 +109,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit from pro_order_workorder where workorder_code = #{workorderCode} + From ba999d484c2f17ef125bed1ed61e207f7c260e17 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 14 Nov 2023 14:36:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=88=90=E5=93=81=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op-mes/src/main/java/com/op/mes/mapper/MesMapper.java | 2 ++ .../com/op/mes/service/impl/IWCInterfaceServiceImpl.java | 7 ++++++- .../op-mes/src/main/resources/mapper/mes/MesMapper.xml | 3 +++ .../src/main/java/com/op/plan/domain/ProOrder.java | 4 ++-- .../java/com/op/plan/mapper/ProOrderWorkorderMapper.java | 2 ++ .../com/op/plan/service/impl/ProOrderServiceImpl.java | 4 ++-- .../resources/mapper/plan/ProOrderWorkorderMapper.xml | 8 ++++++++ 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java index d9c8a5e9..b903ca16 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java @@ -54,4 +54,6 @@ public interface MesMapper { void addSapLog(SysSapLog sysSapLog); List> selectcxjList(); + + void deleteDateByTableName0(@Param("table")String table,@Param("ymdhms")String ymdhms); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 1ee92724..e1761292 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -236,7 +236,12 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { LocalDate nextWeek = today.plus(-3, ChronoUnit.DAYS); String ymdhms7 = nextWeek.format(ymdhms)+" 00:00:00"; for(String table:tables){ - mesMapper.deleteDateByTableName(table,ymdhms7); + if("mes_interface_log".equals(table)){ + mesMapper.deleteDateByTableName0(table,ymdhms7); + }else{ + mesMapper.deleteDateByTableName(table,ymdhms7); + } + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml index ae338574..0430bc98 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml @@ -178,5 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from ${table} where create_time >= #{startDate} and #{endDate}>create_time + + delete from ${table} where #{ymdhms} > CONVERT(varchar(30),creter_time, 120) + diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java index ffb51e77..3e6128ca 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java @@ -137,8 +137,8 @@ public class ProOrder extends TreeEntity { private String planDateEnd; /** 创建日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建日期", width = 20, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建日期", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** 更新日期 */ diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 708b08f1..0818455e 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -150,5 +150,7 @@ public interface ProOrderWorkorderMapper { List selectProOrderWorkorderByOrderId(String orderId); int getProSortNo(ProOrder proOrder); + + void deleteProOrderWorkorderByOrderIds(String[] orderIds); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 01c5cf64..d7191c56 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -472,6 +472,7 @@ public class ProOrderServiceImpl implements IProOrderService { ProOrder orderExit = proOrderMapper.selectProOrderByOrderCode(proOrder.getOrderCode()); if (orderExit==null) {//不存在就插入 proOrder.setId(IdUtils.fastSimpleUUID()); + proOrder.setCreateTime(nowDate); proOrderMapper.insertProOrder(proOrder); logger.info("=======订单"+proOrder.getOrderCode()+"同步成功"); } else {//存在,如果没活动更新,否则不允许更新,关闭订单 @@ -493,7 +494,7 @@ public class ProOrderServiceImpl implements IProOrderService { //删除批次pro_order_workorder_batch proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(ids); //删除工单pro_order_workorder - proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(ids); + proOrderWorkorderMapper.deleteProOrderWorkorderByOrderIds(ids); } logger.info("=======订单"+proOrder.getOrderCode()+"同步成功"); }else{ @@ -547,7 +548,6 @@ public class ProOrderServiceImpl implements IProOrderService { order.setPlanFactoryCode(factoryCode); order.setFactoryCode(factoryCode); order.setCreateBy(SecurityUtils.getUsername()); - order.setCreateTime(DateUtils.getNowDate()); order.setOrderType("LJ01"); order.setProdType("prod"); order.setStatus("o0"); diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 694a8a40..6da59778 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -440,4 +440,12 @@ set del_flag = '1' where order_id = #{id} + + update pro_order_workorder + set del_flag = '1' + where order_id in + + #{orderId} + +