tags/yfai-mes-ext-v1.0
王杰 1 year ago
parent 72ed1f52de
commit d607f51cc3

@ -4,55 +4,70 @@ 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;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : jiaqi.hou
* @Author : wangjie
* @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;
ListPager<MesTimeSegmentStatistics> queryTimeSegmentStatisticsByPager(MesTimeSegmentStatistics timeSegmentStatistics, Pager pager);
/**
*
* @param ids
*
*/
void deleteByIds(Long[] ids, String userName);
void insertTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics);
/**
*
* @param timeSegmentStatistics
*/
void update(MesTimeSegmentStatistics timeSegmentStatistics, String organizeCode, String userName) throws ParseException;
void updateTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics);
/**
*
* @param ids
*/
void doDisable(Long[] ids, String userName);
/**
*
* @param ids
*/
void doEnable(Long[] ids, String organizeCode, String userName);
/**
*
* @param timeSegmentStatistics
* @param pager
* @return
*
*/
void deleteByIds(Long[] ids, String userName);
/**
*
*/
Boolean checkTimeFormat(String time);
/**
*
*/
Boolean checkTimeStartBeforeEnd(String startTime, String endTime);
/**
*
*/
MesTimeSegmentStatistics checkTimeCompareToDataList(List<MesTimeSegmentStatistics> timeSegmentStatisticsList, MesTimeSegmentStatistics timeSegmentStatistics);
/**
*
*/
String getTimeLength(String startTime, String endTime, String today);
/**
*
*/
ListPager<MesTimeSegmentStatistics> queryByPager(MesTimeSegmentStatistics timeSegmentStatistics, Pager pager);
String getTimeSegmentCode(MesTimeSegmentStatistics timeSegmentStatistics);
}

@ -2,6 +2,7 @@ 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.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -18,30 +19,27 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description :controller
* @Description :线
* @Reference :
* @Author : jiaqi.hou
* @Author : wangjie
* @CreateDate : 2023/02/06 09:59
* @Modify:
**/
@RestController
@RequestMapping(CommonConstWords.BASE_URL_MES)
@Api(tags = "分时段统计方式controller")
@Api(tags = "嘉兴生产线班次分时统计配置")
public class JxTimeSegmentStatisticsController extends BaseController {
@Autowired
private IJxTimeSegmentStatisticsService timeSegmentStatisticsService;
@PostMapping(value = "/ext/jx/time-segment-statistics/insert")
@ApiOperation(value = "新增")
public ResultBean insert(MesTimeSegmentStatistics segmentStatistics) {
@GetMapping(value = "/ext/jx/time-segment-statistics/query-by-pager")
@ApiOperation(value = "查询")
public ResultBean queryTimeSegmentStatisticsByPager(MesTimeSegmentStatistics timeSegmentStatistics, Pager pager) {
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());
timeSegmentStatistics.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
ListPager<MesTimeSegmentStatistics> result = timeSegmentStatisticsService.queryTimeSegmentStatisticsByPager(timeSegmentStatistics, pager);
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setListPager(result);
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
@ -49,13 +47,21 @@ public class JxTimeSegmentStatisticsController extends BaseController {
}
}
@DeleteMapping(value = "/ext/jx/time-segment-statistics/delete-by-ids")
@ApiOperation(value = "删除")
public ResultBean deleteByIds(Long[] ids) {
@PostMapping(value = "/ext/jx/time-segment-statistics/insert")
@ApiOperation(value = "新增")
public ResultBean insertTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics) {
try {
ValidatorBean.checkNotNull(ids,"id不能为空");
timeSegmentStatisticsService.deleteByIds(ids, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("删除成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
ValidatorBean.beginValid(timeSegmentStatistics)
.notNull(MesExtConstWords.WORK_CENTER_CODE, timeSegmentStatistics.getWorkCenterCode())
.notNull(MesExtConstWords.SHIFT_CODE, timeSegmentStatistics.getShiftCode())
.notNull(MesExtConstWords.START_TIME, timeSegmentStatistics.getStartTime())
.notNull(MesExtConstWords.END_TIME, timeSegmentStatistics.getEndTime());
timeSegmentStatistics.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
timeSegmentStatistics.setCreateUser(AuthUtil.getSessionUser().getUserName());
timeSegmentStatisticsService.insertTimeSegmentStatistics(timeSegmentStatistics);
return ResultBean.success("新增成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
} catch (Exception e) {
@ -63,17 +69,20 @@ public class JxTimeSegmentStatisticsController extends BaseController {
}
}
@PutMapping(value = "/ext/jx/time-segment-statistics/update")
@ApiOperation(value = "修改")
public ResultBean update(MesTimeSegmentStatistics segmentStatistics) {
public ResultBean updateTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics) {
try {
ValidatorBean.checkNotNull(segmentStatistics.getId(),"id不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getShiftCode(),"班次不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getStartTime(),"开始时间不能为空");
ValidatorBean.checkNotNull(segmentStatistics.getEndTime(),"结束时间不能为空");
ValidatorBean.beginValid(timeSegmentStatistics)
.notNull(MesExtConstWords.ID, timeSegmentStatistics.getId())
.notNull(MesExtConstWords.WORK_CENTER_CODE, timeSegmentStatistics.getWorkCenterCode())
.notNull(MesExtConstWords.SHIFT_CODE, timeSegmentStatistics.getShiftCode())
.notNull(MesExtConstWords.START_TIME, timeSegmentStatistics.getStartTime())
.notNull(MesExtConstWords.END_TIME, timeSegmentStatistics.getEndTime());
timeSegmentStatisticsService.update(segmentStatistics, AuthUtil.getOrganize().getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
timeSegmentStatistics.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
timeSegmentStatistics.setModifyUser(AuthUtil.getSessionUser().getUserName());
timeSegmentStatisticsService.updateTimeSegmentStatistics(timeSegmentStatistics);
return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException e) {
return ResultBean.fail(e);
@ -110,13 +119,13 @@ public class JxTimeSegmentStatisticsController extends BaseController {
}
}
@GetMapping(value = "/ext/jx/time-segment-statistics/query-by-pager")
@ApiOperation(value = "查询")
public ResultBean queryByPager(MesTimeSegmentStatistics partCheck, Pager pager) {
@DeleteMapping(value = "/ext/jx/time-segment-statistics/delete-by-ids")
@ApiOperation(value = "删除")
public ResultBean deleteByIds(Long[] ids) {
try {
partCheck.setOrganizeCode(AuthUtil.getOrganizeCode());
ListPager<MesTimeSegmentStatistics> result = timeSegmentStatisticsService.queryByPager(partCheck, pager);
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setListPager(result);
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) {

@ -3,6 +3,7 @@ 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.sqlpack.MesExtHqlPack;
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;
@ -13,27 +14,22 @@ 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.text.ParseException;
import java.util.List;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.stream.Collectors;
/**
* @Description :
* @Reference :
* @Author : jiaqi.hou
* @Author : wangjie
* @CreateDate : 2023/02/06 13:42
* @Modify:
**/
@ -41,261 +37,144 @@ import java.util.List;
public class JxTimeSegmentStatisticsService implements IJxTimeSegmentStatisticsService {
@Autowired
private MesTimeSegmentStatisticsRepository timeSegmentStatisticsRDao;
@Autowired
private EntityManager entityManager;
private MesTimeSegmentStatisticsRepository timeSegmentStatisticsRepository;
@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());
public ListPager<MesTimeSegmentStatistics> queryTimeSegmentStatisticsByPager(MesTimeSegmentStatistics timeSegmentStatistics, Pager pager) {
DdlPackBean hqlPack = MesExtHqlPack.getTimeSegmentStatistics(timeSegmentStatistics);
pager = PagerHelper.getPager(pager, timeSegmentStatisticsRepository.findByHqlWhereCount(hqlPack));
hqlPack.setOrderByStr(timeSegmentStatistics.orderBy());
return new ListPager(timeSegmentStatisticsRepository.findByHqlWherePage(hqlPack, pager), pager);
}
//实际工作时长 = 总耗时 - 休息时间
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 insertTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics){
List<MesTimeSegmentStatistics> timeSegmentStatisticsList = timeSegmentStatisticsRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
new Object[]{timeSegmentStatistics.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), timeSegmentStatistics.getWorkCenterCode(), timeSegmentStatistics.getShiftCode()});
checkTimeIsValid(timeSegmentStatisticsList, timeSegmentStatistics);
timeSegmentStatistics.setTimeLength(getTimeLength(timeSegmentStatistics.getStartTime(), timeSegmentStatistics.getEndTime(), TimeTool.getToday()));
timeSegmentStatistics.setTimeSegmentCode(getTimeSegmentCode(timeSegmentStatistics));
timeSegmentStatistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelInitialize(timeSegmentStatistics, timeSegmentStatistics.getCreateUser());
timeSegmentStatisticsRepository.insert(timeSegmentStatistics);
}
@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){
public void updateTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics) {
List<MesTimeSegmentStatistics> timeSegmentStatisticsList = timeSegmentStatisticsRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
new Object[]{timeSegmentStatistics.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), timeSegmentStatistics.getWorkCenterCode(), timeSegmentStatistics.getShiftCode()});
Optional<MesTimeSegmentStatistics> timeSegmentStatisticsDbOp = CollectionUtils.isEmpty(timeSegmentStatisticsList) ? null : timeSegmentStatisticsList.stream().filter(o -> (null != o && o.getId().compareTo(timeSegmentStatistics.getId()) == 0)).findFirst();
if (null == timeSegmentStatisticsDbOp || !timeSegmentStatisticsDbOp.isPresent())
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
.setErrorDetail("ID[%s]记录不存在!", timeSegmentStatistics.getId())
.build();
}
timeSegmentStatisticsRDao.deleteByIds(ids);
timeSegmentStatisticsList = timeSegmentStatisticsList.stream().filter(o -> (null != o && o.getId().compareTo(timeSegmentStatistics.getId()) != 0)).collect(Collectors.toList());
checkTimeIsValid(timeSegmentStatisticsList, timeSegmentStatistics);
MesTimeSegmentStatistics timeSegmentStatisticsDb = timeSegmentStatisticsDbOp.get();
timeSegmentStatisticsDb.setWorkCenterCode(timeSegmentStatistics.getWorkCenterCode());
timeSegmentStatisticsDb.setShiftCode(timeSegmentStatistics.getShiftCode());
timeSegmentStatisticsDb.setStartTime(timeSegmentStatistics.getStartTime());
timeSegmentStatisticsDb.setEndTime(timeSegmentStatistics.getEndTime());
timeSegmentStatisticsDb.setTimeLength(getTimeLength(timeSegmentStatisticsDb.getStartTime(), timeSegmentStatisticsDb.getEndTime(), TimeTool.getToday()));
timeSegmentStatisticsDb.setTimeSegmentCode(getTimeSegmentCode(timeSegmentStatisticsDb));
timeSegmentStatisticsDb.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelUpdate(timeSegmentStatisticsDb, timeSegmentStatistics.getModifyUser());
timeSegmentStatisticsRepository.save(timeSegmentStatisticsDb);
}
@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){
private void checkTimeIsValid(List<MesTimeSegmentStatistics> timeSegmentStatisticsList, MesTimeSegmentStatistics timeSegmentStatistics) {
if (!checkTimeFormat(timeSegmentStatistics.getStartTime()))
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("开始时间[%s]格式错误,请检查时间格式[%s]!", timeSegmentStatistics.getStartTime(), MesExtConstWords.TIME_TRUNCATE_SECOND_FORMAT)
.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){
if (!checkTimeFormat(timeSegmentStatistics.getEndTime()))
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
.setErrorDetail("请检查数据是否全部有效")
.setErrorSolution("请重新操作!")
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("结束时间[%s]格式错误,请检查时间格式[%s]!", timeSegmentStatistics.getEndTime(), MesExtConstWords.TIME_TRUNCATE_SECOND_FORMAT)
.build();
}
List<MesTimeSegmentStatistics> seasonInformationList = timeSegmentStatisticsRDao.findByHqlWhere(hql);
for (MesTimeSegmentStatistics statistics : seasonInformationList) {
validateExists(statistics);
if (!checkTimeStartBeforeEnd(timeSegmentStatistics.getStartTime(), timeSegmentStatistics.getEndTime()))
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("开始时间[%s]必须小于结束时间[%s]!", timeSegmentStatistics.getStartTime(), timeSegmentStatistics.getEndTime())
.build();
String startTime = timeSegmentStatistics.getStartTime();
String endTime = timeSegmentStatistics.getEndTime();
timeSegmentStatistics.setStartTime(startTime + MesExtConstWords.APPEND_SECONDS);
timeSegmentStatistics.setEndTime(endTime + MesExtConstWords.APPEND_SECONDS);
MesTimeSegmentStatistics item = checkTimeCompareToDataList(timeSegmentStatisticsList, timeSegmentStatistics);
if (null != item)
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("开始时间[%s]结束时间[%s]与已维护的生产线[%s]班次代码[%s]配置的开始时间[%s]结束时间[%s]存在时间重叠!",
startTime, endTime, item.getWorkCenterCode(), item.getShiftCode(), item.getStartTime(), item.getEndTime())
.build();
}
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 Boolean checkTimeFormat(String time) { return TimeTool.checkDateFormat(time, MesExtConstWords.TIME_TRUNCATE_SECOND_FORMAT); }
@Override
public Boolean checkTimeStartBeforeEnd(String startTime, String endTime) { return startTime.compareTo(endTime) < 0 ? true : false; }
@Override
public MesTimeSegmentStatistics checkTimeCompareToDataList(List<MesTimeSegmentStatistics> timeSegmentStatisticsList, MesTimeSegmentStatistics timeSegmentStatistics) {
if (CollectionUtils.isEmpty(timeSegmentStatisticsList)) return null;
for (MesTimeSegmentStatistics item : timeSegmentStatisticsList) {
if (StringUtils.isEmpty(item.getStartTime()) || StringUtils.isEmpty(item.getEndTime())) continue;
if (timeSegmentStatistics.getStartTime().compareTo(item.getStartTime()) <= 0 && timeSegmentStatistics.getEndTime().compareTo(item.getStartTime()) > 0) return item;
if (timeSegmentStatistics.getStartTime().compareTo(item.getStartTime()) >= 0 && timeSegmentStatistics.getStartTime().compareTo(item.getEndTime()) < 0) return item;
}
return null;
}
@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);
public String getTimeLength(String startTime, String endTime, String today) {
try {
return String.valueOf(TimeTool.getSecoundsBetweenTime(1, getTimeAppendToday(today, startTime), getTimeAppendToday(today, endTime)));
} catch (ParseException e) {
return null;
}
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();
}
private String getTimeAppendToday(String today, String time) {
return new StringJoiner(MesExtConstWords.ONE_SPACE).add(today).add(time).toString();
}
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);
@Override
public String getTimeSegmentCode(MesTimeSegmentStatistics timeSegmentStatistics) {
return new StringJoiner(MesExtConstWords.COLON).add(timeSegmentStatistics.getWorkCenterCode()).add(timeSegmentStatistics.getShiftCode()).add(timeSegmentStatistics.getStartTime().substring(0, 5)).toString().replaceAll(MesExtConstWords.COLON, MesExtConstWords.EMPTY);
}
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;
@Override
public void doDisable(Long[] ids, String userName) { updateStatusByIds(ids, userName, CommonEnumUtil.IS_VAILD.INVAILD.getValue(), true); }
@Override
public void doEnable(Long[] ids, String organizeCode, String userName) { updateStatusByIds(ids, userName, CommonEnumUtil.IS_VAILD.VAILD.getValue(), true); }
@Override
public void deleteByIds(Long[] ids, String userName) { updateStatusByIds(ids, userName, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), false); }
private void updateStatusByIds(Long[] ids, String userName, int status, Boolean flag) {
for (Long id : ids) {
MesTimeSegmentStatistics timeSegmentStatistics = timeSegmentStatisticsRepository.getById(id);
if (null == timeSegmentStatistics) return;
if (flag && timeSegmentStatistics.getIsValid() == status) return;
if (!flag && timeSegmentStatistics.getIsDeleted() == status) return;
if (flag) timeSegmentStatistics.setIsValid(status);
else timeSegmentStatistics.setIsDeleted(status);
timeSegmentStatistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
ConvertBean.serviceModelUpdate(timeSegmentStatistics, userName);
timeSegmentStatisticsRepository.save(timeSegmentStatistics);
}
return true;
}
}

@ -0,0 +1,268 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.excel.jx;
import cn.estsh.i3plus.ext.mes.api.base.IExcelImportExtService;
import cn.estsh.i3plus.ext.mes.api.base.jx.IJxTimeSegmentStatisticsService;
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.CommonExtService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesTimeSegmentStatistics;
import cn.estsh.i3plus.ext.mes.pojo.model.ExcelImportErrorExtModel;
import cn.estsh.i3plus.ext.mes.pojo.model.ExcelImportResultExtModel;
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.mes.apiservice.util.MesCommonUtil;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.repository.MesWorkCenterRepository;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description :
* @Reference :
* @Author : wangjie
* @CreateDate : 2019-04-23
* @Modify:
**/
@Service
public class JxTimeSegmentStatisticsExcelService implements IExcelImportExtService {
@Autowired
private MesTimeSegmentStatisticsRepository timeSegmentStatisticsRepository;
@Autowired
private IJxTimeSegmentStatisticsService timeSegmentStatisticsService;
@Autowired
private MesWorkCenterRepository workCenterRepository;
@Autowired
private CommonExtService commonExtService;
/**
*
* @param workbook
* @param organizeCode
* @param userName
* @return
*/
@Override
public ExcelImportResultExtModel insertDataByExcel(Workbook workbook, String organizeCode, String userName) {
//读取表格
ExcelImportResultExtModel excelImportResultExtModel = this.sheetExtractMesShiftExt(workbook.getSheetAt(0), organizeCode);
//数据入库
this.insertExcelMesShiftExt(excelImportResultExtModel, userName);
return excelImportResultExtModel;
}
/**
* -
* @param sheetAt
* @param organizeCode
* @return
*/
private ExcelImportResultExtModel sheetExtractMesShiftExt(Sheet sheetAt, String organizeCode) {
//从0行开始读取
int totalNumberOfRows = sheetAt.getLastRowNum() + 1;
//MesTimeSegmentStatistics集合
List<MesTimeSegmentStatistics> timeSegmentStatisticsList = new ArrayList<>();
Map<String, List<MesTimeSegmentStatistics>> dataMap = new HashMap<>();
//成功数量
Integer successRowNum = 0;
//失败数量
Integer failRowNum = 0;
//错误的行号
String errorRows = "";
//错误行信息集合
List<ExcelImportErrorExtModel> excelImportErrorExtModels = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat(MesExtConstWords.TIME_TRUNCATE_SECOND_FORMAT);
List<MesTimeSegmentStatistics> timeSegmentStatisticsDbList = timeSegmentStatisticsRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue()});
Map<String, List<MesTimeSegmentStatistics>> dataDbMap = CollectionUtils.isEmpty(timeSegmentStatisticsDbList) ? null :
timeSegmentStatisticsDbList.stream().filter(o -> null != o).collect(Collectors.groupingBy(o -> new StringJoiner(MesExtConstWords.AND).add(o.getWorkCenterCode()).add(o.getShiftCode()).toString()));
//查询生产线表
Map<String, Object> workCenterCodeEntityMap;
try {
workCenterCodeEntityMap = MesCommonUtil.getCodeEntityMap(workCenterRepository, MesExtConstWords.WORK_CENTER_CODE, organizeCode, "生产线表");
} catch (Exception e) {
workCenterCodeEntityMap = null;
}
//从excel表的第5行数据开始导入getFirstRowNum是从0行开始读取
for (int i = (sheetAt.getFirstRowNum() + 4); i < totalNumberOfRows; i ++) {
Row row = sheetAt.getRow(i);
//空行跳过
if (null == row) {
continue;
}
//获取总列数
Short lastCellNum = row.getLastCellNum();
if (lastCellNum > 0) {
int rowNum = i + 1; //当前行号
int errorNum = 0; //错误数量
String cellNum = ""; //错误列号
String errorInfo = ""; //错误信息
String workCenterCode;
try {
workCenterCode = new DataFormatter().formatCellValue(row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
} catch (Exception e) {
continue;
}
String shiftCode = null;
try {
shiftCode = new DataFormatter().formatCellValue(row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
} catch (Exception e) {
}
String startTime = null;
try {
startTime = new DataFormatter().formatCellValue(row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
} catch (Exception e) {
}
String endTime = null;
try {
endTime = new DataFormatter().formatCellValue(row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
} catch (Exception e) {
}
if (CollectionUtils.isEmpty(workCenterCodeEntityMap) || !workCenterCodeEntityMap.containsKey(workCenterCode)) {
errorNum ++;
cellNum += "A;";
errorInfo += "第A列数据无效;";
}
if (StringUtils.isEmpty(shiftCode)) {
errorNum ++;
cellNum += "B;";
errorInfo += "第B列数据必填;";
}
if (StringUtils.isEmpty(startTime)) {
errorNum ++;
cellNum += "C;";
errorInfo += "第C列数据必填;";
} else {
if (!timeSegmentStatisticsService.checkTimeFormat(startTime)) {
errorNum ++;
cellNum += "C;";
errorInfo += "第C列数据格式错误,请检查时间格式[HH:mm];";
}
}
if (StringUtils.isEmpty(endTime)) {
errorNum ++;
cellNum += "D;";
errorInfo += "第D列数据必填;";
} else {
if (!timeSegmentStatisticsService.checkTimeFormat(endTime)) {
errorNum ++;
cellNum += "D;";
errorInfo += "第D列数据格式错误,请检查时间格式[HH:mm];";
}
}
if (StringUtils.isEmpty(errorInfo) && !timeSegmentStatisticsService.checkTimeStartBeforeEnd(startTime, endTime)) {
errorNum ++;
cellNum += "C+D;";
errorInfo += "第C+D列数据错误,开始时间必须小于结束时间;";
}
if (errorNum == 0) {
String key = new StringJoiner(MesExtConstWords.AND).add(workCenterCode).add(shiftCode).toString();
MesTimeSegmentStatistics timeSegmentStatistics = new MesTimeSegmentStatistics();
timeSegmentStatistics.setOrganizeCode(organizeCode);
timeSegmentStatistics.setWorkCenterCode(workCenterCode);
timeSegmentStatistics.setShiftCode(shiftCode);
timeSegmentStatistics.setStartTime(startTime + MesExtConstWords.APPEND_SECONDS);
timeSegmentStatistics.setEndTime(endTime + MesExtConstWords.APPEND_SECONDS);
timeSegmentStatistics.setOrderByParam(String.valueOf(rowNum));
MesTimeSegmentStatistics item = timeSegmentStatisticsService.checkTimeCompareToDataList(CollectionUtils.isEmpty(dataDbMap) ? null : dataDbMap.get(key), timeSegmentStatistics);
if (null != item) {
errorNum ++;
cellNum += "A+B+C+D;";
errorInfo += String.format("第A+B+C+D列开始时间[%s]结束时间[%s]与已维护的生产线[%s]班次代码[%s]配置的开始时间[%s]结束时间[%s]存在时间重叠;", startTime, endTime, item.getWorkCenterCode(), item.getShiftCode(), item.getStartTime(), item.getEndTime());
} else {
item = timeSegmentStatisticsService.checkTimeCompareToDataList(CollectionUtils.isEmpty(dataMap) ? null : dataMap.get(key), timeSegmentStatistics);
if (null != item) {
errorNum ++;
cellNum += "A+B+C+D;";
errorInfo += String.format("第A+B+C+D列开始时间[%s]结束时间[%s]与EXCEL的第[%s]行生产线[%s]班次代码[%s]开始时间[%s]结束时间[%s]存在时间重叠;", startTime, endTime, item.getOrderByParam(), item.getWorkCenterCode(), item.getShiftCode(), item.getStartTime().substring(0, 5), item.getEndTime().substring(0, 5));
}
}
if (null == item) {
List<MesTimeSegmentStatistics> itemList = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(key)) ? dataMap.get(key) : new ArrayList<>();
itemList.add(timeSegmentStatistics);
dataMap.put(key, timeSegmentStatisticsDbList);
timeSegmentStatisticsList.add(timeSegmentStatistics);
}
}
if (errorNum == 0) successRowNum ++;
else {
//封装错误行信息ExcelImportErrorExtModel
excelImportErrorExtModels = commonExtService.getExcelImportErrorModels(excelImportErrorExtModels, rowNum, errorNum, cellNum, errorInfo);
errorRows += rowNum + ";";
failRowNum ++;
}
}
}
//校验EXCEL数据
commonExtService.checkExcelData(failRowNum, successRowNum, errorRows);
//封装返回结果
ExcelImportResultExtModel excelImportResultModel = commonExtService.getExcelImportResultModel(failRowNum, successRowNum, excelImportErrorExtModels, errorRows);
excelImportResultModel.setExcelList((failRowNum > 0) ? null : timeSegmentStatisticsList);
return excelImportResultModel;
}
/**
* -
* @param excelImportResultExtModel
*/
private void insertExcelMesShiftExt(ExcelImportResultExtModel excelImportResultExtModel, String userName) {
//导入数据
if (null != excelImportResultExtModel) {
List<MesTimeSegmentStatistics> excelList = excelImportResultExtModel.getExcelList();
if (!CollectionUtils.isEmpty(excelList)) {
String time = TimeTool.getNowTime(true);
String today = time.substring(0, 10);
for (MesTimeSegmentStatistics timeSegmentStatistics : excelList) {
timeSegmentStatistics.setTimeLength(timeSegmentStatisticsService.getTimeLength(timeSegmentStatistics.getStartTime(), timeSegmentStatistics.getEndTime(), today));
timeSegmentStatistics.setWorkCenterCode(timeSegmentStatisticsService.getTimeSegmentCode(timeSegmentStatistics));
timeSegmentStatistics.setCreateDatetime(time);
timeSegmentStatistics.setModifyDatetime(time);
timeSegmentStatistics.setCreateUser(userName);
timeSegmentStatistics.setModifyUser(userName);
timeSegmentStatistics.setIsValid(CommonEnumUtil.IS_VAILD.VAILD.getValue());
timeSegmentStatistics.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
timeSegmentStatistics.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
timeSegmentStatisticsRepository.insert(timeSegmentStatistics);
}
}
}
}
}

@ -50,10 +50,6 @@ public class MesTimeSegmentStatistics extends BaseBean implements Serializable {
@ApiParam("结束时间")
private String endTime;
@Column(name = "REST_TIME")
@ApiParam("休息时间")
private String restTime;
@Column(name = "TIME_LENGTH")
@ApiParam("实际工作时间长度(分钟)")
private String timeLength;

@ -16,7 +16,6 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.*;
import org.apache.commons.beanutils.ConvertUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
@ -916,5 +915,14 @@ public class MesExtHqlPack {
return packBean;
}
public static DdlPackBean getTimeSegmentStatistics(MesTimeSegmentStatistics timeSegmentStatistics) {
DdlPackBean packBean = getAllBaseDataByNormalPro(timeSegmentStatistics, timeSegmentStatistics.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(timeSegmentStatistics.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(timeSegmentStatistics.getShiftCode(), MesExtConstWords.SHIFT_CODE, packBean);
DdlPreparedPack.getStringEqualPack(timeSegmentStatistics.getStartTime(), MesExtConstWords.START_TIME, packBean);
DdlPreparedPack.getStringEqualPack(timeSegmentStatistics.getEndTime(), MesExtConstWords.END_TIME, packBean);
return packBean;
}
}

@ -88,7 +88,8 @@ public class MesExtEnumUtil {
MES_JX_BADNESS_CLASSIFY(960, "jxBadnessClassifyExcelService", "JX出货不良分类"),
MES_JX_BADNESS_CLASSIFY_DETAIL(970, "jxBadnessClassifyDetailExcelService", "JX不良分类明细"),
MES_WORK_CELL_EXT(980, "workCellExtExcelService", "工位信息导入"),
REPAIR_JUDGE_TYPE(990, "repairJudgeTypeExcelService", "返修判定类型导入");
REPAIR_JUDGE_TYPE(990, "repairJudgeTypeExcelService", "返修判定类型导入"),
MES_TIME_SEGMENT_STATISTICS(1000, "jxTimeSegmentStatisticsExcelService", "分时段统计方式导入");
private int value;
private String service;

Loading…
Cancel
Save