philip 4 years ago
parent ce0b98d283
commit eaf7ea4156

@ -62,7 +62,28 @@ public class SfcController {
result = sfcService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/pageByResrce")
public R page(FrontPage<Sfc> frontPage, SfcDto sfc){
IPage result;
try {
String site = CommonMethods.getSite();
sfc.setSite(site);
QueryWrapper<SfcDto> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfc);
result = sfcService.pageByResrce(frontPage.getPagePlus(), queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
/**
*
*

@ -23,4 +23,6 @@ public interface OperationMapper extends BaseMapper<Operation> {
Operation selectOperationBySfcBo(@Param("sfcBo") String sfcBo, @Param("locale") String locale);
Operation getCurrentRevisionRef(@Param("site") String site, @Param("operation") String operation);
}

@ -1,5 +1,8 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -24,4 +27,8 @@ public interface SfcMapper extends BaseMapper<Sfc> {
List<Sfc> getSfcListByResrceBO(String resrceBO);
SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc);
Sfc findBySfc(@Param("sfc") Sfc sfc);
IPage pageByResrce(Page<Sfc> pagePlus,@Param("ew") QueryWrapper<SfcDto> queryWrapper,@Param("locale")String locale);
}

@ -26,4 +26,6 @@ public interface OperationService extends IService<Operation> {
IPage<Operation> selectPage(Page<Operation> page, QueryWrapper<Operation> operation);
List<Operation> selectList(Operation operation);
Operation getCurrentRevisionRef(String site, String operation);
}

@ -1,7 +1,10 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.modular.core.util.FrontPage;
@ -17,6 +20,7 @@ import java.util.List;
* @since 2021-06-02
*/
public interface SfcService extends IService<Sfc> {
IPage<Sfc> pageByResrce(Page<Sfc> pagePlus, QueryWrapper<SfcDto> queryWrapper);
/**
*
@ -45,4 +49,5 @@ public interface SfcService extends IService<Sfc> {
* @return
*/
SfcDto findSfcData(String site, String sfc);
}

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.meapi.mapper.OperationMapper;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.service.OperationService;
import com.foreverwin.modular.core.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
@ -46,5 +47,14 @@ public class OperationServiceImpl extends ServiceImpl<OperationMapper, Operation
return super.list(queryWrapper);
}
@Override
public Operation getCurrentRevisionRef(String site,String operation) {
Operation currentRevisionRef = operationMapper.getCurrentRevisionRef(site, operation);
if (currentRevisionRef==null){
throw new BaseException("未找到工序的当前版本");
}
return currentRevisionRef;
}
}

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -9,6 +10,7 @@ import com.foreverwin.mesnac.meapi.mapper.SfcMapper;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.service.SfcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +31,11 @@ public class SfcServiceImpl extends ServiceImpl<SfcMapper, Sfc> implements SfcSe
@Autowired
private SfcMapper sfcMapper;
@Override
public IPage pageByResrce(Page<Sfc> pagePlus, QueryWrapper<SfcDto> queryWrapper) {
return sfcMapper.pageByResrce(pagePlus, queryWrapper, LocaleContextHolder.getLocale().getLanguage());
}
@Override
public IPage<Sfc> selectPage(FrontPage<Sfc> frontPage, Sfc sfc) {
QueryWrapper<Sfc> queryWrapper = new QueryWrapper<>();

@ -598,11 +598,21 @@
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectOperationBySfcBo" resultMap="BaseResultMap">
SELECT OP.HANDLE, OP.OPERATION,OT.DESCRIPTION FROM SFC_ROUTING SR
SELECT OP.HANDLE, OP.OPERATION,OT.DESCRIPTION ,SS.STEP_ID FROM SFC_ROUTING SR
JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO AND SR2.IN_USE = 'true'
JOIN SFC_STEP SS ON SR2.HANDLE =SS.SFC_ROUTER_BO
JOIN OPERATION OP ON 'OperationBO:'|| OP.SITE ||','|| OP.OPERATION||',#'=SS.OPERATION_BO
LEFT JOIN OPERATION_T OT ON OP.HANDLE = OT.OPERATION_BO AND OT.LOCALE = #{locale}
WHERE SR.SFC_BO =#{sfcBo} AND (SS.QTY_IN_QUEUE>0 or SS.QTY_IN_WORK>0)
</select>
<select id="getCurrentRevisionRef" resultMap="BaseResultMap">
SELECT
HANDLE,OPERATION,
REVISION
FROM OPERATION
WHERE SITE = #{site}
AND OPERATION = #{operation}
AND CURRENT_REVISION = 'true'
</select>
</mapper>

@ -663,4 +663,12 @@
LEFT JOIN OPERATION_T OTT ON SPLIT(OTT.OPERATION_BO,2) = ZSD.PREPOSITION_OPERATION AND OTT.LOCALE = 'zh'
WHERE SC.SITE = #{site} AND SC.SFC = #{sfc}
</select>
<select id="pageByResrce" resultMap="FullResultMap">
SELECT S.SFC,S.QTY,IT.DESCRIPTION ITEM_DESCRIPTION FROM SFC S
LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.HANDLE AND IT.LOCALE=#{locale}
JOIN Z_SFC_DISPATCH zsd ON S.SFC=zsd.SFC AND S.SITE=zsd.SITE
WHERE S.SITE=#{ew.entity.site} AND ZSD.RESRCE=#{ew.entity.resrce} AND ZSD.DISPATCH_STATUS!='CANCEL'
AND S.STATUS_BO IN ('StatusBO:'||#{ew.entity.site}||',401','StatusBO:'||#{ew.entity.site}||',402','StatusBO:'||#{ew.entity.site}||',403')
</select>
</mapper>

@ -9,6 +9,9 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
@RequestMapping("/sfcDataMains")
public class PodTemplateController {
@ -37,4 +40,27 @@ public class PodTemplateController {
public R sfcEnter(SfcDto sfcDto) {
return R.ok(podTemplateService.sfcEnter(sfcDto));
}
/**
* sfc
* @param sfcDtoList
* @return
*/
@ResponseBody
@GetMapping("/sfcStart")
public R sfcStart(List<SfcDto> sfcDtoList) {
podTemplateService.sfcStart(sfcDtoList);
return R.ok();
}
/**
*
* @param sfcDto
* @return
*/
@ResponseBody
@GetMapping("/getSfcInfo")
public R getSfcInfo(SfcDto sfcDto) {
return R.ok(podTemplateService.getSfcInfo(sfcDto));
}
}

@ -39,8 +39,6 @@ public interface SfcCrossMapper extends BaseMapper {
*/
List<StepOperation> findRouterOperationByRouterBo(@Param("site") String site, @Param("routerBo") String routerBo, @Param("locale") String locale);
// String getDoneSfcItemBo(IPage page, @Param("dataAttr") String dataAttr,
// @Param("site") String site, @Param("statusBo") String statusBo);
/**
@ -60,7 +58,6 @@ public interface SfcCrossMapper extends BaseMapper {
List<ShopOrder> findShopOrderListByStatus(@Param("plannedWorkCenterBo") String plannedWorkCenterBo,
@Param("status") String customStatus);
//List<Map<String, Object>> findSfcListBySnList(@Param("site") String site, @Param("snList") List<String> snList);
/**
* 线
@ -93,5 +90,7 @@ public interface SfcCrossMapper extends BaseMapper {
Map<String, Object> querySfcData(@Param("site")String site, @Param("locale")String locale, @Param("dto")SfcDto sfcDto);
List<Map<String, Object>> querySfcStep(@Param("site")String site, @Param("sfc")String sfc, @Param("operation")String operation);
Map<String, Object> getSfcInfo(@Param("site")String site, @Param("sfc")String sfc, @Param("operation")String operation);
Integer getSfcDispatch(@Param("site") String site, @Param("sfc") String sfc, @Param("operation") String operation, @Param("stepId") String stepId,@Param("resrce")String resrce);
}

@ -3,10 +3,15 @@ package com.foreverwin.mesnac.production.service;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
import java.util.List;
import java.util.Map;
public interface PodTemplateService {
Map<String, Object> resrceEnter(WorkCenterDto workCenterDto);
Map<String, Object> sfcEnter(SfcDto workCenterDto);
Object getSfcInfo(SfcDto sfcDto);
void sfcStart(List<SfcDto> sfcDto);
}

@ -0,0 +1,44 @@
package com.foreverwin.mesnac.production.service;
import java.math.BigDecimal;
/**
* :
* : philip
* : 2021-6-30
*/
public interface SfcCrossService {
/**
*
* @param site
* @param operationRef
* @param resource
* @param sfcRef
* @param qty
* @throws Exception
*/
void startAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception;
/**
*
* @param site
* @param operationRef
* @param resource
* @param sfcRef
* @param qty
* @throws Exception
*/
void completeAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception;
/**
* SFC
* @param site
* @param operationRef
* @param resource
* @param sfcRef
* @param qty
* @throws Exception
*/
void passAction(String site, String operationRef, String resource, String sfcRef, BigDecimal qty) throws Exception;
}

@ -2,16 +2,19 @@ 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.ExceptionUtil;
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.Operation;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.service.OperationService;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.mesnac.meapi.service.SfcService;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.service.PodTemplateService;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.CommonMethods;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +22,8 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,24 +40,27 @@ public class PodTemplateServiceImpl implements PodTemplateService {
private CommonService commonService;
@Autowired
private SfcCrossMapper sfcCrossMapper;
@Autowired
private SfcCrossService sfcCrossService;
@Autowired
private OperationService operationService;
@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+" 不存在");
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 (StringUtil.isBlank(workShopBo)) {
throw new BaseException("资源 " + resrce + " 未匹配到车间");
}
if (!workCenter.equals(StringUtil.trimHandle(workShopBo))){
throw new BaseException("资源 "+resrce+" 与车间不匹配");
if (!workCenter.equals(StringUtil.trimHandle(workShopBo))) {
throw new BaseException("资源 " + resrce + " 与车间不匹配");
}
//查询在该设备存在活动中的SFC
@ -70,26 +78,36 @@ public class PodTemplateServiceImpl implements PodTemplateService {
String sfc = sfcDto.getSfc();
String operation = sfcDto.getOperation();
String locale = LocaleContextHolder.getLocale().getLanguage();
String resrce = sfcDto.getResrce();
//校验产品条码是否存在
Sfc sfcById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc));
if (sfcById==null){
throw new BaseException("产品条码"+sfc+"不存在");
if (sfcById == null) {
throw new BaseException("产品条码" + sfc + "不存在");
}
String status = StringUtil.trimHandle(sfcById.getStatusBo());
if (!status.equals("403") && !status.equals("401") && !status.equals("402")) {
throw new BaseException("产品条码" + sfc + "不在工作中或排队中");
}
//校验产品条码是否在当前工序排队
Operation operationBySfcBo = commonService.getOperationBySfcBo(sfcById.getHandle());
if (StringUtil.notBlank(operation)&&!operationBySfcBo.getOperation().equals(operation)){
/* if (StringUtil.notBlank(operation)&&!operationBySfcBo.getOperation().equals(operation)){
throw new BaseException("产品条码"+sfc+"在"+operationBySfcBo.getOperation()+"/"+operationBySfcBo.getDescription()+"工序");
}
}*/
//校验SFC+工序+设备+STEP_ID是否与当前设备确认的派工单匹配
Integer integer = sfcCrossMapper.getSfcDispatch(site, sfc, operationBySfcBo.getOperation(), operationBySfcBo.getStepId(), resrce);
if (integer < 1) {
throw new BaseException("产品条码与当前设备工序确认的派工单不匹配");
}
String substep = "";
String substepHandle = "";
//构造前台所需要的数据
Map<String, Object> resultMap = sfcCrossMapper.querySfcData(site,locale,sfcDto);
if(resultMap == null){
Map<String, Object> resultMap = sfcCrossMapper.querySfcData(site, locale, sfcDto);
if (resultMap == null) {
throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
}
List<Map<String, Object>> substepList = sfcCrossMapper.querySfcStep(site, sfc, operation);
//List<Map<String, Object>> substepList = sfcCrossMapper.querySfcStep(site, sfc, operationBySfcBo.getOperation());
List<Map<String, Object>> substepList = new ArrayList<>();
resultMap.put("SFC_STEP_LIST", substepList);
String stepId = (String) resultMap.get("STEP_ID");
@ -194,6 +212,33 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}*/
resultMap.put("IS_CREATE_H", isCreateH);
resultMap.put("IS_CREATE_Z", isCreateZ);
return null;
return resultMap;
}
@Override
public Object getSfcInfo(SfcDto sfcDto) {
String site = CommonMethods.getSite();
String operation = sfcDto.getOperation();
String sfc = sfcDto.getSfc();
Map<String, Object> substepList = sfcCrossMapper.getSfcInfo(site, sfc, operation);
return substepList;
}
@Override
public void sfcStart(List<SfcDto> sfcDtoList) {
sfcDtoList.forEach(sfcDto -> {
String site = CommonMethods.getSite();
String operation = sfcDto.getOperation();
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);
String resrce = sfcDto.getResrce();
String sfc = sfcDto.getSfc();
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(sfc, sfc));
BigDecimal qty=new BigDecimal(sfcServiceById.getQty().toString());
try {
sfcCrossService.startAction(site, currentRevisionRef.getHandle(),resrce,sfcServiceById.getHandle(),qty);
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
});
}
}

@ -0,0 +1,64 @@
package com.foreverwin.mesnac.production.service.impl;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.CommonMethods;
import com.sap.me.plant.ResourceBOHandle;
import com.sap.me.production.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
/**
* :
* : philip
* : 2021-06-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SfcCrossServiceImpl implements SfcCrossService {
@Override
public void startAction(String site, String operationRef,
String resource, String sfcRef, BigDecimal qty) throws Exception {
SfcStartServiceInterface sfcStartService = MEServices.create("com.sap.me.production", "SfcStartService", site);
StartSfcRequest paramStartSfcRequest = new StartSfcRequest();
paramStartSfcRequest.setQty(qty);
paramStartSfcRequest.setOperationRef(operationRef);
paramStartSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue());
paramStartSfcRequest.setSfcRef(sfcRef);
paramStartSfcRequest.setUserRef(CommonMethods.getUserBo());
sfcStartService.startSfc(paramStartSfcRequest);
}
@Override
public void completeAction(String site, String operationRef,
String resource, String sfcRef, BigDecimal qty) throws Exception {
SfcCompleteServiceInterface sfcCompleteService = MEServices.create("com.sap.me.production", "SfcCompleteService", site);
CompleteSfcRequest paramCompleteSfcRequest = new CompleteSfcRequest();
paramCompleteSfcRequest.setOperationRef(operationRef);
paramCompleteSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue());
paramCompleteSfcRequest.setSfcRef(sfcRef);
if(qty != null) {
paramCompleteSfcRequest.setQuantity(qty);
}
paramCompleteSfcRequest.setLocation("");
sfcCompleteService.completeSfc(paramCompleteSfcRequest);
}
@Override
public void passAction(String site, String operationRef,
String resource, String sfcRef, BigDecimal qty) throws Exception {
SfcCompleteServiceInterface sfcCompleteService = MEServices.create("com.sap.me.production", "SfcCompleteService", site);
CompleteSfcQuickRequest paramCompleteSfcRequest = new CompleteSfcQuickRequest();
paramCompleteSfcRequest.setOperationRef(operationRef);
paramCompleteSfcRequest.setResourceRef(new ResourceBOHandle(site, resource).getValue());
paramCompleteSfcRequest.setSfcRef(sfcRef);
if(qty != null) {
paramCompleteSfcRequest.setQuantity(qty);
}
sfcCompleteService.completeSfcQuick(paramCompleteSfcRequest);
}
}

@ -139,8 +139,8 @@ WHERE sfc.site = #{site} and
RO_CF2.VALUE TOOL ,SOD.HANDLE SFC_DISPATCH_DETAIL_BO,
S.SFC,S.QTY SFC_QTY,RS.STEP_ID, SOD.DISPATCH_NO ,
TO_CHAR( SOD.PLANNED_START_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss')START_DATE,
TO_CHAR(SOD.PLANNED_COMPLETE_DATE + INTERVAL '8' HOUR ,'yyyy-mm-dd hh24:mi:ss')COMP_DATE,
TO_CHAR((SOD.PLANNED_COMPLETE_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H' ADD_DATE,
TO_CHAR(SOD.PLANNED_COMP_DATE + INTERVAL '8' HOUR ,'yyyy-mm-dd hh24:mi:ss')COMP_DATE,
TO_CHAR((SOD.PLANNED_COMP_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H' ADD_DATE,
CASE WHEN OT.DESCRIPTION LIKE 'CH%' THEN SUBSTR(OT.DESCRIPTION, 0, 3) ELSE N'' END SLOT
FROM SFC S
INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
@ -159,7 +159,7 @@ WHERE sfc.site = #{site} and
INNER JOIN ITEM I ON I.HANDLE = S.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE =#{locale}
INNER JOIN (
SELECT SD.HANDLE, SD.SFC,SD.RESRCE,SD.OPERATION,SD.STEP_ID,SD.PLANNED_COMPLETE_DATE, SD.PLANNED_START_DATE,SD.DISPATCH_NO
SELECT SD.HANDLE, SD.SFC,SD.RESRCE,SD.OPERATION,SD.STEP_ID,SD.PLANNED_COMP_DATE, SD.PLANNED_START_DATE,SD.DISPATCH_NO
FROM Z_PROD_READY_TASK RB
INNER JOIN Z_SFC_DISPATCH SD ON SD.HANDLE = RB.SFC_DISPATCH_BO
WHERE RB.SITE =#{site} AND RB.STATUS = 'F'
@ -170,42 +170,28 @@ WHERE sfc.site = #{site} and
OP.OPERATION, OT.DESCRIPTION ,OP.OPERATION||'/'||RS.STEP_ID ,RO_CF2.VALUE,
S.SFC,S.QTY ,RS.STEP_ID,SOD.DISPATCH_NO , SOD.HANDLE ,
TO_CHAR( SOD.PLANNED_START_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'),
TO_CHAR(SOD.PLANNED_COMPLETE_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'),
TO_CHAR((SOD.PLANNED_COMPLETE_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H',
TO_CHAR(SOD.PLANNED_COMP_DATE + INTERVAL '8' HOUR,'yyyy-mm-dd hh24:mi:ss'),
TO_CHAR((SOD.PLANNED_COMP_DATE - SOD.PLANNED_START_DATE )*24,'fm9999999990.00')||'H',
CASE WHEN OT.DESCRIPTION LIKE 'CH%' THEN SUBSTR(OT.DESCRIPTION, 0, 3) ELSE N'' END
</select>
<select id="querySfcStep" resultType="map">
SELECT B1.OPERATION,B1.STEP_ID,B1.DESCRIPTION STEP_DESC,B1.STATE,
B1.HANDLE,B1."SEQUENCE",
CASE WHEN B1."SEQUENCE"=B1.MAXSEQ THEN 'true'
ELSE 'false' END IS_SEQTRUE,B1.LONG_DESCRIPTION,
CASE WHEN B1.STATE ='FINISHED' THEN N'已完工'
WHEN B1."SEQUENCE"=B1.MAXSEQ AND B1.STATE ='READY' AND B1.STATUS ='403' THEN N'加工中'
ELSE N'未加工'
END STEP_STATUS
FROM (
SELECT A1.*,MAX(A1.SELECTSEQ) OVER(PARTITION BY OPERATION) MAXSEQ
FROM (
SELECT O.OPERATION,SST.SUBSTEP STEP_ID,SS.STATE,
NVL(SST.DESCRIPTION,SU.DESCRIPTION) DESCRIPTION,
CASE WHEN SS.STATE ='FINISHED' THEN N'已完工' ELSE N'加工中' END STEP_STATUS,
SS.HANDLE,SS."SEQUENCE",
CASE WHEN SS.STATE='FINISHED' THEN SST."SEQUENCE"+1 ELSE 0 END SELECTSEQ,ST.STATUS,
NVL(SST.LONG_DESCRIPTION,SU.LONG_DESCRIPTION) LONG_DESCRIPTION
FROM SFC_SUBSTEP SS
INNER JOIN SFC_STEP SSTEP ON SS.SFC_STEP_BO=SSTEP.HANDLE AND SSTEP.DONE='false'
AND (SSTEP.QTY_IN_QUEUE > 0 OR SSTEP.QTY_IN_WORK > 0)
INNER JOIN SFC_ROUTER SR ON SR.HANDLE=SSTEP.SFC_ROUTER_BO
INNER JOIN SFC_ROUTING SRI ON SRI.HANDLE=SR.SFC_ROUTING_BO
INNER JOIN ROUTER_SUBSTEP SST ON SS.ROUTER_SUBSTEP_BO = SST.HANDLE
LEFT JOIN SUBSTEP SU ON SU.SUBSTEP = SST.SUBSTEP AND SU.CURRENT_REVISION = 'true' AND SU.SITE = #{site}
INNER JOIN SFC S ON S.HANDLE=SRI.SFC_BO
INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
INNER JOIN OPERATION O ON O.OPERATION=SPLIT(SSTEP.OPERATION_BO,2) AND O.SITE=S.SITE AND O.CURRENT_REVISION = 'true'
AND #{operation} IS NULL OR #{operation} = O.OPERATION)
WHERE S.SFC=#{sfc} AND S.SITE= #{site} ORDER BY SST."SEQUENCE"
) A1
) B1 ORDER BY B1."SEQUENCE" ASC
<select id="getSfcInfo" resultType="map">
SELECT O.OPERATION,SSTEP.STEP_ID,IT.DESCRIPTION,S.SFC,S.QTY,
CASE WHEN SSTEP.QTY_IN_WORK > 0 THEN '工作中'
WHEN SSTEP.QTY_IN_QUEUE > 0 THEN '排队中'
ELSE '新建' END STEP_STATUS
FROM SFC S
LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.HANDLE AND IT.LOCALE='zh'
INNER JOIN SFC_ROUTING SRI ON S.HANDLE=SRI.SFC_BO
INNER JOIN SFC_ROUTER SR ON SRI.HANDLE=SR.SFC_ROUTING_BO AND SR.IN_USE='true'
INNER JOIN ROUTER_STEP RS ON RS.ROUTER_BO=sr.ROUTER_BO
INNER JOIN SFC_STEP SSTEP ON SSTEP.SFC_ROUTER_BO=SR.HANDLE AND RS.STEP_ID= SSTEP.STEP_ID
AND (SSTEP.QTY_IN_QUEUE > 0 OR SSTEP.QTY_IN_WORK > 0)
INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
INNER JOIN OPERATION O ON O.OPERATION=SPLIT(SSTEP.OPERATION_BO,2) AND O.SITE=S.SITE AND O.CURRENT_REVISION = 'true'
AND #{operation} = O.OPERATION
WHERE S.SFC=#{sfc} AND S.SITE=#{site}
</select>
<select id="getSfcDispatch" resultType="java.lang.Integer">
SELECT COUNT(HANDLE) FROM Z_SFC_DISPATCH zsd WHERE OPERATION= #{operation} AND SFC= #{sfc} AND STEP_ID= #{stepId} AND SITE= #{site} AND RESRCE=#{resrce}
</select>
</mapper>

Loading…
Cancel
Save