forked from I3-YF/i3plus-mes-pcn-yfai
常熟站点绑定功能
parent
7acf815e9b
commit
6fdba66cfb
@ -1,9 +0,0 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSn;
|
||||
|
||||
public interface IMesContainerSnService {
|
||||
MesContainerSn getContainerSn(String organizeCode, String containerSn);
|
||||
|
||||
MesContainerSn checkContainerSn(String organizeCode, String containerSn);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesContainerSnService;
|
||||
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.MesContainerSn;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesContainerSnServiceImpl implements IMesContainerSnService {
|
||||
@Autowired
|
||||
private MesContainerSnRepository containerSnRepository;
|
||||
|
||||
@Override
|
||||
public MesContainerSn getContainerSn(String organizeCode, String containerSn) {
|
||||
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(containerSn)) {
|
||||
return null;
|
||||
}
|
||||
return containerSnRepository.getByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesContainerSn checkContainerSn(String organizeCode, String containerSn) {
|
||||
MesContainerSn mesContainerSn = getContainerSn(organizeCode, containerSn);
|
||||
if (mesContainerSn == null) {
|
||||
MesPcnException.throwMesBusiException("容器条码【%s】信息不存在", containerSn);
|
||||
}
|
||||
return mesContainerSn;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.util;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @Description :OverwriteStringJoin
|
||||
* @Reference :
|
||||
* @Author : gsz
|
||||
* @CreateDate : 2024-05-10 16:08
|
||||
* @Modify:
|
||||
**/
|
||||
public class OverwriteStringJoin {
|
||||
|
||||
public static String join(CharSequence delimiter, CharSequence... elements) {
|
||||
Objects.requireNonNull(delimiter);
|
||||
Objects.requireNonNull(elements);
|
||||
StringJoiner joiner = new StringJoiner(delimiter);
|
||||
for (CharSequence cs: elements) {
|
||||
joiner.add("'" + cs + "'");
|
||||
}
|
||||
return joiner.toString();
|
||||
}
|
||||
public static String join(CharSequence delimiter, Collection<String> elements) {
|
||||
Objects.requireNonNull(delimiter);
|
||||
Objects.requireNonNull(elements);
|
||||
StringJoiner joiner = new StringJoiner(delimiter);
|
||||
for (String cs: elements) {
|
||||
joiner.add("'" + cs + "'");
|
||||
}
|
||||
return joiner.toString();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue