refactor(入库任务): 执行入库任务 计算寿命优化

This commit is contained in:
LJW 2024-11-13 15:00:26 +08:00
parent f9d750c814
commit a2b894ecd6

View File

@ -130,32 +130,23 @@ public class WmsInTaskController extends BaseController {
wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId());
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
// 入库类型为整刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
// 入库类型为整刀回库 拆刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9") || Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 计算消耗寿命
int consumeLife = baseKnife.getKnifeLife() - planDetailEntity.getConsumeLife();
int consumeLife = baseKnife.getKnifeLife() - (planDetailEntity.getConsumeLife() % 100);
baseKnife.setKnifeLife(consumeLife);
// 计算重置次数
int resetCount = baseKnife.getResetCount() - (planDetailEntity.getConsumeLife() / 100);
baseKnife.setResetCount(resetCount);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
// 入库类型为拆刀回库
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 计算消耗寿命
int consumeLife = baseKnife.getKnifeLife() - planDetailEntity.getConsumeLife();
baseKnife.setKnifeLife(consumeLife);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
baseKnife.setRfid(planDetailEntity.getRfid());
if (!planDetailEntity.getRfid().isEmpty()) {
baseKnife.setRfid(planDetailEntity.getRfid());
}
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
@ -176,7 +167,9 @@ public class WmsInTaskController extends BaseController {
// 设置台账状态 入库
baseKnife.setKnifeFineState(1);
// 设置RFID
baseKnife.setRfid(planDetailEntity.getRfid());
if (!planDetailEntity.getRfid().isEmpty()) {
baseKnife.setRfid(planDetailEntity.getRfid());
}
baseKnife.setPlanSheet("");
baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());
baseKnife.setItemOrProduct(mbbBdMrlMitm.getItemOrProduct());