refactor(入库任务): 入库任务逻辑修改

This commit is contained in:
LJW 2024-11-21 09:06:10 +08:00
parent 9fb82adabd
commit 2d7e887629

View File

@ -5,6 +5,7 @@ import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.StringUtils;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
/**
* 入库任务Controller
@ -130,8 +133,8 @@ public class WmsInTaskController extends BaseController {
wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId());
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
// 入库类型为整刀回库 拆刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9") || Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
// 入库类型为整刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 计算消耗寿命
@ -144,12 +147,29 @@ public class WmsInTaskController extends BaseController {
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
if (!planDetailEntity.getRfid().isEmpty()) {
if (StringUtils.isNotEmpty(planDetailEntity.getRfid())) {
baseKnife.setRfid(planDetailEntity.getRfid());
}
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
// 拆刀回库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 设置工具状态 已拆刀
baseKnife.setKnifeFineState(4);
// 更新整刀台账状态
baseKnifeService.updateBaseKnife(baseKnife);
// 查询刀柄
Optional<BaseKnife> bladeOpt = baseKnife.getBaseKnifeList().stream().filter(item -> item.getItemOrProduct().equals("ITEM")).findFirst();
if (bladeOpt.isPresent()) {
// 设置状态为 解锁
bladeOpt.get().setIsLocked(0);
bladeOpt.get().setKnifeFineState(1);
baseKnifeService.updateBaseKnife(bladeOpt.get());
}
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "7")) {
// 入库类型为刀柄入库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {