diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index bd698209..8262b9d4 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -148,10 +148,10 @@ public class IoAddInoutService { List insertList = new ArrayList<>(); for (int j = 0; j < filterList.size(); j++) { - IoCodeTempEntity warehouseEntity = filterList.get(j); - String result = checkOrderRepeatCode(warehouseEntity, filterList); + IoCodeTempEntity ioCodeTempEntity = filterList.get(j); + String result = checkOrderRepeatCode(ioCodeTempEntity, filterList); if (result == null) { - insertList.add(warehouseEntity); + insertList.add(ioCodeTempEntity); } else { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); @@ -162,7 +162,7 @@ public class IoAddInoutService { if (bussinessTypeEntity.isCodeFillCheck()) { //三期校验 - String checkOriginMsg = checkOriginCode(warehouseEntity); + String checkOriginMsg = checkOriginCode(ioCodeTempEntity); if (StrUtil.isNotEmpty(checkOriginMsg)) { orderEntity.setErrMsg(checkOriginMsg); orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); @@ -175,48 +175,48 @@ public class IoAddInoutService { //产品是否已维护已关联 - if ((warehouseEntity.getRelId() == null)) { + if ((ioCodeTempEntity.getRelId() == null)) { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); - orderEntity.setErrMsg("udi码:" + warehouseEntity.getCode() + "上传时对照数据丢失,请选择对!"); + orderEntity.setErrMsg("udi码:" + ioCodeTempEntity.getCode() + "上传时对照数据丢失,请选择对!"); orderService.update(orderEntity); return; } //产品是否指定供应商 - if (StrUtil.isEmpty(warehouseEntity.getSupId())) { + if (StrUtil.isEmpty(ioCodeTempEntity.getSupId())) { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); - orderEntity.setErrMsg("udi码:" + warehouseEntity.getCode() + "未指定供应商!"); + orderEntity.setErrMsg("udi码:" + ioCodeTempEntity.getCode() + "未指定供应商!"); orderService.update(orderEntity); return; } //校验是否是当前供应商 if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) { - UdiRlSupEntity udiRlSupEntity = udiRlSupService.findByUdiRlIdUnitFk(warehouseEntity.getRelId() + "", orderEntity.getFromCorp()); + UdiRlSupEntity udiRlSupEntity = udiRlSupService.findByUdiRlIdUnitFk(ioCodeTempEntity.getRelId() + "", orderEntity.getFromCorp()); if (udiRlSupEntity == null) { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); - orderEntity.setErrMsg("udi码:" + warehouseEntity.getCode() + "当前供应商不存在此配送产品"); + orderEntity.setErrMsg("udi码:" + ioCodeTempEntity.getCode() + "当前供应商不存在此配送产品"); orderService.update(orderEntity); return; } } //产品是否可以以使用单元入库 - UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(warehouseEntity.getRelId()); + UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(ioCodeTempEntity.getRelId()); if (udiRelevanceResponse == null) { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); - orderEntity.setErrMsg("udi码:" + warehouseEntity.getCode() + "该产品信息未维护"); + orderEntity.setErrMsg("udi码:" + ioCodeTempEntity.getCode() + "该产品信息未维护"); orderService.update(orderEntity); return; } else if (!udiRelevanceResponse.getUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) { orderEntity.setStatus(ConstantStatus.ORDER_STATS_ERROR); orderEntity.setUpdateTime(new Date()); - orderEntity.setErrMsg("udi码:" + warehouseEntity.getCode() + "该产品不允许以使用单元入库"); + orderEntity.setErrMsg("udi码:" + ioCodeTempEntity.getCode() + "该产品不允许以使用单元入库"); orderService.update(orderEntity); return; } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java b/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java index 4fa0cccf..4d765e11 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderUtilsService.java @@ -1,36 +1,24 @@ package com.glxp.api.service.inout; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.net.URLDecoder; import cn.hutool.core.util.IdUtil; -import com.alibaba.fastjson.JSON; -import com.glxp.api.common.res.BaseResponse; -import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.Constant; import com.glxp.api.dao.auth.AuthAdminDao; import com.glxp.api.dao.basic.UdiRlSupDao; import com.glxp.api.dao.inout.*; import com.glxp.api.entity.auth.AuthAdmin; -import com.glxp.api.entity.basic.UdiRlSupEntity; import com.glxp.api.entity.inout.*; -import com.glxp.api.idc.utils.IDCUtils; import com.glxp.api.req.basic.FilterCompanyProductRelevanceRequest; import com.glxp.api.req.inout.ioOrderUploadRequest; import com.glxp.api.res.inout.PlatformLinkResponse; import com.glxp.api.res.inout.ioUploadOrderResponse; -import com.glxp.api.util.BeanCopyUtils; -import com.glxp.api.util.FileUtils; import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.OrderNoTypeBean; -import org.apache.catalina.User; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.*; @@ -88,15 +76,17 @@ public class IoOrderUtilsService { filterCompanyProductRelevanceRequest.setCustomerId(Long.valueOf(platformLinkRespons.getCustomerId())); filterCompanyProductRelevanceRequest.setNameCode(ioCodeTempEntity.getNameCode()); List udiRlSupEntityList = udiRlSupDao.filterCompanyProduct(filterCompanyProductRelevanceRequest); - if (udiRlSupEntityList != null && udiRlSupEntityList.size() == 0 || udiRlSupEntityList.size() > 1) { + if (CollectionUtil.isNotEmpty(udiRlSupEntityList) && udiRlSupEntityList.size() > 1) { ioCodeTempEntity1.setRelId(null); checkUdi = true; } else { - ioCodeTempEntity1.setRelId(udiRlSupEntityList.get(0).getId()); - map.put(ioCodeTempEntity.getRelId(), udiRlSupEntityList.get(0)); + if(CollectionUtil.isNotEmpty(udiRlSupEntityList)) { + ioCodeTempEntity1.setRelId(udiRlSupEntityList.get(0).getId()); + map.put(ioCodeTempEntity.getRelId(), udiRlSupEntityList.get(0)); + } ioCodeTempEntity1.setOrderId(billNO); - String code=URLDecoder.decode(ioCodeTempEntity.getCode(), StandardCharsets.UTF_8); + String code = URLDecoder.decode(ioCodeTempEntity.getCode(), StandardCharsets.UTF_8); ioCodeTempEntity1.setCode(code); ioCodeTempEntity1.setMainAction(ioCodeTempEntity.getMainAction()); ioCodeTempEntity1.setAction(platformLinkRespons.getTargetAction()); @@ -266,7 +256,6 @@ public class IoOrderUtilsService { ioOrderEntity1.setMainAction(ioOrderEntity.getMainAction()); ioOrderEntity1.setAction(platformLinkRespons.getTargetAction()); ioOrderEntity1.setFromCorp(ioOrderEntity.getFromCorp()); - ioOrderEntity1.setFromCorp(ioOrderEntity.getFromCorp()); ioOrderEntity1.setFromDeptCode(ioOrderEntity.getFromDeptCode()); ioOrderEntity1.setFromInvCode(ioOrderEntity.getFromInvCode()); ioOrderEntity1.setOrderType(3);