Merge remote-tracking branch 'origin/master'

# Conflicts:
#	op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java
highway
Yangwl 1 year ago
commit c0ee7ca097

@ -29,6 +29,12 @@ public class WCSDTO {
private String spec;
private String productionState;
private List<WCSDataDTO> stationNos;
private String workorderId;
private String bucketCode;
private String materialCode;
private String materialName;
private String shiftId;
private String workorderCode;
public List<WCSDataDTO> getStationNos() {
return stationNos;
@ -161,4 +167,52 @@ public class WCSDTO {
public void setData(List<WCSDataDTO> 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;
}
}

@ -31,8 +31,7 @@ public class DeviceTaskController {
*/
@PostMapping("/createSpotCheckPlanTask")
public R createSpotCheckPlanTask() {
EquPlan equPlan = new EquPlan();
AjaxResult result = taskService.createSpotCheckPlanTask(equPlan);
AjaxResult result = taskService.createSpotCheckPlanTask();
if(result.isSuccess()){
return R.ok("点检计划生成成功");
}

@ -150,6 +150,15 @@ public class EquOrder extends BaseEntity {
private int days;
private String equipmentName;
private String planRestrict;
public String getPlanRestrict() {
return planRestrict;
}
public void setPlanRestrict(String planRestrict) {
this.planRestrict = planRestrict;
}
public String getEquipmentName() {
return equipmentName;

@ -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() {

@ -20,5 +20,5 @@ public interface DeviceTaskMapper {
List<EquPlan> getPlans(EquPlan equPlan);
EquOrder getNewTaskOrder(EquOrder equOrder);
EquOrder getNewTaskOrder(EquPlan quPlan);
}

@ -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<EquCheckItemDetail> selectCheckItemDetailByItemCode(String itemCode);
}

@ -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<EquOrderDetail> selectEquOrderDetailByOrderCode(String orderCode);
int insertEquOrderDetails(@Param("list") List<EquPlanDetail> details);
}

@ -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<EquPlanEqu> equs);
}

@ -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<EquOrder> selectTodayTask(PDADTO pdadto);
}

@ -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<String> selectEquOrderPersonByOrderCode(String orderCode);
int insertEquOrderPlans(@Param("list") List<EquPlanPerson> persons);
}

@ -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
@ -68,16 +70,12 @@ public interface EquOrderStandardMapper {
*/
List<EquOrderStandard> selectEquOrderStandardByParentCode(String code);
/**
*
* @param files
*/
void insertBaseFileBatch(List<BaseFileData> files);
/**
*
* @param equOrder
* @return
*/
public List<EquOrderStandard> selectPdaEquOrderList(EquOrder equOrder);
int insertEquOrderStandards(@Param("list") List<EquPlanStandard> standards);
}

@ -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<EquPlanDetail> selectEquPlanDetailListByParentCode(String code);
List<EquPlanDetail> selectPlanDetailList(EquPlan plan);
}

@ -12,5 +12,5 @@ import com.op.device.domain.EquPlan;
*/
public interface IDeviceTaskService {
AjaxResult createSpotCheckPlanTask(EquPlan equPlan);
AjaxResult createSpotCheckPlanTask();
}

@ -62,6 +62,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
private EquEquipmentMapper equEquipmentMapper;
@Autowired
private EquSpareApplyMapper equSpareApplyMapper;
@Autowired
private EquFileMapper equFileMapper;
/**
@ -186,9 +188,10 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
file.setSourceId(standard.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
file.setImageType("3");
files.add(file);
}
equOrderStandardMapper.insertBaseFileBatch(files);
equFileMapper.insertEquFileBatch(files);
}
// 校验标准信息-是否申请报修

@ -1,18 +1,33 @@
package com.op.device.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
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.*;
import com.op.device.mapper.*;
import com.op.device.service.IDeviceTaskService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
@ -25,6 +40,7 @@ import static com.op.common.core.web.domain.AjaxResult.success;
*/
@Service
public class DeviceTaskServiceImpl implements IDeviceTaskService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private DeviceTaskMapper deviceTaskMapper;
@ -32,38 +48,177 @@ 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;
@Autowired
private RemoteUserService remoteUserService;
/**
*
* **/
@Override
@DS("#header.poolName")
public AjaxResult createSpotCheckPlanTask(EquPlan equPlan) {
public AjaxResult createSpotCheckPlanTask() {
// 加载sf-cloud库的sys_datasource
SysUser sysUser = new SysUser();
sysUser.setUserId(1L);
R<List<Map<String, String>>> dateSources0 = remoteUserService.getPoolNameList(sysUser);
List<Map<String, String>> dateSources = dateSources0.getData();
ExecutorService executorService = new ThreadPoolExecutor(
dateSources.size(),
dateSources.size(),
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
try {
dateSources.forEach(dateSource -> {
if("ds_1000".equals(dateSource.get("poolName"))){//TODO生产去掉
logger.info("++++++++++++" + dateSource.get("poolName") + "++++点检开始++++++++++");
Runnable run = () -> createSpotCheckPlanFunc(dateSource.get("poolName"));
executorService.execute(run);
}
});
} catch (Exception e) {
logger.error("service == dataClearTask == exception", e);
return error("service == dataClearTask == exception");
} finally {
executorService.shutdown();
}
return success();
}
public void createSpotCheckPlanFunc(String poolName){
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
/**equ_plan equ_plan_equ**/
EquPlan equPlan = new EquPlan();
equPlan.setPlanType("spotInspection");
List<EquPlan> 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相关添加失败");
}
}
}
return success();
logger.info("++++++++++++" + poolName + "++++点检结束++++++++++");
}
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<EquOrderDetail> 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);
System.out.println("========equ_order:"+sce);
return 0;
/**equ_plan_equ->equ_order_equ*************************************************************/
EquPlanEqu equPlanEqu = new EquPlanEqu();
equPlanEqu.setId(plan.getPlanEquId());
List<EquPlanEqu> 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);
System.out.println("========equ_order_equ:"+sce);
/**equ_plan_detail->equ_order_detail*******************************************************/
EquPlanDetail itqo = new EquPlanDetail();
itqo.setParentCode(plan.getPlanEquId());
itqo.setDelFlag("0");
List<EquPlanDetail> details = equPlanDetailMapper.selectEquPlanDetailList(itqo);
if(CollectionUtils.isEmpty(details)){
return 0;
}
List<EquPlanStandard> standards = new ArrayList<>();
List<EquPlanStandard> 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);
System.out.println("========equ_order_detail:"+sce);
/**equ_plan_standard->equ_order_standard*******************************************************/
if(CollectionUtils.isEmpty(standards)){
return 0;
}
sce = equOrderStandardMapper.insertEquOrderStandards(standards);
System.out.println("========equ_order_detail:"+sce);
/**equ_plan_person->equ_order_standard*********************************************************/
EquPlanPerson equPlanPerson = new EquPlanPerson();
equPlanPerson.setPlanCode(plan.getPlanCode());
List<EquPlanPerson> 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);
System.out.println("========equ_order_standard:"+sce);
return sce;
}
}

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.BaseFileData;
@ -50,6 +51,8 @@ public class EquOrderServiceImpl implements IEquOrderService {
private EquOrderEquSpareMapper equOrderEquSpareMapper;
@Autowired
private EquRepairOrderMapper equRepairOrderMapper;
@Autowired
private EquFileMapper equFileMapper;
/**
*
@ -178,9 +181,10 @@ public class EquOrderServiceImpl implements IEquOrderService {
file.setSourceId(standard.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
file.setImageType("3");
files.add(file);
}
equOrderStandardMapper.insertBaseFileBatch(files);
equFileMapper.insertEquFileBatch(files);
}
// 校验标准信息-是否申请报修

@ -5,7 +5,8 @@
<mapper namespace="com.op.device.mapper.DeviceTaskMapper">
<select id="getPlans" resultType="com.op.device.domain.EquPlan">
select ep.plan_code planCode,
select ep.plan_workshop planWorkshop,
ep.plan_code planCode,
ep.plan_name planName,
ep.plan_loop planLoop,
ep.plan_loop_type planLoopType,
@ -15,7 +16,8 @@
ep.plan_type planType,
ep.plan_outsource planOutsource,
epe.equipment_code equipmentCode,
epe.equipment_name equipmentName
epe.equipment_name equipmentName,
epe.id planEquId
from equ_plan ep
left join equ_plan_equ epe on ep.plan_code = epe.plan_code
where ep.del_flag = '0' and epe.del_flag = '0' and ep.plan_status = '0'
@ -25,9 +27,13 @@
<select id="getNewTaskOrder" resultType="com.op.device.domain.EquOrder">
select top 1 order_code orderCode,
create_time createTime,
DATEDIFF (day, create_time, GETDATE()) days
<if test='planLoopType=="day"'> DATEDIFF (day, create_time, GETDATE()) days </if>
<if test='planLoopType=="week"'> DATEDIFF (week, create_time, GETDATE()) days </if>
<if test='planLoopType=="month"'> DATEDIFF (month, create_time, GETDATE()) days </if>
<if test='planLoopType=="season"'> DATEDIFF (month, create_time, GETDATE())/3 days </if>
<if test='planLoopType=="year"'> DATEDIFF (year, create_time, GETDATE()) days </if>
from equ_order
where plan_type = #{planType}
where plan_type = #{planType} and plan_code = #{planCode}
order by create_time desc
</select>
</mapper>

@ -25,7 +25,9 @@
</resultMap>
<sql id="selectEquCheckItemDetailVo">
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
</sql>
<select id="selectEquCheckItemDetailList" parameterType="EquCheckItemDetail" resultMap="EquCheckItemDetailResult">
@ -160,4 +162,4 @@
where parent_code = (
select item_code from equ_check_item where item_id = #{itemId} )
</delete>
</mapper>
</mapper>

@ -26,7 +26,10 @@
</resultMap>
<sql id="selectEquOrderDetailVo">
select id, code, order_code, parent_code, item_code, item_name, item_method, item_type, item_type_name, factroy_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_order_detail
select id, code, order_code, parent_code, item_code, item_name, item_method,
item_type, item_type_name, factroy_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
from equ_order_detail
</sql>
<select id="selectEquOrderDetailList" parameterType="EquOrderDetail" resultMap="EquOrderDetailResult">
@ -106,6 +109,25 @@
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertEquOrderDetails">
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
<foreach collection="list" index="index" item="item" separator=",">
(
#{item.id},#{item.parentCode},
#{item.itemCode},#{item.itemName},#{item.itemMethod},
#{item.itemType},#{item.itemTypeName},#{item.factroyCode},#{item.delFlag},
#{item.createBy},#{item.createTime}
)
</foreach>
</insert>
<update id="updateEquOrderDetail" parameterType="EquOrderDetail">
update equ_order_detail
@ -141,4 +163,4 @@
#{id}
</foreach>
</delete>
</mapper>
</mapper>

@ -89,6 +89,18 @@
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertEquOrderEqus">
insert into equ_order_equ(
id,order_code,equipment_code, equipment_name,
factory_code,del_flag, create_by, create_time
)values
<foreach collection="list" index="index" item="item" separator=",">
(
#{item.id},#{item.code},#{item.equipmentCode},#{item.equipmentName},
#{item.factoryCode},#{item.delFlag},#{item.createBy},#{item.createTime}
)
</foreach>
</insert>
<update id="updateEquOrderEqu" parameterType="EquOrderEqu">
update equ_order_equ
@ -121,4 +133,4 @@
#{id}
</foreach>
</delete>
</mapper>
</mapper>

@ -42,7 +42,12 @@
</resultMap>
<sql id="selectEquOrderVo">
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
</sql>
<select id="selectEquOrderList" parameterType="EquOrder" resultMap="EquOrderResult">
@ -172,6 +177,8 @@
<if test="repairCode != null">repair_code,</if>
<if test="repairCode != null">repair_code,</if>
<if test="workCode != null">work_code,</if>
<if test="planRestrict != null">plan_restrict,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
@ -208,6 +215,7 @@
<if test="orderInspect != null">#{orderInspect},</if>
<if test="repairCode != null">#{repairCode},</if>
<if test="workCode != null">#{workCode},</if>
<if test="planRestrict != null">#{planRestrict},</if>
</trim>
</insert>
@ -261,4 +269,4 @@
#{orderId}
</foreach>
</delete>
</mapper>
</mapper>

@ -21,7 +21,9 @@
</resultMap>
<sql id="selectEquOrderPersonVo">
select id, order_code, user_id, user_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_order_person
select id, order_code, user_id, user_name, factory_code, attr1, attr2, attr3,
del_flag, create_by, create_time, update_by, update_time
from equ_order_person
</sql>
<select id="selectEquOrderPersonList" parameterType="EquOrderPerson" resultMap="EquOrderPersonResult">
@ -80,6 +82,21 @@
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertEquOrderPlans">
insert into equ_order_person
(
id, order_code, user_id, user_name, factory_code,
del_flag, create_by, create_time
)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(
#{item.id},#{item.planCode},
#{item.userId},#{item.userName},#{item.factroyCode},
#{item.delFlag},#{item.createBy},#{item.createTime}
)
</foreach>
</insert>
<update id="updateEquOrderPerson" parameterType="EquOrderPerson">
update equ_order_person
@ -110,4 +127,4 @@
#{id}
</foreach>
</delete>
</mapper>
</mapper>

@ -37,7 +37,11 @@
</resultMap>
<sql id="selectEquOrderStandardVo">
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
</sql>
<select id="selectEquOrderStandardList" parameterType="EquOrderStandard" resultMap="EquOrderStandardResult">
@ -152,6 +156,21 @@
)
</foreach>
</insert>
<insert id="insertEquOrderStandards">
insert into equ_order_standard(
id, parent_code, order_code, standard_type, standard_name,
detail_up_limit, detail_down_limit,detail_unit,
factory_code,del_flag, create_by, create_time,fault_type
)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(
#{item.id},#{item.parentCode},#{item.planCode},#{item.standardType},#{item.standardName},
#{item.detailUpLimit},#{item.detailDownLimit},#{item.detailUnit},
#{item.factroyCode},#{item.delFlag},#{item.createBy},#{item.createTime}
)
</foreach>
</insert>
<update id="updateEquOrderStandard" parameterType="EquOrderStandard">
update equ_order_standard

@ -28,7 +28,10 @@
</resultMap>
<sql id="selectEquPlanDetailVo">
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
</sql>
<select id="selectEquPlanDetailList" parameterType="EquPlanDetail" resultMap="EquPlanDetailResult">
@ -160,4 +163,4 @@
<delete id="delEquPlanDetailByPlanCode">
update equ_plan_detail set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>
</mapper>

@ -23,12 +23,15 @@
</resultMap>
<sql id="selectEquPlanEquVo">
select id, code, parent_code,plan_code, equipment_code, equipment_name, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_equ
select id, code, parent_code,plan_code, equipment_code, equipment_name, factory_code,
attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time
from equ_plan_equ
</sql>
<select id="selectEquPlanEquList" parameterType="EquPlanEqu" resultMap="EquPlanEquResult">
<include refid="selectEquPlanEquVo"/>
<where>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
@ -129,4 +132,4 @@
<delete id="delEquPlanEquByPlanCode">
update equ_plan_equ set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>
</mapper>

@ -21,7 +21,9 @@
</resultMap>
<sql id="selectEquPlanPersonVo">
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
</sql>
<select id="selectEquPlanPersonList" parameterType="EquPlanPerson" resultMap="EquPlanPersonResult">
@ -119,4 +121,4 @@
<delete id="delEquPlanPersonByPlanCode">
update equ_plan_person set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>
</mapper>

@ -27,7 +27,10 @@
</resultMap>
<sql id="selectEquPlanStandardVo">
select id, code, parent_code,plan_code, detail_code, standard_type, standard_name, detail_up_limit, detail_down_limit, detail_unit, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_plan_standard
select id, code, parent_code,plan_code, detail_code, standard_type, standard_name, detail_up_limit,
detail_down_limit, detail_unit, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time,
update_by, update_time
from equ_plan_standard
</sql>
<select id="selectEquPlanStandardList" parameterType="EquPlanStandard" resultMap="EquPlanStandardResult">
@ -155,4 +158,4 @@
<delete id="delEquPlanStandardByPlanCode">
update equ_plan_standard set del_flag = '1' where plan_code = #{planCode}
</delete>
</mapper>
</mapper>

@ -93,6 +93,9 @@ public class MesReportWork extends BaseEntity {
@Excel(name = "工时")
private Long workTime;
@Excel(name = "用人")
private Long useMan;
/** 线体编码 */
@Excel(name = "线体编码")
private String machineCode;
@ -161,6 +164,14 @@ public class MesReportWork extends BaseEntity {
private String feedbackTimeStart;
private String feedbackTimeEnd;
public Long getUseMan() {
return useMan;
}
public void setUseMan(Long useMan) {
this.useMan = useMan;
}
public BigDecimal getQuantitySplit() {
return quantitySplit;
}

@ -56,4 +56,6 @@ public interface MesMapper {
List<Map<String, String>> selectcxjList();
List<Map<String, String>> selectdryingRoomListInfo();
void deleteDateByTableName0(@Param("table")String table,@Param("ymdhms")String ymdhms);
}

@ -241,7 +241,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);
}
}
}

@ -201,5 +201,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from ${table}
where create_time >= #{startDate} and #{endDate}>create_time
</delete>
<delete id="deleteDateByTableName0">
delete from ${table} where #{ymdhms} > CONVERT(varchar(30),creter_time, 120)
</delete>
</mapper>

@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="workTime" column="work_time" />
<result property="useMan" column="use_man" />
<result property="machineCode" column="machine_code" />
<result property="machineName" column="machine_name" />
<result property="teamCode" column="team_code" />
@ -95,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mrw.feedback_time, mrw.record_user, mrw.status, mrw.remark, mrw.work_time, mrw.machine_code,
mrw.machine_name, mrw.team_code, mrw.shift_code, mrw.create_by,
mrw.create_time,mrw.upload_time,mrw.upload_status,mrw.upload_msg,
mrw.use_man,
pow.order_code,pow.quantity_split
from mes_report_work mrw
left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code
@ -455,6 +457,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="workTime != null">work_time,</if>
<if test="useMan != null">use_man,</if>
<if test="machineCode != null">machine_code,</if>
<if test="machineName != null">machine_name,</if>
<if test="teamCode != null">team_code,</if>
@ -490,6 +493,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="workTime != null">#{workTime},</if>
<if test="useMan != null">#{useMan},</if>
<if test="machineCode != null">#{machineCode},</if>
<if test="machineName != null">#{machineName},</if>
<if test="teamCode != null">#{teamCode},</if>
@ -528,6 +532,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="workTime != null">work_time = #{workTime},</if>
<if test="useMan != null">use_man = #{useMan},</if>
<if test="machineCode != null">machine_code = #{machineCode},</if>
<if test="machineName != null">machine_name = #{machineName},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>

@ -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());
}

@ -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<WCSDTO> getLGInfo(WCSDTO wcsDTO);
}

@ -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<WCSDTO> getLGInfo(WCSDTO wcsDTO);
}

@ -210,6 +210,12 @@ public class OpenServiceImpl implements OpenService {
return R.ok();
}
@Override
public List<WCSDTO> 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();

@ -109,5 +109,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
unit
from pro_order_workorder where workorder_code = #{workorderCode}
</select>
<select id="getLGInfo" resultType="com.op.system.api.domain.dto.WCSDTO">
SELECT pw.workorder_id workorderId,
pw.bucket_code bucketCode,
pw.material_code materialCode,
pw.material_name materialName,
pw.shift_id shiftId,
pow.workorder_code workorderCode
from
pro_wet_material_plan_detail pw
left join pro_order_workorder pow on pw.workorder_id = pow.workorder_id
where CONVERT(varchar(10),plan_time, 120) = #{reqTime}
</select>
</mapper>

@ -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;
/** 更新日期 */

@ -150,5 +150,7 @@ public interface ProOrderWorkorderMapper {
List<ProOrderWorkorder> selectProOrderWorkorderByOrderId(String orderId);
int getProSortNo(ProOrder proOrder);
void deleteProOrderWorkorderByOrderIds(String[] orderIds);
}

@ -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");

@ -440,4 +440,12 @@
set del_flag = '1'
where order_id = #{id}
</delete>
<delete id="deleteProOrderWorkorderByOrderIds">
update pro_order_workorder
set del_flag = '1'
where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
</mapper>

Loading…
Cancel
Save