forked from I3-YF/i3plus-mes-pcn-yfai
料包绑定功能开发
parent
b2325f6ce0
commit
2ef4f1e2f0
@ -0,0 +1,37 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi.recyclablepackage;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesRecyclablePackageBindingModel;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackageBinding;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackageBindingDetail;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 料箱绑定
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/9/7 10:27
|
||||
* @Modify:
|
||||
**/
|
||||
public interface IMesRecyclablePackageBindingService {
|
||||
|
||||
@ApiOperation("查询回收包装绑定明细")
|
||||
List<MesRecyclablePackageBindingDetail> findMesRecyclablePackageBindingDetailByPid(String organizeCode, long pid);
|
||||
|
||||
@ApiOperation("查询回收包装绑定明细数量")
|
||||
int findMesRecyclablePackageBindingDetailByPidCount(String organizeCode, long pid);
|
||||
|
||||
@ApiOperation("查询回收包装绑定明细")
|
||||
List<MesRecyclablePackageBindingDetail> findMesRecyclablePackageBindingDetailByProductSn(String organizeCode, String productSn);
|
||||
|
||||
@ApiOperation("查询回收包装绑定")
|
||||
MesRecyclablePackageBinding getMesRecyclablePackageBindingByPackageSn(String organizeCode, String packageSn);
|
||||
|
||||
@ApiOperation("查询回收包装绑定明细")
|
||||
List<MesRecyclablePackageBindingDetail> findMesRecyclablePackageBindingDetail(MesRecyclablePackageBindingModel mesRecyclablePackageBindingModel);
|
||||
|
||||
@ApiOperation("扫描信息")
|
||||
MesRecyclablePackageBinding doScan(MesRecyclablePackageBindingModel mesRecyclablePackageBindingModel);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi.recyclablepackage;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackage;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackagePart;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackageType;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 回收包装
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/9/7 10:27
|
||||
* @Modify:
|
||||
**/
|
||||
public interface IMesRecyclablePackageService {
|
||||
|
||||
@ApiOperation("查询回收包装")
|
||||
MesRecyclablePackage getMesRecyclablePackageByPackageSn(String organizeCode, String packageSn);
|
||||
|
||||
@ApiOperation("校验回收包装")
|
||||
MesRecyclablePackage checkMesRecyclablePackage(String organizeCode, String packageSn);
|
||||
|
||||
@ApiOperation("查询回收包装零件")
|
||||
List<MesRecyclablePackagePart> findMesRecyclablePackagePartByPackageTypeCode(String organizeCode, String packageTypeCode);
|
||||
|
||||
@ApiOperation("查询回收包装零件")
|
||||
MesRecyclablePackagePart getMesRecyclablePackagePartByPackageTypeCodeAndPartNo(String organizeCode, String packageTypeCode, String partNo);
|
||||
|
||||
@ApiOperation("查询回收包装类型")
|
||||
MesRecyclablePackageType getMesRecyclablePackageTypeByPackageTypeCode(String organizeCode, String packageTypeCode);
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi.recyclablepackage;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.recyclablepackage.IMesRecyclablePackageBindingService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesRecyclablePackageBindingModel;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Description : 料箱绑定
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/9/6 16:35
|
||||
* @Modify:
|
||||
**/
|
||||
|
||||
@RestController
|
||||
@Api(tags = "料箱绑定")
|
||||
@RequestMapping(MesCommonConstant.MES_YANFEN + "/recyclable-package-binding")
|
||||
@Slf4j
|
||||
public class MesRecyclablePackageBindingController {
|
||||
|
||||
@Autowired
|
||||
private IMesRecyclablePackageBindingService mesRecyclablePackageBindingService;
|
||||
|
||||
|
||||
@GetMapping("/recyclable-package-binding-detail/query")
|
||||
@ApiOperation(value = "查询绑定信息")
|
||||
public ResultBean findMesRecyclablePackageBindingDetail(MesRecyclablePackageBindingModel mesRecyclablePackageBindingModel) {
|
||||
|
||||
try {
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getPackageSn(), "包条码不能为空");
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getOrganizeCode(), "工厂代码不能为空");
|
||||
return ResultBean.success("查询成功").setResultList(mesRecyclablePackageBindingService.findMesRecyclablePackageBindingDetail(mesRecyclablePackageBindingModel));
|
||||
} catch (ImppBusiException imppException) {
|
||||
return ResultBean.fail(imppException);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/doScan")
|
||||
@ApiOperation(value = "扫描信息")
|
||||
public ResultBean doScan(@RequestBody MesRecyclablePackageBindingModel mesRecyclablePackageBindingModel) {
|
||||
|
||||
try {
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getPackageSn(), "包条码不能为空");
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getOrganizeCode(), "工厂代码不能为空");
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getType(), "操作类型不能为空");
|
||||
ValidatorBean.checkNotNull(mesRecyclablePackageBindingModel.getUserName(), "操作人不能为空");
|
||||
return ResultBean.success("操作成功").setResultObject(mesRecyclablePackageBindingService.doScan(mesRecyclablePackageBindingModel));
|
||||
} catch (ImppBusiException imppException) {
|
||||
return ResultBean.fail(imppException);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.recyclablepackage;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.recyclablepackage.IMesRecyclablePackageService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackage;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackagePart;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.recyclablepackage.MesRecyclablePackageType;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.recyclablepackage.MesRecyclablePackagePartRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.recyclablepackage.MesRecyclablePackageRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.recyclablepackage.MesRecyclablePackageTypeRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description : 回收包装
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/9/7 10:20
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MesRecyclablePackageServiceImpl implements IMesRecyclablePackageService {
|
||||
|
||||
@Autowired
|
||||
private MesRecyclablePackageRepository mesRecyclablePackageRepository;
|
||||
|
||||
@Autowired
|
||||
private MesRecyclablePackagePartRepository mesRecyclablePackagePartRepository;
|
||||
|
||||
@Autowired
|
||||
private MesRecyclablePackageTypeRepository mesRecyclablePackageTypeRepository;
|
||||
|
||||
@Override
|
||||
public MesRecyclablePackage getMesRecyclablePackageByPackageSn(String organizeCode, String packageSn) {
|
||||
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(packageSn)) {
|
||||
return null;
|
||||
}
|
||||
return mesRecyclablePackageRepository.getByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PACKAGE_SN},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), packageSn});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesRecyclablePackage checkMesRecyclablePackage(String organizeCode, String packageSn) {
|
||||
MesRecyclablePackage recyclablePackage = this.getMesRecyclablePackageByPackageSn(organizeCode, packageSn);
|
||||
if (Objects.isNull(recyclablePackage)) {
|
||||
MesPcnException.throwMesBusiException("包条码【%s】信息不存在", packageSn);
|
||||
}
|
||||
return recyclablePackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesRecyclablePackagePart> findMesRecyclablePackagePartByPackageTypeCode(String organizeCode, String packageTypeCode) {
|
||||
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(packageTypeCode)) {
|
||||
return null;
|
||||
}
|
||||
return mesRecyclablePackagePartRepository.findByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PACKAGE_TYPE_CODE},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), packageTypeCode});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesRecyclablePackagePart getMesRecyclablePackagePartByPackageTypeCodeAndPartNo(String organizeCode, String packageTypeCode, String partNo) {
|
||||
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(packageTypeCode) || StringUtil.isEmptyAndNull(partNo)) {
|
||||
return null;
|
||||
}
|
||||
return mesRecyclablePackagePartRepository.getByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PACKAGE_TYPE_CODE, MesPcnExtConstWords.PART_NO},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), packageTypeCode, partNo});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesRecyclablePackageType getMesRecyclablePackageTypeByPackageTypeCode(String organizeCode, String packageTypeCode) {
|
||||
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(packageTypeCode)) {
|
||||
return null;
|
||||
}
|
||||
return mesRecyclablePackageTypeRepository.getByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.PACKAGE_TYPE_CODE},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), packageTypeCode});
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description : 料箱绑定
|
||||
* @Reference :
|
||||
* @Author : junsheng.li
|
||||
* @CreateDate 2024/9/6 16:37
|
||||
* @Modify:
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
public class MesRecyclablePackageBindingModel {
|
||||
@ApiParam("操作人")
|
||||
private String userName;
|
||||
|
||||
@ApiParam("工厂代码")
|
||||
private String organizeCode;
|
||||
|
||||
@ApiParam("包条码")
|
||||
private String packageSn;
|
||||
|
||||
@ApiParam("零件条码")
|
||||
private String productSn;
|
||||
|
||||
@ApiParam("操作类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiParam("删除明细ID")
|
||||
private Long[] detailsIds;
|
||||
}
|
Loading…
Reference in New Issue