生产准备任务检验
parent
068b544c06
commit
ac9496a822
@ -0,0 +1,41 @@
|
||||
package com.foreverwin.mesnac.production.controller;
|
||||
|
||||
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
|
||||
import com.foreverwin.mesnac.meapi.dto.SfcDto;
|
||||
import com.foreverwin.mesnac.production.service.PodTemplateService;
|
||||
import com.foreverwin.modular.core.util.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@Controller
|
||||
@RequestMapping("/sfcDataMains")
|
||||
public class PodTemplateController {
|
||||
|
||||
@Autowired
|
||||
public PodTemplateService podTemplateService;
|
||||
|
||||
/**
|
||||
* 资源回车
|
||||
* @param workCenterDto
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/resrceEnter")
|
||||
public R resrceEnter(@RequestBody WorkCenterDto workCenterDto) {
|
||||
return R.ok(podTemplateService.resrceEnter(workCenterDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* sfc回车
|
||||
* @param sfcDto
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/sfcEnter")
|
||||
public R sfcEnter(@RequestBody SfcDto sfcDto) {
|
||||
return R.ok(podTemplateService.sfcEnter(sfcDto));
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.foreverwin.mesnac.production.service;
|
||||
|
||||
import com.foreverwin.mesnac.meapi.dto.SfcDto;
|
||||
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PodTemplateService {
|
||||
Map<String, Object> resrceEnter(WorkCenterDto workCenterDto);
|
||||
|
||||
Object sfcEnter(SfcDto workCenterDto);
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.foreverwin.mesnac.production.service.impl;
|
||||
|
||||
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
||||
import com.foreverwin.mesnac.common.service.CommonService;
|
||||
import com.foreverwin.mesnac.common.util.StringUtil;
|
||||
import com.foreverwin.mesnac.meapi.dto.SfcDto;
|
||||
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
|
||||
import com.foreverwin.mesnac.meapi.model.Resrce;
|
||||
import com.foreverwin.mesnac.meapi.model.Sfc;
|
||||
import com.foreverwin.mesnac.meapi.service.ResrceService;
|
||||
import com.foreverwin.mesnac.meapi.service.SfcService;
|
||||
import com.foreverwin.mesnac.production.service.PodTemplateService;
|
||||
import com.foreverwin.modular.core.exception.BaseException;
|
||||
import com.foreverwin.modular.core.util.CommonMethods;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PodTemplateServiceImpl implements PodTemplateService {
|
||||
@Autowired
|
||||
private ResrceService resrceService;
|
||||
@Autowired
|
||||
private SfcService sfcService;
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> resrceEnter(WorkCenterDto workCenterDto) {
|
||||
String site = CommonMethods.getSite();
|
||||
String resrce = workCenterDto.getResrce();
|
||||
String resrceBO = HandleEnum.RESOURCE.getHandle(site, resrce);
|
||||
Resrce model = resrceService.getById(resrceBO);
|
||||
if (model==null){
|
||||
throw new BaseException("资源 "+resrce+" 不存在");
|
||||
}
|
||||
String workCenter = workCenterDto.getWorkCenter();
|
||||
//校验
|
||||
String workShopBo = commonService.getWorkShopBo(resrceBO);
|
||||
if (StringUtil.isBlank(workShopBo)){
|
||||
throw new BaseException("资源 "+resrce+" 未匹配到车间");
|
||||
}
|
||||
if (!workCenter.equals(StringUtil.trimHandle(workShopBo))){
|
||||
throw new BaseException("资源 "+resrce+" 与车间不匹配");
|
||||
}
|
||||
|
||||
//查询在该设备存在活动中的SFC
|
||||
List<Sfc> sfcList = sfcService.getSfcListByResrceBO(resrceBO);
|
||||
//List<Map<String, Object>> proReadyList = sfcDataMainMapper.queryPrdReadyByResrce(site, resrce);
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("SFC_LIST", sfcList);
|
||||
//resultMap.put("READY_LIST", proReadyList);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object sfcEnter(SfcDto sfcDto) {
|
||||
// String site = CommonMethods.getSite();
|
||||
// String sfc = sfcDto.getSfc();
|
||||
// String operation = sfcDto.getOperation();
|
||||
// //校验产品条码是否存在
|
||||
// Sfc sfcById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc));
|
||||
// if (sfcById==null){
|
||||
// throw new BaseException("产品条码"+sfc+"不存在");
|
||||
// }
|
||||
// //校验产品条码是否在当前工序排队
|
||||
// Operation operationBySfcBo = commonService.getOperationBySfcBo(sfcById.getHandle());
|
||||
// if (!operationBySfcBo.getOperation().equals(operation)){
|
||||
// throw new BaseException("产品条码"+sfc+"在"+operationBySfcBo.getDescription()+"工序");
|
||||
// }
|
||||
// //校验SFC+工序+设备+STEP_ID是否与当前设备确认的派工单匹配
|
||||
//
|
||||
// String substep = "";
|
||||
// String substepHandle = "";
|
||||
// //构造前台所需要的数据
|
||||
// Map<String, Object> resultMap = sfcDataMainMapper.querySfcData(paramMap);
|
||||
// if(resultMap == null){
|
||||
// throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
|
||||
// }
|
||||
// List<Map<String, Object>> substepList = sfcDataMainMapper.querySfcStep(site, sfc, operation);
|
||||
// resultMap.put("SFC_STEP_LIST", substepList);
|
||||
//
|
||||
// String stepId = (String) resultMap.get("STEP_ID");
|
||||
// //2021/1/20 roc 根据SFC和步骤标识查找是否维护了尾检项
|
||||
// List<Map<String, Object>> checkOperationCheckW = sfcDataMainMapper.checkOperationCheckW(site, sfc, stepId);
|
||||
// if(null != checkOperationCheckW && checkOperationCheckW.size() >0){
|
||||
// resultMap.put("IS_CREATE_W", "Y");
|
||||
// }else{
|
||||
// resultMap.put("IS_CREATE_W", "N");
|
||||
// }
|
||||
//
|
||||
// String isCreateH = "Y";
|
||||
// String isCreateZ = "Y";
|
||||
// if(!"403".equals(resultMap.get("STATUS"))) {
|
||||
// //SFC未开始
|
||||
// //判断对否需要进行互检
|
||||
// List<Map<String, Object>> checkOperationCheckH = sfcDataMainMapper.checkOperationCheckH(site, sfc, stepId);
|
||||
// if(checkOperationCheckH.size() > 0 ){
|
||||
// resultMap.put("IS_CHECK_H", "Y");
|
||||
// //自检/互检 校验是否在当前工序+工序标识 做过检验任务
|
||||
// List<Map<String, Object>> checkList = taskMapper.checkCreateTaskSfc(sfc, site, "H", (String) resultMap.get("OPERATION"), stepId);
|
||||
// if (checkList.size() > 0) {
|
||||
// for (int i = 0; i < checkList.size(); i++) {
|
||||
// if (checkList.get(i).get("STATUS").equals("COMPLETE") && checkList.get(i).get("RESULT").equals("OK")) {
|
||||
// isCreateH = "N";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }else{
|
||||
// //sfc已开始
|
||||
// for (int i = 0; i < substepList.size(); i++) {
|
||||
// if ("READY".equals(substepList.get(i).get("STATE")) && "true".equals(substepList.get(i).get("IS_SEQTRUE"))) {
|
||||
// substep = (String) substepList.get(i).get("STEP_ID");
|
||||
// substepHandle = (String) substepList.get(i).get("HANDLE");
|
||||
// }
|
||||
// }
|
||||
// //判断是否存在工步
|
||||
// if(StringUtils.isEmpty(substep)){
|
||||
// //判断对否需要进行自检(无工步)
|
||||
// List<Map<String, Object>> checkOperationCheckZ = sfcDataMainMapper.checkOperationCheckZ(site, sfc, stepId);
|
||||
// if(checkOperationCheckZ.size() > 0 ){
|
||||
// resultMap.put("IS_CHECK_Z", "Y");
|
||||
// //自检/互检 校验是否在当前工序+工序标识 做过检验任务
|
||||
// List<Map<String, Object>> checkList = taskMapper.checkCreateTaskSfc(sfc, site, "Z", (String) resultMap.get("OPERATION"), stepId);
|
||||
// if (checkList.size() > 0) {
|
||||
// for (int i = 0; i < checkList.size(); i++) {
|
||||
// if (checkList.get(i).get("STATUS").equals("COMPLETE") && "OK".equals(checkList.get(i).get("RESULT"))) {
|
||||
// isCreateZ = "N";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //判断对否需要进行互检(无工步)
|
||||
// List<Map<String, Object>> checkOperationCheckH = sfcDataMainMapper.checkOperationCheckH(site, sfc, stepId);
|
||||
// if(checkOperationCheckH.size() > 0 ){
|
||||
// resultMap.put("IS_CHECK_H", "Y");
|
||||
// //自检/互检 校验是否在当前工序+工序标识 做过检验任务
|
||||
// List<Map<String, Object>> checkList = taskMapper.checkCreateTaskSfc(sfc, site, "H", (String) resultMap.get("OPERATION"), stepId);
|
||||
// if (checkList.size() > 0) {
|
||||
// for (int i = 0; i < checkList.size(); i++) {
|
||||
// if (checkList.get(i).get("STATUS").equals("COMPLETE") && "OK".equals(checkList.get(i).get("RESULT"))) {
|
||||
// isCreateH = "N";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// //判断对否需要进行自检(有工步)
|
||||
// List<Map<String, Object>> checkSubstepCheckZ = sfcDataMainMapper.checkSubstepCheckZ(substepHandle);
|
||||
// if(checkSubstepCheckZ.size() > 0 ){
|
||||
// resultMap.put("IS_CHECK_Z", "Y");
|
||||
// //自检/互检 校验是否在当前工序+工序+工步标识 做过检验任务
|
||||
// List<Map<String, Object>> checkList = taskMapper.checkCreateTaskSfcDetail(sfc, site, "Z", (String) resultMap.get("OPERATION"), stepId, substep);
|
||||
// if (checkList.size() > 0) {
|
||||
// for (int i = 0; i < checkList.size(); i++) {
|
||||
// if (checkList.get(i).get("STATUS").equals("COMPLETE") && "OK".equals(checkList.get(i).get("RESULT"))) {
|
||||
// isCreateZ = "N";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //判断对否需要进行互检(有工步)
|
||||
// List<Map<String, Object>> checkSubstepCheckH = sfcDataMainMapper.checkSubstepCheckH(substepHandle);
|
||||
// if(checkSubstepCheckH.size() > 0 ){
|
||||
// resultMap.put("IS_CHECK_H", "Y");
|
||||
// //自检/互检 校验是否在当前工序+工序标识 做过检验任务
|
||||
// List<Map<String, Object>> checkList = taskMapper.checkCreateTaskSfcDetail(sfc, site, "H", (String) resultMap.get("OPERATION"), stepId, substep);
|
||||
// if (checkList.size() > 0) {
|
||||
// for (int i = 0; i < checkList.size(); i++) {
|
||||
// if (checkList.get(i).get("STATUS").equals("COMPLETE") && "OK".equals(checkList.get(i).get("RESULT"))) {
|
||||
// isCreateH = "N";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// resultMap.put("IS_CREATE_H", isCreateH);
|
||||
// resultMap.put("IS_CREATE_Z", isCreateZ);
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue