# Conflicts:
#	anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java
#	anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java
#	anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java
#	anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java
#	anomaly/src/main/resources/mapper/ReportMapper.xml
#	quality/src/main/java/com/foreverwin/mesnac/quality/service/impl/InspectionTaskManageServiceImpl.java
master
Leon 4 years ago
commit 1f090f3466

@ -217,7 +217,11 @@ public class AbnormalBillController {
@RequestParam List<String> ncGroupAndNcCodes,
@RequestParam List<String> dutyCauseType,
@RequestParam List<String> dutyType){
return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType));
try{
return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType));
}catch(Exception e){
return R.failed("质量异常提报失败,"+e.getMessage());
}
}
/**
@ -227,7 +231,12 @@ public class AbnormalBillController {
*/
@GetMapping("/anomalyReportDevice")
public R anomalyReportDevice(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose){
return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose));
try{
return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose));
}catch (Exception e){
return R.failed("设备异常提报失败,"+e.getMessage());
}
}
@ -239,12 +248,21 @@ public class AbnormalBillController {
*/
@GetMapping("/cancelBrowse")
public R cancelBrowse(String handle, String cancelBrowse,String code,String cancelSendUserGroup){
return R.ok( abnormalBillService.cancelBrowse(handle,cancelBrowse,code,cancelSendUserGroup));
try{
return R.ok( abnormalBillService.cancelBrowse(handle,cancelBrowse,code,cancelSendUserGroup));
}catch(Exception e){
return R.failed("取消失败,"+e.getMessage());
}
}
@GetMapping("/backLog")
public R backLog(AbnormalBillDto abnormalBillDto){
return R.ok(abnormalBillService.backLog(abnormalBillDto));
try{
return R.ok(abnormalBillService.backLog(abnormalBillDto));
}catch(Exception e){
return R.failed("检索失败,"+e.getMessage());
}
}
/**
@ -254,7 +272,12 @@ public class AbnormalBillController {
*/
@GetMapping("/findAllByAbnormalNo")
public R findAllByAbnormalNo(AbnormalBill abnormalBill){
return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill));
try{
return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill));
}catch (Exception e){
return R.failed("检索失败,"+e.getMessage());
}
}
/**
@ -262,7 +285,12 @@ public class AbnormalBillController {
*/
@GetMapping("/findAllByAbnormalNoDevice")
public R findAllByAbnormalNoDevice(AbnormalBill abnormalBill){
return R.ok(abnormalBillService.findAllByAbnormalNoDevice(abnormalBill));
try{
return R.ok(abnormalBillService.findAllByAbnormalNoDevice(abnormalBill));
}catch (Exception e){
return R.failed("设备异常响应检索失败,"+e.getMessage());
}
}
/**
@ -272,8 +300,12 @@ public class AbnormalBillController {
*/
@GetMapping("/resProcessing")
public R resProcessing(AbnormalBill abnormalBill){
abnormalBillService.resProcessing(abnormalBill);
return R.ok();
try{
abnormalBillService.resProcessing(abnormalBill);
return R.ok();
}catch(Exception e){
return R.failed("响应处理失败,"+e.getMessage());
}
}
/**
@ -284,8 +316,12 @@ public class AbnormalBillController {
*/
@GetMapping("/programConfirm")
public R programConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose);
return R.ok();
try{
abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose);
return R.ok();
}catch (Exception e){
return R.failed("方案确认失败,"+e.getMessage());
}
}
/**
@ -298,8 +334,12 @@ public class AbnormalBillController {
public R dutyConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose,
@RequestParam List<String> dutyCauseType,
@RequestParam List<String> dutyType){
abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType);
return R.ok();
try{
abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType);
return R.ok();
}catch(Exception e){
return R.failed("判责提交失败,"+e.getMessage());
}
}
/**
@ -310,25 +350,42 @@ public class AbnormalBillController {
*/
@GetMapping("/anomalyShutDown")
public R anomalyShutDown(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose);
return R.ok();
try{
abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose);
return R.ok();
}catch (Exception e){
return R.failed("闭环关闭失败,"+e.getMessage());
}
}
@GetMapping("/findResrceBySfc")
public R findResrceBySfc(SfcDispatchDto sfcDispatch){
return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch));
try{
return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch));
}catch (Exception e){
return R.failed("根据sfc查找设备失败,"+e.getMessage());
}
}
@GetMapping("/show")
public R showFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
return R.ok(fileUploadedService.showFile(request,response));
try{
return R.ok(fileUploadedService.showFile(request,response));
}catch (Exception e){
return R.failed("显示图片失败,"+e.getMessage());
}
}
@PostMapping("/delete")
public R delete(String ftpPath,String fileName){
fileUploadedService.deleteFile(ftpPath,fileName);
// abnormalBillService.deleteFileInDatabase(ftpPath,fileName);
return R.ok();
try{
fileUploadedService.deleteFile(ftpPath,fileName);
return R.ok();
}catch (Exception e){
return R.failed("图片删除失败,"+e.getMessage());
}
}
@GetMapping("/findUploadPictureByAbnormalBo")

@ -52,6 +52,20 @@ public class ReportController {
}
}
/**
*
* @param map
* @return
*/
@PostMapping("/resourceRepair")
public R resourceRepair(@RequestBody(required = false)Map<String, Object> map){
try{
return R.ok(reportService.resourceRepair(map));
}catch (Exception e){
return R.failed(e.getMessage());
}
}
/**
*
*

@ -24,6 +24,9 @@ public interface ReportMapper {
List<Map<String,Object>> surplusReturnTable(@Param("site")String site, @Param("locale")String locale,
@Param("item")String item, @Param("itemDescription")String itemDescription);
List<Map<String,Object>> resourceRepair(@Param("site")String site, @Param("locale")String locale,
@Param("param")Map<String, Object> map);
List<Map<String, Object>> findInspectionTask(Map paramMap);
}

@ -19,6 +19,8 @@ public interface ReportService {
List<Map<String, Object>> surplusReturnTable(String item, String itemDescription);
List<Map<String, Object>> resourceRepair(Map<String,Object> map);
/**
*
*

@ -5,14 +5,21 @@ import com.foreverwin.mesnac.anomaly.dto.PartsManufacturing;
import com.foreverwin.mesnac.anomaly.mapper.ReportMapper;
import com.foreverwin.mesnac.anomaly.service.ReportService;
import com.foreverwin.mesnac.integration.model.IntegrationLog;
import com.foreverwin.mesnac.meapi.model.NcCode;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.util.CommonMethods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description TODO
@ -23,8 +30,12 @@ import java.util.Map;
@Transactional(rollbackFor = Exception.class)
public class ReportServiceImpl implements ReportService {
@Autowired
private NcCodeService ncCodeService;
@Autowired
private ReportMapper reportMapper;
@Autowired
private NwaUserService nwaUserService;
/**
*
@ -57,6 +68,70 @@ public class ReportServiceImpl implements ReportService {
return reportMapper.surplusReturnTable(site,locale,item,itemDescription);
}
@Override
public List<Map<String, Object>> resourceRepair(Map<String, Object> map) {
String locale = LocaleContextHolder.getLocale().getLanguage();
String site = CommonMethods.getSite();
Map<String, List<NcCode>> ncCodeMap = new HashMap<>();
NcCode ncCode = new NcCode();
ncCode.setSite(site);
List<NcCode> ncCodeList = ncCodeService.selectList(ncCode);
if (ncCodeList != null && ncCodeList.size() > 0) {
ncCodeMap = ncCodeList.stream().collect(Collectors.groupingBy(NcCode::getNcCode));
}
Map<String, List<NwaUser>> userMap = new HashMap<>();
NwaUser nwaUser = new NwaUser();
nwaUser.setSite(site);
List<NwaUser> nwaUserList = nwaUserService.selectList(nwaUser);
if(nwaUserList != null && nwaUserList.size() > 0) {
userMap = nwaUserList.stream().collect(Collectors.groupingBy(NwaUser::getUserName));
}
List<Map<String, Object>> maps = reportMapper.resourceRepair(site, locale, map);
for (int i = 0; i < maps.size(); i++) {
Map<String, Object> temporaryMap = maps.get(i);
String ncCodes = (String)temporaryMap.get("NC_CODE_NO");
if(StringUtils.isBlank(ncCodes)){
maps.get(i).put("NC_CODE_DESCRIPTION", "");
continue;
}
String []ncCodeArray = ncCodes.split(",");
String ncCodeDesc = "";
for (int j = 0; j < ncCodeArray.length; j++) {
ncCodeDesc += ncCodeMap.get(ncCodeArray[j]).get(0).getDescription()+";";
}
maps.get(i).put("NC_CODE_DESCRIPTION", ncCodeDesc);
}
for (int i = 0; i < maps.size(); i++) {
Map<String, Object> temporaryMap = maps.get(i);
String repairUser = (String)temporaryMap.get("REPAIR_USERS");
if(StringUtils.isBlank(repairUser)){
maps.get(i).put("REPAIR_USERS_DESCRIPTION", "");
continue;
}
String []repairUserArray = repairUser.split(",");
String repairUserDescription = "";
for (int j = 0; j < repairUserArray.length; j++) {
repairUserDescription += userMap.get(repairUserArray[j]).get(0).getFullName()+";";
}
maps.get(i).put("REPAIR_USERS_DESCRIPTION", repairUserDescription);
}
return maps;
}
@Override
public List<Map<String, Object>> findInspectionTask(Map paramMap) {
return reportMapper.findInspectionTask(paramMap);

@ -89,6 +89,56 @@
</where>
</select>
<select id="resourceRepair" resultType="map">
SELECT
ZRRT.HANDLE HANDLE,
CASE WHEN WC2.WORK_CENTER != 'NULL' THEN WC2.WORK_CENTER
ELSE WC.WORK_CENTER
END WORK_CENTER,
CASE WHEN WCT.DESCRIPTION != 'NULL' THEN WCT.DESCRIPTION
ELSE WCT2.DESCRIPTION
END WORK_CENTER_DESCRIPTION,
ZRRT.RESOURCE_NO,R.DESCRIPTION RESOURCE_DESCRIPTION,ZRRT.NC_CODE_NO, /*不良代码描述,维修人员*/
ZRRT.PRELIMINARY_REASON ,ZRRT.DEAL_WAY ,ZRRT.DEAL_WAY_DESCRIPTION ,
ZRITS.ITEM_BO ITEM_BO,
CASE WHEN ZRITS.ITEM_BO != 'NULL' THEN IT.DESCRIPTION
ELSE ZRITS.DESCRIPTION
END ITEM_DESCRIPTION,
CF.VALUE ITEM_SPEC,
ZRRT.ACTUAL_START_DATE ACTUAL_START_DATE,ZRRT.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE,
TRUNC(TO_NUMBER((ZRRT.ACTUAL_COMPLETE_DATE-ZRRT.ACTUAL_START_DATE)*24),2) SHUT_DOWN_TIME,
TRUNC(TO_NUMBER((ZRRT.WAIT_END_DATE -ZRRT.WAIT_START_DATE)*24),2) REPAIR_WAIT_TIME,
TRUNC(TO_NUMBER((ZRRT.ACTUAL_COMPLETE_DATE-ZRRT.ACTUAL_START_DATE-ZRRT.WAIT_TIME)*24),2) REPAIR_TIME,
ZRRT. STATUS ,ZRRT.REPORT_USER REPORT_USER,ZNU.FULL_NAME REPORT_USER_DESCRIPTION,
ZRRT.REPAIR_USERS ,ZRRT.REMARK
FROM
Z_RESOURCE_REPAIR_TASK ZRRT
INNER JOIN RESRCE R ON R.RESRCE = ZRRT.RESOURCE_NO AND R.SITE = ZRRT.SITE
INNER JOIN WORK_CENTER_MEMBER WCM ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
LEFT JOIN WORK_CENTER WC ON WC.HANDLE = WCM.WORK_CENTER_BO AND WC.WC_CATEGORY ='LEVEL3'
LEFT JOIN WORK_CENTER_MEMBER WCM2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WC.HANDLE
LEFT JOIN WORK_CENTER WC2 ON WC2.HANDLE = WCM.WORK_CENTER_BO AND WC2.WC_CATEGORY = 'LEVEL4'
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE AND WCT.LOCALE = #{locale}
LEFT JOIN WORK_CENTER_T WCT2 ON WCT2.WORK_CENTER_BO = WC2.HANDLE AND WCT2.LOCALE = #{locale}
LEFT JOIN Z_RESOURCE_INSPECT_TASK_SPARE ZRITS ON ZRITS.RESOURCE_INSPECT_TASK_BO = ZRRT.HANDLE
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = ZRITS.ITEM_BO AND IT.LOCALE = #{locale}
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = ZRITS.ITEM_BO AND CF."ATTRIBUTE" = 'MAT_SPEC'
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZRRT.REPORT_USER AND ZNU.SITE = ZRRT.SITE
<where>
ZRRT.SITE = #{site}
<if test="param.workCenter != null and param.workCenter != ''">
AND (WC.WORK_CENTER LIKE '%${param.workCenter}%' OR WC2.WORK_CENTER LIKE '%${param.workCenter}%' OR
WCT.DESCRIPTION LIKE '%${param.workCenter}%' OR WCT2.DESCRIPTION LIKE '%${param.workCenter}%')
</if>
<if test="param.resource != null and param.resource != ''">
AND (R.RESRCE LIKE '%${param.resource}%' OR R.DESCRIPTION LIKE '%${param.resource}%')
</if>
</where>
</select>

@ -177,6 +177,8 @@ public interface Constants {
// 余料标签
String PRINT_TYPE_EXM = "EXM";
// 成品标签
String PRINT_TYPE_PRODUCT = "PRODUCT";
/**
* Y-使N-/
*/

@ -29,6 +29,7 @@ public class LabelPrintDto implements Serializable {
private String label;
//在制品标签参数
private String shopOrder;
//工作指令
private String workOrder;
//图纸版本号
@ -44,6 +45,14 @@ public class LabelPrintDto implements Serializable {
//打印张数
private Integer printNum;
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getSite() {
return site;
}

@ -35,5 +35,5 @@ public interface InspectionTaskService extends IService<InspectionTask> {
InspectionTask isCreateTask(String site, String category, String sfc, String operation, String stepId);
void createCompleteTask(Map<String, Object> paramMap);
void createNewTask(Map<String, Object> paramMap);
}

@ -264,7 +264,7 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
}
@Override
public void createCompleteTask(Map<String, Object> paramMap) {
public void createNewTask(Map<String, Object> paramMap) {
String site = CommonMethods.getSite();
String category = (String) paramMap.get("CATEGORY");
String sfc = (String) paramMap.get("SFC");
@ -287,8 +287,8 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
task.setSite(site);
task.setCategory(category);
task.setTaskNo(taskNo);
task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE);
task.setResrce(Constants.RSESULT_OK);
task.setStatus(Constants.INSPECTION_TASK_STATUS_NEW);
task.setResult(null);
task.setDescription("专检检验任务");
task.setInspectionItemBo( null);
task.setShopOrder(shopOrder);

@ -36,6 +36,7 @@ import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.messaging.MessageTypeBOHandle;
import com.sap.me.user.UserGroupBOHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.jms.core.JmsMessagingTemplate;
@ -45,7 +46,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* <p>
@ -68,6 +68,7 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public static final String STATUS_CANCEL = "CANCEL";
public static final String MESSAGE_TYPE_WLZB = "WLZB";
@Autowired
@Qualifier("defaultJmsTemplate")
private JmsMessagingTemplate jmsTemplate;
@Value("${print.server}")
private String printServer;
@ -441,7 +442,13 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
PrintLog printTag = new PrintLog();
String resrce = sfcDispatchDto.getResrce();
String shopOrder = sfcDispatchDto.getShopOrder();
String factory = customFieldsService.getCustomFieldsValue(HandleEnum.SHOP_ORDER.getHandle(site, shopOrder), CustomFieldConstant.SO_FACTORY);
String printName = customFieldsService.getCustomFieldsValue(HandleEnum.RESOURCE.getHandle(site, resrce), CustomFieldConstant.RESRCE_CUSTOM_FIELD_PRINT_NAME);
String type=Constants.PRINT_TYPE_SFC;
if (StringUtil.notBlank(factory)&&factory.equals("6100")){
type=Constants.PRINT_TYPE_PRODUCT;
}
if (StringUtil.isBlank(printName)) {
throw new BaseException("资源" + resrce + "维护的打印机不能为空");
}
@ -451,14 +458,15 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
queryWrapper.eq(PrintLog.SFC, prodReadyTask.getSfc());
queryWrapper.eq(PrintLog.STEP_ID, prodReadyTask.getStepId());
queryWrapper.eq(PrintLog.RESRCE, prodReadyTask.getResrce());
queryWrapper.eq(PrintLog.CATEGORY, Constants.PRINT_TYPE_SFC);
queryWrapper.eq(PrintLog.CATEGORY, Constants.PRINT_TYPE_SFC);
queryWrapper.eq(PrintLog.CATEGORY, type);
queryWrapper.eq(PrintLog.PRINT_TEMPLATE, type);
List<PrintLog> printLogList = printLogService.list(queryWrapper);
if (printLogList.isEmpty()) {
//打印参数
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setPrinter(printName);
labelPrintDto.setPrintTemplate(Constants.PRINT_TYPE_SFC);
labelPrintDto.setPrintTemplate(type);
labelPrintDto.setShopOrder(shopOrder);
labelPrintDto.setItem(selectCurrent.getItem());
labelPrintDto.setItemDescription(selectCurrent.getDescription());
labelPrintDto.setSfc(prodReadyTask.getSfc());
@ -482,16 +490,15 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
if (seq != stepOperationList.size() - 1) {
RouterStepDto stepOperation = stepOperationList.get(seq + 1);
labelPrintDto.setOperation(stepOperation.getOperationDesc());
}
labelPrintDtoList.add(labelPrintDto);
printData = JSON.toJSONString(labelPrintDtoList);
//打印记录
printTag.setHandle(UUID.randomUUID().toString());
printTag.setPrintName(printName);
printTag.setPrintTemplate(Constants.PRINT_TYPE_SFC);
printTag.setPrintTemplate(type);
printTag.setSite(site);
printTag.setCategory(Constants.PRINT_TYPE_SFC);
printTag.setCategory(type);
printTag.setPrintParam(JSON.toJSONString(labelPrintDtoList));
printTag.setSfc(prodReadyTask.getSfc());
printTag.setResrce(prodReadyTask.getResrce());
@ -677,7 +684,6 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
messageObject.put("RESOURCE", resource);
messageObject.put("RESOURCE_TYPE", resourceType);
String causeMessage = null;
jmsTemplate.getJmsTemplate().setReceiveTimeout(TimeUnit.SECONDS.toMillis(30));
String message = jmsTemplate.convertSendAndReceive(queue, messageObject.toString(), String.class);
if (StringUtil.isBlank(message)) {

@ -637,6 +637,7 @@
,PREOT.DESCRIPTION LAST_OPERATION,zprt.*,zsd.DISPATCH_NO,zsd.RESOURCE_TYPE,RES.DESCRIPTION RESRCE_DESC,ITT.DESCRIPTION ITEM_DESC,OT.DESCRIPTION OPERATION_DESC
FROM Z_PROD_READY_TASK zprt
JOIN Z_SFC_DISPATCH zsd ON ZPRT.SFC_DISPATCH_BO=ZSD.HANDLE
LEFT JOIN Z_PRINT_LOG ZPL ON ZPL.SFC=ZSD.SFC AND ZPL.SITE=ZSD.SITE AND ZPL.STEP_ID=ZSD.STEP_ID
LEFT JOIN Z_SFC_DISPATCH PREZSD ON zsd.SFC=PREZSD.SFC AND PREZSD.DISPATCH_SEQ=TO_NUMBER(zsd.DISPATCH_SEQ)-1
JOIN OPERATION OP ON OP.OPERATION = zprt.OPERATION AND OP.SITE = zprt.SITE AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE =#{locale}
@ -654,7 +655,8 @@
<if test="entity.workCenter!=null and entity.workCenter!='' "> AND ZPRT.WORK_CENTER=#{entity.workCenter}</if>
<if test="entity.resrce!=null and entity.resrce!='' "> AND ZPRT.RESRCE=#{entity.resrce}</if>
<if test="entity.dispatchNo!=null and entity.dispatchNo!='' "> AND ZSD.DISPATCH_NO=#{entity.dispatchNo}</if>
<if test="entity.status!=null and entity.status!='' "> AND ZPRT.STATUS=#{entity.status}</if>
<if test="entity.status!=null and entity.status!='' and entity.status!='PRINT'"> AND ZPRT.STATUS=#{entity.status}</if>
<if test="entity.status!=null and entity.status!='' and entity.status eq 'PRINT' "> AND ZPL.IS_PRINT='true' AND ZPRT.STATUS='FINISH'</if>
<if test="entity.result!=null and entity.result!='' "> AND ZPRT.RESULT=#{entity.result}</if>
<if test="entity.sfcStepStatus!=null and entity.sfcStepStatus!='' and entity.sfcStepStatus=='COMPLETE' "> AND ZSD.DISPATCH_STATUS=#{entity.sfcStepStatus}</if>
<if test="entity.sfcStepStatus!=null and entity.sfcStepStatus!='' and entity.sfcStepStatus!='COMPLETE' "> AND ZSD.DISPATCH_STATUS!='COMPLETE'</if>

@ -1,12 +1,16 @@
package com.foreverwin.mesnac.dispatch.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import com.foreverwin.mesnac.dispatch.service.SfcDispatchService;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
@ -273,7 +277,25 @@ public class SfcDispatchController {
}
}
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<SfcDispatch> frontPage, SfcDispatch sfcDispatch){
IPage result;
QueryWrapper<SfcDispatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcDispatch);
sfcDispatch.setSite(CommonMethods.getSite());
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.or().like(SfcDispatch::getShopOrder, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getSfc, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDispatchNo, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDispatchStatus, frontPage.getGlobalQuery())
);
}
result = sfcDispatchService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
@PostMapping("/gantt-list")
public R ganttList(@RequestBody SfcDispatchDto sfcDispatchDto) {
Map<String, Object> result = new HashMap<>();

@ -3,6 +3,7 @@ package com.foreverwin.mesnac.equip.mapper;
import com.foreverwin.mesnac.equip.dto.ResourceInspectTaskDto;
import com.foreverwin.mesnac.equip.model.ResourceInspectTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@ -46,4 +47,7 @@ public interface ResourceInspectTaskMapper extends BaseMapper<ResourceInspectTas
* @return
*/
LocalDateTime getMaxCreateTimeByStatus(ResourceInspectTask resourceInspectTask);
Integer findResourceTaskByResrceAndCategory(@Param("site") String site,@Param("category") String category, @Param("resrce") String resrce);
}

@ -0,0 +1,6 @@
package com.foreverwin.mesnac.equip.service;
public interface ResourceInspectTaskJobService {
void resourceInspectTaskJobProcess(String site);
}

@ -86,6 +86,7 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
if (inspectionItem == null){
throw BusinessException.build("检验项目清单不存在!!!");
}
String category = resourceInspectPlan.getCategory();
//查询设备计划是否存在
String site = CommonMethods.getSite();
resourceInspectPlan.setSite(site);
@ -134,15 +135,23 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
throw BusinessException.build("未添加设备!!!");
}
Collection<ResourceInspectResource> resourceColl = new ArrayList<>();
StringBuffer resInfo = new StringBuffer("[");
for (ResourceInspectResource equip: equips) {
equip.setResourceInspectPlanBo(handle);
equip.setCreateUser(user);
equip.setCreatedDateTime(LocalDateTime.now());
String resourceNo = equip.getResourceNo();
Integer cnt = resourceInspectTaskMapper.findResourceTaskByResrceAndCategory(site, category, resourceNo);
if (cnt > 0){
resInfo.append(resourceNo+",");
}
String resourceHandle = HandleEnum.RESOURCE.getHandle(site, resourceNo);
equip.setHandle(HandleEnum.RESOURCE_INSPECT_RESOURCE.getHandle(site,handle,resourceHandle));
resourceColl.add(equip);
}
if (!resInfo.equals("")){
throw BusinessException.build("设备编号" + resInfo.append("]") + "已经维护了相同点检类型的点检计划!");
}
resourceInspectResourceService.saveBatch(resourceColl);
// 保存用户组清单
List<InspectPlanUserGroup> userGroups = resourceInspectPlan.getInspectPlanUserGroupList();
@ -380,6 +389,9 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
return;
}
ResourceInspectResource resource = resourceInspectResourceService.getById(HandleEnum.RESOURCE_INSPECT_RESOURCE.getHandle(site,planHandle,resourceBo));
if (resource == null){
return;
}
String resourceStatus = resource.getStatus();
// 设备非启用状态
if (!resourceStatus.equals("301")){
@ -436,7 +448,7 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
minutes = Math.round(frequency*60*24*7);
break;
case "M":
minutes = Math.round(frequency*60*24*7*30);
minutes = Math.round(frequency*60*24*30);
break;
default:
throw BusinessException.build("周期时间不存在!");

@ -0,0 +1,49 @@
package com.foreverwin.mesnac.equip.service.impl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.equip.mapper.ResourceInspectTaskMapper;
import com.foreverwin.mesnac.equip.model.ResourceInspectTask;
import com.foreverwin.mesnac.equip.service.ResourceInspectPlanService;
import com.foreverwin.mesnac.equip.service.ResourceInspectTaskJobService;
import com.foreverwin.mesnac.equip.service.ResourceInspectTaskService;
import com.foreverwin.modular.core.util.CommonMethods;
import org.apache.tomcat.jni.Local;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ResourceInspectTaskJobServiceImpl implements ResourceInspectTaskJobService {
@Autowired
ResourceInspectTaskMapper resourceInspectTaskMapper;
@Autowired
ResourceInspectPlanService resourceInspectPlanService;
@Autowired
ResourceInspectTaskService resourceInspectTaskService;
@Override
public void resourceInspectTaskJobProcess(String site) {
String user = CommonMethods.getUser();
ResourceInspectTask resourceInspectTask = new ResourceInspectTask();
resourceInspectTask.setSite(site);
resourceInspectTask.setCategory(Constants.INSPECTION_TYPE_DM);
LocalDateTime now = LocalDateTime.now();
LocalDateTime dateTime = LocalDateTime.now().minusDays(1);
resourceInspectTask.setPlanStartDate(dateTime);
resourceInspectTask.setPlanCompleteDate(now);
List<ResourceInspectTask> inspectTaskList = resourceInspectTaskMapper.getInspectTaskList(resourceInspectTask);
for (ResourceInspectTask inspectTask: inspectTaskList) {
resourceInspectPlanService.autoCreateTaskByResourceInspectTask(inspectTask);
inspectTask.setModifyUser(user);
inspectTask.setModifiedDateTime(LocalDateTime.now());
}
if (inspectTaskList.size() > 0){
resourceInspectTaskService.updateBatchById(inspectTaskList);
}
}
}

@ -717,9 +717,24 @@
AND ZRIT.RESOURCE_INSPECT_PLAN_BO = #{resourceInspectPlanBo}
</if>
<if test="resrce != null and resrce != ''">
AND ZRIT.resrce = #{resrce}
AND ZRIT.RESRCE = #{resrce}
</if>
<if test="category != null and category != ''">
AND ZRIT.CATEGORY = #{category}
</if>
<if test="planCompleteDate != null">
AND ZRIT.TASK_CREATE_DATE &lt;= #{planCompleteDate}
</if>
<if test="planStartDate != null">
AND ZRIT.TASK_CREATE_DATE &gt;= #{planStartDate}
</if>
</select>
<select id="findResourceTaskByResrceAndCategory" resultType="Integer">
SELECT COUNT(*) FROM Z_RESOURCE_INSPECT_TASK ZRIT
WHERE ZRIT.SITE = #{site} AND ZRIT.RESRCE = #{resrce} AND ZRIT.CATEGORY = #{category}
</select>
<!--自定义sql-->

@ -1,18 +1,17 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import com.foreverwin.mesnac.meapi.model.UserGroup;
import com.foreverwin.mesnac.meapi.service.UserGroupService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.UserGroupService;
import com.foreverwin.mesnac.meapi.model.UserGroup;
import java.util.List;
import java.util.Map;
/**
*
@ -122,4 +121,27 @@ public class UserGroupController {
public R removeByIds(List<String> ids){
return R.ok(userGroupService.removeByIds(ids));
}
}
@ResponseBody
@PostMapping("/findAbnormalUserGroup")
public R findAbnormalUserGroup(@RequestBody Map<String,Object> param){
try{
return R.ok(userGroupService.findAbnormalUserGroup(param));
}catch (Exception e){
return R.failed("找寻用户组失败"+e.getMessage());
}
}
}

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -33,4 +34,6 @@ public interface UserGroupMapper extends BaseMapper<UserGroup> {
List<UserGroup> findUserGroupListByUser(@Param("site")String site,@Param("user")String user);
List<UserGroup> findAbnormalUserGroup(@Param("site")String site, @Param("param")Map<String,Object> map);
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -29,4 +30,6 @@ public interface UserGroupService extends IService<UserGroup> {
List<UserGroup> getUserGroupListByUserBo(String userBo);
Integer getUserGroupByUser(String userBO,String userGroupBO);
List<UserGroup> findAbnormalUserGroup(Map<String,Object> param);
}

@ -1,17 +1,19 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.UserGroup;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper;
import com.foreverwin.mesnac.meapi.model.UserGroup;
import com.foreverwin.mesnac.meapi.service.UserGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -52,4 +54,10 @@ public class UserGroupServiceImpl extends ServiceImpl<UserGroupMapper, UserGroup
return userGroupMapper.getUserGroupByUser(userBO,userGroupBO);
}
@Override
public List<UserGroup> findAbnormalUserGroup(Map<String, Object> param) {
String site = CommonMethods.getSite();
return userGroupMapper.findAbnormalUserGroup(site,param);
}
}

@ -390,5 +390,15 @@
WHERE U.USER_ID = #{user} AND U.SITE = #{site}
</select>
<select id="findAbnormalUserGroup" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM USER_GROUP ug
INNER JOIN CUSTOM_FIELDS cf ON cf.HANDLE = ug.HANDLE AND cf."ATTRIBUTE" = 'TYPE'
<where>
<if test="param.type != null and param.type != ''">
cf.VALUE LIKE '%${param.type}%'
</if>
</where>
</select>
</mapper>

@ -139,7 +139,12 @@ public class SfcScrapController {
*/
@GetMapping("/getScrapDtoBysfc")
public R getScrapDtoBysfc(String site,String sfc){
return R.ok(anomalyService.getScrapDtoBysfc(site,sfc));
try{
return R.ok(anomalyService.getScrapDtoBysfc(site,sfc));
}catch (Exception e){
return R.failed("产品报废检索报错"+e.getMessage());
}
}
/**

@ -220,10 +220,14 @@ public class PodTemplateServiceImpl implements PodTemplateService {
QueryWrapper<InspectionTask> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(InspectionTask.CATEGORY, Constants.INSPECTION_TYPE_P);
queryWrapper.eq(InspectionTask.SFC, sfc);
queryWrapper.ne(InspectionTask.RESULT, Constants.RSESULT_OK);
queryWrapper.orderByDesc(InspectionTask.CREATED_DATE_TIME);
List<InspectionTask> list = inspectionTaskService.list(queryWrapper);
if (!list.isEmpty()) {
throw new BaseException("请完成专检检验任务");
InspectionTask inspectionTask = list.get(0);
String result = inspectionTask.getResult();
if (!inspectionTask.getStatus().equals(Constants.INSPECTION_TASK_STATUS_COMPLETE)||StringUtil.isBlank(result)||!result.equals(Constants.RSESULT_OK)){
throw new BaseException("请完成专检检验任务");
}
}
try {
sfcCrossService.startAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
@ -289,7 +293,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
inspectionTaskService.createTask(paramMap);
} else {
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P);
inspectionTaskService.createCompleteTask(paramMap);
inspectionTaskService.createNewTask(paramMap);
}
//首件创建
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_S);

@ -10,7 +10,6 @@ import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.RouterStepDto;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.RouterStepService;
import com.foreverwin.mesnac.meapi.service.ShopOrderService;
@ -22,7 +21,6 @@ import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.model.StepOperation;
import com.foreverwin.mesnac.production.service.SplitSfcService;
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.foreverwin.modular.core.util.FrontPage;
@ -159,19 +157,8 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
splitSfc.setCreateUser(CommonMethods.getUser());
splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc);
String workCenter = null;
if (operation.contains("_")) {
workCenter = operation.split("_")[0];
} else {
workCenter = operation;
}
String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
if (workCenterModel == null) {
throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
}
Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle());
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle());
return splitSfc;
} catch (Exception e) {
ExceptionUtil.throwException(e);
@ -257,23 +244,11 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
dispositionSfcsRequest.setDispositionSelection(dispositionSelection);
dispositionSfcsRequest.setProdCtx(new ProductionContext());
ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest);
String workCenter;
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, routerBo);
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, maxRevisionRouter.getHandle());
if (routerOperationByRouterBo.isEmpty()){
throw new BaseException("处置工艺路线没有步骤");
}
String routerOperation = routerOperationByRouterBo.get(0).getOperation();
if (routerOperation.contains("_")) {
workCenter = routerOperation.split("_")[0];
} else {
workCenter = routerOperation;
}
String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
if (workCenterModel == null) {
throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
}
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle());
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),null,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle());
}
SplitSfc splitSfc=new SplitSfc();
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));

@ -42,5 +42,9 @@
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>anomaly</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>equip</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,44 @@
package com.foreverwin.mesnac.quartz.job;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.equip.service.ResourceInspectTaskJobService;
import com.foreverwin.mesnac.equip.service.ResourceInspectTaskService;
import com.foreverwin.modular.core.exception.BaseException;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description TODO
* @Author zhaojiawei
* @Since 2021-07-22
*/
@DisallowConcurrentExecution
public class ResourceInspectTaskJob implements Job {
private static final String SITE_UPPERCASE = "SITE";
private static final String SITE_LOWERCASE = "site";
@Autowired
private ResourceInspectTaskJobService resourceInspectTaskJobService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
//获取站点,若站点为空则抛出异常
String site = getSite(context);
if (StringUtil.isBlank(site)) {
throw new BaseException("equip.quartz.task.not.site", null);
}
resourceInspectTaskJobService.resourceInspectTaskJobProcess(site);
}
private String getSite(JobExecutionContext context) {
String site = context.getJobDetail().getJobDataMap().getString(SITE_LOWERCASE);
if (StringUtil.isBlank(site)) {
site = context.getJobDetail().getJobDataMap().getString(SITE_UPPERCASE);
}
return site;
}
}
Loading…
Cancel
Save