找设备逻辑修改

master
philip 3 years ago
parent 637a25ed77
commit 6dba19e70d

@ -20,4 +20,12 @@ public interface CommonService {
Operation getOperationBySfcBo(String sfcBo);
void updateInventory(String site, String inventoryId, BigDecimal measuredQty);
/**
*
* @param operation
* @return
*/
String getResrceByOperation(String operation);
}

@ -2,17 +2,20 @@ package com.foreverwin.mesnac.common.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.OperationMapper;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
import com.foreverwin.mesnac.meapi.model.WorkCenterMember;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.ResourceTypeService;
import com.foreverwin.mesnac.meapi.service.WorkCenterMemberService;
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.CommonMethods;
import com.sap.me.inventory.InventoryIdentifier;
import com.sap.me.inventory.InventoryServiceInterface;
import com.sap.me.inventory.InventoryStatusEnum;
@ -33,7 +36,10 @@ public class CommonServiceImpl implements CommonService {
private WorkCenterService workCenterService;
@Autowired
private OperationMapper operationMapper;
@Autowired
private ResourceTypeService resourceTypeService;
@Autowired
private ResrceMapper resrceMapper;
@Override
public String getWorkShopBo(String workCenterBo) {
if (StrUtil.isBlank(workCenterBo)) {
@ -96,4 +102,19 @@ public class CommonServiceImpl implements CommonService {
ExceptionUtil.throwException(e);
}
}
@Override
public String getResrceByOperation(String operation) {
String site = CommonMethods.getSite();
String resourceTypeHandle = HandleEnum.RESOURCE_TYPE.getHandle(CommonMethods.getSite(), operation);
ResourceType resourceTypeServiceById = resourceTypeService.getById(resourceTypeHandle);
if (resourceTypeServiceById==null){
throw new BaseException("设备类型"+operation+"不存在");
}
List<Resrce> resrces = resrceMapper.findResourceListByResourceType(site, resourceTypeServiceById.getHandle());
if (resrces.isEmpty()){
throw new BaseException("设备类型"+operation+"下没有资源");
}
return resrces.get(0).getHandle();
}
}

@ -8,6 +8,15 @@ public class SplitSfcDto extends SplitSfc {
private String ncQty;
private String abnormalNo;
private String abnormalMethod;
private String stepId;
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public String getAbnormalMethod() {
return abnormalMethod;

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.service.InspectionTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
@ -18,7 +18,6 @@ import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.RouterStepService;
import com.foreverwin.mesnac.meapi.service.ShopOrderService;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.service.SplitSfcService;
@ -65,7 +64,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
@Autowired
private RouterStepService routerStepService;
@Autowired
private SfcCrossMapper sfcCrossMapper;
private CommonService commonService;
@Override
public IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc) {
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
@ -186,16 +185,16 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
if (sfcData==null){
throw new BaseException("未找到产品条码信息");
}
//查询质量异常记录数量 处置工艺路线及不良代码
SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation, abnormalNo);
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setSite(site);
sfcDispatchDto.setSfc(sfc);
sfcDispatchDto.setStepId(sfcData.getStepId());
sfcDispatchDto.setStepId(splitSfcDto.getStepId());
SfcDispatchDto sfcDispatchBySfc = sfcDispatchCommonService.findSfcDispatchBySfc(sfcDispatchDto);
if (sfcDispatchBySfc.equals(DispatchStatusEnum.CANCEL.getCode())){
throw new BaseException("产品已取消派工");
if (sfcDispatchBySfc==null){
throw new BaseException("未找到派工任务");
}
//查询质量异常记录数量 处置工艺路线及不良代码
SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation, abnormalNo);
String routerBo = splitSfcDto.getRouterBo();
String ncCode = splitSfcDto.getNcCode();
String abnormalMethod = splitSfcDto.getAbnormalMethod();
@ -236,10 +235,8 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
stepIdentifier.setStepId(sfcData.getStepId());
stepIdentifier.setOperationId(sfcData.getOperation());
productionContext.setStepIdentifier(stepIdentifier);
if (StringUtil.isBlank(sfcDispatchBySfc.getResrce())){
throw new BaseException("未派工到设备");
}
productionContext.setResourceRef(HandleEnum.RESOURCE.getHandle(site,sfcDispatchBySfc.getResrce()));
String resrceBo = commonService.getResrceByOperation(operation);
productionContext.setResourceRef(resrceBo);
createNCRequest.setProdCtx(productionContext);
createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0]));
ncProductionService.createNC(createNCRequest);
@ -266,7 +263,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
paramMap.put("SFC",sfc );
paramMap.put("SHOP_ORDER",sfcDispatchBySfc.getShopOrder());
paramMap.put("OPERATION",sfcDispatchBySfc.getOperation());
paramMap.put("STEP_ID",sfcDispatchBySfc.getStepId());;
paramMap.put("STEP_ID",sfcDispatchBySfc.getStepId());
paramMap.put("WORK_CENTER",sfcDispatchBySfc.getWorkCenter());
paramMap.put("RESRCE",sfcDispatchBySfc.getResrce());
paramMap.put("SFC_DISPATCH_DETAIL_BO",sfcDispatchBySfc.getHandle());

@ -378,7 +378,7 @@
WHERE S.HANDLE=#{handle}
</select>
<select id="getAbnormalQty" resultType="com.foreverwin.mesnac.production.dto.SplitSfcDto">
SELECT zab.NC_QTY,zsbd.ROUTER_BO,zab.NC_CODE,zab.ABNORMAL_NO,zsbd.ABNORMAL_METHOD FROM Z_ABNORMAL_BILL zab
SELECT zab.NC_QTY,zsbd.ROUTER_BO,zab.NC_CODE,zab.ABNORMAL_NO,zsbd.ABNORMAL_METHOD,zab.STEP_ID FROM Z_ABNORMAL_BILL zab
JOIN Z_ABNORMAL_BILL_DISPOSE zsbd ON zab.HANDLE=ZSBD.ABNORMAL_BILL_BO
WHERE ZAB.SFC=#{sfc} AND zab.ABNORMAL_NO=#{abnormalNo} AND zab.SITE=#{site} AND ZAB.OPERATION=#{operation} AND zab.STATUS='G' AND zab."TYPE"='Z' AND (zsbd.ABNORMAL_METHOD='F' OR zsbd.ABNORMAL_METHOD='C')
</select>

Loading…
Cancel
Save