|
|
|
@ -282,8 +282,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BaseResponse response = ResultVOUtils.error(501, com.glxp.api.util.StringUtils.isNotEmpty(baseResponse.getMessage()) ?
|
|
|
|
|
"单据存在未对照产品: " + baseResponse.getMessage() : "未找到匹配单据");
|
|
|
|
|
BaseResponse response = ResultVOUtils.error(501, com.glxp.api.util.StringUtils.isNotEmpty(baseResponse.getMessage()) ? "单据存在未对照产品: " + baseResponse.getMessage() : "未找到匹配单据");
|
|
|
|
|
response.setData(code);
|
|
|
|
|
return response;
|
|
|
|
|
} else {
|
|
|
|
@ -311,8 +310,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
String code = "";
|
|
|
|
|
String originCode = addEnterCodeRequest.getOriginCode();
|
|
|
|
|
if (originCode == null)
|
|
|
|
|
originCode = "";
|
|
|
|
|
if (originCode == null) originCode = "";
|
|
|
|
|
if (addEnterCodeRequest.getCode().contains(originCode)) {
|
|
|
|
|
addEnterCodeRequest.setCode(addEnterCodeRequest.getCode().replace(originCode, ""));
|
|
|
|
|
}
|
|
|
|
@ -370,8 +368,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
@PostMapping("warehouse/inout/batchVailCode")
|
|
|
|
|
public BaseResponse batchVailCode(@RequestBody AddEnterCodeRequest addEnterCodeRequest) {
|
|
|
|
|
List<String> codeList = addEnterCodeRequest.getCodeList();
|
|
|
|
|
if (CollUtil.isEmpty(codeList))
|
|
|
|
|
return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
if (CollUtil.isEmpty(codeList)) return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
codeList = codeList.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
List<VailCodeResultResponse> vailCodeResultResponses = new ArrayList<>();
|
|
|
|
|
List<String> prefixes = Arrays.asList("01", "11", "17", "10", "21");
|
|
|
|
@ -470,6 +467,14 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
addOrderCodeRequest.setCodeList(codeList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(codeList)) {
|
|
|
|
|
String firstCode = codeList.get(0);
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(firstCode);
|
|
|
|
|
if (IntUtil.value(udiEntity.getProductType()) == 2) {
|
|
|
|
|
addOrderCodeRequest.setProductType(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取第一个码判断类型,如果是药品类型则使用批量处理方法
|
|
|
|
|
if (!codeList.isEmpty() && IntUtil.value(addOrderCodeRequest.getProductType()) == 2) {
|
|
|
|
|
String firstCode = codeList.get(0);
|
|
|
|
@ -518,25 +523,13 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
addOrderRequest.setAction(ConstantType.SPLIT_OUT);
|
|
|
|
|
}
|
|
|
|
|
addOrderRequest.setFromCorp(ConstantType.SPLIT_CORP);
|
|
|
|
|
|
|
|
|
|
BaseResponse baseResponse = null;
|
|
|
|
|
addOrderRequest.setCode(code);
|
|
|
|
|
IoOrderEntity ioOrderEntity = orderService.findCorpOrderId(addOrderCodeRequest.getCorpOrderId());
|
|
|
|
|
if (ioOrderEntity != null) {
|
|
|
|
|
addOrderRequest.setBillNo(ioOrderEntity.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(udiEntity.getProductType()) == 2) {
|
|
|
|
|
try {
|
|
|
|
|
baseResponse = addDrugOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
} catch (JsonException e) {
|
|
|
|
|
if (e.getCode() == 507) {
|
|
|
|
|
baseResponse = ResultVOUtils.error(e.getCode(), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
baseResponse = addMaterOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
baseResponse = addMaterOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
vailCodeResultResponse.setCode(code);
|
|
|
|
|
vailCodeResultResponse.setStatus(1);
|
|
|
|
@ -561,7 +554,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("warehouse/inout/addOrderWeb")
|
|
|
|
|
// @CusRedissonAnnotation(cacheName = RedissonCacheKey.WEB_ADD_CODE, key = {"#addOrderRequest.corpOrderId", "#addOrderRequest.code"}, timeOutMsg = "系统正在处理,请勿重复扫码")
|
|
|
|
|
@CusRedissonAnnotation(cacheName = RedissonCacheKey.WEB_ADD_CODE, key = {"#addOrderRequest.corpOrderId", "#addOrderRequest.code"}, timeOutMsg = "系统正在处理,请勿重复扫码")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
@ -575,8 +568,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
code = code.replace("\u001D", "");
|
|
|
|
|
}
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
if (udiEntity == null)
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
if (udiEntity == null) return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
@ -596,10 +588,14 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
//TODO 退货校验是否有库存 提示产品不存在
|
|
|
|
|
if (StrUtil.equals("return", addOrderRequest.getSplitType())) {
|
|
|
|
|
//ioSplitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>().eq(IoSplitFifoInv::getInvCode,"").last("limit 1"));
|
|
|
|
|
}
|
|
|
|
|
Integer groupNumber = getMaxGroupNumber() == null ? 1 : getMaxGroupNumber() + 1;
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(udiEntity.getProductType()) == 2) {
|
|
|
|
|
// UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getCode());
|
|
|
|
|
// InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(ioOrderEntity.getInvCode());
|
|
|
|
|
// BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(ioOrderEntity.getAction());
|
|
|
|
|
// return addCoodeService.addDrugOrder(addOrderRequest, udiEntity, code, groupNumber, bussinessTypeEntity, udiRelevanceResponse, getUser(), invWarehouseEntity);
|
|
|
|
|
return addDrugOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
} else {
|
|
|
|
|
return addMaterOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
@ -712,8 +708,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
} else return checkOriginCodeRes;
|
|
|
|
|
} else {
|
|
|
|
|
udiEntity.setBatchNo(codeLostEntity.getBatchNo());
|
|
|
|
|
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
|
|
|
|
@ -725,8 +720,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
} else return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
@ -737,10 +731,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
|
|
|
|
|
udiEntity.setProduceDate(codeLostEntity.getProduceDate());
|
|
|
|
|
checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
|
if (checkOriginCodeRes != null)
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
} else
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
if (checkOriginCodeRes != null) return checkOriginCodeRes;
|
|
|
|
|
} else return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -999,14 +991,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else {
|
|
|
|
|
boolean update = true;
|
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
@ -1119,10 +1109,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (udiRelevanceResponses.size() == 0) {
|
|
|
|
|
if (unitFk == null)
|
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
else
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
if (unitFk == null) return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
else return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
@ -1184,8 +1172,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
|
if (baseResponse == null) {
|
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
|
if (baseResponse != null)
|
|
|
|
|
return baseResponse;
|
|
|
|
|
if (baseResponse != null) return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
if (baseResponse.getCode() == 501) {
|
|
|
|
|
return baseResponse;
|
|
|
|
@ -1245,8 +1232,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
//预出库退货校验队列库存
|
|
|
|
|
if (bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN)) {
|
|
|
|
|
IoSplitFifoCodeEntity ioSplitFifoCodeEntity = splitFifoCodeService.findByCode(codeEnttity.getCode(), orderEntity.getWorkPlaceCode());
|
|
|
|
|
if (ioSplitFifoCodeEntity == null)
|
|
|
|
|
return ResultVOUtils.error(500, "当前工位库存库存不足");
|
|
|
|
|
if (ioSplitFifoCodeEntity == null) return ResultVOUtils.error(500, "当前工位库存库存不足");
|
|
|
|
|
|
|
|
|
|
if (ioSplitFifoCodeEntity.getScanCount() < codeEnttity.getCount()) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前工位库存库存不足");
|
|
|
|
@ -1260,14 +1246,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
|
} else {
|
|
|
|
|
checkPrice(codeEnttity, bussinessTypeEntity, inBatch, codeEnttitys);
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
@ -1637,7 +1621,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysWorkplaceQueue sysWorkplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>()
|
|
|
|
|
.eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()));
|
|
|
|
|
.eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()).last("limit 1"));
|
|
|
|
|
if (sysWorkplaceQueue.getRelId() == null) {
|
|
|
|
|
//虚拟槽位这个时候就要设置
|
|
|
|
|
if (sysWorkplace.getQueueStatus() == 0) {
|
|
|
|
@ -1787,8 +1771,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
long recentTime = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
|
if (resultTime > 0 && resultTime < recentTime) {
|
|
|
|
|
long time = udiRelevanceResponse.getIsDateBy() == 2
|
|
|
|
|
? resultTime / (60 * 60 * 1000) // 单位:小时
|
|
|
|
|
long time = udiRelevanceResponse.getIsDateBy() == 2 ? resultTime / (60 * 60 * 1000) // 单位:小时
|
|
|
|
|
: resultTime / (24 * 60 * 60 * 1000); // 单位:天
|
|
|
|
|
String unit = udiRelevanceResponse.getIsDateBy() == 2 ? "时" : "天";
|
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + unit + ",是否确定继续添加?");
|
|
|
|
@ -1888,8 +1871,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
code = code.replace("\u001D", "");
|
|
|
|
|
}
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
if (udiEntity == null)
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
if (udiEntity == null) return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
@ -1927,8 +1909,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return addDrugOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String
|
|
|
|
|
inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
|
//入库时添加入库批号
|
|
|
|
@ -1971,8 +1952,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity
|
|
|
|
|
bussinessTypeEntity, String unitFk) {
|
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
|
|
|
|
|
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
|
|
|
|
|
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
|
|
|
|
@ -2010,8 +1990,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
|
|
|
|
|
} else {
|
|
|
|
|
codeEnttity.setStatus(0);
|
|
|
|
|
if (codeEnttity.getRelId() == null)
|
|
|
|
|
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
if (codeEnttity.getRelId() == null) codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
@ -2042,16 +2021,14 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
|
|
|
|
|
} else {
|
|
|
|
|
codeEnttity.setStatus(0);
|
|
|
|
|
if (codeEnttity.getRelId() == null)
|
|
|
|
|
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
if (codeEnttity.getRelId() == null) codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验供应商唯一性
|
|
|
|
|
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity
|
|
|
|
|
codeEnttity, String unitFk) {
|
|
|
|
|
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeEnttity, String unitFk) {
|
|
|
|
|
|
|
|
|
|
if ((bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT) || bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN)))
|
|
|
|
|
return null;
|
|
|
|
@ -2098,31 +2075,30 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
public List<IoCodeTempEntity> isExitLocalList(String code, List<IoCodeTempEntity> codeEnttityList) {
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = codeEnttityList.stream()
|
|
|
|
|
.filter(item -> {
|
|
|
|
|
if (item.getCode().equals(code)) {
|
|
|
|
|
if (StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = codeEnttityList.stream().filter(item -> {
|
|
|
|
|
if (item.getCode().equals(code)) {
|
|
|
|
|
if (StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}).sorted(Comparator.comparing(IoCodeTempEntity::getInBatchNo)).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}).sorted(Comparator.comparing(IoCodeTempEntity::getInBatchNo)).collect(Collectors.toList());
|
|
|
|
|
Collections.reverse(codeTempEntities);
|
|
|
|
|
return codeTempEntities;
|
|
|
|
|
}
|
|
|
|
@ -2201,8 +2177,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(codeTempEntity.getAction());
|
|
|
|
|
BaseResponse baseResponse = checkSupId(bussinessTypeEntity, codeTempEntity, codeTempEntity.getSupId());
|
|
|
|
|
if (baseResponse != null)
|
|
|
|
|
return baseResponse;
|
|
|
|
|
if (baseResponse != null) return baseResponse;
|
|
|
|
|
|
|
|
|
|
codeTempEntity.setRelId(codeSaveRequest.getRelId());
|
|
|
|
|
int reCount = udiCalCountUtil.getActCount(codeTempEntity);
|
|
|
|
@ -2215,8 +2190,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeTempEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(codeTempEntity);
|
|
|
|
|
} else codeTempService.updateById(codeTempEntity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.updateById(codeTempEntity);
|
|
|
|
|
}
|
|
|
|
@ -2254,8 +2228,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
@PostMapping("warehouse/inout/saveTempCode")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse saveCode(@RequestBody IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
if (codeTempEntity.getCount() == null)
|
|
|
|
|
codeTempEntity.setCount(1);
|
|
|
|
|
if (codeTempEntity.getCount() == null) codeTempEntity.setCount(1);
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo()) && codeTempEntity.getSerialNo().length() > 20) {
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!序列号超出最大范围");
|
|
|
|
@ -2326,8 +2299,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
int b = codeTempService.updateById(codeTempEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (b > 0)
|
|
|
|
|
return ResultVOUtils.success("修改成功");
|
|
|
|
|
if (b > 0) return ResultVOUtils.success("修改成功");
|
|
|
|
|
else return ResultVOUtils.error(500, "修改失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2363,8 +2335,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
code = code.replace("\u001D", "");
|
|
|
|
|
}
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
if (udiEntity == null)
|
|
|
|
|
return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
if (udiEntity == null) return ResultVOUtils.error(500, "无效条码!");
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
@ -2415,8 +2386,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
} else return checkOriginCodeRes;
|
|
|
|
|
} else {
|
|
|
|
|
udiEntity.setBatchNo(codeLostEntity.getBatchNo());
|
|
|
|
|
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
|
|
|
|
@ -2428,8 +2398,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (ioCodeEnttity == null) {
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
return checkOriginCodeRes;
|
|
|
|
|
} else return checkOriginCodeRes;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BaseResponse checkOriginCodeRes = checkOriginCode(udiEntity);
|
|
|
|
@ -2616,14 +2585,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(genDetaiEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
}
|
|
|
|
@ -2693,10 +2660,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (udiRelevanceResponses.size() == 0) {
|
|
|
|
|
if (unitFk == null)
|
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
else
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
if (unitFk == null) return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
|
else return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
@ -2752,8 +2717,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
|
if (baseResponse == null) {
|
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
|
if (baseResponse != null)
|
|
|
|
|
return baseResponse;
|
|
|
|
|
if (baseResponse != null) return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
if (baseResponse.getCode() == 501) {
|
|
|
|
|
return baseResponse;
|
|
|
|
@ -2790,14 +2754,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
|
} else if (bussinessTypeEntity.getCheckWebNew() == 2 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkNoPiCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
}
|
|
|
|
@ -2811,13 +2773,11 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
/**
|
|
|
|
|
* @param purType 1:入账库;2:预验收库;3:寄售库
|
|
|
|
|
*/
|
|
|
|
|
public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse
|
|
|
|
|
udiRelevanceEntity, Integer purType) {
|
|
|
|
|
public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceEntity, Integer purType) {
|
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
|
if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
} else return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -2829,8 +2789,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
|
if (udiRelevanceService.findPurType(relId) == IntUtil.value(purType)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
} else return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -2897,8 +2856,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddCodeResult addCodeResult = new AddCodeResult();
|
|
|
|
|
if (CollUtil.isEmpty(codeOnelist))
|
|
|
|
|
return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
if (CollUtil.isEmpty(codeOnelist)) return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
List<VailCodeResultResponse> vailCodeResultResponses = new ArrayList<>();
|
|
|
|
|
Integer groupNumber = getMaxGroupNumber() == null ? 1 : getMaxGroupNumber() + 1;
|
|
|
|
|
for (String code : codeOnelist) {
|
|
|
|
@ -2952,9 +2910,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// IoCollectOrderBackup byBillNo = ioCollectOrderBackupService.getByBillNo(orderFinishBillNo);
|
|
|
|
|
IoCollectOrderCodeMan one = collectOrderCodeManService.getOne(new LambdaQueryWrapper<IoCollectOrderCodeMan>()
|
|
|
|
|
.eq(IoCollectOrderCodeMan::getOrderIdFk, orderFinishBillNo)
|
|
|
|
|
.eq(IoCollectOrderCodeMan::getUdiCode, code));
|
|
|
|
|
IoCollectOrderCodeMan one = collectOrderCodeManService.getOne(new LambdaQueryWrapper<IoCollectOrderCodeMan>().eq(IoCollectOrderCodeMan::getOrderIdFk, orderFinishBillNo).eq(IoCollectOrderCodeMan::getUdiCode, code));
|
|
|
|
|
addOrderRequest.setScanActCount(one.getScanActCount());
|
|
|
|
|
baseResponse = addMaterOrder(addOrderRequest, udiEntity, code, groupNumber);
|
|
|
|
|
}
|
|
|
|
@ -2984,14 +2940,11 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
List<String> codeList = addEnterCodeRequest.getCodeList();
|
|
|
|
|
String orderId = addEnterCodeRequest.getOrderId();
|
|
|
|
|
IoOrderEntity order = orderService.findByBillNo(orderId);
|
|
|
|
|
if (order == null)
|
|
|
|
|
return ResultVOUtils.error(500, "单据不存在");
|
|
|
|
|
if (CollUtil.isEmpty(codeList))
|
|
|
|
|
return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
if (order == null) return ResultVOUtils.error(500, "单据不存在");
|
|
|
|
|
if (CollUtil.isEmpty(codeList)) return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
//器械的码 可能会是一样的
|
|
|
|
|
List<IoCodeTempEntity> ioCodeTempEntities = codeTempService.selectByCodes(codeList, orderId);
|
|
|
|
|
if (CollUtil.isEmpty(ioCodeTempEntities))
|
|
|
|
|
return ResultVOUtils.error(500, "当前追溯码不存在");
|
|
|
|
|
if (CollUtil.isEmpty(ioCodeTempEntities)) return ResultVOUtils.error(500, "当前追溯码不存在");
|
|
|
|
|
for (IoCodeTempEntity codeTempEntity : ioCodeTempEntities) {
|
|
|
|
|
codeTempService.removeCodeById(codeTempEntity);
|
|
|
|
|
}
|
|
|
|
@ -3039,8 +2992,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/udiwms/warehouse/inout/removeCodes")
|
|
|
|
|
public BaseResponse removeCodes(@RequestBody FilterCodeRequest filterCodeRequest,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
public BaseResponse removeCodes(@RequestBody FilterCodeRequest filterCodeRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
@ -3176,11 +3128,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
* @param codeEnttitys 码实体列表
|
|
|
|
|
* @return 是否处理成功
|
|
|
|
|
*/
|
|
|
|
|
private boolean handleCodeCheckAndUpdate(BasicBussinessTypeEntity bussinessTypeEntity,
|
|
|
|
|
IoCodeTempEntity genDetaiEntity,
|
|
|
|
|
IoCodeTempEntity exitLocalEntity,
|
|
|
|
|
String inBatch,
|
|
|
|
|
List<IoCodeTempEntity> codeEnttitys) {
|
|
|
|
|
private boolean handleCodeCheckAndUpdate(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity genDetaiEntity, IoCodeTempEntity exitLocalEntity, String inBatch, List<IoCodeTempEntity> codeEnttitys) {
|
|
|
|
|
try {
|
|
|
|
|
if (bussinessTypeEntity.getCheckWebNew() == 1 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
@ -3202,17 +3150,11 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
|
if (bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
//1.获取当前批次已出库数量
|
|
|
|
|
Integer outCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "",
|
|
|
|
|
exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(),
|
|
|
|
|
exitLocalEntity.getInvCode(), ConstantType.TYPE_OUT);
|
|
|
|
|
Integer outCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_OUT);
|
|
|
|
|
//2.获取当前批次入库数量
|
|
|
|
|
Integer inCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "",
|
|
|
|
|
exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(),
|
|
|
|
|
exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT);
|
|
|
|
|
Integer inCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT);
|
|
|
|
|
if ((IntUtil.value(inCount) - IntUtil.value(outCount) - IntUtil.value(exitLocalEntity.getReCount())) < 0) {
|
|
|
|
|
InvProductNewVo nextInvProduct = invProductServiceNew.selectNextInBatch(bussinessTypeEntity,
|
|
|
|
|
exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), exitLocalEntity.getInvCode(),
|
|
|
|
|
ConstantType.TYPE_PUT, exitLocalEntity.getInBatchNo());
|
|
|
|
|
InvProductNewVo nextInvProduct = invProductServiceNew.selectNextInBatch(bussinessTypeEntity, exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT, exitLocalEntity.getInBatchNo());
|
|
|
|
|
if (nextInvProduct != null) {
|
|
|
|
|
genDetaiEntity.setPrice(nextInvProduct.getPrice());
|
|
|
|
|
genDetaiEntity.setInBatchNo(nextInvProduct.getInBatchNo());
|
|
|
|
@ -3232,4 +3174,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|