tags/yfai-mes-ext-v1.0
王杰 2 years ago
parent ffaf869cfe
commit 57c6ee06fb

@ -0,0 +1,58 @@
package cn.estsh.i3plus.ext.mes.api.base.jx;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesTimeSegmentStatistics;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import java.text.ParseException;
/**
* @Description :
* @Reference :
* @Author : jiaqi.hou
* @CreateDate : 2023/02/06 13:42
* @Modify:
**/
public interface IJxTimeSegmentStatisticsService {
/**
*
* @param timeSegmentStatistics
* @param userName
* @return
*/
void insert(MesTimeSegmentStatistics timeSegmentStatistics, String organizeCode, String userName) throws ParseException;
/**
*
* @param ids
*/
void deleteByIds(Long[] ids, String userName);
/**
*
* @param timeSegmentStatistics
*/
void update(MesTimeSegmentStatistics timeSegmentStatistics, String organizeCode, String userName) throws ParseException;
/**
*
* @param ids
*/
void doDisable(Long[] ids, String userName);
/**
*
* @param ids
*/
void doEnable(Long[] ids, String organizeCode, String userName);
/**
*
* @param timeSegmentStatistics
* @param pager
* @return
*/
ListPager<MesTimeSegmentStatistics> queryByPager(MesTimeSegmentStatistics timeSegmentStatistics, Pager pager);
}

@ -0,0 +1,127 @@
package cn.estsh.i3plus.ext.mes.apiservice.controller.base.jx;
import cn.estsh.i3plus.ext.mes.api.base.jx.IJxTimeSegmentStatisticsService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesTimeSegmentStatistics;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.impp.framework.base.controller.BaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description :controller
* @Reference :
* @Author : jiaqi.hou
* @CreateDate : 2023/02/06 09:59
* @Modify:
**/
@RestController
@RequestMapping(CommonConstWords.BASE_URL_MES)
@Api(tags = "分时段统计方式controller")
public class JxTimeSegmentStatisticsController extends BaseController {
@Autowired
private IJxTimeSegmentStatisticsService timeSegmentStatisticsService;
@PostMapping(value = "/ext/jx/time-segment-statistics/insert")
@ApiOperation(value = "新增")
public ResultBean insert(MesTimeSegmentStatistics segmentStatistics) {
try {
ValidatorBean.checkNotNull(segmentStatistics.getShiftCode(),"班次不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getStartTime(),"开始时间不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getEndTime(),"结束时间不能为空");
timeSegmentStatisticsService.insert(segmentStatistics, AuthUtil.getOrganize().getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
return ResultBean.success("新增成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@DeleteMapping(value = "/ext/jx/time-segment-statistics/delete-by-ids")
@ApiOperation(value = "删除")
public ResultBean deleteByIds(Long[] ids) {
try {
ValidatorBean.checkNotNull(ids,"id不能为空");
timeSegmentStatisticsService.deleteByIds(ids, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("删除成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@PutMapping(value = "/ext/jx/time-segment-statistics/update")
@ApiOperation(value = "修改")
public ResultBean update(MesTimeSegmentStatistics segmentStatistics) {
try {
ValidatorBean.checkNotNull(segmentStatistics.getId(),"id不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getShiftCode(),"班次不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getStartTime(),"开始时间不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getEndTime(),"结束时间不能为空");
timeSegmentStatisticsService.update(segmentStatistics, AuthUtil.getOrganize().getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@PutMapping(value = "/ext/jx/time-segment-statistics/do-disable")
@ApiOperation(value = "禁用")
public ResultBean doDisable(Long[] ids) {
try {
ValidatorBean.checkNotNull(ids,"id不能为空");
timeSegmentStatisticsService.doDisable(ids, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("禁用成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@PutMapping(value = "/ext/jx/time-segment-statistics/do-enable")
@ApiOperation(value = "启用")
public ResultBean doEnable(Long[] ids) {
try {
ValidatorBean.checkNotNull(ids,"id不能为空");
timeSegmentStatisticsService.doEnable(ids, AuthUtil.getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
return ResultBean.success("启用成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping(value = "/ext/jx/time-segment-statistics/query-by-pager")
@ApiOperation(value = "查询")
public ResultBean queryByPager(MesTimeSegmentStatistics partCheck, Pager pager) {
try {
partCheck.setOrganizeCode(AuthUtil.getOrganizeCode());
ListPager<MesTimeSegmentStatistics> result = timeSegmentStatisticsService.queryByPager(partCheck, pager);
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setListPager(result);
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -0,0 +1,301 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.jx;
import cn.estsh.i3plus.ext.mes.api.base.jx.IJxTimeSegmentStatisticsService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesTimeSegmentStatistics;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesTimeSegmentStatisticsRepository;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : jiaqi.hou
* @CreateDate : 2023/02/06 13:42
* @Modify:
**/
@Service
public class JxTimeSegmentStatisticsService implements IJxTimeSegmentStatisticsService {
@Autowired
private MesTimeSegmentStatisticsRepository timeSegmentStatisticsRDao;
@Autowired
private EntityManager entityManager;
@Override
public void insert(MesTimeSegmentStatistics statistics, String organizeCode, String userName){
statistics.setOrganizeCode(organizeCode);
//同一班次+开始时间+结束时间范围不允许有重叠的
validateExists(statistics);
//如果休息时间不为空 获取休息消耗的时间 计算出时间长度 单位为分钟
if (!StringUtils.isEmpty(statistics.getRestTime())){
//休息时间需要在开始时间和结束时间之内(包含开始时间和结束时间)
if (whetherTheTargetTimeIsWithinTheCurrentTime(statistics.getStartTime()+"-"+statistics.getEndTime(),statistics.getRestTime())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("休息时间【%s】必须在开始时间【%s】和结束时间【%s】内",
statistics.getRestTime(),statistics.getStartTime(),statistics.getEndTime())
.setErrorSolution("请重新操作!")
.build();
}
//休息的时间(分钟)
long restTimeMin = getDatePoor(statistics.getRestTime());
//总耗时
long sumTime = getDatePoor(statistics.getStartTime()+"-"+statistics.getEndTime());
//实际工作时长 = 总耗时 - 休息时间
statistics.setTimeLength((sumTime - restTimeMin)+"");
}else{
//总耗时
long sumTime = getDatePoor(statistics.getStartTime()+"-"+statistics.getEndTime());
statistics.setTimeLength(sumTime+"");
}
statistics.setTimeSegmentCode(statistics.getShiftCode()+statistics.getStartTime());
statistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelInitialize(statistics, userName);
timeSegmentStatisticsRDao.insert(statistics);
}
@Override
public void deleteByIds(Long[] ids, String userName) {
DdlPackBean hql = new DdlPackBean();
DdlPreparedPack.getInPackList(Arrays.asList(ids), "id", hql);
int count = timeSegmentStatisticsRDao.findByHqlWhereCount(hql);
if (count != ids.length){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.build();
}
timeSegmentStatisticsRDao.deleteByIds(ids);
}
@Override
public void update(MesTimeSegmentStatistics statistics, String organizeCode, String userName){
//同一班次+开始时间+结束时间范围不允许有重叠的
statistics.setOrganizeCode(organizeCode);
validateExists(statistics);
//如果休息时间不为空 获取休息消耗的时间 计算出时间长度 单位为分钟
if (!StringUtils.isEmpty(statistics.getRestTime())){
//休息时间需要在开始时间和结束时间之内(包含开始时间和结束时间)
if (whetherTheTargetTimeIsWithinTheCurrentTime(statistics.getStartTime()+"-"+statistics.getEndTime(),statistics.getRestTime())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("休息时间【%s】必须在开始时间【%s】和结束时间【%s】内",
statistics.getRestTime(),statistics.getStartTime(),statistics.getEndTime())
.setErrorSolution("请重新操作!")
.build();
}
//休息的时间(分钟)
long restTimeMin = getDatePoor(statistics.getRestTime());
//总耗时
long sumTime = getDatePoor(statistics.getStartTime()+"-"+statistics.getEndTime());
//实际工作时长 = 总耗时 - 休息时间
statistics.setTimeLength((sumTime - restTimeMin)+"");
}else{
//总耗时
long sumTime = getDatePoor(statistics.getStartTime()+"-"+statistics.getEndTime());
statistics.setTimeLength(sumTime+"");
}
statistics.setTimeSegmentCode(statistics.getShiftCode()+statistics.getStartTime());
statistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelUpdate(statistics, userName);
timeSegmentStatisticsRDao.update(statistics);
}
@Override
public void doDisable(Long[] ids, String userName) {
DdlPackBean hql = new DdlPackBean();
DdlPreparedPack.getInPackList(Arrays.asList(ids), "id", hql);
int count = timeSegmentStatisticsRDao.findByHqlWhereCount(hql);
if (count != ids.length){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.build();
}
for (Long id : ids) {
timeSegmentStatisticsRDao.updateByProperties(
new String[]{"id"},
new Object[]{id},
new String[]{"isValid", "modifyUser", "modifyDatetime", MesExtConstWords.SYSTEM_SYNC_STATUS},
new Object[]{WmsEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), userName, TimeTool.getNowTime(true), MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue()}
);
}
}
@Override
public void doEnable(Long[] ids, String organizeCode, String userName) {
DdlPackBean hql = new DdlPackBean();
DdlPreparedPack.getInPackList(Arrays.asList(ids), "id", hql);
int count = timeSegmentStatisticsRDao.findByHqlWhereCount(hql);
if (count != ids.length){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.build();
}
List<MesTimeSegmentStatistics> seasonInformationList = timeSegmentStatisticsRDao.findByHqlWhere(hql);
for (MesTimeSegmentStatistics statistics : seasonInformationList) {
validateExists(statistics);
statistics.setIsValid(MesEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
statistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelUpdate(statistics,userName);
timeSegmentStatisticsRDao.update(statistics);
}
}
@Override
public ListPager<MesTimeSegmentStatistics> queryByPager(MesTimeSegmentStatistics partCheck, Pager pager) {
DdlPackBean hql = new DdlPackBean();
DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "isDeleted", hql);
DdlPreparedPack.getStringEqualPack(partCheck.getOrganizeCode(), "organizeCode", hql);
DdlPreparedPack.getStringEqualPack(partCheck.getShiftCode(), "shiftCode", hql);
DdlPreparedPack.getStringEqualPack(partCheck.getWorkCenterCode(), "workCenterCode", hql);
DdlPreparedPack.getStringEqualPack(partCheck.getStartTime(), "startTime", hql);
DdlPreparedPack.getStringEqualPack(partCheck.getEndTime(), "endTime", hql);
DdlPreparedPack.getNumEqualPack(partCheck.getIsValid(), "isValid", hql);
int count = timeSegmentStatisticsRDao.findByHqlWhereCount(hql);
if (count>0){
pager = PagerHelper.getPager(pager,count);
List<MesTimeSegmentStatistics> partCheckList = timeSegmentStatisticsRDao.findByHqlPage(hql, pager);
return new ListPager<>(partCheckList,pager);
}
return new ListPager<>(new ArrayList<>(),pager);
}
void validateExists(MesTimeSegmentStatistics statistics) {
StringBuffer sbf = new StringBuffer("select statistics from MesTimeSegmentStatistics statistics where 1=1");
sbf.append(" and (");
sbf.append("(statistics.startTime<=:startTime and statistics.endTime>=:startTime)");//开始时间在两者之中
sbf.append(" or ");
sbf.append(" (statistics.startTime<=:endTime and statistics.endTime>=:endTime) ");//结束时间在两者之中
sbf.append(" or ");
sbf.append(" (statistics.startTime>=:startTime and statistics.endTime<=:endTime) ");// 结束时间开始时间之外
sbf.append(" or ");
sbf.append(" (statistics.startTime=:startTime and statistics.endTime=:endTime) ");// 结束时间开始时间之外
sbf.append(")");
sbf.append(" and statistics.shiftCode=:shiftCode");
sbf.append(" and statistics.workCenterCode=:workCenterCode");
sbf.append(" and statistics.organizeCode=:organizeCode");
sbf.append(" and statistics.isValid=:isValid");
sbf.append(" and statistics.isDeleted=:isDeleted");
if (statistics.getId() != null) {
sbf.append(" and statistics.id !=:id");
}
Query query = entityManager.createQuery(sbf.toString(), MesTimeSegmentStatistics.class);
query.setParameter("organizeCode", statistics.getOrganizeCode());
query.setParameter("isDeleted", CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
query.setParameter("isValid", CommonEnumUtil.IS_VAILD.VAILD.getValue());
query.setParameter("startTime", statistics.getStartTime());
query.setParameter("endTime", statistics.getEndTime());
query.setParameter("shiftCode", statistics.getShiftCode());
query.setParameter("workCenterCode", statistics.getWorkCenterCode());
if (statistics.getId() != null) {
query.setParameter("id", statistics.getId());
}
List<MesTimeSegmentStatistics> segmentStatisticsList = query.setMaxResults(1).getResultList();
if (!CollectionUtils.isEmpty(segmentStatisticsList)) {
MesTimeSegmentStatistics segmentStatistics = segmentStatisticsList.get(0);
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("已存在班次【%s】开始时间【%s】,结束时间【%s】不可交叉维护",
segmentStatistics.getShiftCode(),
segmentStatistics.getStartTime(),
segmentStatistics.getEndTime())
.setErrorSolution("请重新操作")
.build();
}
}
public static long getDatePoor(String time){
Date date;
Date date2;
try {
String[] split = time.split("-");
SimpleDateFormat df = new SimpleDateFormat("HH:mm");//设置日期格式
date =df.parse(split[0]);
date2 =df.parse(split[1]);
}catch (Exception e){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("时间格式不正确应该为【mm:ss-mm:ss】")
.setErrorSolution("请重新操作")
.build();
}
// 获得两个时间的毫秒时间差异
long diff = date2.getTime() - date.getTime();
// 计算差多少分钟
return (diff/1000/60);
}
public static boolean whetherTheTargetTimeIsWithinTheCurrentTime(String currentTime,String targetTime){
Date currentTime1;
Date currentTime2;
Date targetTime1;
Date targetTime2;
try {
String[] currentTimeSplit = currentTime.split("-");
String[] targetTimeSplit = targetTime.split("-");
SimpleDateFormat df = new SimpleDateFormat("HH:mm");//设置日期格式
currentTime1 =df.parse(currentTimeSplit[0]);
currentTime2 =df.parse(currentTimeSplit[1]);
targetTime1 = df.parse(targetTimeSplit[0]);;
targetTime2 = df.parse(targetTimeSplit[1]);;
}catch (Exception e){
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("时间格式不正确应该为【mm:ss-mm:ss】")
.setErrorSolution("请重新操作")
.build();
}
if ((currentTime1.before(targetTime1)&&currentTime1.before(targetTime2) &&
targetTime1.before(currentTime2)&&targetTime2.before(currentTime2))
|| (currentTime1.compareTo(targetTime1)==0 &&
(currentTime2.compareTo(targetTime2)==0 || currentTime2.compareTo(targetTime2)>0))) {
return false;
}
return true;
}
}

@ -0,0 +1,110 @@
package cn.estsh.i3plus.ext.mes.pojo.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
/**
* @Description:
* @Reference:
* @Author: wangjie
* @CreateDate: 2023\02\10 09:45
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "MES_OUT_PUT_STATISTICS_TIME_SEGMENT", indexes = {
@Index(columnList = "WORK_ORDER_NO,WORK_TIME,TIME_SEGMENT_CODE"),
@Index(columnList = "WORK_ORDER_NO,WORK_TIME"),
@Index(columnList = "WORK_ORDER_NO"),
@Index(columnList = "WORK_CENTER_CODE"),
@Index(columnList = "PART_NO"),
@Index(columnList = "SHIFT_CODE"),
@Index(columnList = "WORK_TIME"),
@Index(columnList = "WORK_ORDER_TYPE")
})
@NoArgsConstructor
@AllArgsConstructor
@Api("分时产量统计表")
public class MesOutPutStatisticsTimeSegment extends BaseBean implements Serializable {
private static final long serialVersionUID = 209085242707461269L;
@Column(name = "SYSTEM_SYNC_STATUS")
@ColumnDefault("2")
@ApiParam(value = "系统同步标志")
public Integer systemSyncStatus = 2;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("产线代码")
private String workCenterCode;
@Column(name = "SHIFT_CODE")
@ApiParam("班次代码")
private String shiftCode;
@Column(name = "WORK_TIME")
@ApiParam("作业时间")
private String workTime;
@Column(name = "WORK_ORDER_NO")
@ApiParam("生产工单号")
private String workOrderNo;
@Column(name = "PART_NO")
@ApiParam("物料号")
private String partNo;
@Column(name = "PART_NAME_RDD")
@ApiParam("物料名称")
private String partNameRdd;
@Column(name = "START_TIME")
@ApiParam("开始时间")
private String startTime;
@Column(name = "END_TIME")
@ApiParam("结束时间")
private String endTime;
@Column(name = "QTY", columnDefinition = "decimal(18,8)")
@ColumnDefault("0")
@ApiParam("产量")
private Double qty;
@Column(name = "PLAN_QTY", columnDefinition = "decimal(18,8)")
@ColumnDefault("0")
@ApiParam("工单计划数量")
private Double planQty;
@Column(name = "WORK_ORDER_TYPE")
@ApiParam("工单类型")
private Integer workOrderType;
@Column(name = "TIME_SEGMENT_CODE")
@ApiParam("分时代码")
private String timeSegmentCode;
@Column(name = "TIME_SEGMENT_START_TIME")
@ApiParam("分时开始时间")
private String timeSegmentsStartTime;
@Column(name = "TIME_SEGMENT_END_TIME")
@ApiParam("分时结束时间")
private String timeSegmentEndTime;
}

@ -0,0 +1,70 @@
package cn.estsh.i3plus.ext.mes.pojo.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @DESCRIPTION: MES_
* @USER: wangjie
* @DATE: 2023-02-03 16:11
*/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_TIME_SEGMENT_STATISTICS", indexes = {
@Index(columnList = "SYSTEM_SYNC_STATUS"),
@Index(columnList = "WORK_CENTER_CODE, SHIFT_CODE")
})
@Api("MES_分时段统计方式表")
public class MesTimeSegmentStatistics extends BaseBean implements Serializable {
private static final long serialVersionUID = 1366427224064250379L;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("工作中心代码")
private String workCenterCode;
@Column(name = "SHIFT_CODE")
@ApiParam("班次")
private String shiftCode;
@Column(name = "START_TIME")
@ApiParam("开始时间")
private String startTime;
@Column(name = "END_TIME")
@ApiParam("结束时间")
private String endTime;
@Column(name = "REST_TIME")
@ApiParam("休息时间")
private String restTime;
@Column(name = "TIME_LENGTH")
@ApiParam("实际工作时间长度(分钟)")
private String timeLength;
@Column(name = "TIME_SEGMENT_CODE")
@ApiParam("分时代码(方便统计)")
private String timeSegmentCode;
@Column(name = "SYSTEM_SYNC_STATUS")
@ColumnDefault("2")
@ApiParam(value = "系统同步标志")
public Integer systemSyncStatus = 2;
}

@ -0,0 +1,15 @@
package cn.estsh.i3plus.ext.mes.pojo.repository;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesOutPutStatisticsTimeSegment;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import org.springframework.stereotype.Repository;
/**
* @Description: RDao
* @Author: wangjie
* @Date: 2023/01/10 09:46
* @Modify:
*/
@Repository
public interface MesOutPutStatisticsTimeSegmentRepository extends BaseRepository<MesOutPutStatisticsTimeSegment,Long> {
}

@ -0,0 +1,9 @@
package cn.estsh.i3plus.ext.mes.pojo.repository;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesTimeSegmentStatistics;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface MesTimeSegmentStatisticsRepository extends BaseRepository<MesTimeSegmentStatistics, Long> {
}
Loading…
Cancel
Save