数据类型优化

This commit is contained in:
Stang 2024-11-05 16:07:36 +08:00
parent fe1aa26549
commit 70f4f0bb27
4 changed files with 24 additions and 22 deletions

View File

@ -95,8 +95,8 @@ public class BaseKnifeController extends BaseController
map.put("mbbMrlClass", item.getKnifeType());
map.put("wmsAreaCode", item.getAreaCode());
map.put("knifeLife", "100");
map.put("knifeLifeUser", item.getKnifeLife() == null ? null : String.valueOf(100 - Integer.parseInt(item.getKnifeLife())));
map.put("knifeLifeLeave", item.getKnifeLife() == null ? null : item.getKnifeLife());
map.put("knifeLifeUser", item.getKnifeLife() == 0 ? null : String.valueOf(100 - item.getKnifeLife()));
map.put("knifeLifeLeave", item.getKnifeLife() == 0 ? null : String.valueOf(item.getKnifeLife()));
map.put("isLocked", item.getIsLocked().toString());
map.put("lockedStartTime", item.getLockedStartTime() == null ? null : item.getLockedStartTime().toString());
map.put("lockedEndTime",item.getLockedEndTime() == null ? null : item.getLockedEndTime().toString());
@ -126,9 +126,11 @@ public class BaseKnifeController extends BaseController
@PostMapping("/open/checkForAlignment")
@ResponseBody
public AjaxResult checkForAlignment(@RequestBody String json) {
// 检查请求json是否正确
List<BaseTechnologyBom> technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
// 记录请求数据
technologyBomList.forEach(baseTechnologyBom -> baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom));
// 构建日志
@ -164,10 +166,11 @@ public class BaseKnifeController extends BaseController
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
}
// 查询台账数据
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount());
// 如果台账表中不存在尝试组刀任务查询
@ -191,7 +194,7 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
if (sitmTempList.isEmpty()){
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
@ -229,7 +232,7 @@ public class BaseKnifeController extends BaseController
} else {
// 将物料填入集合
tempList.forEach(item -> {
if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) {
if (knifeCount.get() > 0 && tempList.size() > countMap.get(item.getKnifeCode())) {
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
}
@ -245,7 +248,6 @@ public class BaseKnifeController extends BaseController
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
}
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
@ -255,7 +257,7 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
if (sitmTempList.isEmpty()){
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
@ -346,7 +348,7 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount());
// 如果台账表中不存在尝试组刀任务查询
@ -371,7 +373,7 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
if (sitmTempList.isEmpty()){
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
@ -409,7 +411,7 @@ public class BaseKnifeController extends BaseController
} else {
// 将物料填入集合
tempList.forEach(item -> {
if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) {
if (knifeCount.get() > 0 && tempList.size() > countMap.get(item.getKnifeCode())) {
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
}
@ -435,7 +437,7 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
if (sitmTempList.isEmpty()){
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
@ -487,9 +489,9 @@ public class BaseKnifeController extends BaseController
baseKnifeWrapper.setMbbBdMrlId(mdItem.getItemId());
baseKnifeWrapper.setIsLocked(0);
baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.removeIf(wmsBaseKnife -> Integer.parseInt(wmsBaseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
baseKnifeList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
for (BaseKnife wmsBaseKnife : baseKnifeList){
if (Integer.parseInt(wmsBaseKnife.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && count > 0){
if (wmsBaseKnife.getKnifeLife() >= techBom.getExpendLife() && count > 0){
count--;
}
}
@ -577,7 +579,7 @@ public class BaseKnifeController extends BaseController
baseKnife.setAreaCode(zdTask.getAttr3());
baseKnife.setSafeStock(mdItem.getMinStock().toString().split("\\.")[0]);
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife("100");
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(0);
baseKnife.setIsLocked(0);
baseKnife.setPlanSheet("");
@ -674,7 +676,7 @@ public class BaseKnifeController extends BaseController
wmsInPlan.setCellCode(zdTask.getAttr3());
wmsInPlan.setPlanCode(zdTask.getCode() + random.nextInt(100));
wmsInPlan.setRelBillCode("组装单据");
wmsInPlan.setPlanTypeId("7");
wmsInPlan.setPlanTypeId("13");
wmsInPlan.setCreateBy(getUsername());
wmsInPlan.setCreateTime(DateUtils.getNowDate());

View File

@ -80,7 +80,7 @@ public class BaseKnife extends BaseEntity {
* 工具寿命
*/
@Excel(name = "工具寿命")
private String knifeLife;
private Integer knifeLife;
/**
* 工具状态
@ -294,11 +294,11 @@ public class BaseKnife extends BaseEntity {
this.areaCode = areaCode;
}
public String getKnifeLife() {
public Integer getKnifeLife() {
return knifeLife;
}
public void setKnifeLife(String knifeLife) {
public void setKnifeLife(Integer knifeLife) {
this.knifeLife = knifeLife;
}

View File

@ -46,7 +46,7 @@ public class BaseTechnologyBom extends BaseEntity
/** 消耗定额 */
@Excel(name = "消耗定额")
private String expendLife;
private Integer expendLife;
/** 锁定开始时间 */
@Excel(name = "锁定开始时间")
@ -135,12 +135,12 @@ public class BaseTechnologyBom extends BaseEntity
{
return knifeCount;
}
public void setExpendLife(String expendLife)
public void setExpendLife(Integer expendLife)
{
this.expendLife = expendLife;
}
public String getExpendLife()
public Integer getExpendLife()
{
return expendLife;
}

View File

@ -149,7 +149,7 @@ public class WmsInTaskController extends BaseController {
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock().toString().split("\\.")[0]);
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife("100");
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(0);
baseKnife.setPlanSheet("");
baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());