refactor(入库任务): 执行任务代码优化
This commit is contained in:
parent
37067b913d
commit
db60f86dcd
@ -11,8 +11,10 @@ import com.ktg.mes.md.domain.MdItem;
|
||||
import com.ktg.mes.md.service.IBaseKnifeService;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
||||
import com.ktg.mes.wm.domain.WmsInTask;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -33,15 +35,14 @@ import java.util.Objects;
|
||||
public class WmsInTaskController extends BaseController {
|
||||
@Autowired
|
||||
private IWmsInTaskService wmsInTaskService;
|
||||
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
|
||||
@Autowired
|
||||
private IBaseKnifeService baseKnifeService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
@Autowired
|
||||
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
|
||||
|
||||
/**
|
||||
* 查询入库任务列表
|
||||
@ -124,13 +125,66 @@ public class WmsInTaskController extends BaseController {
|
||||
MdItem mbbBdMrlMitm = mdItemService.selectMdItemByCode(wmsInTask.getMaterialCode());
|
||||
// 获取库位信息
|
||||
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInTask.getCellTgt());
|
||||
// 根据入库计划明细ID查询 实体信息
|
||||
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
|
||||
wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId());
|
||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
|
||||
|
||||
// 入库类型为整刀回库
|
||||
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
|
||||
// baseKnifeService.selectBaseKnifeByBaseKnifeId()
|
||||
} else {
|
||||
// 修改物料标准数量
|
||||
mbbBdMrlMitm.setStandardNumber(mbbBdMrlMitm.getStandardNumber() + 1);
|
||||
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
|
||||
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
|
||||
// 计算消耗寿命
|
||||
int consumeLife = baseKnife.getKnifeLife() - planDetailEntity.getConsumeLife();
|
||||
baseKnife.setKnifeLife(consumeLife);
|
||||
// 设置状态为 解锁
|
||||
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());
|
||||
// 更新台账状态
|
||||
baseKnifeService.updateBaseKnife(baseKnife);
|
||||
});
|
||||
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "7")) {
|
||||
// 入库类型为刀柄入库
|
||||
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
|
||||
// 生成台账
|
||||
BaseKnife baseKnife = new BaseKnife();
|
||||
baseKnife.setMbbBdMrlId(mbbBdMrlMitm.getItemId());
|
||||
baseKnife.setKnifeCode(mbbBdMrlMitm.getItemCode());
|
||||
baseKnife.setKnifeName(mbbBdMrlMitm.getItemName());
|
||||
baseKnife.setKnifeUnit(mbbBdMrlMitm.getUnitName());
|
||||
baseKnife.setKnifeType(mbbBdMrlMitm.getItemTypeName());
|
||||
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
|
||||
baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock());
|
||||
baseKnife.setStandardQuantity("1");
|
||||
baseKnife.setKnifeLife(100);
|
||||
// 设置台账状态 入库
|
||||
baseKnife.setKnifeFineState(0);
|
||||
// 设置RFID
|
||||
baseKnife.setRfid(planDetailEntity.getRfid());
|
||||
baseKnife.setPlanSheet("");
|
||||
baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());
|
||||
baseKnife.setItemOrProduct(mbbBdMrlMitm.getItemOrProduct());
|
||||
|
||||
baseKnifeService.insertBaseKnife(baseKnife);
|
||||
});
|
||||
mdItemService.updateMdItem(mbbBdMrlMitm);
|
||||
} else {
|
||||
for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) {
|
||||
// 生成台账
|
||||
BaseKnife baseKnife = new BaseKnife();
|
||||
@ -143,6 +197,7 @@ public class WmsInTaskController extends BaseController {
|
||||
baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock());
|
||||
baseKnife.setStandardQuantity("1");
|
||||
baseKnife.setKnifeLife(100);
|
||||
// 设置台账状态 入库
|
||||
baseKnife.setKnifeFineState(0);
|
||||
baseKnife.setPlanSheet("");
|
||||
baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());
|
||||
@ -150,6 +205,7 @@ public class WmsInTaskController extends BaseController {
|
||||
|
||||
baseKnifeService.insertBaseKnife(baseKnife);
|
||||
}
|
||||
mdItemService.updateMdItem(mbbBdMrlMitm);
|
||||
}
|
||||
});
|
||||
return toAjax(1);
|
||||
|
Loading…
Reference in New Issue
Block a user