|
|
|
@ -27,9 +27,11 @@ import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.collect.CollectOrderCodeManRequest;
|
|
|
|
|
import com.glxp.api.req.collect.IoCollectCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inout.AddTagCodeReqeust;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.res.collect.CollectOrderCodeManResponse;
|
|
|
|
|
import com.glxp.api.res.collect.IoCollectCodeResponse;
|
|
|
|
|
import com.glxp.api.res.collect.RelCodeDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inout.AddEnterCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inout.VailCodeResultResponse;
|
|
|
|
@ -95,7 +97,7 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
|
|
|
|
|
IoSplitCodeService splitCodeService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
IoCollectCodeBackService ioCollectCodeBackService;
|
|
|
|
|
private IoCollectCodeBackService ioCollectCodeBackService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
@ -190,6 +192,22 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果是处方退药的码 要去校验是 否是 原始单据处方已完成的码
|
|
|
|
|
if (addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
|
|
|
|
|
collectOrder = collectOrderService.getByBillNo(addTagCodeReqeust.getBillNo());
|
|
|
|
|
IoCollectCodeRequest ioCollectCodeRequest = new IoCollectCodeRequest();
|
|
|
|
|
ioCollectCodeRequest.setBillNo(collectOrder.getRemark());
|
|
|
|
|
ioCollectCodeRequest.setCode(code);
|
|
|
|
|
List<IoCollectCodeResponse> ioCollectCodeResponses = ioCollectCodeBackService.filterList(ioCollectCodeRequest);
|
|
|
|
|
if (ioCollectCodeResponses.size() == 0){
|
|
|
|
|
throw new JsonException(500, "当前追溯码非原始处方追溯码");
|
|
|
|
|
}
|
|
|
|
|
IoCollectCodeResponse ioCollectCodeResponse = ioCollectCodeResponses.get(0);
|
|
|
|
|
if (!ioCollectCodeResponse.getCode().equals(code)){
|
|
|
|
|
throw new JsonException(500, "当前追溯码非原始处方追溯码");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2-1.校验预验收库存是否已存在
|
|
|
|
|
String preInBillNo = addTagCodeReqeust.getPreInBillNo();
|
|
|
|
|
String orderId = addTagCodeReqeust.getBillNo();
|
|
|
|
@ -420,14 +438,17 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
|
|
|
|
|
throw new JsonException(500, "当前追溯码已被其他单据关联!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (splitCodeEntity != null && StrUtil.isNotEmpty(splitCodeEntity.getSerialNo())) {
|
|
|
|
|
if (IntUtil.value(splitCodeEntity.getRemainCount()) < 1) {
|
|
|
|
|
throw new JsonException(500, "当前追溯码已被拆零!");
|
|
|
|
|
} else {
|
|
|
|
|
circleCount = splitCodeEntity.getRemainCount();
|
|
|
|
|
useCount = splitCodeEntity.getRemainCount();
|
|
|
|
|
if (!addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
|
|
|
|
|
if (splitCodeEntity != null && StrUtil.isNotEmpty(splitCodeEntity.getSerialNo())) {
|
|
|
|
|
if (IntUtil.value(splitCodeEntity.getRemainCount()) < 1) {
|
|
|
|
|
throw new JsonException(500, "当前追溯码已被拆零!");
|
|
|
|
|
} else {
|
|
|
|
|
circleCount = splitCodeEntity.getRemainCount();
|
|
|
|
|
useCount = splitCodeEntity.getRemainCount();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(collectOrder.getOrderCirType()) == 1) {
|
|
|
|
|
scanCount = circleCount;
|
|
|
|
|
} else {
|
|
|
|
@ -469,25 +490,27 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
|
|
|
|
|
int count1 = IntUtil.value(collectOrderBiz.getScanCount()) + 1;
|
|
|
|
|
int actCount1 = 0;
|
|
|
|
|
actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + scanCount;
|
|
|
|
|
if (actCount1 > IntUtil.value(collectOrderBiz.getCount())) {
|
|
|
|
|
int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount());
|
|
|
|
|
if (needCount > 0) {
|
|
|
|
|
if (vailInSplit(collectOrderBiz, putWorkPlaceCode, needCount)) {
|
|
|
|
|
throw new JsonException(502, collectOrderBiz.getCpmctymc() + "拆零数量还有剩余,是否继续添加?");
|
|
|
|
|
}
|
|
|
|
|
int myUseCount = calCountUtil.getUseActCount(udiRelevanceResponse);
|
|
|
|
|
if (needCount > myUseCount) {
|
|
|
|
|
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
|
|
|
|
|
} else {
|
|
|
|
|
collectOrderBiz.setSplitUnCheck(true);
|
|
|
|
|
if (IntUtil.value(collectSet.getLastCodeSplit())) {
|
|
|
|
|
throw new JsonException(503, collectOrderBiz.getId() + ";" + count1 + ";" + collectOrderBiz.getCpmctymc() + ";" + "扫码数量超出!");
|
|
|
|
|
if (!addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
|
|
|
|
|
if (actCount1 > IntUtil.value(collectOrderBiz.getCount())) {
|
|
|
|
|
int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount());
|
|
|
|
|
if (needCount > 0) {
|
|
|
|
|
if (vailInSplit(collectOrderBiz, putWorkPlaceCode, needCount)) {
|
|
|
|
|
throw new JsonException(502, collectOrderBiz.getCpmctymc() + "拆零数量还有剩余,是否继续添加?");
|
|
|
|
|
}
|
|
|
|
|
int myUseCount = calCountUtil.getUseActCount(udiRelevanceResponse);
|
|
|
|
|
if (needCount > myUseCount) {
|
|
|
|
|
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
|
|
|
|
|
} else {
|
|
|
|
|
collectOrderBiz.setSplitUnCheck(true);
|
|
|
|
|
if (IntUtil.value(collectSet.getLastCodeSplit())) {
|
|
|
|
|
throw new JsonException(503, collectOrderBiz.getId() + ";" + count1 + ";" + collectOrderBiz.getCpmctymc() + ";" + "扫码数量超出!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
collectOrderBiz.setAddScanCount(1);
|
|
|
|
|
collectOrderBiz.setAddScanActCount(scanCount);
|
|
|
|
|