forked from I3-YF/i3plus-mes-yfai
问题清单修复
parent
ddd22117b1
commit
5e2d23b101
@ -0,0 +1,33 @@
|
||||
package cn.estsh.i3plus.ext.mes.api.base.file;
|
||||
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysFile;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/7/19 11:54
|
||||
* @Modify:
|
||||
**/
|
||||
public interface IMesFileService {
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file 文件
|
||||
* @return 文件信息
|
||||
*/
|
||||
@ApiOperation(value = "上传文件", notes = "上传文件")
|
||||
SysFile uploadFile(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
* @param resp
|
||||
* @param fileUrl 文件url
|
||||
* @return 文件流
|
||||
*/
|
||||
void getFileByUrl(HttpServletResponse resp, String fileUrl);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.estsh.i3plus.ext.mes.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesDefectType;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
/**
|
||||
* @Description :缺陷记录
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/7/19 15:32
|
||||
* @Modify:
|
||||
**/
|
||||
public interface IMesInputDefectRecordService {
|
||||
|
||||
@ApiOperation(value = "生成缺陷记录")
|
||||
void savePartInspection(MesProduceSn mesProduceSn, String userName, MesDefectType mesDefect,String defectLocation);
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
||||
import cn.estsh.i3plus.ext.mes.api.base.IMesPartSapService;
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.IMesInputDefectRecordService;
|
||||
import cn.estsh.i3plus.mes.api.iservice.busi.ISyncFuncService;
|
||||
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesDefectType;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesMove;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPartSap;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesMoveRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesPartInspectionDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesPartInspectionRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesProduceSnRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description : 缺陷记录
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/7/19 15:52
|
||||
* @Modify:
|
||||
**/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MesInputDefectRecordServiceImpl implements IMesInputDefectRecordService {
|
||||
@Autowired
|
||||
private MesMoveRepository moveRepository;
|
||||
|
||||
@Autowired
|
||||
private MesPartInspectionRepository partInspectionRepository;
|
||||
|
||||
@Autowired
|
||||
private MesPartInspectionDetailRepository partInspectionDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private IMesConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISyncFuncService syncFuncService;
|
||||
|
||||
@Autowired
|
||||
private MesProduceSnRepository mesProduceSnRepository;
|
||||
|
||||
@Autowired
|
||||
private IMesPartSapService mesPartSapService;
|
||||
|
||||
@Override
|
||||
public void savePartInspection(MesProduceSn mesProduceSn, String userName, MesDefectType mesDefect,String defectLocation) {
|
||||
MesPartSap mesPartSap = mesPartSapService.getMesPartSapByPartNo(mesProduceSn.getPartNo(), mesProduceSn.getOrganizeCode());
|
||||
MesPartInspection mesPartInspection = partInspectionRepository.insert(createPartInspection(mesPartSap, mesProduceSn.getProductSn(), mesProduceSn.getOrganizeCode(), userName));
|
||||
saveDetail(mesProduceSn.getOrganizeCode(), mesDefect, mesPartInspection.getId(), userName,defectLocation);
|
||||
//更新条码状态
|
||||
mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue());
|
||||
ConvertBean.serviceModelInitialize(mesProduceSn, userName);
|
||||
mesProduceSnRepository.update(mesProduceSn);
|
||||
//移库
|
||||
createMove(mesPartSap, mesPartInspection.getId(), configService.getCfgValue(mesProduceSn.getOrganizeCode(), "LGORT"), configService.getCfgValue(mesProduceSn.getOrganizeCode(), "UMLGO"), mesProduceSn);
|
||||
}
|
||||
|
||||
private void saveDetail(String organizeCode, MesDefectType mesDefect, long partInspectionId, String userName,String defectLocation) {
|
||||
MesPartInspectionDetail detail = new MesPartInspectionDetail();
|
||||
if (!Objects.isNull(mesDefect)) {
|
||||
detail.setDefectTypeId(mesDefect.getId());
|
||||
BeanUtils.copyProperties(mesDefect, detail);
|
||||
}
|
||||
detail.setId(null);
|
||||
detail.setDefectLocation(defectLocation);
|
||||
detail.setFrontBack(MesExtEnumUtil.DEFECT_ALARM_CONFIG_SIDES.FRONT.getValue());
|
||||
detail.setOrganizeCode(organizeCode);
|
||||
detail.setPid(partInspectionId);
|
||||
ConvertBean.serviceModelInitialize(detail, userName);
|
||||
partInspectionDetailRepository.insert(detail);
|
||||
}
|
||||
|
||||
private MesPartInspection createPartInspection(MesPartSap mesPartSap, String sn, String org, String userName) {
|
||||
MesPartInspection partInspection = new MesPartInspection();
|
||||
partInspection.setOrganizeCode(org);
|
||||
partInspection.setPartNo(mesPartSap.getPartNo());
|
||||
partInspection.setPartName(mesPartSap.getPartName());
|
||||
partInspection.setInspectionDate(TimeTool.getToday());
|
||||
partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue());
|
||||
partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue());
|
||||
partInspection.setSn(sn);
|
||||
partInspection.setQty(1);
|
||||
partInspection.setSourceType(10);
|
||||
ConvertBean.serviceModelInitialize(partInspection, userName);
|
||||
return partInspection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移库
|
||||
*
|
||||
* @param source 来源
|
||||
* @param target 目标
|
||||
* @return
|
||||
*/
|
||||
private void createMove(MesPartSap mesPartSap, long partInspectionId, String source, String target, MesProduceSn mesProduceSn) {
|
||||
GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM");
|
||||
serialNoModel.setPartNo(mesPartSap.getPartNo());
|
||||
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), mesProduceSn.getOrganizeCode(), 1);
|
||||
String zrsum = "";
|
||||
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
|
||||
zrsum = (rb.getResultList().get(0)).toString();
|
||||
}
|
||||
|
||||
MesMove move = new MesMove();
|
||||
move.setMatnr(mesPartSap.getPartNo());
|
||||
move.setOrganizeCode(mesProduceSn.getOrganizeCode());
|
||||
move.setFactoryCode(mesProduceSn.getOrganizeCode());
|
||||
move.setLgort(source);
|
||||
move.setUmlgo(target);
|
||||
move.setMenge(1d);
|
||||
move.setMeins(mesPartSap.getUnit());
|
||||
move.setZrsum(zrsum);
|
||||
move.setPostDate(TimeTool.getToday());
|
||||
move.setPostTime(TimeTool.getTimeShortWithColon());
|
||||
move.setPartInspectionId(partInspectionId);
|
||||
move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue());
|
||||
move.setProductSn(mesProduceSn.getProductSn());
|
||||
ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName());
|
||||
moveRepository.insert(move);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue