|
|
|
@ -6,14 +6,20 @@ import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeTempEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreinDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvProductDetailEntity;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvPreinDetailRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvPreinRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvProductDetailRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.inv.InvPreinDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inv.InvPreinOrderResponse;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinOrderService;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.regexp.RE;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
@ -62,4 +68,36 @@ public class InvPreinOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/prein/inv/products/getDetaiByCode")
|
|
|
|
|
public BaseResponse getDetaiByCode(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
|
|
|
|
InvPreinDetailEntity invProductDetailEntity = invPreinDetailService.findOneByCode(filterInvProductDetailRequest.getCode());
|
|
|
|
|
if (invProductDetailEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "预验收库存未存在此产品!");
|
|
|
|
|
} else {
|
|
|
|
|
if (StrUtil.isNotEmpty(invProductDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(filterInvProductDetailRequest.getBatchNo())
|
|
|
|
|
&& !invProductDetailEntity.getBatchNo().equals(filterInvProductDetailRequest.getBatchNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
|
|
|
|
|
}
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterInvProductDetailRequest.getCode());
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
//无序列号,则可能存在多个预验收入库单
|
|
|
|
|
List<InvPreinDetailEntity> invPreinDetailEntities = invPreinDetailService.findByCode(filterInvProductDetailRequest.getCode());
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (InvPreinDetailEntity temp : invPreinDetailEntities) {
|
|
|
|
|
count = count + temp.getCount();
|
|
|
|
|
}
|
|
|
|
|
invPreinDetailEntities.get(0).setCount(count);
|
|
|
|
|
return ResultVOUtils.success(invPreinDetailEntities.get(0));
|
|
|
|
|
} else {
|
|
|
|
|
if (invProductDetailEntity.getCount() < 1) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(invProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|