移动端主界面

Leon 4 years ago
parent d244e4be9b
commit b5932fdeb0

@ -0,0 +1,42 @@
package com.foreverwin.mesnac.common.controller;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.MobileWorkStationData;
import com.foreverwin.mesnac.common.service.MobileWorkStationService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* @author Syngna
* @since 2020-01-04
*/
@RestController
@RequestMapping("/mobileWorkStations")
public class MobileWorkStationController {
@Autowired
public MobileWorkStationService mobileWorkStationService;
@GetMapping("listMobileWorkStationApplication")
public R listMobileWorkStationApplication(String workStation) {
List<MobileWorkStationData> result;
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
String userBo = HandleEnum.USER.getHandle(site, user);
result = mobileWorkStationService.listMobileWorkStationApplication(site, userBo, workStation);
}
catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
}

@ -14,6 +14,9 @@ public enum HandleEnum {
/**车间作业控制*/
SFC( "SFCBO:", "SFCBO:{0},{1}" ),
/**用户**/
USER("UserBO:", "UserBO:{0},{1}"),
/**物料清单**/
BOM("BOMBO:","BOMBO:{0},{1},{2},{3}"),

@ -0,0 +1,16 @@
package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.common.model.ActivityOption;
import com.foreverwin.mesnac.common.model.MobileWorkStationData;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MobileWorkStationMapper {
List<ActivityOption> selectActivityOptionList(@Param("activityBoList") List<String> activityBoList);
List<MobileWorkStationData> selectMobileWorkStationList(@Param("site") String site, @Param("userBo") String userBo, @Param("workStation") String workStation);
}

@ -0,0 +1,34 @@
package com.foreverwin.mesnac.common.model;
public class ActivityOption {
private String activity;
private String key;
private String value;
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

@ -0,0 +1,156 @@
package com.foreverwin.mesnac.common.model;
import java.util.List;
public class MobileWorkStationData {
private String workStationBo;
private String canChangeOperation;
private String canChangeResource;
private String defaultOperationBo;
private String defaultResourceBo;
private String mainInputPrompt;
private String sequence;
private String buttonId;
private String buttonSize;
private String label;
private String imageIcon;
private String activityBo;
private String activity;
private String classOrProgram;
private List<ActivityOption> activityOptionList;
public String getWorkStationBo() {
return workStationBo;
}
public void setWorkStationBo(String workStationBo) {
this.workStationBo = workStationBo;
}
public String getCanChangeOperation() {
return canChangeOperation;
}
public void setCanChangeOperation(String canChangeOperation) {
this.canChangeOperation = canChangeOperation;
}
public String getCanChangeResource() {
return canChangeResource;
}
public void setCanChangeResource(String canChangeResource) {
this.canChangeResource = canChangeResource;
}
public String getDefaultOperationBo() {
return defaultOperationBo;
}
public void setDefaultOperationBo(String defaultOperationBo) {
this.defaultOperationBo = defaultOperationBo;
}
public String getDefaultResourceBo() {
return defaultResourceBo;
}
public void setDefaultResourceBo(String defaultResourceBo) {
this.defaultResourceBo = defaultResourceBo;
}
public String getMainInputPrompt() {
return mainInputPrompt;
}
public void setMainInputPrompt(String mainInputPrompt) {
this.mainInputPrompt = mainInputPrompt;
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
public String getButtonId() {
return buttonId;
}
public void setButtonId(String buttonId) {
this.buttonId = buttonId;
}
public String getButtonSize() {
return buttonSize;
}
public void setButtonSize(String buttonSize) {
this.buttonSize = buttonSize;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getImageIcon() {
return imageIcon;
}
public void setImageIcon(String imageIcon) {
this.imageIcon = imageIcon;
}
public String getActivityBo() {
return activityBo;
}
public void setActivityBo(String activityBo) {
this.activityBo = activityBo;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public String getClassOrProgram() {
return classOrProgram;
}
public void setClassOrProgram(String classOrProgram) {
this.classOrProgram = classOrProgram;
}
public List<ActivityOption> getActivityOptionList() {
return activityOptionList;
}
public void setActivityOptionList(List<ActivityOption> activityOptionList) {
this.activityOptionList = activityOptionList;
}
}

@ -0,0 +1,20 @@
package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.model.MobileWorkStationData;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Syngna
* @since 2019-05-30
*/
public interface MobileWorkStationService {
List<MobileWorkStationData> listMobileWorkStationApplication(String site, String userBo, String workStation);
}

@ -0,0 +1,48 @@
package com.foreverwin.mesnac.common.service.impl;
import com.foreverwin.mesnac.common.mapper.MobileWorkStationMapper;
import com.foreverwin.mesnac.common.model.ActivityOption;
import com.foreverwin.mesnac.common.model.MobileWorkStationData;
import com.foreverwin.mesnac.common.service.MobileWorkStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
*
* </p>
*
* @author Syngna
* @since 2020-01-04
*/
@Service
public class MobileWorkStationServiceImpl implements MobileWorkStationService {
@Autowired
private MobileWorkStationMapper mobileWorkStationMapper;
@Override
public List<MobileWorkStationData> listMobileWorkStationApplication(String site, String userBo, String workStation) {
List<MobileWorkStationData> workStationDataList = mobileWorkStationMapper.selectMobileWorkStationList(site, userBo, workStation);
if(workStationDataList == null || workStationDataList.size() == 0) {
return new ArrayList<>();
}
List<String> activityList = workStationDataList.stream().map(MobileWorkStationData::getActivityBo).collect(Collectors.toList());
List<ActivityOption> activityOptionList = mobileWorkStationMapper.selectActivityOptionList(activityList);
for(MobileWorkStationData mobileWorkStationData : workStationDataList) {
if(mobileWorkStationData.getActivityOptionList() == null) {
mobileWorkStationData.setActivityOptionList(new ArrayList<>());
}
for(ActivityOption activityOption: activityOptionList) {
if(activityOption.getActivity().equals(mobileWorkStationData.getActivity())) {
mobileWorkStationData.getActivityOptionList().add(activityOption);
}
}
}
return workStationDataList;
}
}

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.common.util;
import com.foreverwin.mesnac.common.model.ExcelColumn;
import com.foreverwin.modular.core.exception.BusinessException;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.CharUtils;
import org.apache.commons.lang.StringUtils;
@ -40,12 +41,17 @@ public class ExcelUtils {
private final static String EXCEL2003 = "xls";
private final static String EXCEL2007 = "xlsx";
public static <T> List<T> readExcel(String fileType, Class<T> tClass, MultipartFile multipartFile){
public static <T> List<T> readExcel(String fileType, Class<T> tClass, MultipartFile multipartFile, FileItem fileItem){
Workbook workbook = null;
List<T> dataList = new ArrayList<>();
try {
InputStream inputStream = multipartFile.getInputStream();
InputStream inputStream = null;
if (multipartFile != null && !multipartFile.isEmpty()) {
inputStream = multipartFile.getInputStream();
} else {
inputStream = fileItem.getInputStream();
}
//分析文件格式
if (EXCEL2003.equals(fileType)) {

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.common.mapper.MobileWorkStationMapper">
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.common.model.MobileWorkStationData">
<result column="WORKSTATION_BO" property="workStationBo" />
<result column="CAN_CHANGE_OPERATION" property="canChangeOperation" />
<result column="CAN_CHANGE_RESOURCE" property="canChangeResource" />
<result column="DEFAULT_OPERATION_BO" property="defaultOperationBo" />
<result column="DEFAULT_RESOURCE_BO" property="defaultResourceBo" />
<result column="MAIN_INPUT_PROMPT" property="mainInputPrompt" />
<result column="SEQUENCE" property="sequence" />
<result column="BUTTON_ID" property="buttonId" />
<result column="BUTTON_SIZE" property="buttonSize" />
<result column="LABEL" property="label" />
<result column="IMAGE_ICON" property="imageIcon" />
<result column="ACTIVITY_BO" property="activityBo" />
<result column="ACTIVITY" property="activity" />
<result column="CLASS_OR_PROGRAM" property="classOrProgram" />
</resultMap>
<resultMap id="ActivityOptionMap" type="com.foreverwin.mesnac.common.model.ActivityOption">
<result column="ACTIVITY" property="activity" />
<result column="KEY" property="key" />
<result column="VALUE" property="value" />
</resultMap>
<select id="selectActivityOptionList" resultMap="ActivityOptionMap">
SELECT AC.ACTIVITY, AO.EXEC_UNIT_OPTION AS KEY, SETTING AS VALUE
FROM ACTIVITY_OPTION AO
INNER JOIN ACTIVITY AC ON AC.HANDLE = AO.ACTIVITY_BO
WHERE AC.HANDLE IN
<foreach collection="activityBoList" item="item" separator="," close=")" open="(">
#{item}
</foreach>
</select>
<select id="selectMobileWorkStationList" resultMap="BaseResultMap">
SELECT PC.WORKSTATION_BO, PC.CAN_CHANGE_OPERATION, PC.CAN_CHANGE_RESOURCE, PC.DEFAULT_OPERATION_BO, PC.DEFAULT_RESOURCE_BO, PC.MAIN_INPUT_PROMPT,
PB.SEQUENCE, PB.BUTTON_ID, PB.BUTTON_SIZE, PB.LABEL, PB.IMAGE_ICON, PA.ACTIVITY_BO, AC.ACTIVITY, AC.CLASS_OR_PROGRAM
FROM WORKSTATION WC
INNER JOIN POD_CONFIG PC ON WC.HANDLE = PC.WORKSTATION_BO
INNER JOIN POD_BUTTON PB ON PB.POD_CONFIG_BO = PC.HANDLE
INNER JOIN POD_ACTIVITY PA ON PA.POD_BUTTON_BO = PB.HANDLE
INNER JOIN ACTIVITY AC ON AC.HANDLE = PA.ACTIVITY_BO AND AC.ENABLED = 'true'
INNER JOIN(
SELECT AP.ACTIVITY_OR_GROUP_GBO AS ACTIVITY_BO
FROM USER_GROUP_MEMBER UGM
INNER JOIN ACTIVITY_PERM AP ON UGM.USER_GROUP_BO = AP.USER_OR_GROUP_GBO
WHERE UGM.USER_OR_GROUP_GBO = #{userBo}
GROUP BY AP.ACTIVITY_OR_GROUP_GBO
)AP ON AP.ACTIVITY_BO = PA.ACTIVITY_BO
WHERE WC.SITE = #{site}
AND WC.WORKSTATION = #{workStation}
AND WC.WORKSTATION_TYPE = 'C'
</select>
</mapper>

@ -17,11 +17,13 @@ import com.foreverwin.mesnac.dispatch.service.UserResourceService;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BusinessException;
import org.apache.commons.fileupload.FileItem;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
@ -38,7 +40,7 @@ import java.util.stream.Collectors;
* @author Leon.L
* @since 2021-06-02
*/
@Service
@Service("sfcDispatchService")
@Transactional(rollbackFor = Exception.class)
public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDispatch> implements SfcDispatchService {
@ -173,7 +175,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
InputStream inputStream = null;
List<SfcDispatchDto> sfcDispatchList;
try {
sfcDispatchList = ExcelUtils.readExcel(fileType, SfcDispatchDto.class, multipartFile);
sfcDispatchList = ExcelUtils.readExcel(fileType, SfcDispatchDto.class, multipartFile, null);
} finally {
if (inputStream != null){
try {
@ -190,6 +192,36 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
return this.sfcDispatch(site, user, DispatchStatusEnum.IMPORT.getCode(), message, sfcDispatchList);
}
public String importDispatch(FileItem fileItem, HttpServletRequest httpServletRequest) {
String site = httpServletRequest.getParameter("site");
String user = httpServletRequest.getParameter("user");
String fileType = httpServletRequest.getParameter("fileType");
InputStream inputStream = null;
List<SfcDispatchDto> sfcDispatchList;
try {
sfcDispatchList = ExcelUtils.readExcel(fileType, SfcDispatchDto.class, null, fileItem);
} finally {
if (inputStream != null){
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
if (sfcDispatchList == null || sfcDispatchList.size() <= 0) {
throw BusinessException.build("上传的Excel没有数据或者数据格式不正确");
}
//调用业务处理逻辑
StringBuffer message = new StringBuffer();
this.sfcDispatch(site, user, DispatchStatusEnum.IMPORT.getCode(), message, sfcDispatchList);
return message.toString();
}
/**
@ -264,14 +296,8 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
resourceType = sfcDispatchModel.getResourceType();
//资源、计划时间必输
if (StringUtils.isBlank(resource) || sfcDispatchDto.getPlannedStartDate() == null || sfcDispatchDto.getPlannedCompDate() == null) {
flag = false;
message.append(seq++%3 == 0 ? "\n" : "| |");
message.append("派工单[" + dispatchNo + "]的资源、计划开始或完成时间没维护,不允许发布");
continue;
}
type = sfcDispatch.getDispatchStatus();
sfcDispatch.setHandle(handle);
//是否导入
sfcDispatch.setIsImport(Constants.BOOL_TRUE);

@ -33,9 +33,9 @@ public class GeneratorApplication {
dataSourceConfig.setTypeConvert( new OracleTypeConvert() );
MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig)
.tablePrefix( "APS_", "DS_", "Z_" )
.packageName( "com.foreverwin.mesnac.equip" )
.tables("Z_RESOURCE_INSPECT_PLAN","Z_RESOURCE_INSPECT_RESOURCE","Z_RESOURCE_INSPECT_TASK","Z_RESOURCE_INSPECT_TASK_PARAM")
.author("pavel.Liu")
.packageName( "com.foreverwin.mesnac.meapi" )
.tables("SFC_DATA")
.author("Leon.L")
.uiAppId("com.foreverwin.me")
.uiPackage("com.foreverwin.me.migration")
.build();

@ -1,5 +1,8 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
@ -26,6 +29,25 @@ public class SfcController {
public SfcService sfcService;
@ResponseBody
@GetMapping("/findSfcData")
public R findSfcData(String sfc) {
SfcDto sfcDto = null;
try {
if (StringUtils.isBlank(sfc)) {
throw BusinessException.build("SFC不能为空");
}
String site = CommonMethods.getSite();
sfcDto = sfcService.findSfcData(site, sfc);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(sfcDto);
}
/**
*
*

@ -3,9 +3,47 @@ package com.foreverwin.mesnac.meapi.dto;
import com.foreverwin.mesnac.meapi.model.Sfc;
public class SfcDto extends Sfc {
String resrce;
String operation;
private String shopOrder;
private String status;
private String item;
private String itemDescription;
private String operation;
private String operationDescription;
private String prepositionOperation;
private String resrce;
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getOperation() {
return operation;
@ -15,6 +53,22 @@ public class SfcDto extends Sfc {
this.operation = operation;
}
public String getOperationDescription() {
return operationDescription;
}
public void setOperationDescription(String operationDescription) {
this.operationDescription = operationDescription;
}
public String getPrepositionOperation() {
return prepositionOperation;
}
public void setPrepositionOperation(String prepositionOperation) {
this.prepositionOperation = prepositionOperation;
}
public String getResrce() {
return resrce;
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.model.SfcData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Leon.L
* @since 2021-06-29
*/
@Repository
public interface SfcDataMapper extends BaseMapper<SfcData> {
}

@ -1,7 +1,9 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -20,4 +22,6 @@ public interface SfcMapper extends BaseMapper<Sfc> {
* sfc
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc);
}

@ -0,0 +1,143 @@
package com.foreverwin.mesnac.meapi.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-29
*/
@TableName("SFC_DATA")
public class SfcData extends Model<SfcData> {
private static final long serialVersionUID = 1L;
@TableField("HANDLE")
private String handle;
@TableField("SFC_BO")
private String sfcBo;
@TableField("DATE_TIME")
private LocalDateTime dateTime;
@TableField("DATA_FIELD")
private String dataField;
@TableField("DATA_ATTR")
private String dataAttr;
@TableField("USER_BO")
private String userBo;
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSfcBo() {
return sfcBo;
}
public void setSfcBo(String sfcBo) {
this.sfcBo = sfcBo;
}
public LocalDateTime getDateTime() {
return dateTime;
}
public void setDateTime(LocalDateTime dateTime) {
this.dateTime = dateTime;
}
public String getDataField() {
return dataField;
}
public void setDataField(String dataField) {
this.dataField = dataField;
}
public String getDataAttr() {
return dataAttr;
}
public void setDataAttr(String dataAttr) {
this.dataAttr = dataAttr;
}
public String getUserBo() {
return userBo;
}
public void setUserBo(String userBo) {
this.userBo = userBo;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SFC_BO = "SFC_BO";
public static final String DATE_TIME = "DATE_TIME";
public static final String DATA_FIELD = "DATA_FIELD";
public static final String DATA_ATTR = "DATA_ATTR";
public static final String USER_BO = "USER_BO";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "SfcData{" +
"handle = " + handle +
", sfcBo = " + sfcBo +
", dateTime = " + dateTime +
", dataField = " + dataField +
", dataAttr = " + dataAttr +
", userBo = " + userBo +
", createdDateTime = " + createdDateTime +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -0,0 +1,37 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.SfcData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-29
*/
public interface SfcDataService extends IService<SfcData> {
/**
*
* @param frontPage
* @return
*/
IPage<SfcData> selectPage(FrontPage<SfcData> frontPage, SfcData sfcData);
List<SfcData> selectList(SfcData sfcData);
/**
* SFC
*
* @param site
* @param sfc
* @param location
*/
void saveSfcLocation(String site, String sfc, String location);
}

@ -1,6 +1,7 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
@ -35,4 +36,13 @@ public interface SfcService extends IService<Sfc> {
* sfc
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
/**
*
*
* @param site
* @param sfc
* @return
*/
SfcDto findSfcData(String site, String sfc);
}

@ -0,0 +1,58 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.mesnac.meapi.service.SfcService;
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
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.SfcData;
import com.foreverwin.mesnac.meapi.mapper.SfcDataMapper;
import com.foreverwin.mesnac.meapi.service.SfcDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.logging.Handler;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-06-29
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SfcDataServiceImpl extends ServiceImpl<SfcDataMapper, SfcData> implements SfcDataService {
@Autowired
private SfcService sfcService;
@Autowired
private SfcDataMapper sfcDataMapper;
@Autowired
private WorkCenterService workCenterService;
@Override
public IPage<SfcData> selectPage(FrontPage<SfcData> frontPage, SfcData sfcData) {
QueryWrapper<SfcData> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcData);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<SfcData> selectList(SfcData sfcData) {
QueryWrapper<SfcData> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcData);
return super.list(queryWrapper);
}
@Override
public void saveSfcLocation(String site, String sfc, String location) {
}
}

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -57,5 +58,10 @@ public class SfcServiceImpl extends ServiceImpl<SfcMapper, Sfc> implements SfcSe
return sfc;
}
@Override
public SfcDto findSfcData(String site, String sfc) {
return sfcMapper.findSfcData(site, sfc);
}
}

@ -0,0 +1,332 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.meapi.mapper.SfcDataMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.SfcData">
<result column="HANDLE" property="handle" />
<result column="SFC_BO" property="sfcBo" />
<result column="DATE_TIME" property="dateTime" />
<result column="DATA_FIELD" property="dataField" />
<result column="DATA_ATTR" property="dataAttr" />
<result column="USER_BO" property="userBo" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SFC_BO, DATE_TIME, DATA_FIELD, DATA_ATTR, USER_BO, CREATED_DATE_TIME, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM SFC_DATA
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM SFC_DATA
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.SfcData">
INSERT INTO SFC_DATA
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="sfcBo!=null">SFC_BO,</if>
<if test="dateTime!=null">DATE_TIME,</if>
<if test="dataField!=null">DATA_FIELD,</if>
<if test="dataAttr!=null">DATA_ATTR,</if>
<if test="userBo!=null">USER_BO,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="sfcBo!=null">#{sfcBo},</if>
<if test="dateTime!=null">#{dateTime},</if>
<if test="dataField!=null">#{dataField},</if>
<if test="dataAttr!=null">#{dataAttr},</if>
<if test="userBo!=null">#{userBo},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.SfcData">
INSERT INTO SFC_DATA
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{sfcBo},
#{dateTime},
#{dataField},
#{dataAttr},
#{userBo},
#{createdDateTime},
#{modifiedDateTime},
</trim>
</insert>
<update id="update">
UPDATE SFC_DATA <trim prefix="SET" suffixOverrides=",">
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
<if test="et.sfcBo!=null">SFC_BO=#{et.sfcBo},</if>
<if test="et.dateTime!=null">DATE_TIME=#{et.dateTime},</if>
<if test="et.dataField!=null">DATA_FIELD=#{et.dataField},</if>
<if test="et.dataAttr!=null">DATA_ATTR=#{et.dataAttr},</if>
<if test="et.userBo!=null">USER_BO=#{et.userBo},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteByMap">
DELETE FROM SFC_DATA
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM SFC_DATA
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.sfcBo!=null"> AND SFC_BO=#{ew.entity.sfcBo}</if>
<if test="ew.entity.dateTime!=null"> AND DATE_TIME=#{ew.entity.dateTime}</if>
<if test="ew.entity.dataField!=null"> AND DATA_FIELD=#{ew.entity.dataField}</if>
<if test="ew.entity.dataAttr!=null"> AND DATA_ATTR=#{ew.entity.dataAttr}</if>
<if test="ew.entity.userBo!=null"> AND USER_BO=#{ew.entity.userBo}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -35,6 +35,16 @@
<result column="PARTITION_DATE" property="partitionDate" />
</resultMap>
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.meapi.dto.SfcDto">
<result column="SHOP_ORDER" property="shopOrder" />
<result column="STATUS" property="status" />
<result column="ITEM" property="item" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="OPERATION" property="operation" />
<result column="OPERATION_DESCRIPTION" property="operationDescription" />
<result column="PREPOSITION_OPERATION" property="prepositionOperation" />
<result column="RESRCE" property="resrce" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, CHANGE_STAMP, SITE, SFC, STATUS_BO, SHOP_ORDER_BO, QTY, QTY_DONE, QTY_SCRAPPED, QTY_HISTORICAL_MIN, QTY_HISTORICAL_MAX, ITEM_BO, PRIORITY, LOCATION, RMA_MAX_TIMES_PROCESSED, LCC_BO, ORIGINAL_STATUS_BO, QTY_MULT_PERFORMED, ACTUAL_COMP_DATE, PREV_SITE, ORIGINAL_TRANSFER_KEY, IMMEDIATE_ARCHIVE, TRANSFER_DATETIME, TRANSFER_USER, SN_DONE, AIN_EQUIPMENT_ID, CREATED_DATE_TIME, MODIFIED_DATE_TIME, PARTITION_DATE
@ -634,4 +644,21 @@
WHERE RES.HANDLE = #{resrceBO}
ORDER BY IW.DATE_STARTED DESC
</select>
<select id="findSfcData" resultMap="FullResultMap">
SELECT SC.SITE, SC.SFC, SO.SHOP_ORDER, SC.QTY, SC.QTY_DONE, ST.STATUS, IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, OP.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, OTT.DESCRIPTION PREPOSITION_OPERATION
FROM SFC SC
INNER JOIN SHOP_ORDER SO ON SO.HANDLE = SC.SHOP_ORDER_BO
INNER JOIN STATUS ST ON ST.HANDLE = SC.STATUS_BO AND ST.STATUS_GROUP = 'SFC'
INNER JOIN ITEM IM ON IM.HANDLE = SC.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
INNER JOIN SFC_ROUTING SG ON SG.SFC_BO = SC.HANDLE
INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = SG.HANDLE AND SR.IN_USE = 'true'
INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE
INNER JOIN OPERATION OP ON SP.OPERATION_BO = 'OperationBO:'||OP.SITE||','||OP.OPERATION||',#' AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
LEFT JOIN Z_SFC_DISPATCH ZSD ON ZSD.SITE = SC.SITE AND ZSD.SFC = SC.SFC AND ZSD.OPERATION = OP.OPERATION AND ZSD.STEP_ID = SP.STEP_ID
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>
</mapper>

@ -0,0 +1,145 @@
package com.foreverwin.mesnac.production.controller;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.SfcDataService;
import com.foreverwin.mesnac.meapi.model.SfcData;
import java.util.List;
/**
*
* @author Leon.L
* @since 2021-06-29
*/
@RestController
@RequestMapping("/SFC-DATA")
public class SfcDataController {
@Autowired
public SfcDataService sfcDataService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getSfcDataById(@PathVariable String id) {
return R.ok( sfcDataService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getSfcDataList(SfcData sfcData){
List<SfcData> result;
QueryWrapper<SfcData> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcData);
result = sfcDataService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<SfcData> frontPage, SfcData sfcData){
IPage result;
QueryWrapper<SfcData> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcData);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(SfcData::getHandle, frontPage.getGlobalQuery())
.or().like(SfcData::getSfcBo, frontPage.getGlobalQuery())
.or().like(SfcData::getDataField, frontPage.getGlobalQuery())
.or().like(SfcData::getDataAttr, frontPage.getGlobalQuery())
.or().like(SfcData::getUserBo, frontPage.getGlobalQuery())
);
}
result = sfcDataService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param sfcData
* @return null
*/
@PostMapping
public R save(@RequestBody SfcData sfcData) {
return R.ok(sfcDataService.save(sfcData));
}
/**
*
* @param sfcData
* @return null
*/
@PutMapping
public R updateById(@RequestBody SfcData sfcData) {
return R.ok(sfcDataService.updateById(sfcData));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(sfcDataService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(sfcDataService.removeByIds(ids));
}
@ResponseBody
@GetMapping("/saveSfcLocation")
public R saveSfcLocation(String sfc, String location) {
try {
if (StringUtils.isBlank(sfc)) {
throw BusinessException.build("SFC不能为空");
}
if (StringUtils.isBlank(location)) {
throw BusinessException.build("位置不能为空");
}
String site = CommonMethods.getSite();
sfcDataService.saveSfcLocation(site, sfc, location);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
}
Loading…
Cancel
Save