diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java index 10421d8d..3199bd5a 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java @@ -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 frontPage, SfcDto sfc){ + IPage result; + try { + String site = CommonMethods.getSite(); + sfc.setSite(site); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(sfc); + result = sfcService.pageByResrce(frontPage.getPagePlus(), queryWrapper); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + return R.ok(result); + } /** * 分页查询数据 * diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java index fd171b67..612d7b3e 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java @@ -23,4 +23,6 @@ public interface OperationMapper extends BaseMapper { Operation selectOperationBySfcBo(@Param("sfcBo") String sfcBo, @Param("locale") String locale); + Operation getCurrentRevisionRef(@Param("site") String site, @Param("operation") String operation); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java index 42dfb822..021b01b0 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java @@ -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 { List getSfcListByResrceBO(String resrceBO); SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc); + + Sfc findBySfc(@Param("sfc") Sfc sfc); + + IPage pageByResrce(Page pagePlus,@Param("ew") QueryWrapper queryWrapper,@Param("locale")String locale); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java index 6903de18..35342dfe 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java @@ -26,4 +26,6 @@ public interface OperationService extends IService { IPage selectPage(Page page, QueryWrapper operation); List selectList(Operation operation); + + Operation getCurrentRevisionRef(String site, String operation); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java index be4a8471..c89430ad 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java @@ -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 { + IPage pageByResrce(Page pagePlus, QueryWrapper queryWrapper); /** * 分页查询 @@ -45,4 +49,5 @@ public interface SfcService extends IService { * @return */ SfcDto findSfcData(String site, String sfc); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java index 0429f6e2..71b6d230 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java @@ -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 implements SfcSe @Autowired private SfcMapper sfcMapper; + @Override + public IPage pageByResrce(Page pagePlus, QueryWrapper queryWrapper) { + return sfcMapper.pageByResrce(pagePlus, queryWrapper, LocaleContextHolder.getLocale().getLanguage()); + } + @Override public IPage selectPage(FrontPage frontPage, Sfc sfc) { QueryWrapper queryWrapper = new QueryWrapper<>(); diff --git a/meapi/src/main/resources/mapper/OperationMapper.xml b/meapi/src/main/resources/mapper/OperationMapper.xml index f2506945..83ba455f 100644 --- a/meapi/src/main/resources/mapper/OperationMapper.xml +++ b/meapi/src/main/resources/mapper/OperationMapper.xml @@ -598,11 +598,21 @@ + + diff --git a/meapi/src/main/resources/mapper/SfcMapper.xml b/meapi/src/main/resources/mapper/SfcMapper.xml index 480f8b26..6e535505 100644 --- a/meapi/src/main/resources/mapper/SfcMapper.xml +++ b/meapi/src/main/resources/mapper/SfcMapper.xml @@ -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} + + diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java index 05f1e4d6..0e34c706 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/PodTemplateController.java @@ -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 sfcDtoList) { + podTemplateService.sfcStart(sfcDtoList); + return R.ok(); + } + + /** + * 生产操作员面板工作列表 + * @param sfcDto + * @return + */ + @ResponseBody + @GetMapping("/getSfcInfo") + public R getSfcInfo(SfcDto sfcDto) { + return R.ok(podTemplateService.getSfcInfo(sfcDto)); + } } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java b/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java index 72bc3622..09244b09 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/mapper/SfcCrossMapper.java @@ -39,8 +39,6 @@ public interface SfcCrossMapper extends BaseMapper { */ List 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 findShopOrderListByStatus(@Param("plannedWorkCenterBo") String plannedWorkCenterBo, @Param("status") String customStatus); - //List> findSfcListBySnList(@Param("site") String site, @Param("snList") List snList); /** * 查找工艺路线的最后一道工序 @@ -93,5 +90,7 @@ public interface SfcCrossMapper extends BaseMapper { Map querySfcData(@Param("site")String site, @Param("locale")String locale, @Param("dto")SfcDto sfcDto); - List> querySfcStep(@Param("site")String site, @Param("sfc")String sfc, @Param("operation")String operation); + Map 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); } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java index de7e633e..b2200c76 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/PodTemplateService.java @@ -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 resrceEnter(WorkCenterDto workCenterDto); Map sfcEnter(SfcDto workCenterDto); + + Object getSfcInfo(SfcDto sfcDto); + + void sfcStart(List sfcDto); } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java new file mode 100644 index 00000000..e8f33804 --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/SfcCrossService.java @@ -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; + +} diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java index ae844a1b..e2f1567f 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java @@ -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 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 resultMap = sfcCrossMapper.querySfcData(site,locale,sfcDto); - if(resultMap == null){ + Map resultMap = sfcCrossMapper.querySfcData(site, locale, sfcDto); + if (resultMap == null) { throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!"); } - List> substepList = sfcCrossMapper.querySfcStep(site, sfc, operation); + //List> substepList = sfcCrossMapper.querySfcStep(site, sfc, operationBySfcBo.getOperation()); + List> 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 substepList = sfcCrossMapper.getSfcInfo(site, sfc, operation); + return substepList; + } + + @Override + public void sfcStart(List 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); + } + }); } } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java new file mode 100644 index 00000000..5b868a2f --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SfcCrossServiceImpl.java @@ -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); + } +} diff --git a/production/src/main/resources/mapper/SfcCrossMapper.xml b/production/src/main/resources/mapper/SfcCrossMapper.xml index 88d69a6c..d90b0ea9 100644 --- a/production/src/main/resources/mapper/SfcCrossMapper.xml +++ b/production/src/main/resources/mapper/SfcCrossMapper.xml @@ -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 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} + +