Merge remote-tracking branch 'origin/master'

master
mengjiao
commit 342e2895ec

@ -45,4 +45,7 @@ public interface RemoteMesService {
public R addDatasource(@RequestBody DataSourcePropertyDTO dataSourceProperty);
@PostMapping("/reportWork/removeDatasource")
public R removeDatasource(@RequestBody DataSourcePropertyDTO dataSourceProperty);
@PostMapping("/wcsInterface/changeTransferResultTask")
public R changeTransferResultTask();
}

@ -66,6 +66,13 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R removeDatasource(DataSourcePropertyDTO dataSourceProperty) {
return R.fail("mes数据源删除失败:" + throwable.getMessage());
}
@Override
public R changeTransferResultTask() {
return R.fail("交接班修改信息失败:" + throwable.getMessage());
}
};
}
}

@ -56,6 +56,12 @@ public class RyTask {
remoteSapService.shopOrderSync(sapProOrder);
}
//班次切换时修正最后一条数据每天8点执行
public void changeTransferResultTask(){
logger.info("++MES管理系统+交接班修正任务+开始++changeTransferResultTask+++++");
remoteMesService.changeTransferResultTask();
}
/**22
* 16
* 0 00 22 * * ?

@ -1,24 +1,25 @@
package com.op.mes.controller;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.mes.mapper.MesMapper;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.mes.service.IWCSInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* WCS
@ -32,6 +33,8 @@ public class WCSInterfaceController extends BaseController {
@Autowired
private IWCSInterfaceService wCInterfaceService;
@Autowired
private MesMapper mesMapper;
/**
@ -152,5 +155,8 @@ public class WCSInterfaceController extends BaseController {
return success(wCInterfaceService.dryRoomDataCarousel(boardDTO));
}
@PostMapping("/changeTransferResultTask")
public AjaxResult changeTransferResultTask() {
return wCInterfaceService.changeTransferResultTask();
}
}

@ -1,10 +1,40 @@
package com.op.mes.domain;
import java.util.Date;
//班次实体类
public class MesShift {
private Integer shiftId;
private String shiftDesc;
private Date startTime;
private Date endTime;
private String deviceCode;
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "ProShift{" +

@ -110,6 +110,61 @@ public class MesStationArrive extends BaseEntity {
@Excel(name = "状态")
private String status;
private Date startTime;
private Date endTime;
private Integer shiftId;
private String changeOrderWorkId;
private Date changeTime;
private Date changeWorkDate;
public Date getChangeWorkDate() {
return changeWorkDate;
}
public void setChangeWorkDate(Date changeWorkDate) {
this.changeWorkDate = changeWorkDate;
}
public Date getChangeTime() {
return changeTime;
}
public void setChangeTime(Date changeTime) {
this.changeTime = changeTime;
}
public String getChangeOrderWorkId() {
return changeOrderWorkId;
}
public void setChangeOrderWorkId(String changeOrderWorkId) {
this.changeOrderWorkId = changeOrderWorkId;
}
public Integer getShiftId() {
return shiftId;
}
public void setShiftId(Integer shiftId) {
this.shiftId = shiftId;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getStatus() {
return status;
}

@ -1,9 +1,7 @@
package com.op.mes.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.mes.domain.MesBoard;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.ProOrderWorkorder;
import com.op.mes.domain.*;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.system.api.domain.SysDept;
@ -11,6 +9,7 @@ import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataItemsDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import com.op.system.api.domain.quality.QcCheckTaskDTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
@ -97,4 +96,14 @@ public interface MesMapper {
List<BoardDTO> getHFQcInfo(BoardDTO boardDTO);
List<BoardDTO> getHFxlInfo(BoardDTO boardDTO);
String getStartTime(BaseEquipmentDto dto);
List<MesStationArrive> getUnChangeList(MesStationArrive dto);
List<MesShift> getChangeInfos(BaseEquipmentDto dto);
ProOrderWorkorderDTO getActOrderWork(MesStationArrive qo);
int updateTransferResult(@Param("list") List<MesStationArrive> todoList);
}

@ -41,4 +41,5 @@ public interface IWCSInterfaceService {
Map dryRoomDataCarousel(BoardDTO boardDTO);
AjaxResult changeTransferResultTask();
}

@ -9,9 +9,10 @@ import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.core.utils.http.HttpUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.*;
import com.op.mes.domain.buffer.JsonRootBean;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.mes.domain.dto.LGInfoDto;
import com.op.mes.mapper.MesMapper;
import com.op.mes.mapper.MesReportWorkConsumeMapper;
@ -21,13 +22,12 @@ import com.op.mes.service.IWCSInterfaceService;
import com.op.system.api.RemoteSapService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import com.op.system.api.domain.mes.ProRfidProcessDetail;
import com.op.system.api.domain.sap.SapCloseOrderQuery;
import com.op.system.api.domain.sap.SapRFW;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@ -47,7 +47,8 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* wcs
*
@ -638,4 +639,86 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return map;
}
/**白坯工厂,修正设备**/
@Override
public AjaxResult changeTransferResultTask() {
// 加载sf-cloud库的sys_datasource
DynamicDataSourceContextHolder.push("ds_999");// 这是数据源的key
BaseEquipmentDto edto = new BaseEquipmentDto();
edto.setEquipmentTypeCode("equTypeCxj");
List<BaseEquipmentDto> cxjList = mesMapper.getAllEquipments(edto);
ExecutorService executorService = new ThreadPoolExecutor(
cxjList.size(),
cxjList.size(),
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
try {
cxjList.forEach(cxj -> {
Runnable run = () -> changeTransferResultFunc(cxj);
executorService.execute(run);
});
} catch (Exception e) {
logger.error("service == changeTransferResultTask == exception", e);
return error("service == changeTransferResultTask == exception");
} finally {
executorService.shutdown();
}
return success();
}
/**
* T-1mes_material_transfer_result
* @param cxj
*/
private R changeTransferResultFunc(BaseEquipmentDto cxj){
logger.info("++++++++++++" + cxj.getEquipmentCode() + "++++班次交接最后一车数据修正++++++++++");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
LocalDate today = LocalDate.now();
String ymdT0 = today.format(formatter); // 格式化今天的日期
LocalDate yesterday = today.minusDays(1);
String ymd = yesterday.format(formatter); // 格式化昨天的日期
cxj.setYmd("'"+ymdT0+"','"+ymd+"'");
List<MesShift> changeInfos = mesMapper.getChangeInfos(cxj);
if(CollectionUtils.isEmpty(changeInfos)){
logger.info("++++++++++++班次交接最后一车数据修正:无数据++++++++++"+JSONObject.toJSONString(cxj));
return R.fail("班次交接最后一车数据修正:无数据");
}
List<MesStationArrive> todoList = new ArrayList<>();
for(int m=0;m<changeInfos.size()-1;m++){
Date startTime = changeInfos.get(m).getStartTime();
Date endTime = changeInfos.get(m+1).getStartTime();
MesStationArrive qo = new MesStationArrive();
qo.setShiftId(changeInfos.get(m).getShiftId());
qo.setStartTime(startTime);
qo.setEndTime(endTime);
qo.setStationNo(cxj.getEquipmentCode());//成型机编码
logger.info("++++++++++++班次交接最后一车数据修正:开始修正++++++++++"+JSONObject.toJSONString(qo));
List<MesStationArrive> todos1 = mesMapper.getUnChangeList(qo);//需要调整的数据
todoList.addAll(todos1);
if(!CollectionUtils.isEmpty(todoList)){
continue;
}
qo.setReqCode(ymd);//工单日期
ProOrderWorkorderDTO actOrderWork = mesMapper.getActOrderWork(qo);
if(actOrderWork != null){//给需要调整的数据重新赋值新的班次工单Id
Date nowDate = DateUtils.getNowDate();
for(MesStationArrive newtodo:todoList){
newtodo.setChangeOrderWorkId(actOrderWork.getWorkorderId());
newtodo.setShiftId(Integer.parseInt(actOrderWork.getShiftId()));
newtodo.setChangeWorkDate(actOrderWork.getProductDate());
newtodo.setChangeTime(nowDate);
}
}
/**mes_material_transfer_result**/
int n = mesMapper.updateTransferResult(todoList);
logger.info("++++++++++++班次交接最后一车数据修正:修正成功"+n+"++++++++++"+JSONObject.toJSONString(todoList));
}
logger.info("++++++++++++班次交接最后一车数据修正:数据条数++++++++++"+todoList.size());
return R.fail("班次交接最后一车数据修正:完成");
}
}

@ -588,6 +588,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
List<MesMachineReport> dbMProductList = mesReportWorkMapper.getMachineProductionList(mesMachineReport);
List<Map<String, Object>> results = listDate.stream()
.map(date -> {
Map<String, Object> row = new HashMap<>();

@ -55,6 +55,16 @@
)
</foreach>
</insert>
<update id="updateTransferResult">
<foreach collection="list" item="item" separator=";">
update mes_material_transfer_result
set change_order = #{item.changeOrderWorkId},
change_shift_id = #{item.shiftId},
change_time = #{item.changeTime},
change_work_date = #{item.changeWorkDate}
where id = #{item.recordId}
</foreach>
</update>
<delete id="deleteDateByTableName">
delete from ${table} where #{ymdhms} > CONVERT(varchar(30),create_time, 120)
@ -405,5 +415,36 @@
GROUP BY device_code
) t2 on t1.equCode = t2.equCode
</select>
<select id="getStartTime" resultType="java.lang.String">
select remark from base_dict_data
where dict_type= 'change_shift_time'
and dict_value = concat('time_',#{equipmentCode})
</select>
<select id="getUnChangeList" resultType="com.op.mes.domain.MesStationArrive">
select id recordId,equipmentCode,OrderCode,shift_id,work_date
from mes_material_transfer_result mmtr
where mmtr.equipmentCode = #{stationNo}
and mmtr.update_time >= #{startTime} and #{endTime}> mmtr.update_time
and shift_id != #{shiftId}
</select>
<select id="getChangeInfos" resultType="com.op.mes.domain.MesShift">
select * from(
select shift_code shiftId,min(change_time) startTime,work_date,device_code deviceCode
from mes_changeshift_info
where device_code = #{equipmentCode}
and work_date in (${ymd})
group by shift_code,work_date,device_code
) t order by t.startTime
</select>
<select id="getActOrderWork" resultType="com.op.system.api.domain.mes.ProOrderWorkorderDTO">
select top 1 workorder_id workorderId,
shift_id shiftId,
product_date productDate,
prod_line_code prodLineCode
from pro_order_workorder
where shift_id=#{shiftId} and product_date = #{reqCode} and del_flag='0'
and prod_line_code like concat('%"',#{stationNo},'"%')
order by create_time desc
</select>
</mapper>

@ -754,8 +754,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pow.product_name productName,
mt.ymd ymd
FROM
(
SELECT CONVERT( VARCHAR ( 10 ), mtr.update_time, 20 ) ymd,mtr.OrderCode
(
SELECT CONVERT(VARCHAR ( 10 ), mtr.update_time, 20 ) ymd,mtr.OrderCode
FROM mes_material_transfer_result mtr
LEFT JOIN base_equipment equ ON mtr.equipmentCode = equ.equipment_code
WHERE
@ -763,7 +763,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND equ.equipment_type_code = 'equ_type_cxj'
<if test="productDateStart != null "> and CONVERT(varchar(30),mtr.update_time, 120) &gt;= #{productDateStart}</if>
<if test="productDateEnd != null "> and #{productDateEnd} &gt; CONVERT(varchar(30),mtr.update_time, 120)</if>
) mt
) mt
LEFT JOIN pro_order_workorder pow ON pow.workorder_id = mt.OrderCode
WHERE pow.order_code IS NOT NULL
<if test="shiftId != null and shiftId != ''">

@ -179,6 +179,19 @@ public class QuaController extends BaseController {
}
return success(qcProCheckService.getCheckTaskDetailList(qcCheckTaskDetail));
}
/**
*
*/
@GetMapping(value = "getWeightInfo")
public AjaxResult getWeightInfo(QcCheckTaskDetail qcCheckTaskDetail) {
if(StringUtils.isBlank(qcCheckTaskDetail.getFactoryCode())){
return error("[factoryCode]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskDetail.getRecordId())){
return error("[recordId]不能为空");
}
return success(qcProCheckService.getWeightInfo(qcCheckTaskDetail));
}
/**
*

@ -141,6 +141,15 @@ public class QcCheckTaskDetail extends BaseEntity {
private String itemType;
private String judgeRate;
private String samplePlan;
private String weight;
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getSamplePlan() {
return samplePlan;

@ -2,6 +2,7 @@ package com.op.quality.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.domain.R;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcProCheck;
import org.apache.ibatis.annotations.Mapper;
@ -41,4 +42,5 @@ public interface QcProCheckMapper {
List<QcProCheck> getHFnames(QcProCheck qcProCheck);
String getWeightInfo(QcCheckTaskDetail qcCheckTaskDetail);
}

@ -43,4 +43,6 @@ public interface QcProCheckService {
List<QcProCheck> selectQcCheckList(QcProCheck qcProCheck);
ChartSeriesDTO getHfChartData(QcProCheck qcProCheck);
String getWeightInfo(QcCheckTaskDetail qcCheckTaskDetail);
}

@ -215,4 +215,10 @@ public class QcProCheckServiceImpl implements QcProCheckService {
return dto;
}
@Override
public String getWeightInfo(QcCheckTaskDetail qcCheckTaskDetail) {
DynamicDataSourceContextHolder.push(qcCheckTaskDetail.getFactoryCode());
return qcProCheckMapper.getWeightInfo(qcCheckTaskDetail);
}
}

@ -152,7 +152,8 @@
td.defect_quality defectQuality,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
qctp.sample
qctp.sample,
qctp.weight
from qc_check_task_detail td
left join qc_check_type_project qctp on td.type_project_id = qctp.id
where td.belong_to = #{belongTo} and td.del_flag='0' and qctp.del_flag = '0' and td.rule_name is not null

@ -386,5 +386,9 @@
) ok on alls.machineCode = ok.machineCode
order by alls.machineName
</select>
<select id="getWeightInfo" resultType="java.lang.String">
select actual_value from qc_check_task_detail
where record_id = #{recordId}
</select>
</mapper>

Loading…
Cancel
Save