Merge remote-tracking branch 'origin/master'

This commit is contained in:
Kelvin 2024-11-01 10:47:50 +08:00
commit cfb6386a10
9 changed files with 518 additions and 125 deletions

View File

@ -13,7 +13,8 @@ import com.ktg.mes.md.domain.MbbProduBom;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.service.IBomRouteService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.BaseTechnologyBom;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import org.codehaus.jackson.map.Serializers;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -66,7 +67,7 @@ public class BaseKnifeController extends BaseController
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("isLocked", item.getIsLocked());
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());
map.put("planSheet",item.getPlanSheet() == null ? null : item.getPlanSheet());
@ -94,68 +95,20 @@ public class BaseKnifeController extends BaseController
countMap.putIfAbsent(techBom.getKnifeCode(), 0);
// 台账表中查询工具 并记录数量
baseKnifeWarpper.setKnifeCode(techBom.getKnifeCode());
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null)
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
baseKnifeWarpper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWarpper.setIsLocked(0);
baseKnifeWarpper.setKnifeFineState(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < techBom.getExpendLife());
AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount().intValue());
tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
AtomicInteger knifeCount = new AtomicInteger(Integer.parseInt(techBom.getKnifeCount()));
// 如果台账表中不存在尝试组刀任务查询
if (tempList.isEmpty()){
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null)
return AjaxResult.error("物料编码查询错误", techBom.getKnifeCode());
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.size() != 1)
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()){
// 查询基础物料不包含已锁定的
baseKnifeWarpper.setKnifeCode(bom.getMdItemCode());
baseKnifeWarpper.setKnifeFineState("0");
baseKnifeWarpper.setIsLocked("0");
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < techBom.getExpendLife());
if (sitmTempList.isEmpty()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null){
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() <= countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
}
} else {
return AjaxResult.error("缺少基础物料或没有记录整刀bom项", techBom.getKnifeCode());
}
} else {
// 将物料填入集合
tempList.forEach(item -> {
if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= techBom.getExpendLife()) {
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
}
});
if (knifeCount.get() > 0) {
if ("PRODUCT".equals(mdItemTemp.getItemOrProduct())){
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null)
return AjaxResult.error("编码查询错误", techBom.getKnifeCode());
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
@ -168,11 +121,11 @@ public class BaseKnifeController extends BaseController
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()){
// 查询基础物料不包含已锁定的
baseKnifeWarpper.setKnifeCode(bom.getMdItemCode());
baseKnifeWarpper.setKnifeFineState("0");
baseKnifeWarpper.setIsLocked("0");
baseKnifeWarpper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < techBom.getExpendLife());
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
if (sitmTempList.isEmpty()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
@ -187,12 +140,67 @@ public class BaseKnifeController extends BaseController
}
// 判断基础物料是否充足
if (sitmTempList.size() <= countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
}
} else {
return AjaxResult.error("缺少基础物料或没有记录整刀bom项", techBom.getKnifeCode());
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
}
} else {
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
}
} else {
// 将物料填入集合
tempList.forEach(item -> {
if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) {
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
}
});
if (knifeCount.get() > 0) {
if ("PRODUCT".equals(mdItemTemp.getItemOrProduct())){
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.size() != 1)
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()){
// 查询基础物料不包含已锁定的
baseKnifeWarpper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
if (sitmTempList.isEmpty()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null){
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
}
} else {
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
}
} else {
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
}
}
}
@ -201,6 +209,231 @@ public class BaseKnifeController extends BaseController
return AjaxResult.success("齐套性检查成功!");
}
@PostMapping("/open/productionArrangements")
@ResponseBody
public AjaxResult productionArrangements(@RequestBody String json) {
List<BaseTechnologyBom> technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
// 记录所需物料数量的map
Map<String, Integer> countMap = new HashMap<>();
BaseKnife baseKnifeWarpper = new BaseKnife();
BomRoute bomRouteTemp = new BomRoute();
MdItem mdItemTemp = new MdItem();
// 遍历工艺bom 所需要的所有材料
for (BaseTechnologyBom techBom : technologyBomList){
// 空则0
countMap.putIfAbsent(techBom.getKnifeCode(), 0);
// 台账表中查询工具 并记录数量
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null)
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
baseKnifeWarpper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWarpper.setIsLocked(0);
baseKnifeWarpper.setKnifeFineState(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
AtomicInteger knifeCount = new AtomicInteger(Integer.parseInt(techBom.getKnifeCount()));
// 如果台账表中不存在尝试组刀任务查询
if (tempList.isEmpty()){
if ("PRODUCT".equals(mdItemTemp.getItemOrProduct())){
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.size() != 1)
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()){
// 查询基础物料不包含已锁定的
baseKnifeWarpper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
if (sitmTempList.isEmpty()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null){
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
}
} else {
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
}
} else {
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
}
} else {
// 将物料填入集合
tempList.forEach(item -> {
if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) {
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
}
});
if (knifeCount.get() > 0) {
if ("PRODUCT".equals(mdItemTemp.getItemOrProduct())){
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.size() != 1)
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()){
// 查询基础物料不包含已锁定的
baseKnifeWarpper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
if (sitmTempList.isEmpty()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null){
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
}
} else {
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
}
} else {
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
}
}
}
}
// 锁定 组刀
MdItem mdItem;
List<BaseKnife> baseKnifeList;
int count;
List<MbbProduBom> bomList;
for (BaseTechnologyBom techBom : technologyBomList){
mdItem = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
count = Integer.parseInt(techBom.getKnifeCount());
// 先从台账表找
baseKnifeWarpper.setMbbBdMrlId(mdItem.getItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
baseKnifeList.removeIf(wmsBaseKnife -> Integer.parseInt(wmsBaseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
for (BaseKnife wmsBaseKnife : baseKnifeList){
if (Integer.parseInt(wmsBaseKnife.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && count > 0){
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setLockedStartTime(techBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(techBom.getLockedEndTime());
baseKnifeService.updateBaseKnife(wmsBaseKnife);
count--;
}
}
// 整刀不足进行组装
if (count > 0){
if ("PRODUCT".equals(mdItem.getItemOrProduct())){
int tempLife = 0;
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItem.getItemId());
bomRouteTemp.setBomVersion("V1.0");
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.size() != 1)
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
bomList = bomRoute.getMbbProduBomList();
if (!bomList.isEmpty()){
for (MbbProduBom bom : bomList){
baseKnifeWarpper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWarpper.setKnifeFineState(0);
baseKnifeWarpper.setIsLocked(0);
baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWarpper);
baseKnifeList.removeIf(wmsBaseKnife -> Integer.parseInt(wmsBaseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife()));
int bomCount = bom.getStandardDosage();
for (BaseKnife wmsBaseKnife : baseKnifeList){
if (bomCount > 0){
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setLockedStartTime(techBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(techBom.getLockedEndTime());
baseKnifeService.updateBaseKnife(wmsBaseKnife);
bomCount--;
}
}
}
// 生成整刀
MdItem mbbBdMrlMitm = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
mbbBdMrlMitm.setStandardNumber(Double.valueOf(mbbBdMrlMitm.getStandardNumber().toString().split("\\.")[0] + techBom.getKnifeCount()));
mdItemService.updateMdItem(mbbBdMrlMitm);
// 生成台账
BaseKnife baseKnife = new BaseKnife();
baseKnife.setMbbBdMrlId(mbbBdMrlMitm.getItemId());
baseKnife.setKnifeCode(mbbBdMrlMitm.getItemCode());
baseKnife.setKnifeName(mbbBdMrlMitm.getItemName());
baseKnife.setKnifeUnit(mbbBdMrlMitm.getUnitOfMeasure());
baseKnife.setKnifeType(mbbBdMrlMitm.getItemTypeId().toString());
baseKnife.setAreaCode("");
baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock().toString().split("\\.")[0]);
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife("100");
baseKnife.setKnifeFineState(0);
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(techBom.getLockedStartTime());
baseKnife.setLockedEndTime(techBom.getLockedEndTime());
baseKnife.setPlanSheet("");
baseKnife.setResetCount("0");
baseKnife.setItemOrProduct("PRODUCT");
baseKnifeService.insertBaseKnife(baseKnife);
} else {
return AjaxResult.error("缺少BOM项", techBom.getKnifeCode());
}
} else {
return AjaxResult.error("缺少BOM项", techBom.getKnifeCode());
}
}
}
return AjaxResult.success("生产准备验证成功!相关物料已锁定!");
}
/**
* 查询工具台账列表
*/

View File

@ -0,0 +1,104 @@
package com.ktg.mes.md.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import com.ktg.mes.md.service.IBaseTechnologyBomService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 工艺bomController
*
* @author yinjinlu
* @date 2024-11-01
*/
@RestController
@RequestMapping("/md/BOM")
public class BaseTechnologyBomController extends BaseController
{
@Autowired
private IBaseTechnologyBomService baseTechnologyBomService;
/**
* 查询工艺bom列表
*/
@PreAuthorize("@ss.hasPermi('md:BOM:list')")
@GetMapping("/list")
public TableDataInfo list(BaseTechnologyBom baseTechnologyBom)
{
startPage();
List<BaseTechnologyBom> list = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBom);
return getDataTable(list);
}
/**
* 导出工艺bom列表
*/
@PreAuthorize("@ss.hasPermi('md:BOM:export')")
@Log(title = "工艺bom", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseTechnologyBom baseTechnologyBom)
{
List<BaseTechnologyBom> list = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBom);
ExcelUtil<BaseTechnologyBom> util = new ExcelUtil<BaseTechnologyBom>(BaseTechnologyBom.class);
util.exportExcel(response, list, "工艺bom数据");
}
/**
* 获取工艺bom详细信息
*/
@PreAuthorize("@ss.hasPermi('md:BOM:query')")
@GetMapping(value = "/{technologyBomId}")
public AjaxResult getInfo(@PathVariable("technologyBomId") String technologyBomId)
{
return AjaxResult.success(baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(technologyBomId));
}
/**
* 新增工艺bom
*/
@PreAuthorize("@ss.hasPermi('md:BOM:add')")
@Log(title = "工艺bom", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseTechnologyBom baseTechnologyBom)
{
return toAjax(baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom));
}
/**
* 修改工艺bom
*/
@PreAuthorize("@ss.hasPermi('md:BOM:edit')")
@Log(title = "工艺bom", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseTechnologyBom baseTechnologyBom)
{
return toAjax(baseTechnologyBomService.updateBaseTechnologyBom(baseTechnologyBom));
}
/**
* 删除工艺bom
*/
@PreAuthorize("@ss.hasPermi('md:BOM:remove')")
@Log(title = "工艺bom", businessType = BusinessType.DELETE)
@DeleteMapping("/{technologyBomIds}")
public AjaxResult remove(@PathVariable String[] technologyBomIds)
{
return toAjax(baseTechnologyBomService.deleteBaseTechnologyBomByTechnologyBomIds(technologyBomIds));
}
}

View File

@ -64,11 +64,11 @@ public class BaseKnife extends BaseEntity
/** 工具状态 */
@Excel(name = "工具状态")
private String knifeFineState;
private Integer knifeFineState;
/** 库区编码 */
@Excel(name = "是否锁定")
private String isLocked;
private Integer isLocked;
/** 库区编码 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -84,6 +84,9 @@ public class BaseKnife extends BaseEntity
@Excel(name = "重置次数")
private String resetCount;
@Excel(name = "物料或整刀")
private String itemOrProduct;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
@ -135,11 +138,11 @@ public class BaseKnife extends BaseEntity
this.knifeCode = knifeCode;
}
public String getIsLocked() {
public Integer getIsLocked() {
return isLocked;
}
public void setIsLocked(String isLocked) {
public void setIsLocked(Integer isLocked) {
this.isLocked = isLocked;
}
@ -211,7 +214,15 @@ public class BaseKnife extends BaseEntity
this.safeStock = safeStock;
}
public String getSafeStock()
public String getItemOrProduct() {
return itemOrProduct;
}
public void setItemOrProduct(String itemOrProduct) {
this.itemOrProduct = itemOrProduct;
}
public String getSafeStock()
{
return safeStock;
}
@ -242,12 +253,12 @@ public class BaseKnife extends BaseEntity
{
return knifeLife;
}
public void setKnifeFineState(String knifeFineState)
public void setKnifeFineState(Integer knifeFineState)
{
this.knifeFineState = knifeFineState;
}
public String getKnifeFineState()
public Integer getKnifeFineState()
{
return knifeFineState;
}

View File

@ -1,50 +1,60 @@
package com.ktg.mes.wm.domain;
package com.ktg.mes.md.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 工艺bom对象 base_technology_bom
* 工艺bom对象 BASE_TECHNOLOGY_BOM
*
* @author yinjinlu
* @date 2024-10-30
* @date 2024-11-01
*/
public class BaseTechnologyBom extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工艺bomId */
private Long technologyBomId;
/** $column.columnComment */
private String technologyBomId;
/** 图号 */
@Excel(name = "图号")
private String figureCode;
/** 工序代码 */
@Excel(name = "工序代码")
/** 工序 */
@Excel(name = "工序")
private String processCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 刀具代码 */
@Excel(name = "刀具代")
/** 工具编码 */
@Excel(name = "工具编")
private String knifeCode;
/** 序内刀具编号 */
@Excel(name = "序内刀具编号")
private String knifeSort;
/** 具数量 */
@Excel(name = "具数量")
private Long knifeCount;
/** 具数量 */
@Excel(name = "具数量")
private String knifeCount;
/** 消耗定额 */
@Excel(name = "消耗定额")
private Long expendLife;
private String expendLife;
/** 锁定开始时间 */
@Excel(name = "锁定开始时间")
private Date lockedStartTime;
/** 锁定结束时间 */
@Excel(name = "锁定结束时间")
private Date lockedEndTime;
/** 预留字段1 */
@Excel(name = "预留字段1")
@ -56,18 +66,18 @@ public class BaseTechnologyBom extends BaseEntity
/** 预留字段3 */
@Excel(name = "预留字段3")
private Long attr3;
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private Long attr4;
private String attr4;
public void setTechnologyBomId(Long technologyBomId)
public void setTechnologyBomId(String technologyBomId)
{
this.technologyBomId = technologyBomId;
}
public Long getTechnologyBomId()
public String getTechnologyBomId()
{
return technologyBomId;
}
@ -116,24 +126,42 @@ public class BaseTechnologyBom extends BaseEntity
{
return knifeSort;
}
public void setKnifeCount(Long knifeCount)
public void setKnifeCount(String knifeCount)
{
this.knifeCount = knifeCount;
}
public Long getKnifeCount()
public String getKnifeCount()
{
return knifeCount;
}
public void setExpendLife(Long expendLife)
public void setExpendLife(String expendLife)
{
this.expendLife = expendLife;
}
public Long getExpendLife()
public String getExpendLife()
{
return expendLife;
}
public void setLockedStartTime(Date lockedStartTime)
{
this.lockedStartTime = lockedStartTime;
}
public Date getLockedStartTime()
{
return lockedStartTime;
}
public void setLockedEndTime(Date lockedEndTime)
{
this.lockedEndTime = lockedEndTime;
}
public Date getLockedEndTime()
{
return lockedEndTime;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
@ -152,21 +180,21 @@ public class BaseTechnologyBom extends BaseEntity
{
return attr2;
}
public void setAttr3(Long attr3)
public void setAttr3(String attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
public String getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
public void setAttr4(String attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
public String getAttr4()
{
return attr4;
}
@ -182,6 +210,8 @@ public class BaseTechnologyBom extends BaseEntity
.append("knifeSort", getKnifeSort())
.append("knifeCount", getKnifeCount())
.append("expendLife", getExpendLife())
.append("lockedStartTime", getLockedStartTime())
.append("lockedEndTime", getLockedEndTime())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())

View File

@ -1,13 +1,13 @@
package com.ktg.mes.wm.mapper;
package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.BaseTechnologyBom;
import com.ktg.mes.md.domain.BaseTechnologyBom;
/**
* 工艺bomMapper接口
*
* @author yinjinlu
* @date 2024-10-30
* @date 2024-11-01
*/
public interface BaseTechnologyBomMapper
{
@ -17,7 +17,7 @@ public interface BaseTechnologyBomMapper
* @param technologyBomId 工艺bom主键
* @return 工艺bom
*/
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId);
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(String technologyBomId);
/**
* 查询工艺bom列表
@ -49,7 +49,7 @@ public interface BaseTechnologyBomMapper
* @param technologyBomId 工艺bom主键
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId);
public int deleteBaseTechnologyBomByTechnologyBomId(String technologyBomId);
/**
* 批量删除工艺bom
@ -57,5 +57,5 @@ public interface BaseTechnologyBomMapper
* @param technologyBomIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds);
public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds);
}

View File

@ -1,13 +1,13 @@
package com.ktg.mes.wm.service;
package com.ktg.mes.md.service;
import java.util.List;
import com.ktg.mes.wm.domain.BaseTechnologyBom;
import com.ktg.mes.md.domain.BaseTechnologyBom;
/**
* 工艺bomService接口
*
* @author yinjinlu
* @date 2024-10-30
* @date 2024-11-01
*/
public interface IBaseTechnologyBomService
{
@ -17,7 +17,7 @@ public interface IBaseTechnologyBomService
* @param technologyBomId 工艺bom主键
* @return 工艺bom
*/
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId);
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(String technologyBomId);
/**
* 查询工艺bom列表
@ -49,7 +49,7 @@ public interface IBaseTechnologyBomService
* @param technologyBomIds 需要删除的工艺bom主键集合
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds);
public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds);
/**
* 删除工艺bom信息
@ -57,5 +57,5 @@ public interface IBaseTechnologyBomService
* @param technologyBomId 工艺bom主键
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId);
public int deleteBaseTechnologyBomByTechnologyBomId(String technologyBomId);
}

View File

@ -74,7 +74,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService
public int updateBaseKnife(BaseKnife baseKnife)
{
baseKnife.setUpdateTime(DateUtils.getNowDate());
baseKnifeMapper.deleteMdItemByItemId(baseKnife.getBaseKnifeId());
return baseKnifeMapper.updateBaseKnife(baseKnife);
}

View File

@ -1,18 +1,18 @@
package com.ktg.mes.wm.service.impl;
package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.BaseTechnologyBomMapper;
import com.ktg.mes.wm.domain.BaseTechnologyBom;
import com.ktg.mes.wm.service.IBaseTechnologyBomService;
import com.ktg.mes.md.mapper.BaseTechnologyBomMapper;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import com.ktg.mes.md.service.IBaseTechnologyBomService;
/**
* 工艺bomService业务层处理
*
* @author yinjinlu
* @date 2024-10-30
* @date 2024-11-01
*/
@Service
public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService
@ -27,7 +27,7 @@ public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService
* @return 工艺bom
*/
@Override
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId)
public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(String technologyBomId)
{
return baseTechnologyBomMapper.selectBaseTechnologyBomByTechnologyBomId(technologyBomId);
}
@ -77,7 +77,7 @@ public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService
* @return 结果
*/
@Override
public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds)
public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds)
{
return baseTechnologyBomMapper.deleteBaseTechnologyBomByTechnologyBomIds(technologyBomIds);
}
@ -89,7 +89,7 @@ public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService
* @return 结果
*/
@Override
public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId)
public int deleteBaseTechnologyBomByTechnologyBomId(String technologyBomId)
{
return baseTechnologyBomMapper.deleteBaseTechnologyBomByTechnologyBomId(technologyBomId);
}

View File

@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lockedEndTime" column="LOCKED_END_TIME" />
<result property="planSheet" column="PLAN_SHEET" />
<result property="resetCount" column="RESET_COUNT" />
<result property="itemOrProduct" column="ITEM_OR_PRODUCT" />
<result property="remark" column="REMARK" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
@ -69,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectBaseKnifeVo">
SELECT BK.BASE_KNIFE_ID, BK.MBB_BD_MRL_ID, RFID, MI.ITEM_CODE AS KNIFE_CODE, MI.ITEM_NAME AS KNIFE_NAME, MI.UNIT_NAME AS KNIFE_UNIT,
MIT.ITEM_TYPE_NAME AS KNIFE_TYPE, BK.SAFE_STOCK, BK.STANDARD_QUANTITY, BK.AREA_CODE, BK.KNIFE_LIFE, BK.KNIFE_FINE_STATE,
BK.IS_LOCKED, BK.LOCKED_START_TIME, BK.LOCKED_END_TIME, BK.PLAN_SHEET, BK.RESET_COUNT,
BK.IS_LOCKED, BK.LOCKED_START_TIME, BK.LOCKED_END_TIME, BK.PLAN_SHEET, BK.RESET_COUNT, BK.ITEM_OR_PRODUCT,
BK.REMARK, BK.ATTR1, BK.ATTR2, BK.ATTR3, BK.ATTR4, BK.CREATE_BY, BK.CREATE_TIME, BK.UPDATE_BY, BK.UPDATE_TIME from BASE_KNIFE BK
LEFT JOIN MD_ITEM MI on BK.MBB_BD_MRL_ID = MI.ITEM_ID
LEFT JOIN MD_ITEM_TYPE MIT ON MI.ITEM_TYPE_ID = MIT.ITEM_TYPE_ID
@ -88,8 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standardQuantity != null and standardQuantity != ''"> and STANDARD_QUANTITY = #{standardQuantity}</if>
<if test="areaCode != null and areaCode != ''"> and AREA_CODE = #{areaCode}</if>
<if test="knifeLife != null and knifeLife != ''"> and KNIFE_LIFE = #{knifeLife}</if>
<if test="knifeFineState != null and knifeFineState != ''"> and KNIFE_FINE_STATE = #{knifeFineState}</if>
<if test="isLocked != null and isLocked != ''"> and IS_LOCKED = #{isLocked}</if>
<if test="knifeFineState != null "> and KNIFE_FINE_STATE = #{knifeFineState}</if>
<if test="isLocked != null"> and IS_LOCKED = #{isLocked}</if>
<if test="itemOrProduct != null and itemOrProduct != ''"> and ITEM_OR_PRODUCT = #{itemOrProduct}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and ATTR2 = #{attr2}</if>
@ -124,6 +126,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaCode != null">AREA_CODE,</if>
<if test="knifeLife != null">KNIFE_LIFE,</if>
<if test="knifeFineState != null">KNIFE_FINE_STATE,</if>
<if test="isLocked != null">is_locked,</if>
<if test="lockedStartTime != null">locked_start_time,</if>
<if test="lockedEndTime != null">locked_end_time,</if>
<if test="planSheet != null">plan_sheet,</if>
<if test="resetCount != null">reset_count,</if>
<if test="itemOrProduct != null">item_or_product,</if>
<if test="remark != null">REMARK,</if>
<if test="attr1 != null">ATTR1,</if>
<if test="attr2 != null">ATTR2,</if>
@ -146,6 +154,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaCode != null">#{areaCode},</if>
<if test="knifeLife != null">#{knifeLife},</if>
<if test="knifeFineState != null">#{knifeFineState},</if>
<if test="isLocked != null">#{isLocked},</if>
<if test="lockedStartTime != null">#{lockedStartTime},</if>
<if test="lockedEndTime != null">#{lockedEndTime},</if>
<if test="planSheet != null">#{planSheet},</if>
<if test="resetCount != null">#{resetCount},</if>
<if test="itemOrProduct != null">#{itemOrProduct},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
@ -172,6 +186,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaCode != null">AREA_CODE = #{areaCode},</if>
<if test="knifeLife != null">KNIFE_LIFE = #{knifeLife},</if>
<if test="knifeFineState != null">KNIFE_FINE_STATE = #{knifeFineState},</if>
<if test="isLocked != null">is_locked = #{isLocked},</if>
<if test="lockedStartTime != null">locked_start_time = #{lockedStartTime},</if>
<if test="lockedEndTime != null">locked_end_time = #{lockedEndTime},</if>
<if test="planSheet != null">plan_sheet = #{planSheet},</if>
<if test="resetCount != null">reset_count = #{resetCount},</if>
<if test="itemOrProduct != null">item_or_product = #{itemOrProduct},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if>
<if test="attr2 != null">ATTR2 = #{attr2},</if>
@ -203,10 +223,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<delete id="deleteMdItemByItemId" parameterType="String">
delete from MD_ITEM where ITEM_ID = #{itemId}
</delete>
<insert id="batchMdItem">
insert into MD_ITEM( ITEM_ID, ITEM_CODE, ITEM_NAME, SPECIFICATION, UNIT_OF_MEASURE, ITEM_OR_PRODUCT, ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK, MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
<foreach item="item" index="index" collection="list" separator=",">