|
|
|
@ -3,6 +3,8 @@ package com.gaotao.modules.production.service.impl; |
|
|
|
import com.gaotao.common.exception.XJException; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.IssueShopOrderDto; |
|
|
|
import com.gaotao.modules.api.service.IfsApiIssueAndReturnService; |
|
|
|
import com.gaotao.modules.handlingunit.entity.HandlingUnit; |
|
|
|
import com.gaotao.modules.handlingunit.service.HandlingUnitService; |
|
|
|
import com.gaotao.modules.production.entity.dto.AutoIssueFailureDto; |
|
|
|
import com.gaotao.modules.production.entity.dto.AutoIssueHandlingUnitDto; |
|
|
|
import com.gaotao.modules.production.entity.dto.AutoIssueRequestDto; |
|
|
|
@ -14,6 +16,7 @@ import org.apache.commons.lang.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@ -25,6 +28,9 @@ public class AutoIssueServiceImpl implements AutoIssueService { |
|
|
|
@Autowired |
|
|
|
private IfsApiIssueAndReturnService ifsApiIssueAndReturnService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HandlingUnitService handlingUnitService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public AutoIssueResultDto autoIssue(AutoIssueRequestDto requestDto) { |
|
|
|
AutoIssueResultDto resultDto = new AutoIssueResultDto(); |
|
|
|
@ -40,6 +46,7 @@ public class AutoIssueServiceImpl implements AutoIssueService { |
|
|
|
try { |
|
|
|
validateHandlingUnit(handlingUnit); |
|
|
|
ifsApiIssueAndReturnService.addShopOrderManualIssue(buildIssueDto(shopOrder, handlingUnit)); |
|
|
|
markHandlingUnitIssued(shopOrder.getSite(), getLabelCode(handlingUnit)); |
|
|
|
resultDto.setSuccessCount(resultDto.getSuccessCount() + 1); |
|
|
|
} catch (Exception e) { |
|
|
|
resultDto.setFailCount(resultDto.getFailCount() + 1); |
|
|
|
@ -135,6 +142,18 @@ public class AutoIssueServiceImpl implements AutoIssueService { |
|
|
|
return StringUtils.isBlank(value) ? defaultValue : value; |
|
|
|
} |
|
|
|
|
|
|
|
private void markHandlingUnitIssued(String site, String unitId) { |
|
|
|
boolean updated = handlingUnitService.lambdaUpdate() |
|
|
|
.set(HandlingUnit::getInStockFlag, "N") |
|
|
|
.set(HandlingUnit::getModifiedDate, new Date()) |
|
|
|
.eq(HandlingUnit::getSite, site) |
|
|
|
.eq(HandlingUnit::getUnitId, unitId) |
|
|
|
.update(); |
|
|
|
if (!updated) { |
|
|
|
throw new XJException("IFS发料成功但更新handling_unit.in_stock_flag失败, site=" + site + ", unitId=" + unitId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void sleepAfterIfsCall() { |
|
|
|
try { |
|
|
|
Thread.sleep(IFS_CALL_INTERVAL_MS); |
|
|
|
|