|
|
|
@ -15,10 +15,7 @@ import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeTempEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.http.SpsDirectClient;
|
|
|
|
|
import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
|
|
|
|
@ -32,10 +29,7 @@ import com.glxp.api.res.basic.UdiRlSupResponse;
|
|
|
|
|
import com.glxp.api.res.inout.AddCodeResult;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
|
import com.glxp.api.service.inout.IoCodeTempService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailCodeService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.service.inout.IoAddInoutService;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
@ -84,6 +78,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
UdiRlSupService udiRlSupService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCheckInoutService ioCheckInoutService;
|
|
|
|
|
|
|
|
|
|
//手持端扫码单据上传调用接口
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@ -506,23 +502,38 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> codeEnttitys = codeTempService.findByOrderId(orderId);
|
|
|
|
|
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
|
|
|
|
|
IoCodeTempEntity exitLocalEntity = null;
|
|
|
|
|
IoCodeTempEntity genDetaiEntity = new IoCodeTempEntity();
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = null;
|
|
|
|
|
if (codeEnttitys.size() > 0) {
|
|
|
|
|
exitLocalEntity = isExitLocal(code, codeEnttitys);
|
|
|
|
|
if (exitLocalEntity != null) {
|
|
|
|
|
codeEnttity = exitLocalEntity;
|
|
|
|
|
codeEnttity.setCount(codeEnttity.getCount() + 1);
|
|
|
|
|
if (StringUtils.isBlank(codeEnttity.getSerialNo())) {
|
|
|
|
|
codeTempService.updateById(codeEnttity);
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode());
|
|
|
|
|
BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
|
|
|
|
|
genDetaiEntity.setCount(1);
|
|
|
|
|
genDetaiEntity.setReCount(udiCalCountUtil.getActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
|
|
|
|
|
exitLocalEntity.setCount(exitLocalEntity.getCount() + 1);
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getCount() * udiCalCountUtil.getActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
if (StringUtils.isBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
|
if (bussinessTypeEntity.isCheckEnable() && bussinessTypeEntity.isCheckWebNew()) {
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(exitLocalEntity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.updateById(exitLocalEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (exitLocalEntity == null) {
|
|
|
|
|
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
|
|
|
|
|
codeEnttity.setCode(code);
|
|
|
|
|
codeEnttity.setOrderId(orderId);
|
|
|
|
|
codeEnttity.setCorpOrderId(addOrderRequest.getCorpOrderId());
|
|
|
|
@ -543,12 +554,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
unitFk = addOrderRequest.getFromCorp();
|
|
|
|
|
}
|
|
|
|
|
//产品是否可以以使用单元入库
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.selectAllByNameCode(codeEnttity.getNameCode(), unitFk);
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(codeEnttity.getNameCode());
|
|
|
|
|
if (udiRelevanceResponses.size() == 1) {
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
|
|
|
|
|
if (udiRelevanceResponse == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "该产品信息未维护!");
|
|
|
|
|
} else if (!udiRelevanceResponse.getIsUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
} else if (!udiRelevanceResponse.getUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
return ResultVOUtils.error(500, "该产品不允许以使用单元入库!");
|
|
|
|
|
}
|
|
|
|
|
//计算实际数量
|
|
|
|
@ -560,14 +571,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
|
BaseResponse corpResponse = checkCorp(codeEnttity, bussinessTypeEntity, unitFk);
|
|
|
|
|
if (corpResponse != null) {
|
|
|
|
|
return corpResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IoOrderEntity isExit = orderService.findByBillNo(orderId);
|
|
|
|
|
if (isExit == null) {
|
|
|
|
|
orderEntity = new IoOrderEntity();
|
|
|
|
@ -591,8 +600,18 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
|
|
|
|
|
codeEnttity = codeTempService.findByUnique(codeEnttity.getOrderId(), codeEnttity.getCode());
|
|
|
|
|
if (bussinessTypeEntity.isCheckEnable() && bussinessTypeEntity.isCheckWebNew()){
|
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
|
if (errMsg != null) {
|
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
|
} else
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
}
|
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
|
if (baseResponse == null) {
|
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
|
if (baseResponse != null)
|
|
|
|
@ -608,7 +627,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addCodeResult.setOrderId(orderId);
|
|
|
|
|
transInoutService.genOrderDetailCode(orderEntity, codeEnttity);
|
|
|
|
|
transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity);
|
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -673,7 +692,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
codeEnttity.setStatus(0);
|
|
|
|
|
if (codeEnttity.getRelId() == null)
|
|
|
|
|
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
@ -776,28 +794,24 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新扫码详情
|
|
|
|
|
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = ioOrderDetailCodeService.findByOrderId(codeTempEntity.getOrderId());
|
|
|
|
|
if (CollUtil.isNotEmpty(orderDetailCodeEntities)) {
|
|
|
|
|
for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) {
|
|
|
|
|
if (orderDetailCodeEntity.getBindRlFk() == codeTempEntity.getRelId() && StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()).equals(codeTempEntity.getBatchNo())) {
|
|
|
|
|
//扫码数量-1
|
|
|
|
|
int orderCount = orderDetailCodeEntity.getCount();
|
|
|
|
|
int orderReCount = orderDetailCodeEntity.getReCount();
|
|
|
|
|
if (orderCount > 1) {
|
|
|
|
|
orderDetailCodeEntity.setCount(orderCount - codeTempEntity.getCount());
|
|
|
|
|
orderDetailCodeEntity.setCount(orderReCount - codeTempEntity.getReCount());
|
|
|
|
|
ioOrderDetailCodeService.update(orderDetailCodeEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ioOrderDetailCodeService.deleteById(orderDetailCodeEntity.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
IoOrderDetailCodeEntity orderDetailCodeEntity = ioOrderDetailCodeService.findByUnique(orderEntity.getBillNo(), codeTempEntity.getRelId(), codeTempEntity.getBatchNo());
|
|
|
|
|
if (orderDetailCodeEntity != null) {
|
|
|
|
|
//扫码数量-1
|
|
|
|
|
int orderCount = orderDetailCodeEntity.getCount();
|
|
|
|
|
int orderReCount = orderDetailCodeEntity.getReCount();
|
|
|
|
|
if (orderCount > 1) {
|
|
|
|
|
orderDetailCodeEntity.setCount(orderCount - codeTempEntity.getCount());
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderReCount - codeTempEntity.getReCount());
|
|
|
|
|
ioOrderDetailCodeService.update(orderDetailCodeEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ioOrderDetailCodeService.deleteById(orderDetailCodeEntity.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
orderEntity.setUpdateUser(getUserId() + "");
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
orderService.update(orderEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
return ResultVOUtils.success("删除成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|