|
|
|
@ -22,9 +22,9 @@ import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreInProductDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreProductDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvPreinDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.http.sync.SpsDirectClient;
|
|
|
|
|
import com.glxp.api.req.basic.CompanyProductRelevanceRequest;
|
|
|
|
|
import com.glxp.api.req.inout.AddEnterCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inout.AddOrderRequest;
|
|
|
|
@ -38,9 +38,7 @@ import com.glxp.api.res.inout.IoCodeTempResponse;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.*;
|
|
|
|
|
import com.glxp.api.service.purchase.SupProductService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
@ -70,8 +68,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
@Resource
|
|
|
|
|
private IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SpsDirectClient spsDirectClient;
|
|
|
|
|
@Resource
|
|
|
|
|
IoAddInoutService transInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemParamConfigService systemParamConfigService;
|
|
|
|
@ -101,6 +97,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
IoOrderDetailBizService orderDetailBizService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeService codeService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreProductDetailService invPreProductDetailService;
|
|
|
|
|
|
|
|
|
|
//手持端扫码单据上传调用接口
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@ -136,10 +134,6 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
inPostOrder.setPostOrders(inPostOrders);
|
|
|
|
|
outPostOrder.setPostOrders(outPostOrders);
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(outPostOrders)) {
|
|
|
|
|
outPostOrder.setWmsUserId(userId + "");
|
|
|
|
|
return spsDirectClient.uploadPdaOrder(outPostOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(inPostOrders)) {
|
|
|
|
|
inPostOrder.setCustomerId(getCustomerId());
|
|
|
|
@ -438,9 +432,13 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//失效期提醒
|
|
|
|
|
SystemParamConfigEntity recentParamConfigEntity = systemParamConfigService.selectByParamKey("recent_date_tip");
|
|
|
|
|
long recent = Long.parseLong(recentParamConfigEntity.getParamValue());
|
|
|
|
|
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
|
|
|
|
|
//近效期提醒
|
|
|
|
|
// SystemParamConfigEntity recentParamConfigEntity = systemParamConfigService.selectByParamKey("recent_date_tip");
|
|
|
|
|
long recent = 0;
|
|
|
|
|
if (udiRelevanceResponse.getRecentDateTime() != null)
|
|
|
|
|
recent = udiRelevanceResponse.getRecentDateTime().longValue();
|
|
|
|
|
if (bussinessTypeEntity.getCheckVailDate() == 1 && recent > 0 && !addOrderRequest.isIgnoreRecentExpire()) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
@ -457,6 +455,22 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCheckVailDate() == 2 && recent > 0) {
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
|
|
|
|
|
String expireDate = "20" + udiEntity.getExpireDate();
|
|
|
|
|
long expireTime = DateUtil.parseDateExpire(expireDate);
|
|
|
|
|
long recentTieme = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
if (resultTime > 0) {
|
|
|
|
|
long time = resultTime / (24 * 60 * 60 * 1000);
|
|
|
|
|
if (resultTime < recentTieme) {
|
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,无法添加?");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验预验收是否已存在
|
|
|
|
|
if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
@ -530,6 +544,34 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 是否检验寄售库存
|
|
|
|
|
if (bussinessTypeEntity.isAdvancePreIn()) {
|
|
|
|
|
int preInCount = invPreProductDetailService.findCountByCode(code);
|
|
|
|
|
InvPreProductDetailEntity invPreinDetailEntity = invPreProductDetailService.findUseOneByCode(code);
|
|
|
|
|
if (preInCount <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "寄售库存数量不足!");
|
|
|
|
|
} else {
|
|
|
|
|
if (StrUtil.isNotEmpty(invPreinDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(addOrderRequest.getBatchNo())
|
|
|
|
|
&& !invPreinDetailEntity.getBatchNo().equals(addOrderRequest.getBatchNo())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!");
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {//非首次添加
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
//无序列号,则可能存在多个预验收入库单
|
|
|
|
|
IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
|
|
|
|
|
if (codeTempEntity != null) {
|
|
|
|
|
if (preInCount < (codeTempEntity.getMyCount() + 1)) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出寄售存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (preInCount < 1) {
|
|
|
|
|
return ResultVOUtils.error(500, "寄售库存数量不足");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addOrderRequest.getFromCorp() == null) {
|
|
|
|
@ -618,7 +660,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
//产品是否可以以使用单元入库
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(codeEnttity.getNameCode(), false);
|
|
|
|
|
if (udiRelevanceResponses.size() >= 1) {
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
|
|
|
|
|
// UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
|
|
|
|
|
if (udiRelevanceResponse == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "该产品信息未维护!");
|
|
|
|
|
} else if (!udiRelevanceResponse.getUseDy() && udiRelevanceResponse.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
@ -977,6 +1019,9 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
public BaseResponse deleteCodesTempById(@RequestParam("id") Integer id) {
|
|
|
|
|
|
|
|
|
|
IoCodeTempEntity codeTempEntity = codeTempService.selectById(id);
|
|
|
|
|
if (codeTempEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(506, "UDI码异常,未录入!");
|
|
|
|
|
}
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(codeTempEntity.getOrderId());
|
|
|
|
|
if (codeTempEntity.getMyCount() > 1) {
|
|
|
|
|
codeTempEntity.setCount(codeTempEntity.getMyCount() - 1);
|
|
|
|
@ -1002,8 +1047,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean r1 = orderDetailBizService.isExit(orderDetailCodeEntity.getOrderIdFk());
|
|
|
|
|
boolean r2 = ioOrderDetailCodeService.isExit(orderDetailCodeEntity.getOrderIdFk());
|
|
|
|
|
boolean r1 = orderDetailBizService.isExit(orderEntity.getBillNo());
|
|
|
|
|
boolean r2 = ioOrderDetailCodeService.isExit(orderEntity.getBillNo());
|
|
|
|
|
if (!r1 && !r2) {
|
|
|
|
|
orderService.deleteByBillNo(orderDetailCodeEntity.getOrderIdFk());
|
|
|
|
|
}
|
|
|
|
|