Merge remote-tracking branch 'origin/master'

master
zpl 3 years ago
commit ad907f84af

@ -1,8 +1,10 @@
package com.foreverwin.mesnac.anomaly.dto; package com.foreverwin.mesnac.anomaly.dto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.meapi.model.DataFieldList;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* @Description TODO * @Description TODO
@ -50,6 +52,8 @@ public class AbnormalBillDto extends AbnormalBill {
private String checkUsr; private String checkUsr;
private List<DataFieldList> cancelCodeList;
public String getCheckUsr() { public String getCheckUsr() {
return checkUsr; return checkUsr;
} }
@ -163,4 +167,12 @@ public class AbnormalBillDto extends AbnormalBill {
public void setProductionCategory(String productionCategory) { public void setProductionCategory(String productionCategory) {
this.productionCategory = productionCategory; this.productionCategory = productionCategory;
} }
public List<DataFieldList> getCancelCodeList() {
return cancelCodeList;
}
public void setCancelCodeList(List<DataFieldList> cancelCodeList) {
this.cancelCodeList = cancelCodeList;
}
} }

@ -309,11 +309,17 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//异常代码 //异常代码
//通过设备找到异常车间 //通过设备找到异常车间
Resrce resrce = new Resrce(); try{
resrce.setSite(site); Resrce resrce = new Resrce();
resrce.setResrce(abnormalBill.getResrce()); resrce.setSite(site);
WorkCenter workCenterByResrce = workCenterMapper.findWorkCenterByResrce(resrce); resrce.setResrce(abnormalBill.getResrce());
abnormalBill.setWorkCenter(workCenterByResrce.getWorkCenter()); WorkCenter workCenterByResrce = workCenterMapper.findWorkCenterByResrce(resrce);
abnormalBill.setWorkCenter(workCenterByResrce.getWorkCenter());
}catch (Exception e){
throw new BaseException("根据资源(设备)查找异常车间报错,请查看工作中心维护。报错信息:"+e.getMessage());
}
List<NcCodeDto> ncCodesAndNcGroups = ncCodeService.findNcCodeDescriptionByNcCode(abnormalBill.getNcCode()); List<NcCodeDto> ncCodesAndNcGroups = ncCodeService.findNcCodeDescriptionByNcCode(abnormalBill.getNcCode());
List<AbnormalNcCode> abnormalNcCodes = new LinkedList<>(); List<AbnormalNcCode> abnormalNcCodes = new LinkedList<>();
for(int i = 0; i < ncCodesAndNcGroups.size(); i ++){ for(int i = 0; i < ncCodesAndNcGroups.size(); i ++){
@ -451,7 +457,13 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(StringUtil.isEmpty(abnormalBill.getAbnormalNo())){ if(StringUtil.isEmpty(abnormalBill.getAbnormalNo())){
return null; return null;
} }
return abnormalBillMapper.findAllByAbnormalNoDevice(abnormalBill,local); DataField dataField = new DataField();
dataField.setSite(site);
dataField.setDataField("RERR_CANCEL_REASON");
List<DataFieldList> dataFieldList = dataFieldListMapper.findDataFieldList(dataField);
AbnormalBillDto abnormalBillDto = abnormalBillMapper.findAllByAbnormalNoDevice(abnormalBill, local);
abnormalBillDto.setCancelCodeList(dataFieldList);
return abnormalBillDto;
} }
@Override @Override
@ -480,10 +492,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo())); abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
AbnormalBill abnormalBill1 = abnormalBillMapper.selectById(HandleEnum.ABNORMAL_BILL.getHandle(site, abnormalBill.getAbnormalNo())); // AbnormalBill abnormalBill1 = abnormalBillMapper.selectById(HandleEnum.ABNORMAL_BILL.getHandle(site, abnormalBill.getAbnormalNo()));
if("true".equals(abnormalBill1.getProgram())){ // if("true".equals(abnormalBill1.getProgram())){
throw BusinessException.build("该异常单已经方案确认"); // throw BusinessException.build("该异常单已经方案确认");
} // }
if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){ if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){
//分割该工艺路线 //分割该工艺路线
@ -531,18 +543,23 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle()); AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
abnormalPlanService.saveAbnormalPlan(abnormalBill2,abnormalBillDispose1,now); abnormalPlanService.saveAbnormalPlan(abnormalBill2,abnormalBillDispose1,now);
} }
//判断该异常解决方案是否是让步放行、配作、线下换料、试装,并且关联来源不是空,如果是,就调用孙豪的方法 //判断该异常解决方案是否是让步放行、配作、线下换料、试装,并且关联来源不是空,如果是,就调用孙豪的方法,并且sfc不能为空
if((Constants.CONCESSION.equals(abnormalBillDispose.getAbnormalMethod()) || if((Constants.CONCESSION.equals(abnormalBillDispose.getAbnormalMethod()) ||
Constants.MATCH.equals(abnormalBillDispose.getAbnormalMethod()) || Constants.MATCH.equals(abnormalBillDispose.getAbnormalMethod()) ||
Constants.OFFLINE_REFUELING.equals(abnormalBillDispose.getAbnormalMethod()) || Constants.OFFLINE_REFUELING.equals(abnormalBillDispose.getAbnormalMethod()) ||
Constants.TEST_EQUIPMENT.equals(abnormalBillDispose.getAbnormalMethod())) Constants.TEST_EQUIPMENT.equals(abnormalBillDispose.getAbnormalMethod()))
&& !StringUtil.isBlank(abnormalBill2.getObjectBo())){ && !StringUtil.isBlank(abnormalBill2.getObjectBo())
&& StringUtil.notBlank(abnormalBill2.getSfc())){
try{ try{
this.creatInspectionTask(site,abnormalBill2.getObjectBo(),abnormalBill2.getSfc(),abnormalBill2.getStepId(),AnomalyConstant.AnomalyMethod.msg(abnormalBillDispose.getAbnormalMethod())); this.creatInspectionTask(site,abnormalBill2.getObjectBo(),abnormalBill2.getSfc(),abnormalBill2.getStepId(),AnomalyConstant.AnomalyMethod.msg(abnormalBillDispose.getAbnormalMethod()));
}catch (Exception e){ }catch (Exception e){
throw new BaseException("createInspectionTask方法报错,"+e.getMessage()); throw new BaseException("createInspectionTask方法报错,"+e.getMessage());
} }
}else if(Constants.REPAIR.equals(abnormalBillDispose.getAbnormalMethod()) && StringUtil.isBlank(abnormalBillDispose.getResolveShopOrder())){
}else if(Constants.REPAIR.equals(abnormalBillDispose.getAbnormalMethod()) &&
StringUtil.isBlank(abnormalBillDispose.getResolveShopOrder()) &&
StringUtil.notBlank(abnormalBill2.getSfc())){
Sfc sfc = sfcMapper.selectById(HandleEnum.SFC.getHandle(site, abnormalBill2.getSfc())); Sfc sfc = sfcMapper.selectById(HandleEnum.SFC.getHandle(site, abnormalBill2.getSfc()));
if(sfc.getQty() > Double.parseDouble(abnormalBill2.getNcQty())){ if(sfc.getQty() > Double.parseDouble(abnormalBill2.getNcQty())){
//跳过啥都不做 //跳过啥都不做
@ -558,10 +575,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
sfcDto.setStepId((String) map.get("STEP_ID")); sfcDto.setStepId((String) map.get("STEP_ID"));
this.batchRepair(sfcDto); this.batchRepair(sfcDto);
} }
} }
this.anomalyCreatedAndSendMessage(abnormalBill2,abnormalBillDispose); this.anomalyCreatedAndSendMessage(abnormalBill2,abnormalBillDispose);
} }

@ -45,14 +45,20 @@
CASE WHEN S2.STATUS = '405' THEN '是' ELSE '否' END DISPATCH_STATUS, CASE WHEN S2.STATUS = '405' THEN '是' ELSE '否' END DISPATCH_STATUS,
ZSD.EARLIEST_START_DATE EARLIEST_START_DATE,ZSD.LATEST_END_DATE LATEST_END_DATE, ZSD.EARLIEST_START_DATE EARLIEST_START_DATE,ZSD.LATEST_END_DATE LATEST_END_DATE,
ZSD.ACTUAL_START_DATE ACTUAL_START_DATE,ZSD.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE, ZSD.ACTUAL_START_DATE ACTUAL_START_DATE,ZSD.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE,
CF2.VALUE WORK_ORDER CF2.VALUE WORK_ORDER,OT2.DESCRIPTION CURRENT_OPERATION_DESCRIPTION,O2.OPERATION CURRENT_OPERATION
FROM SFC S FROM SFC S
LEFT JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
LEFT JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE
LEFT JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = ST.HANDLE AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
INNER JOIN SHOP_ORDER SO ON SO.HANDLE = S.SHOP_ORDER_BO INNER JOIN SHOP_ORDER SO ON SO.HANDLE = S.SHOP_ORDER_BO
INNER JOIN ITEM I ON I.HANDLE = SO.ITEM_BO INNER JOIN ITEM I ON I.HANDLE = SO.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = #{locale} LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = #{locale}
INNER JOIN Z_SFC_DISPATCH ZSD ON S.SFC = ZSD.SFC AND S.SITE = ZSD.SITE LEFT JOIN Z_SFC_DISPATCH ZSD ON S.SFC = ZSD.SFC AND S.SITE = ZSD.SITE
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = S.SITE AND O.CURRENT_REVISION = 'true' LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = S.SITE AND O.CURRENT_REVISION = 'true'
INNER JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = #{locale} LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = #{locale}
LEFT JOIN OPERATION O2 ON O2.OPERATION = SUBSTR(SS.OPERATION_BO,INSTR(SS.OPERATION_BO,',',1,1)+1,INSTR(SS.OPERATION_BO,',',1,2) - INSTR(SS.OPERATION_BO,',') -1)
AND O2.SITE = S.SITE AND O2.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT2 ON OT2.OPERATION_BO = O2.HANDLE AND OT2.LOCALE = #{locale}
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZSD.EMPLOYEE AND ZSD.DISPATCH_SEQ = ( LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZSD.EMPLOYEE AND ZSD.DISPATCH_SEQ = (
SELECT MAX(ZSD2.DISPATCH_SEQ) FROM Z_SFC_DISPATCH ZSD2 WHERE S.SFC = ZSD2.SFC AND S.SITE = ZSD2.SITE SELECT MAX(ZSD2.DISPATCH_SEQ) FROM Z_SFC_DISPATCH ZSD2 WHERE S.SFC = ZSD2.SFC AND S.SITE = ZSD2.SITE
) )

@ -50,6 +50,8 @@ public interface Constants {
String PRODUCT_SCRAP = "C";//产品报废 String PRODUCT_SCRAP = "C";//产品报废
String MATCH = "P"; //配作 String MATCH = "P"; //配作
String REPAIR = "F";//返修 String REPAIR = "F";//返修
String REPAIR_OUT_SOURCING = "FW";//返修(外协)
String REPAIR_NOT_ROUTER = "FB";//返修(不回原工艺)
String REGULAR_REPAIR = "CG";//常规维修 String REGULAR_REPAIR = "CG";//常规维修
String PLAN_REPAIR = "JH";//计划维修 String PLAN_REPAIR = "JH";//计划维修
String MAJOR_REPAIR = "DX";//大项修 String MAJOR_REPAIR = "DX";//大项修

@ -224,7 +224,10 @@ public enum AnomalyConstant {
AnomalyMethod3("R","让步放行"), AnomalyMethod3("R","让步放行"),
AnomalyMethod4("C","产品报废"), AnomalyMethod4("C","产品报废"),
AnomalyMethod5("P","配作"), AnomalyMethod5("P","配作"),
AnomalyMethod6("F","返修"); AnomalyMethod6("F","返修"),
AnomalyMethod7("FW","返修(外协)"),
AnomalyMethod8("FB","返修(不返回原工艺)");

@ -1,7 +1,6 @@
package com.foreverwin.mesnac.production.mapper; package com.foreverwin.mesnac.production.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc; import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder; import com.foreverwin.mesnac.meapi.model.ShopOrder;
@ -53,11 +52,10 @@ public interface SfcCrossMapper extends BaseMapper {
/** /**
* 线 * 线
* @param page * @param sfcBo
* @param routerBo
* @return * @return
*/ */
StepOperation findRouterLastOperationByRouterBo(IPage page, @Param("routerBo") String routerBo); List<StepOperation> findRouterLastOperationByRouterBo(@Param("sfcBo") String sfcBo);
List<StepOperation> getResourceBySfc(@Param("site") String site, @Param("sfc") String sfc); List<StepOperation> getResourceBySfc(@Param("site") String site, @Param("sfc") String sfc);

@ -7,6 +7,8 @@ import com.foreverwin.mesnac.production.model.SplitSfc;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* <p> * <p>
* Mapper * Mapper
@ -20,6 +22,9 @@ public interface SplitSfcMapper extends BaseMapper<SplitSfc> {
SfcDto getSfcData(@Param("handle") String handle); SfcDto getSfcData(@Param("handle") String handle);
SplitSfcDto getAbnormalQty(@Param("site") String site, @Param("sfc") String sfc, @Param("operation") String operation,@Param("abnormalNo") String abnormalNo); SplitSfcDto getAbnormalQty(@Param("site") String site, @Param("sfc") String sfc, @Param("stepId") String stepId,@Param("abnormalNo") String abnormalNo);
void updateSfcRouterInUse(@Param("sfcRouterBo") String sfcRouterRef, @Param("isUse") String isUse, @Param("completed") String completed);
List<SfcDto> getCompleteSfcData(@Param("handle") String handle);
} }

@ -8,6 +8,9 @@ import java.math.BigDecimal;
* : 2021-6-29 08:48 * : 2021-6-29 08:48
*/ */
public class StepOperation { public class StepOperation {
private String handle;
private String routerBo;
private String operationBo; private String operationBo;
@ -31,6 +34,32 @@ public class StepOperation {
private String resourceBo; private String resourceBo;
private String resrce;
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public String getRouterBo() {
return routerBo;
}
public void setRouterBo(String routerBo) {
this.routerBo = routerBo;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getResourceBo() { public String getResourceBo() {
return resourceBo; return resourceBo;
} }

@ -14,22 +14,25 @@ import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.RouterStepDto; import com.foreverwin.mesnac.meapi.dto.RouterStepDto;
import com.foreverwin.mesnac.meapi.dto.SfcDto; import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Router; import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.service.OperationService;
import com.foreverwin.mesnac.meapi.service.RouterService; import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.RouterStepService; import com.foreverwin.mesnac.meapi.service.RouterStepService;
import com.foreverwin.mesnac.meapi.service.ShopOrderService; import com.foreverwin.mesnac.meapi.service.SfcService;
import com.foreverwin.mesnac.production.dto.SplitSfcDto; 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.mapper.SplitSfcMapper;
import com.foreverwin.mesnac.production.model.SplitSfc; import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.model.StepOperation;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.mesnac.production.service.SplitSfcService; import com.foreverwin.mesnac.production.service.SplitSfcService;
import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.meext.MEServices; import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.nonconformance.*; import com.sap.me.nonconformance.*;
import com.sap.me.production.SplitSerializeServiceInterface; import com.sap.me.production.*;
import com.sap.me.production.SplitSfcDetail; import com.sap.me.status.StatusBOHandle;
import com.sap.me.production.SplitSfcRequest;
import com.sap.me.production.SplitSfcResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -58,10 +61,16 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
@Autowired @Autowired
private InspectionTaskService inspectionTaskService; private InspectionTaskService inspectionTaskService;
@Autowired @Autowired
private ShopOrderService shopOrderService; private OperationService operationService;
@Autowired
private SfcCrossMapper sfcCrossMapper;
@Autowired @Autowired
private RouterService routerService; private RouterService routerService;
@Autowired @Autowired
private SfcService sfcService;
@Autowired
private SfcCrossService sfcCrossService;
@Autowired
private RouterStepService routerStepService; private RouterStepService routerStepService;
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@ -92,11 +101,15 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
//根据sfc找工单等信息 //根据sfc找工单等信息
SfcDto sfcData = splitSfcMapper.getSfcData(handle); SfcDto sfcData = splitSfcMapper.getSfcData(handle);
if (sfcData==null){ if (sfcData==null){
throw new BaseException("未找到产品条码信息"); Sfc sfcServiceById = sfcService.getById(handle);
if (!sfcServiceById.getStatusBo().equals(HandleEnum.STATUS.getHandle(site,"405"))){
throw new BaseException("未找到产品条码信息");
}
sfcData= splitSfcMapper.getCompleteSfcData(handle).get(0);
} }
String operation = sfcData.getOperation(); String stepId = sfcData.getStepId();
//查询质量异常记录数量 //查询质量异常记录数量
SplitSfcDto sfcDto=splitSfcMapper.getAbnormalQty(site,dto.getSfc(),operation,dto.getAbnormalNo()); SplitSfcDto sfcDto=splitSfcMapper.getAbnormalQty(site,dto.getSfc(),stepId,dto.getAbnormalNo());
if (sfcDto==null){ if (sfcDto==null){
throw new BaseException("未找到闭环关闭的质量异常"); throw new BaseException("未找到闭环关闭的质量异常");
} }
@ -181,12 +194,40 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
//根据sfc找工单等信息 //根据sfc找工单等信息
SfcDto sfcData = splitSfcMapper.getSfcData(handle); SfcDto sfcData = splitSfcMapper.getSfcData(handle);
String operation = sfcData.getOperation(); String operation ;
BigDecimal qty ;
String shopOrder;
String stepId;
String stepSequence;
String resrce = null;
boolean isComplete=false;
String routerBoBySfc = null;
String sfcRouterRef = null;
if (sfcData==null){ if (sfcData==null){
throw new BaseException("未找到产品条码信息"); Sfc sfcServiceById = sfcService.getById(handle);
if (!sfcServiceById.getStatusBo().equals(new StatusBOHandle(site,"405").getValue())){
throw new BaseException("未找到产品条码信息");
}
StepOperation lastStep = sfcCrossMapper.findRouterLastOperationByRouterBo(handle).get(0);
qty=new BigDecimal(sfcServiceById.getQty().toString());
operation = StringUtil.trimHandle(lastStep.getOperationBo());
shopOrder=StringUtil.trimHandle(sfcServiceById.getShopOrderBo());
stepId=lastStep.getStepId();
stepSequence= String.valueOf(lastStep.getSequence());
routerBoBySfc=lastStep.getRouterBo();
sfcRouterRef=lastStep.getHandle();
resrce= lastStep.getResrce();
isComplete=true;
}else {
qty= BigDecimal.valueOf(sfcData.getQty());
operation = sfcData.getOperation();
shopOrder=sfcData.getShopOrder();
stepId=sfcData.getStepId();
stepSequence=sfcData.getStepSequence();
} }
//查询质量异常记录数量 处置工艺路线及不良代码 //查询质量异常记录数量 处置工艺路线及不良代码
SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation, abnormalNo); SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,stepId, abnormalNo);
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto(); SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setSite(site); sfcDispatchDto.setSite(site);
sfcDispatchDto.setSfc(sfc); sfcDispatchDto.setSfc(sfc);
@ -201,7 +242,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
if (StringUtil.isBlank(ncCode)){ if (StringUtil.isBlank(ncCode)){
throw new BaseException("异常处置未选择不良代码"); throw new BaseException("异常处置未选择不良代码");
} }
BigDecimal sfcQty = new BigDecimal(sfcData.getQty()); BigDecimal sfcQty = qty;
if (new BigDecimal(splitSfcDto.getNcQty()).compareTo(sfcQty)>=0){ if (new BigDecimal(splitSfcDto.getNcQty()).compareTo(sfcQty)>=0){
throw new BaseException("质量异常数量大于等于于产品条码的数量,不能拆分"); throw new BaseException("质量异常数量大于等于于产品条码的数量,不能拆分");
} }
@ -213,7 +254,14 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
SplitSfcRequest splitSfcRequest=new SplitSfcRequest(); SplitSfcRequest splitSfcRequest=new SplitSfcRequest();
try { try {
SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",site); SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",site);
NCProductionServiceInterface ncProductionService = MEServices.create("com.sap.me.nonconformance", "NCProductionService",site); if (isComplete){
//修改状态
updateStatus(site,handle,HandleEnum.STATUS.getHandle(site,"402"));
//调整步骤
splitSfcMapper.updateSfcRouterInUse(sfcRouterRef,"true","false");
placeInQueueAtStep(site, handle, routerBoBySfc, HandleEnum.OPERATION.getHandle(site,operation), sfcRouterRef, qty, stepId);
}
//拆sfc //拆sfc
List<SplitSfcDetail> newList=new ArrayList<>(); List<SplitSfcDetail> newList=new ArrayList<>();
SplitSfcDetail splitDetail=new SplitSfcDetail(); SplitSfcDetail splitDetail=new SplitSfcDetail();
@ -225,39 +273,19 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
SplitSfcResponse splitSfcResponse = splitSfcResponses.iterator().next(); SplitSfcResponse splitSfcResponse = splitSfcResponses.iterator().next();
String newSfcRef = splitSfcResponse.getNewSfcRef(); String newSfcRef = splitSfcResponse.getNewSfcRef();
String newSfc = StringUtil.trimHandle(newSfcRef); String newSfc = StringUtil.trimHandle(newSfcRef);
if(abnormalMethod.equals("F")&&StringUtil.notBlank(routerBo)){ if (isComplete){
//记录不合格 //修改状态
CreateNCRequest createNCRequest=new CreateNCRequest(); updateStatus(site,handle,HandleEnum.STATUS.getHandle(site,"405"));
createNCRequest.setQty(splitQty); splitSfcMapper.updateSfcRouterInUse(sfcRouterRef,"false","true");
createNCRequest.setSfcRef(newSfcRef); //Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);
ProductionContext productionContext=new ProductionContext(); //sfcCrossService.passAction(site,currentRevisionRef.getHandle(),resrce,handle,null);
StepIdentifier stepIdentifier=new StepIdentifier(); //修改库存数量
stepIdentifier.setStepId(sfcData.getStepId()); commonService.updateInventory(site,sfc,qty.subtract(splitQty));
stepIdentifier.setOperationId(sfcData.getOperation());
productionContext.setStepIdentifier(stepIdentifier);
String resrceBo = commonService.getResrceByOperation(operation);
productionContext.setResourceRef(resrceBo);
createNCRequest.setProdCtx(productionContext);
createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0]));
ncProductionService.createNC(createNCRequest);
//不合格处置特殊工艺路线
DispositionMultipleSfcsRequest dispositionSfcsRequest=new DispositionMultipleSfcsRequest();
List<String> sfcs=new ArrayList<>();
sfcs.add(newSfcRef);
dispositionSfcsRequest.setSfcs(sfcs);
dispositionSfcsRequest.setBypassStepValidation(true);
DispositionSelection dispositionSelection=new DispositionSelection();
Router maxRevisionRouter = routerService.getMaxRevisionRouter(site, StringUtil.trimHandle(routerBo));
dispositionSelection.setRouterRef(maxRevisionRouter.getHandle());
dispositionSfcsRequest.setDispositionSelection(dispositionSelection);
dispositionSfcsRequest.setProdCtx(new ProductionContext());
ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest);
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, maxRevisionRouter.getHandle());
if (routerOperationByRouterBo.isEmpty()){
throw new BaseException("处置工艺路线没有步骤");
}
sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", sfcData.getShopOrder(), sfc, operation, sfcDispatchBySfc.getStepId(),newSfc, maxRevisionRouter.getHandle(), sfcData.getStepSequence());
} }
if(abnormalMethod.equals("F")&&StringUtil.notBlank(routerBo)){
//记录不合格和处置
recordNc(site, shopOrder, sfc, operation, stepId, newSfc, stepSequence, splitQty, newSfcRef, splitNcCode, routerBo);
}
//创建专检任务 //创建专检任务
Map<String, Object> paramMap=new HashMap<>(); Map<String, Object> paramMap=new HashMap<>();
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P); paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P);
@ -286,4 +314,61 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
return null; return null;
} }
private void updateStatus(String site,String sfcBo,String statusBo) throws Exception {
SfcStateServiceInterface sfcStateServiceInterface = MEServices.create("com.sap.me.production", "SfcStateService", site);
UpdateSfcStatusRequest updateSfcStatusRequest = new UpdateSfcStatusRequest();
updateSfcStatusRequest.setSfcRef(sfcBo);
updateSfcStatusRequest.setStatusRef(statusBo);
sfcStateServiceInterface.updateSfcStatus(updateSfcStatusRequest);
}
private void placeInQueueAtStep(String site, String sfcRef, String routerRef, String operationRef, String sfcRouterRef, BigDecimal qty, String stepId) throws Exception {
SfcRoutingServiceInterface sfcRoutingService = MEServices.create("com.sap.me.production", "SfcRoutingService",site);
PlaceInQueueAtStepRequest request=new PlaceInQueueAtStepRequest();
request.setSfcRef(sfcRef);
request.setPlacementRouterRef(routerRef);
request.setPlacementOperationRef(operationRef);
request.setOperationSelectionType(OperationSelectionType.CURRENT_OPERATION);
request.setPlacementSfcRouterRef(sfcRouterRef);
request.setQuantity(qty);
request.setPlacementStepId(stepId);
sfcRoutingService.placeInQueueAtStep(request);
}
private void recordNc(String site, String shopOrder, String sfc, String operation, String stepId, String newSfc, String stepSequence, BigDecimal splitQty, String newSfcRef, String[] splitNcCode, String routerBo) throws Exception {
NCProductionServiceInterface ncProductionService = MEServices.create("com.sap.me.nonconformance", "NCProductionService",site);
//记录不合格
CreateNCRequest createNCRequest=new CreateNCRequest();
createNCRequest.setQty(splitQty);
createNCRequest.setSfcRef(newSfcRef);
ProductionContext productionContext=new ProductionContext();
StepIdentifier stepIdentifier=new StepIdentifier();
stepIdentifier.setStepId(stepId);
stepIdentifier.setOperationId(operation);
productionContext.setStepIdentifier(stepIdentifier);
String resrceBo = commonService.getResrceByOperation(operation);
productionContext.setResourceRef(resrceBo);
createNCRequest.setProdCtx(productionContext);
createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0]));
ncProductionService.createNC(createNCRequest);
//不合格处置特殊工艺路线
DispositionMultipleSfcsRequest dispositionSfcsRequest=new DispositionMultipleSfcsRequest();
List<String> sfcs=new ArrayList<>();
sfcs.add(newSfcRef);
dispositionSfcsRequest.setSfcs(sfcs);
dispositionSfcsRequest.setBypassStepValidation(true);
DispositionSelection dispositionSelection=new DispositionSelection();
Router maxRevisionRouter = routerService.getMaxRevisionRouter(site, StringUtil.trimHandle(routerBo));
dispositionSelection.setRouterRef(maxRevisionRouter.getHandle());
dispositionSfcsRequest.setDispositionSelection(dispositionSelection);
dispositionSfcsRequest.setProdCtx(new ProductionContext());
ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest);
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, maxRevisionRouter.getHandle());
if (routerOperationByRouterBo.isEmpty()){
throw new BaseException("处置工艺路线没有步骤");
}
sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", shopOrder, sfc, operation, stepId, newSfc, maxRevisionRouter.getHandle(), stepSequence);
}
} }

@ -10,6 +10,10 @@
<result property="operation" column="OPERATION" /> <result property="operation" column="OPERATION" />
<result property="description" column="DESCRIPTION" /> <result property="description" column="DESCRIPTION" />
<result property="resourceBo" column="RESOURCE_BO" /> <result property="resourceBo" column="RESOURCE_BO" />
<result property="handle" column="HANDLE" />
<result property="routerBo" column="ROUTER_BO" />
<result property="resrce" column="RESRCE" />
</resultMap> </resultMap>
<select id="findBindingBarcode" resultMap="com.foreverwin.mesnac.meapi.mapper.SfcMapper.BaseResultMap"> <select id="findBindingBarcode" resultMap="com.foreverwin.mesnac.meapi.mapper.SfcMapper.BaseResultMap">
@ -54,15 +58,14 @@
</select> </select>
<select id="findRouterLastOperationByRouterBo" resultMap="StepOperationMap"> <select id="findRouterLastOperationByRouterBo" resultMap="StepOperationMap">
SELECT select zsd.RESRCE,srt.HANDLE,sep.STEP_ID ,sep.STEP_SEQUENCE "SEQUENCE",sep.OPERATION_BO,srt.ROUTER_BO
STEP.STEP_ID , from sfc sfc
STEP."SEQUENCE", inner join sfc_routing sri on sfc.handle = sri.sfc_bo
RO.OPERATION_BO inner join sfc_router srt on sri.handle = srt.sfc_routing_bo
FROM ROUTER R inner join sfc_step sep on srt.handle = sep.sfc_router_bo
JOIN ROUTER_STEP STEP ON R.HANDLE = STEP.ROUTER_BO JOIN Z_SFC_DISPATCH zsd ON zsd.SFC=sfc.SFC AND zsd.SITE=sfc.SITE AND sep.STEP_ID=zsd.STEP_ID
JOIN ROUTER_OPERATION RO ON STEP.HANDLE = RO.ROUTER_STEP_BO WHERE SFC.HANDLE=#{sfcBo}
WHERE R.HANDLE = #{routerBo} ORDER BY sep.STEP_SEQUENCE DESC
ORDER BY STEP."SEQUENCE" DESC
</select> </select>
<select id="findShopOrderListByStatus" resultMap="com.foreverwin.mesnac.meapi.mapper.ShopOrderMapper.BaseResultMap"> <select id="findShopOrderListByStatus" resultMap="com.foreverwin.mesnac.meapi.mapper.ShopOrderMapper.BaseResultMap">

@ -377,11 +377,26 @@
JOIN OPERATION OP ON 'OperationBO:'|| OP.SITE ||','|| OP.OPERATION||',#'=SS.OPERATION_BO JOIN OPERATION OP ON 'OperationBO:'|| OP.SITE ||','|| OP.OPERATION||',#'=SS.OPERATION_BO
WHERE S.HANDLE=#{handle} WHERE S.HANDLE=#{handle}
</select> </select>
<select id="getCompleteSfcData" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto">
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.QTY,ST.STATUS,STEP_SEQUENCE FROM SFC S
JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO
JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
LEFT JOIN CUSTOM_FIELDS CF ON cf.HANDLE=s.SHOP_ORDER_BO AND CF."ATTRIBUTE"='WORK_ORDER'
JOIN SFC_ROUTING SR ON s.HANDLE=sr.SFC_BO
JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO
JOIN SFC_STEP SS ON SR2.HANDLE =SS.SFC_ROUTER_BO
JOIN OPERATION OP ON 'OperationBO:'|| OP.SITE ||','|| OP.OPERATION||',#'=SS.OPERATION_BO
WHERE S.HANDLE=#{handle}
ORDER BY DATE_QUEUED DESC
</select>
<select id="getAbnormalQty" resultType="com.foreverwin.mesnac.production.dto.SplitSfcDto"> <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,zab.STEP_ID 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 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' OR zab.STATUS='F') AND zab."TYPE"='Z' AND (zsbd.ABNORMAL_METHOD='F' OR zsbd.ABNORMAL_METHOD='C') WHERE ZAB.SFC=#{sfc} AND zab.ABNORMAL_NO=#{abnormalNo} AND zab.SITE=#{site} AND ZAB.STEP_ID=#{stepId} AND (zab.STATUS='G' OR zab.STATUS='F') AND zab."TYPE"='Z' AND (zsbd.ABNORMAL_METHOD='F' OR zsbd.ABNORMAL_METHOD='C')
</select> </select>
<update id="updateSfcRouterInUse">
UPDATE SFC_ROUTER set IN_USE=#{isUse},COMPLETED=#{completed} where handle=#{sfcRouterBo}
</update>
</mapper> </mapper>

Loading…
Cancel
Save