MES报废功能

highway
chj 1 year ago
parent ebc9f11ea9
commit c7adabcee9

@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

@ -1,7 +1,8 @@
package com.op.mes.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
@ -16,7 +17,7 @@ import com.op.mes.mapper.ProEmbryoScrapMapper;
import com.op.mes.service.IProEmbryoScrapService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import sun.plugin.javascript.navig.Array;
/**
* Service
@ -68,7 +69,7 @@ public class ProEmbryoScrapServiceImpl implements IProEmbryoScrapService {
@DS("#header.poolName")
@Transactional(rollbackFor = Exception.class)
public int insertProEmbryoScrap(ProEmbryoScrap proEmbryoScrap) {
proEmbryoScrap.setId(IdUtils.fastSimpleUUID());
proEmbryoScrap.setId(IdUtils.fastSimpleUUID());
proEmbryoScrap.setCreateBy(SecurityContextHolder.getUserName());
proEmbryoScrap.setUpdateBy(SecurityContextHolder.getUserName());
proEmbryoScrap.setUpdateTime(DateUtils.getNowDate());
@ -95,16 +96,17 @@ public class ProEmbryoScrapServiceImpl implements IProEmbryoScrapService {
ProOrderWorkorder proOrderWorkorder = proEmbryoScrapMapper.selectOrderWorkByProductId(proEmbryoScrap.getMaterialId());
if (ObjectUtils.isEmpty(proOrderWorkorder)) {
throw new ServiceException("该物料下没有对应的工单!");
}else {
proEmbryoScrapDetail.setWorkorderId(proOrderWorkorder.getWorkorderId());
proEmbryoScrapDetail.setWorkorderCode(proOrderWorkorder.getWorkorderCode());
proEmbryoScrapDetail.setScrapQuality(proEmbryoScrap.getScrapQuality());
proEmbryoScrapDetail.setUnit(proEmbryoScrap.getUnit());
proEmbryoScrapDetail.setStatus(proEmbryoScrap.getStatus());
proEmbryoScrapDetail.setCreateTime(proEmbryoScrap.getCreateTime());
proEmbryoScrapDetail.setUpdateTime(proEmbryoScrap.getUpdateTime());
proEmbryoScrapDetail.setCreateBy(proEmbryoScrap.getCreateBy());
proEmbryoScrapDetail.setUpdateBy(proEmbryoScrap.getUpdateBy());
}
proEmbryoScrapDetail.setWorkorderId(proOrderWorkorder.getWorkorderId());
proEmbryoScrapDetail.setWorkorderCode(proOrderWorkorder.getWorkorderCode());
proEmbryoScrapDetail.setScrapQuality(proEmbryoScrap.getScrapQuality());
proEmbryoScrapDetail.setUnit(proEmbryoScrap.getUnit());
proEmbryoScrapDetail.setStatus(proEmbryoScrap.getStatus());
proEmbryoScrapDetail.setCreateTime(proEmbryoScrap.getCreateTime());
proEmbryoScrapDetail.setUpdateTime(proEmbryoScrap.getUpdateTime());
proEmbryoScrapDetail.setCreateBy(proEmbryoScrap.getCreateBy());
proEmbryoScrapDetail.setUpdateBy(proEmbryoScrap.getUpdateBy());
// todo 向详情表中添加
return proEmbryoScrapDetailMapper.insertProEmbryoScrapDetail(proEmbryoScrapDetail);
}
@ -132,7 +134,6 @@ public class ProEmbryoScrapServiceImpl implements IProEmbryoScrapService {
proEmbryoScrapDetail.setUpdateTime(DateUtils.getNowDate());
}
proEmbryoScrapMapper.updateProEmbryoScrap(proEmbryoScrap);
return proEmbryoScrapDetailMapper.updateProEmbryoScrapDetail(proEmbryoScrapDetail);
}
@ -145,14 +146,21 @@ public class ProEmbryoScrapServiceImpl implements IProEmbryoScrapService {
@Override
@DS("#header.poolName")
public int deleteProEmbryoScrapByIds(String[] ids) {
ArrayList<String> strings = new ArrayList<>();
// ArrayList<String> strings = new ArrayList<>();
// List<ProEmbryoScrap> proEmbryoScraps = proEmbryoScrapMapper.selectManyProEmbryScrap(ids);
// for (ProEmbryoScrap proEmbryoScrap : proEmbryoScraps) {
// strings.add(proEmbryoScrap.getScrapCode());
// }
// String[] codes= strings.toArray(new String[0]);
// proEmbryoScrapDetailMapper.deleteProEmbryoScrapDetails(codes);
// return proEmbryoScrapMapper.deleteProEmbryoScrapByIds(ids);
List<ProEmbryoScrap> proEmbryoScraps = proEmbryoScrapMapper.selectManyProEmbryScrap(ids);
for (ProEmbryoScrap proEmbryoScrap : proEmbryoScraps) {
strings.add(proEmbryoScrap.getScrapCode());
}
String[] codes= strings.toArray(new String[0]);
proEmbryoScrapDetailMapper.deleteProEmbryoScrapDetails(codes);
List<String> codes = proEmbryoScraps.stream()
.map(ProEmbryoScrap::getScrapCode)
.collect(Collectors.toList());
String[] code= codes.toArray(new String[0]);
proEmbryoScrapDetailMapper.deleteProEmbryoScrapDetails(code);
return proEmbryoScrapMapper.deleteProEmbryoScrapByIds(ids);
}
@ -173,14 +181,20 @@ public class ProEmbryoScrapServiceImpl implements IProEmbryoScrapService {
// return proEmbryoScrapMapper.selectProEmbryoScrap();
// }
//查询所有物料名称
/**
*
* @return
*/
@Override
@DS("#header.poolName")
public List<Product> showAllMaterial() {
return proEmbryoScrapMapper.showAllMaterial();
}
//查询工位信息
/**
*
* @return
*/
@Override
@DS("#header.poolName")
public List<SysPost> showSysPost() {

Loading…
Cancel
Save