Merge remote-tracking branch 'origin/master'

master
zpl 3 years ago
commit b5fd5cf3d8

@ -13,6 +13,8 @@ import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/REPORT")
public class ReportController {
@ -46,4 +48,18 @@ public class ReportController {
return R.failed(e.getMessage());
}
}
/**
*
* @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());
}
}
}

@ -23,4 +23,7 @@ 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);
}

@ -17,4 +17,6 @@ public interface ReportService {
List<Map<String, Object>> partsManufacturing(PartsManufacturing partsManufacturing);
List<Map<String, Object>> surplusReturnTable(String item, String itemDescription);
List<Map<String, Object>> resourceRepair(Map<String,Object> map);
}

@ -4,14 +4,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
@ -22,8 +29,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;
/**
*
@ -55,4 +66,68 @@ public class ReportServiceImpl implements ReportService {
String site = CommonMethods.getSite();
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;
}
}

@ -88,4 +88,54 @@
</if>
</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>
</mapper>

@ -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;
}

@ -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)) {

@ -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<>();

@ -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());
}
}
/**

@ -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));

@ -116,7 +116,7 @@ public class InspectionTaskManageServiceImpl implements InspectionTaskManageServ
}
List<InspectionTaskManageDetail> inspectionItemDetailList = this.getInspectionTaskDetail(HandleEnum.INSPECTION_TASK.getHandle(taskNo));
if (inspectionItemDetailList != null || inspectionItemDetailList.size() > 0) {
if (inspectionItemDetailList != null && inspectionItemDetailList.size() > 0) {
throw BusinessException.build("检验任务:"+taskNo+"有检验项目,不允许执行合格操作");
}

Loading…
Cancel
Save