forked from I3-YF/i3plus-mes-pcn-yfai
Merge remote-tracking branch 'origin/mes-uat-changshu0609-temp-logic-20250613-3533' into uat-temp-nht-2506120000-jialiao
commit
7acf815e9b
@ -0,0 +1,20 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.api.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 容器条码-业务方法
|
||||||
|
* @Reference :
|
||||||
|
* @Author : logic
|
||||||
|
* @CreateDate : 2025/6/16 10:43
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface IMesContainerSnService {
|
||||||
|
|
||||||
|
ListPager<MesContainerSn> queryMesContainerSnByPager(MesContainerSn mesContainerSn, Pager pager);
|
||||||
|
|
||||||
|
void checkContainerSnIsExist(String containerSn, String organizeCode);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.api.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSnStation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 容器条码与站点关系表-业务方法
|
||||||
|
* @Reference :
|
||||||
|
* @Author : logic
|
||||||
|
* @CreateDate : 2025/6/13 09:16
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface IMesContainerSnStationService {
|
||||||
|
|
||||||
|
ListPager<MesContainerSnStation> queryPager(MesContainerSnStation mesContainerSnStation, Pager pager);
|
||||||
|
|
||||||
|
void doInsert(MesContainerSnStation mesContainerSnStation, String userName);
|
||||||
|
|
||||||
|
void deleteWeaklyByIds(List<Long> idList, String organizeCode, String userName);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesContainerSnService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesContainerSnStationService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSnStation;
|
||||||
|
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 cn.estsh.impp.framework.boot.util.ValidatorBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 容器条码与站点关系表
|
||||||
|
* @Reference :
|
||||||
|
* @Author : logic
|
||||||
|
* @CreateDate : 2025/6/13 09:15
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "容器条码与站点关系表")
|
||||||
|
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mes-container-sn-station")
|
||||||
|
public class MesContainerSnStationController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesContainerSnStationService mesContainerSnStationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesContainerSnService mesContainerSnService;
|
||||||
|
|
||||||
|
@GetMapping("/query")
|
||||||
|
@ApiOperation(value = "查询")
|
||||||
|
public ResultBean queryPager(MesContainerSnStation mesContainerSnStation, Pager pager) {
|
||||||
|
try {
|
||||||
|
ValidatorBean.checkNotNull(mesContainerSnStation.getOrganizeCode(), "工厂代码为空");
|
||||||
|
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setListPager(
|
||||||
|
mesContainerSnStationService.queryPager(mesContainerSnStation, pager));
|
||||||
|
} catch (ImppBusiException imppException) {
|
||||||
|
return ResultBean.fail(imppException);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@ApiOperation(value = "新增")
|
||||||
|
public ResultBean doInsert(@RequestBody MesContainerSnStation mesContainerSnStation) {
|
||||||
|
try {
|
||||||
|
ValidatorBean.checkNotNull(mesContainerSnStation.getCreateUser(), "操作人为空");
|
||||||
|
ValidatorBean.checkNotNull(mesContainerSnStation.getOrganizeCode(), "工厂代码为空");
|
||||||
|
//校验容器条码是否存在
|
||||||
|
mesContainerSnService.checkContainerSnIsExist(mesContainerSnStation.getContainerSn(), mesContainerSnStation.getOrganizeCode());
|
||||||
|
mesContainerSnStationService.doInsert(mesContainerSnStation, mesContainerSnStation.getCreateUser());
|
||||||
|
return ResultBean.success("新增成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
} catch (ImppBusiException imppException) {
|
||||||
|
return ResultBean.fail(imppException);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/delete-weakly")
|
||||||
|
@ApiOperation(value = "批量软删除信息")
|
||||||
|
public ResultBean batchDeleteWeaklyByIds(@RequestBody Long[] idList) {
|
||||||
|
try {
|
||||||
|
ValidatorBean.checkNotNull(idList, "请选择需要删除的信息");
|
||||||
|
List<Long> ids = Arrays.asList(idList);
|
||||||
|
String organizeCode = AuthUtil.getOrganize().getOrganizeCode();
|
||||||
|
String userName = AuthUtil.getSessionUser().getUserName();
|
||||||
|
mesContainerSnStationService.deleteWeaklyByIds(ids, organizeCode, userName);
|
||||||
|
return ResultBean.success("批量删除信息成功")
|
||||||
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
} catch (ImppBusiException e) {
|
||||||
|
return ResultBean.fail(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesContainerSnService;
|
||||||
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSn;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnRepository;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 容器条码-业务方法实现
|
||||||
|
* @Reference :
|
||||||
|
* @Author : logic
|
||||||
|
* @CreateDate : 2025/6/16 10:44
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MesContainerSnServiceImpl implements IMesContainerSnService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesContainerSnRepository mesContainerSnRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ListPager<MesContainerSn> queryMesContainerSnByPager(MesContainerSn mesContainerSn, Pager pager) {
|
||||||
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(mesContainerSn.getOrganizeCode());
|
||||||
|
DdlPreparedPack.getStringEqualPack(mesContainerSn.getContainerTypeCode(), "containerTypeCode", ddlPackBean);
|
||||||
|
DdlPreparedPack.getStringEqualPack(mesContainerSn.getContainerSn(), "containerSn", ddlPackBean);
|
||||||
|
pager = PagerHelper.getPager(pager, mesContainerSnRepository.findByHqlWhereCount(ddlPackBean));
|
||||||
|
List<MesContainerSn> containerSnList = mesContainerSnRepository.findByHqlWherePage(ddlPackBean, pager);
|
||||||
|
return new ListPager<>(containerSnList, pager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkContainerSnIsExist(String containerSn, String organizeCode) {
|
||||||
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||||
|
DdlPreparedPack.getStringEqualPack(containerSn, "containerSn", ddlPackBean);
|
||||||
|
if (!mesContainerSnRepository.isExitByHql(ddlPackBean)) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("容器条码【%s】不存在!", containerSn)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue