forked from I3-YF/i3plus-mes-yfai
批量启用禁用工序信息
parent
202fca78c0
commit
0afee7b357
@ -0,0 +1,33 @@
|
||||
package cn.estsh.i3plus.ext.mes.api.base.jx;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @Description:MES_松下工位节拍PLC配置接口
|
||||
* @Reference:
|
||||
* @Author: jessica.chen
|
||||
* @CreateDate: 2019\11\13 13:56
|
||||
* @Modify:
|
||||
**/
|
||||
public interface IJxProcessExtService {
|
||||
|
||||
/**
|
||||
* 批量软删数据
|
||||
*
|
||||
* @param ids id数组
|
||||
* @param userName 操作人
|
||||
*/
|
||||
@ApiOperation("批量软删数据")
|
||||
int deleteWeaklySProcessByIds(String[] ids, String userName);
|
||||
|
||||
/**
|
||||
* 批量禁用/启用数据有效性
|
||||
*
|
||||
* @param ids id数组
|
||||
* @param status 更新状态
|
||||
* @param userName 操作人
|
||||
* @return 操作行数
|
||||
*/
|
||||
@ApiOperation(value = "批量禁用/启用数据有效性")
|
||||
int updateProcessValid(String[] ids, int status, String userName);
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.controller.base.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.base.jx.IJxProcessExtService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||
import cn.estsh.impp.framework.base.controller.MesBaseController;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @PROJECT_NAME: i3plus-mes-panasonic-jx
|
||||
* @DESCRIPTION:
|
||||
* @USER: xinwang.yi
|
||||
* @DATE: 2023-11-13 17:18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(MesExtConstWords.BASE_URL_MES_JX + "/process-flow")
|
||||
@Api(tags = "嘉兴工序信息 控制层")
|
||||
public class JxProcessController extends MesBaseController {
|
||||
|
||||
@Autowired
|
||||
private IJxProcessExtService jxProcessExtService;
|
||||
|
||||
@PutMapping(value = "/update-valid-batch")
|
||||
@ApiOperation(value = "批量禁用/启用详情", notes = "批量禁用/启用详情")
|
||||
public ResultBean updateProcessValid(String[] ids, int status) {
|
||||
try {
|
||||
ConvertBean.modelSafeArrayNumber(ids, true);
|
||||
//登陆用户
|
||||
SessionUser user = AuthUtil.getSessionUser();
|
||||
|
||||
jxProcessExtService.updateProcessValid(ids, status, user.getUserName());
|
||||
return ResultBean.success("修改成功")
|
||||
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||
} catch (ImppBusiException busExcep) {
|
||||
return ResultBean.fail(busExcep);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/delete-batch")
|
||||
@ApiOperation(value = "批量删除", notes = "批量删除")
|
||||
public ResultBean deleteProcessByIds(String[] ids) {
|
||||
try {
|
||||
ConvertBean.modelSafeArrayNumber(ids, true);
|
||||
//登陆用户
|
||||
SessionUser user = AuthUtil.getSessionUser();
|
||||
|
||||
jxProcessExtService.deleteWeaklySProcessByIds(ids, user.getUserName());
|
||||
return ResultBean.success("修改成功")
|
||||
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||
} catch (ImppBusiException busExcep) {
|
||||
return ResultBean.fail(busExcep);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.base.jx.IJxProcessExtService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesProcessRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @PROJECT_NAME: i3plus-mes-panasonic-jx
|
||||
* @DESCRIPTION:
|
||||
* @USER: xinwang.yi
|
||||
* @DATE: 2023-12-14 11:03
|
||||
*/
|
||||
@Service
|
||||
public class JxProcessExtService implements IJxProcessExtService {
|
||||
|
||||
@Autowired
|
||||
private MesProcessRepository processRepository;
|
||||
|
||||
@Override
|
||||
public int deleteWeaklySProcessByIds(String[] ids, String userName) {
|
||||
StringBuffer wheres = new StringBuffer();
|
||||
HqlPack.getInPack(String.join(",", ids), MesExtConstWords.ID, wheres);
|
||||
|
||||
int num = processRepository.updateByHqlWhere(
|
||||
wheres.toString(),
|
||||
new String[]{MesExtConstWords.SYSTEM_SYNC_STATUS, MesExtConstWords.IS_DELETED, MesExtConstWords.MODIFY_USER, MesExtConstWords.MODIFY_DATE_TIME},
|
||||
new Object[]{MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), userName, TimeTool.getNowTime(true)}
|
||||
);
|
||||
return num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateProcessValid(String[] ids, int status, String userName) {
|
||||
StringBuffer wheres = new StringBuffer();
|
||||
HqlPack.getInPack(String.join(",", ids), MesExtConstWords.ID, wheres);
|
||||
|
||||
int num = processRepository.updateByHqlWhere(
|
||||
wheres.toString(),
|
||||
new String[]{MesExtConstWords.SYSTEM_SYNC_STATUS, MesExtConstWords.IS_DELETED, MesExtConstWords.MODIFY_USER, MesExtConstWords.MODIFY_DATE_TIME},
|
||||
new Object[]{MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), userName, TimeTool.getNowTime(true)}
|
||||
);
|
||||
return num;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue