diff --git a/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java b/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java index 8c01fbc..f03a1ee 100644 --- a/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java +++ b/ktg-framework/src/main/java/com/ktg/framework/config/SecurityConfig.java @@ -116,6 +116,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .antMatchers("/druid/**").anonymous() .antMatchers("/websocket/**").anonymous() .antMatchers("/system/autocode/get/**").permitAll() + .antMatchers("/**/open/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() .and() diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java new file mode 100644 index 0000000..077bf0b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java @@ -0,0 +1,271 @@ +package com.ktg.mes.md.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import javax.servlet.http.HttpServletResponse; + +import com.alibaba.fastjson.JSON; +import com.ktg.mes.md.domain.BomRoute; +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 org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +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.BaseKnife; +import com.ktg.mes.md.service.IBaseKnifeService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 工具台账Controller + * + * @author yinjinlu + * @date 2024-10-31 + */ +@RestController +@RequestMapping("/mes/md/baseKnife") +public class BaseKnifeController extends BaseController +{ + @Autowired + private IBaseKnifeService baseKnifeService; + + @Autowired + private IBomRouteService bomRouteService; + + @Autowired + private IMdItemService mdItemService; + + /** + * 列表查询 + * + * @return + */ + @GetMapping("/open/selectBaseKnife") + public List> openList() { + BaseKnife baseKnife = new BaseKnife(); + List list = baseKnifeService.selectBaseKnifeList(null); + List> result = new ArrayList<>(); + list.forEach(item -> { + Map map = new HashMap<>(); + map.put("gid", item.getBaseKnifeId().toString()); + map.put("code", item.getKnifeCode()); + map.put("name", item.getKnifeName()); + map.put("pmbbMeasure", item.getKnifeUnit()); + 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("isLocked", item.getIsLocked()); + 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()); + result.add(map); + }); + return result; + } + + @PostMapping("/open/checkForAlignment") + @ResponseBody + public AjaxResult checkForAlignment(@RequestBody String json) { + List technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class); + if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null) + return AjaxResult.error("未检测到工艺bom项"); + + // 记录所需物料数量的map + Map 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); + + // 台账表中查询工具 :并记录数量 + baseKnifeWarpper.setKnifeCode(techBom.getKnifeCode()); + List tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWarpper); + tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < techBom.getExpendLife()); + AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount().intValue()); + + // 如果台账表中不存在,尝试组刀任务查询 + 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 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 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) { + // 查询整刀bom项, 如果不存在说明 为基础物料,或者没有记录此整刀的组装 + mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode()); + if (mdItemTemp == null) + return AjaxResult.error("编码查询错误", techBom.getKnifeCode()); + bomRouteTemp.setMdItemId(mdItemTemp.getItemId()); + bomRouteTemp.setBomVersion("V1.0"); + List 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 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()); + } + } + } + } + + return AjaxResult.success("齐套性检查成功!"); + } + + /** + * 查询工具台账列表 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:list')") + @GetMapping("/list") + public TableDataInfo list(BaseKnife baseKnife) + { + startPage(); + List list = baseKnifeService.selectBaseKnifeList(baseKnife); + return getDataTable(list); + } + + /** + * 导出工具台账列表 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:export')") + @Log(title = "工具台账", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseKnife baseKnife) + { + List list = baseKnifeService.selectBaseKnifeList(baseKnife); + ExcelUtil util = new ExcelUtil(BaseKnife.class); + util.exportExcel(response, list, "工具台账数据"); + } + + /** + * 获取工具台账详细信息 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:query')") + @GetMapping(value = "/{baseKnifeId}") + public AjaxResult getInfo(@PathVariable("baseKnifeId") Long baseKnifeId) + { + return AjaxResult.success(baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnifeId)); + } + + /** + * 新增工具台账 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:add')") + @Log(title = "工具台账", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseKnife baseKnife) + { + return toAjax(baseKnifeService.insertBaseKnife(baseKnife)); + } + + /** + * 修改工具台账 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:edit')") + @Log(title = "工具台账", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseKnife baseKnife) + { + return toAjax(baseKnifeService.updateBaseKnife(baseKnife)); + } + + /** + * 删除工具台账 + */ + @PreAuthorize("@ss.hasPermi('md:baseKnife:remove')") + @Log(title = "工具台账", businessType = BusinessType.DELETE) + @DeleteMapping("/{baseKnifeIds}") + public AjaxResult remove(@PathVariable Long[] baseKnifeIds) + { + return toAjax(baseKnifeService.deleteBaseKnifeByBaseKnifeIds(baseKnifeIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java index 958585c..16157fd 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java @@ -24,7 +24,11 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.Null; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @RequestMapping("/mes/md/mditem") @@ -42,6 +46,49 @@ public class MdItemController extends BaseController { @Autowired private WmBarCodeUtil barcodeUtil; + /** + * 列表查询 + * + * @return + */ + @GetMapping("/open/selectItem") + public List> selectItem() { + MdItem mdItem = new MdItem(); + mdItem.setItemOrProduct("ITEM"); + List list = mdItemService.selectMdItemList(mdItem); + List> result = new ArrayList<>(); + list.forEach(item -> { + Map map = new HashMap<>(); + map.put("gid", item.getItemId().toString()); + map.put("code", item.getItemCode()); + map.put("safeInventory", item.getMinStock().toString().split("\\.")[0]); + map.put("pmbbMeasure", item.getItemTypeName()); + map.put("name", item.getItemName()); + map.put("count", mdItemService.getMdItemCount(item.getItemId()).toString()); + result.add(map); + }); + return result; + } + + @GetMapping("/open/selectProduct") + public List> selectProduct() { + MdItem mdItem = new MdItem(); + mdItem.setItemOrProduct("PRODUCT"); + List list = mdItemService.selectMdItemList(mdItem); + List> result = new ArrayList<>(); + list.forEach(item -> { + Map map = new HashMap<>(); + map.put("gid", item.getItemId().toString()); + map.put("code", item.getItemCode()); + map.put("safeInventory", item.getMinStock().toString().split("\\.")[0]); + map.put("pmbbMeasure", item.getItemTypeName()); + map.put("name", item.getItemName()); + map.put("count", mdItemService.getMdItemCount(item.getItemId()).toString()); + result.add(map); + }); + return result; + } + /** * 列表查询 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java new file mode 100644 index 0000000..8053961 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java @@ -0,0 +1,328 @@ +package com.ktg.mes.md.domain; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + * 工具台账对象 BASE_KNIFE + * + * @author yinjinlu + * @date 2024-10-31 + */ +public class BaseKnife extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long baseKnifeId; + + /** 物料id */ + @Excel(name = "物料id") + private Long mbbBdMrlId; + + /** rfid */ + @Excel(name = "rfid") + private String rfid; + + /** 工具编码 */ + @Excel(name = "工具编码") + private String knifeCode; + + /** 工具名称 */ + @Excel(name = "工具名称") + private String knifeName; + + /** 计量单位 */ + @Excel(name = "计量单位") + private String knifeUnit; + + /** 工具类型(物料分类) */ + @Excel(name = "工具类型", readConverterExp = "物料分类") + private String knifeType; + + /** 安全库存 */ + @Excel(name = "安全库存") + private String safeStock; + + /** 标准数量 */ + @Excel(name = "标准数量") + private String standardQuantity; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String areaCode; + + /** 工具寿命 */ + @Excel(name = "工具寿命") + private String knifeLife; + + /** 工具状态 */ + @Excel(name = "工具状态") + private String knifeFineState; + + /** 库区编码 */ + @Excel(name = "是否锁定") + private String isLocked; + + /** 库区编码 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date lockedStartTime; + + /** 库区编码 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date lockedEndTime; + + @Excel(name = "归属计划单") + private String planSheet; + + @Excel(name = "重置次数") + private String resetCount; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private String attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private String attr4; + + /** 物料产品信息 */ + private List mdItemList; + + public void setBaseKnifeId(Long baseKnifeId) + { + this.baseKnifeId = baseKnifeId; + } + + public Long getBaseKnifeId() + { + return baseKnifeId; + } + public void setMbbBdMrlId(Long mbbBdMrlId) + { + this.mbbBdMrlId = mbbBdMrlId; + } + + public Long getMbbBdMrlId() + { + return mbbBdMrlId; + } + public void setRfid(String rfid) + { + this.rfid = rfid; + } + + public String getRfid() + { + return rfid; + } + public void setKnifeCode(String knifeCode) + { + this.knifeCode = knifeCode; + } + + public String getIsLocked() { + return isLocked; + } + + public void setIsLocked(String isLocked) { + this.isLocked = isLocked; + } + + public Date getLockedStartTime() { + return lockedStartTime; + } + + public void setLockedStartTime(Date lockedStartTime) { + this.lockedStartTime = lockedStartTime; + } + + public Date getLockedEndTime() { + return lockedEndTime; + } + + public void setLockedEndTime(Date lockedEndTime) { + this.lockedEndTime = lockedEndTime; + } + + public String getPlanSheet() { + return planSheet; + } + + public void setPlanSheet(String planSheet) { + this.planSheet = planSheet; + } + + public String getResetCount() { + return resetCount; + } + + public void setResetCount(String resetCount) { + this.resetCount = resetCount; + } + + public String getKnifeCode() + { + return knifeCode; + } + public void setKnifeName(String knifeName) + { + this.knifeName = knifeName; + } + + public String getKnifeName() + { + return knifeName; + } + public void setKnifeUnit(String knifeUnit) + { + this.knifeUnit = knifeUnit; + } + + public String getKnifeUnit() + { + return knifeUnit; + } + public void setKnifeType(String knifeType) + { + this.knifeType = knifeType; + } + + public String getKnifeType() + { + return knifeType; + } + public void setSafeStock(String safeStock) + { + this.safeStock = safeStock; + } + + public String getSafeStock() + { + return safeStock; + } + public void setStandardQuantity(String standardQuantity) + { + this.standardQuantity = standardQuantity; + } + + public String getStandardQuantity() + { + return standardQuantity; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setKnifeLife(String knifeLife) + { + this.knifeLife = knifeLife; + } + + public String getKnifeLife() + { + return knifeLife; + } + public void setKnifeFineState(String knifeFineState) + { + this.knifeFineState = knifeFineState; + } + + public String getKnifeFineState() + { + return knifeFineState; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(String attr3) + { + this.attr3 = attr3; + } + + public String getAttr3() + { + return attr3; + } + public void setAttr4(String attr4) + { + this.attr4 = attr4; + } + + public String getAttr4() + { + return attr4; + } + + public List getMdItemList() + { + return mdItemList; + } + + public void setMdItemList(List mdItemList) + { + this.mdItemList = mdItemList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("baseKnifeId", getBaseKnifeId()) + .append("mbbBdMrlId", getMbbBdMrlId()) + .append("rfid", getRfid()) + .append("knifeCode", getKnifeCode()) + .append("knifeName", getKnifeName()) + .append("knifeUnit", getKnifeUnit()) + .append("knifeType", getKnifeType()) + .append("safeStock", getSafeStock()) + .append("standardQuantity", getStandardQuantity()) + .append("areaCode", getAreaCode()) + .append("knifeLife", getKnifeLife()) + .append("knifeFineState", getKnifeFineState()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("mdItemList", getMdItemList()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java new file mode 100644 index 0000000..ae2eb35 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseKnifeMapper.java @@ -0,0 +1,87 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.BaseKnife; +import com.ktg.mes.md.domain.MdItem; + +/** + * 工具台账Mapper接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface BaseKnifeMapper +{ + /** + * 查询工具台账 + * + * @param baseKnifeId 工具台账主键 + * @return 工具台账 + */ + public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId); + + /** + * 查询工具台账列表 + * + * @param baseKnife 工具台账 + * @return 工具台账集合 + */ + public List selectBaseKnifeList(BaseKnife baseKnife); + + /** + * 新增工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + public int insertBaseKnife(BaseKnife baseKnife); + + /** + * 修改工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + public int updateBaseKnife(BaseKnife baseKnife); + + /** + * 删除工具台账 + * + * @param baseKnifeId 工具台账主键 + * @return 结果 + */ + public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId); + + /** + * 批量删除工具台账 + * + * @param baseKnifeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseKnifeByBaseKnifeIds(Long[] baseKnifeIds); + + /** + * 批量删除物料产品 + * + * @param baseKnifeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMdItemByItemIds(Long[] baseKnifeIds); + + /** + * 批量新增物料产品 + * + * @param mdItemList 物料产品列表 + * @return 结果 + */ + public int batchMdItem(List mdItemList); + + + /** + * 通过工具台账主键删除物料产品信息 + * + * @param baseKnifeId 工具台账ID + * @return 结果 + */ + public int deleteMdItemByItemId(Long baseKnifeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java index b528aa6..e9473bb 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdItemMapper.java @@ -71,4 +71,7 @@ public interface MdItemMapper { */ public int deleteMdItemByIds(Long[] itemIds); + Integer getMdItemCount(Long itemId); + + MdItem selectMdItemByCode(String itemCode); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java new file mode 100644 index 0000000..d63ed75 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IBaseKnifeService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.BaseKnife; + +/** + * 工具台账Service接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface IBaseKnifeService +{ + /** + * 查询工具台账 + * + * @param baseKnifeId 工具台账主键 + * @return 工具台账 + */ + public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId); + + /** + * 查询工具台账列表 + * + * @param baseKnife 工具台账 + * @return 工具台账集合 + */ + public List selectBaseKnifeList(BaseKnife baseKnife); + + /** + * 新增工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + public int insertBaseKnife(BaseKnife baseKnife); + + /** + * 修改工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + public int updateBaseKnife(BaseKnife baseKnife); + + /** + * 批量删除工具台账 + * + * @param baseKnifeIds 需要删除的工具台账主键集合 + * @return 结果 + */ + public int deleteBaseKnifeByBaseKnifeIds(Long[] baseKnifeIds); + + /** + * 删除工具台账信息 + * + * @param baseKnifeId 工具台账主键 + * @return 结果 + */ + public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java index 5c64f07..2a3cb5f 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdItemService.java @@ -45,6 +45,13 @@ public interface IMdItemService { */ public MdItem selectMdItemById(Long itemId); + /** + * 根据code查询物料 + * @param itemCode + * @return + */ + public MdItem selectMdItemByCode(String itemCode); + /** * 检查物料编码是否唯一 * @param mdItem @@ -87,5 +94,6 @@ public interface IMdItemService { */ public int deleteByItemId(Long itemId); + Integer getMdItemCount(Long itemId); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java new file mode 100644 index 0000000..91e674f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/BaseKnifeServiceImpl.java @@ -0,0 +1,109 @@ +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 java.util.ArrayList; +import com.ktg.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.mapper.BaseKnifeMapper; +import com.ktg.mes.md.domain.BaseKnife; +import com.ktg.mes.md.service.IBaseKnifeService; + +/** + * 工具台账Service业务层处理 + * + * @author yinjinlu + * @date 2024-10-31 + */ +@Service +public class BaseKnifeServiceImpl implements IBaseKnifeService +{ + @Autowired + private BaseKnifeMapper baseKnifeMapper; + + /** + * 查询工具台账 + * + * @param baseKnifeId 工具台账主键 + * @return 工具台账 + */ + @Override + public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId) + { + return baseKnifeMapper.selectBaseKnifeByBaseKnifeId(baseKnifeId); + } + + /** + * 查询工具台账列表 + * + * @param baseKnife 工具台账 + * @return 工具台账 + */ + @Override + public List selectBaseKnifeList(BaseKnife baseKnife) + { + return baseKnifeMapper.selectBaseKnifeList(baseKnife); + } + + /** + * 新增工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + @Transactional + @Override + public int insertBaseKnife(BaseKnife baseKnife) + { + baseKnife.setCreateTime(DateUtils.getNowDate()); + int rows = baseKnifeMapper.insertBaseKnife(baseKnife); + return rows; + } + + /** + * 修改工具台账 + * + * @param baseKnife 工具台账 + * @return 结果 + */ + @Transactional + @Override + public int updateBaseKnife(BaseKnife baseKnife) + { + baseKnife.setUpdateTime(DateUtils.getNowDate()); + baseKnifeMapper.deleteMdItemByItemId(baseKnife.getBaseKnifeId()); + return baseKnifeMapper.updateBaseKnife(baseKnife); + } + + /** + * 批量删除工具台账 + * + * @param baseKnifeIds 需要删除的工具台账主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteBaseKnifeByBaseKnifeIds(Long[] baseKnifeIds) + { + baseKnifeMapper.deleteMdItemByItemIds(baseKnifeIds); + return baseKnifeMapper.deleteBaseKnifeByBaseKnifeIds(baseKnifeIds); + } + + /** + * 删除工具台账信息 + * + * @param baseKnifeId 工具台账主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId) + { + baseKnifeMapper.deleteMdItemByItemId(baseKnifeId); + return baseKnifeMapper.deleteBaseKnifeByBaseKnifeId(baseKnifeId); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java index 32299aa..1247eb8 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdItemServiceImpl.java @@ -129,6 +129,11 @@ public class MdItemServiceImpl implements IMdItemService { return mdItemMapper.selectMdItemById(itemId); } + @Override + public MdItem selectMdItemByCode(String itemCode) { + return mdItemMapper.selectMdItemByCode(itemCode); + } + @Override public String checkItemCodeUnique(MdItem mdItem) { MdItem item = mdItemMapper.checkItemCodeUnique(mdItem); @@ -170,4 +175,9 @@ public class MdItemServiceImpl implements IMdItemService { public int deleteByItemId(Long itemId) { return mdItemMapper.deleteMdItemById(itemId); } + + @Override + public Integer getMdItemCount(Long itemId) { + return mdItemMapper.getMdItemCount(itemId); + } } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/UcmCtBaseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/UcmCtBaseController.java new file mode 100644 index 0000000..8bcb618 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/UcmCtBaseController.java @@ -0,0 +1,106 @@ +package com.ktg.mes.wm.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.wm.domain.UcmCtBase; +import com.ktg.mes.wm.service.IUcmCtBaseService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 料箱管理Controller + * + * @author yinjinlu + * @date 2024-10-31 + */ +@RestController +@RequestMapping("/wm/ctBase") +public class UcmCtBaseController extends BaseController +{ + @Autowired + private IUcmCtBaseService ucmCtBaseService; + + /** + * 查询料箱管理列表 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:list')") + @GetMapping("/list") + public TableDataInfo list(UcmCtBase ucmCtBase) + { + startPage(); + List list = ucmCtBaseService.selectUcmCtBaseList(ucmCtBase); + return getDataTable(list); + } + + /** + * 导出料箱管理列表 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:export')") + @Log(title = "料箱管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, UcmCtBase ucmCtBase) + { + List list = ucmCtBaseService.selectUcmCtBaseList(ucmCtBase); + ExcelUtil util = new ExcelUtil(UcmCtBase.class); + util.exportExcel(response, list, "料箱管理数据"); + } + + /** + * 获取料箱管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:query')") + @GetMapping(value = "/{ctBaseId}") + public AjaxResult getInfo(@PathVariable("ctBaseId") String ctBaseId) + { + return AjaxResult.success(ucmCtBaseService.selectUcmCtBaseByCtBaseId(ctBaseId)); + } + + /** + * 新增料箱管理 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:add')") + @Log(title = "料箱管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody UcmCtBase ucmCtBase) + { + ucmCtBase.setCreateBy(getUsername()); + return toAjax(ucmCtBaseService.insertUcmCtBase(ucmCtBase)); + } + + /** + * 修改料箱管理 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:edit')") + @Log(title = "料箱管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody UcmCtBase ucmCtBase) + { + ucmCtBase.setUpdateBy(getUsername()); + return toAjax(ucmCtBaseService.updateUcmCtBase(ucmCtBase)); + } + + /** + * 删除料箱管理 + */ + @PreAuthorize("@ss.hasPermi('wm:ctBase:remove')") + @Log(title = "料箱管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ctBaseIds}") + public AjaxResult remove(@PathVariable String[] ctBaseIds) + { + return toAjax(ucmCtBaseService.deleteUcmCtBaseByCtBaseIds(ctBaseIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/BaseTechnologyBom.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/BaseTechnologyBom.java new file mode 100644 index 0000000..ecf71a1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/BaseTechnologyBom.java @@ -0,0 +1,196 @@ +package com.ktg.mes.wm.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; + +/** + * 工艺bom对象 base_technology_bom + * + * @author yinjinlu + * @date 2024-10-30 + */ +public class BaseTechnologyBom extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工艺bomId */ + private Long technologyBomId; + + /** 图号 */ + @Excel(name = "图号") + private String figureCode; + + /** 工序代码 */ + @Excel(name = "工序代码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 刀具代码 */ + @Excel(name = "刀具代码") + private String knifeCode; + + /** 序内刀具编号 */ + @Excel(name = "序内刀具编号") + private String knifeSort; + + /** 刀具数量 */ + @Excel(name = "刀具数量") + private Long knifeCount; + + /** 消耗定额 */ + @Excel(name = "消耗定额") + private Long expendLife; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setTechnologyBomId(Long technologyBomId) + { + this.technologyBomId = technologyBomId; + } + + public Long getTechnologyBomId() + { + return technologyBomId; + } + public void setFigureCode(String figureCode) + { + this.figureCode = figureCode; + } + + public String getFigureCode() + { + return figureCode; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setKnifeCode(String knifeCode) + { + this.knifeCode = knifeCode; + } + + public String getKnifeCode() + { + return knifeCode; + } + public void setKnifeSort(String knifeSort) + { + this.knifeSort = knifeSort; + } + + public String getKnifeSort() + { + return knifeSort; + } + public void setKnifeCount(Long knifeCount) + { + this.knifeCount = knifeCount; + } + + public Long getKnifeCount() + { + return knifeCount; + } + public void setExpendLife(Long expendLife) + { + this.expendLife = expendLife; + } + + public Long getExpendLife() + { + return expendLife; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("technologyBomId", getTechnologyBomId()) + .append("figureCode", getFigureCode()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("knifeCode", getKnifeCode()) + .append("knifeSort", getKnifeSort()) + .append("knifeCount", getKnifeCount()) + .append("expendLife", getExpendLife()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/UcmCtBase.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/UcmCtBase.java new file mode 100644 index 0000000..79978f5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/UcmCtBase.java @@ -0,0 +1,122 @@ +package com.ktg.mes.wm.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; + +/** + * 料箱管理对象 UCM_CT_BASE + * + * @author yinjinlu + * @date 2024-10-31 + */ +public class UcmCtBase extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 料箱id */ + private String ctBaseId; + + /** 料箱编码 */ + @Excel(name = "料箱编码") + private String code; + + /** 料箱状态:0-正常,1-绑定,2-解绑 */ + @Excel(name = "料箱状态:0-正常,1-绑定,2-解绑") + private String type; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private String attr3; + + /** 预留字段4 */ + private String attr4; + + public void setCtBaseId(String ctBaseId) + { + this.ctBaseId = ctBaseId; + } + + public String getCtBaseId() + { + return ctBaseId; + } + public void setCode(String code) + { + this.code = code; + } + + public String getCode() + { + return code; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(String attr3) + { + this.attr3 = attr3; + } + + public String getAttr3() + { + return attr3; + } + public void setAttr4(String attr4) + { + this.attr4 = attr4; + } + + public String getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("ctBaseId", getCtBaseId()) + .append("code", getCode()) + .append("type", getType()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/BaseTechnologyBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/BaseTechnologyBomMapper.java new file mode 100644 index 0000000..503a6b0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/BaseTechnologyBomMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.BaseTechnologyBom; + +/** + * 工艺bomMapper接口 + * + * @author yinjinlu + * @date 2024-10-30 + */ +public interface BaseTechnologyBomMapper +{ + /** + * 查询工艺bom + * + * @param technologyBomId 工艺bom主键 + * @return 工艺bom + */ + public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId); + + /** + * 查询工艺bom列表 + * + * @param baseTechnologyBom 工艺bom + * @return 工艺bom集合 + */ + public List selectBaseTechnologyBomList(BaseTechnologyBom baseTechnologyBom); + + /** + * 新增工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + public int insertBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom); + + /** + * 修改工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + public int updateBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom); + + /** + * 删除工艺bom + * + * @param technologyBomId 工艺bom主键 + * @return 结果 + */ + public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId); + + /** + * 批量删除工艺bom + * + * @param technologyBomIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/UcmCtBaseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/UcmCtBaseMapper.java new file mode 100644 index 0000000..68b548d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/UcmCtBaseMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.UcmCtBase; + +/** + * 料箱管理Mapper接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface UcmCtBaseMapper +{ + /** + * 查询料箱管理 + * + * @param ctBaseId 料箱管理主键 + * @return 料箱管理 + */ + public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId); + + /** + * 查询料箱管理列表 + * + * @param ucmCtBase 料箱管理 + * @return 料箱管理集合 + */ + public List selectUcmCtBaseList(UcmCtBase ucmCtBase); + + /** + * 新增料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + public int insertUcmCtBase(UcmCtBase ucmCtBase); + + /** + * 修改料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + public int updateUcmCtBase(UcmCtBase ucmCtBase); + + /** + * 删除料箱管理 + * + * @param ctBaseId 料箱管理主键 + * @return 结果 + */ + public int deleteUcmCtBaseByCtBaseId(String ctBaseId); + + /** + * 批量删除料箱管理 + * + * @param ctBaseIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteUcmCtBaseByCtBaseIds(String[] ctBaseIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IBaseTechnologyBomService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IBaseTechnologyBomService.java new file mode 100644 index 0000000..3c0613c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IBaseTechnologyBomService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.BaseTechnologyBom; + +/** + * 工艺bomService接口 + * + * @author yinjinlu + * @date 2024-10-30 + */ +public interface IBaseTechnologyBomService +{ + /** + * 查询工艺bom + * + * @param technologyBomId 工艺bom主键 + * @return 工艺bom + */ + public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId); + + /** + * 查询工艺bom列表 + * + * @param baseTechnologyBom 工艺bom + * @return 工艺bom集合 + */ + public List selectBaseTechnologyBomList(BaseTechnologyBom baseTechnologyBom); + + /** + * 新增工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + public int insertBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom); + + /** + * 修改工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + public int updateBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom); + + /** + * 批量删除工艺bom + * + * @param technologyBomIds 需要删除的工艺bom主键集合 + * @return 结果 + */ + public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds); + + /** + * 删除工艺bom信息 + * + * @param technologyBomId 工艺bom主键 + * @return 结果 + */ + public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IUcmCtBaseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IUcmCtBaseService.java new file mode 100644 index 0000000..7b0d6a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IUcmCtBaseService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.UcmCtBase; + +/** + * 料箱管理Service接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface IUcmCtBaseService +{ + /** + * 查询料箱管理 + * + * @param ctBaseId 料箱管理主键 + * @return 料箱管理 + */ + public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId); + + /** + * 查询料箱管理列表 + * + * @param ucmCtBase 料箱管理 + * @return 料箱管理集合 + */ + public List selectUcmCtBaseList(UcmCtBase ucmCtBase); + + /** + * 新增料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + public int insertUcmCtBase(UcmCtBase ucmCtBase); + + /** + * 修改料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + public int updateUcmCtBase(UcmCtBase ucmCtBase); + + /** + * 批量删除料箱管理 + * + * @param ctBaseIds 需要删除的料箱管理主键集合 + * @return 结果 + */ + public int deleteUcmCtBaseByCtBaseIds(String[] ctBaseIds); + + /** + * 删除料箱管理信息 + * + * @param ctBaseId 料箱管理主键 + * @return 结果 + */ + public int deleteUcmCtBaseByCtBaseId(String ctBaseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/BaseTechnologyBomServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/BaseTechnologyBomServiceImpl.java new file mode 100644 index 0000000..754cc13 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/BaseTechnologyBomServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.wm.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; + +/** + * 工艺bomService业务层处理 + * + * @author yinjinlu + * @date 2024-10-30 + */ +@Service +public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService +{ + @Autowired + private BaseTechnologyBomMapper baseTechnologyBomMapper; + + /** + * 查询工艺bom + * + * @param technologyBomId 工艺bom主键 + * @return 工艺bom + */ + @Override + public BaseTechnologyBom selectBaseTechnologyBomByTechnologyBomId(Long technologyBomId) + { + return baseTechnologyBomMapper.selectBaseTechnologyBomByTechnologyBomId(technologyBomId); + } + + /** + * 查询工艺bom列表 + * + * @param baseTechnologyBom 工艺bom + * @return 工艺bom + */ + @Override + public List selectBaseTechnologyBomList(BaseTechnologyBom baseTechnologyBom) + { + return baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBom); + } + + /** + * 新增工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + @Override + public int insertBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom) + { + baseTechnologyBom.setCreateTime(DateUtils.getNowDate()); + return baseTechnologyBomMapper.insertBaseTechnologyBom(baseTechnologyBom); + } + + /** + * 修改工艺bom + * + * @param baseTechnologyBom 工艺bom + * @return 结果 + */ + @Override + public int updateBaseTechnologyBom(BaseTechnologyBom baseTechnologyBom) + { + baseTechnologyBom.setUpdateTime(DateUtils.getNowDate()); + return baseTechnologyBomMapper.updateBaseTechnologyBom(baseTechnologyBom); + } + + /** + * 批量删除工艺bom + * + * @param technologyBomIds 需要删除的工艺bom主键 + * @return 结果 + */ + @Override + public int deleteBaseTechnologyBomByTechnologyBomIds(Long[] technologyBomIds) + { + return baseTechnologyBomMapper.deleteBaseTechnologyBomByTechnologyBomIds(technologyBomIds); + } + + /** + * 删除工艺bom信息 + * + * @param technologyBomId 工艺bom主键 + * @return 结果 + */ + @Override + public int deleteBaseTechnologyBomByTechnologyBomId(Long technologyBomId) + { + return baseTechnologyBomMapper.deleteBaseTechnologyBomByTechnologyBomId(technologyBomId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/UcmCtBaseServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/UcmCtBaseServiceImpl.java new file mode 100644 index 0000000..ae1c952 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/UcmCtBaseServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.mes.wm.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.UcmCtBaseMapper; +import com.ktg.mes.wm.domain.UcmCtBase; +import com.ktg.mes.wm.service.IUcmCtBaseService; + +/** + * 料箱管理Service业务层处理 + * + * @author yinjinlu + * @date 2024-10-31 + */ +@Service +public class UcmCtBaseServiceImpl implements IUcmCtBaseService +{ + @Autowired + private UcmCtBaseMapper ucmCtBaseMapper; + + /** + * 查询料箱管理 + * + * @param ctBaseId 料箱管理主键 + * @return 料箱管理 + */ + @Override + public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId) + { + return ucmCtBaseMapper.selectUcmCtBaseByCtBaseId(ctBaseId); + } + + /** + * 查询料箱管理列表 + * + * @param ucmCtBase 料箱管理 + * @return 料箱管理 + */ + @Override + public List selectUcmCtBaseList(UcmCtBase ucmCtBase) + { + return ucmCtBaseMapper.selectUcmCtBaseList(ucmCtBase); + } + + /** + * 新增料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + @Override + public int insertUcmCtBase(UcmCtBase ucmCtBase) + { + ucmCtBase.setCreateTime(DateUtils.getNowDate()); + return ucmCtBaseMapper.insertUcmCtBase(ucmCtBase); + } + + /** + * 修改料箱管理 + * + * @param ucmCtBase 料箱管理 + * @return 结果 + */ + @Override + public int updateUcmCtBase(UcmCtBase ucmCtBase) + { + ucmCtBase.setUpdateTime(DateUtils.getNowDate()); + return ucmCtBaseMapper.updateUcmCtBase(ucmCtBase); + } + + /** + * 批量删除料箱管理 + * + * @param ctBaseIds 需要删除的料箱管理主键 + * @return 结果 + */ + @Override + public int deleteUcmCtBaseByCtBaseIds(String[] ctBaseIds) + { + return ucmCtBaseMapper.deleteUcmCtBaseByCtBaseIds(ctBaseIds); + } + + /** + * 删除料箱管理信息 + * + * @param ctBaseId 料箱管理主键 + * @return 结果 + */ + @Override + public int deleteUcmCtBaseByCtBaseId(String ctBaseId) + { + return ucmCtBaseMapper.deleteUcmCtBaseByCtBaseId(ctBaseId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml new file mode 100644 index 0000000..e0375f0 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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.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 + + + + + + + + insert into BASE_KNIFE + + MBB_BD_MRL_ID, + RFID, + KNIFE_CODE, + KNIFE_NAME, + KNIFE_UNIT, + KNIFE_TYPE, + SAFE_STOCK, + STANDARD_QUANTITY, + AREA_CODE, + KNIFE_LIFE, + KNIFE_FINE_STATE, + REMARK, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + + + #{mbbBdMrlId}, + #{rfid}, + #{knifeCode}, + #{knifeName}, + #{knifeUnit}, + #{knifeType}, + #{safeStock}, + #{standardQuantity}, + #{areaCode}, + #{knifeLife}, + #{knifeFineState}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update BASE_KNIFE + + MBB_BD_MRL_ID = #{mbbBdMrlId}, + RFID = #{rfid}, + KNIFE_CODE = #{knifeCode}, + KNIFE_NAME = #{knifeName}, + KNIFE_UNIT = #{knifeUnit}, + KNIFE_TYPE = #{knifeType}, + SAFE_STOCK = #{safeStock}, + STANDARD_QUANTITY = #{standardQuantity}, + AREA_CODE = #{areaCode}, + KNIFE_LIFE = #{knifeLife}, + KNIFE_FINE_STATE = #{knifeFineState}, + REMARK = #{remark}, + ATTR1 = #{attr1}, + ATTR2 = #{attr2}, + ATTR3 = #{attr3}, + ATTR4 = #{attr4}, + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + UPDATE_TIME = #{updateTime}, + + where BASE_KNIFE_ID = #{baseKnifeId} + + + + delete from BASE_KNIFE where BASE_KNIFE_ID = #{baseKnifeId} + + + + delete from BASE_KNIFE where BASE_KNIFE_ID in + + #{baseKnifeId} + + + + + delete from MD_ITEM where ITEM_ID in + + #{itemId} + + + + + delete from MD_ITEM where ITEM_ID = #{itemId} + + + + 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 + + ( #{item.itemId}, #{item.itemCode}, #{item.itemName}, #{item.specification}, #{item.unitOfMeasure}, #{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag}, #{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber}) + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml index 3af0ecc..7133ff4 100644 --- a/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml @@ -70,6 +70,9 @@ AND item_name like concat('%', #{itemName}, '%') + + AND item_or_product = #{itemOrProduct} + AND enable_flag = #{enableFlag} @@ -131,6 +134,12 @@ where item_id = #{itemId} + + + + insert into md_item(item_code, item_name, diff --git a/ktg-mes/src/main/resources/mapper/wm/BaseTechnologyBomMapper.xml b/ktg-mes/src/main/resources/mapper/wm/BaseTechnologyBomMapper.xml new file mode 100644 index 0000000..161553b --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/BaseTechnologyBomMapper.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select technology_bom_id, figure_code, process_code, process_name, knife_code, knife_sort, knife_count, expend_life, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from base_technology_bom + + + + + + + + insert into base_technology_bom + + technology_bom_id, + figure_code, + process_code, + process_name, + knife_code, + knife_sort, + knife_count, + expend_life, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{technologyBomId}, + #{figureCode}, + #{processCode}, + #{processName}, + #{knifeCode}, + #{knifeSort}, + #{knifeCount}, + #{expendLife}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update base_technology_bom + + figure_code = #{figureCode}, + process_code = #{processCode}, + process_name = #{processName}, + knife_code = #{knifeCode}, + knife_sort = #{knifeSort}, + knife_count = #{knifeCount}, + expend_life = #{expendLife}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where technology_bom_id = #{technologyBomId} + + + + delete from base_technology_bom where technology_bom_id = #{technologyBomId} + + + + delete from base_technology_bom where technology_bom_id in + + #{technologyBomId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/UcmCtBaseMapper.xml b/ktg-mes/src/main/resources/mapper/wm/UcmCtBaseMapper.xml new file mode 100644 index 0000000..6c10303 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/UcmCtBaseMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + select CT_BASE_ID, CODE, TYPE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from UCM_CT_BASE + + + + + + + + insert into UCM_CT_BASE + + CODE, + TYPE, + REMARK, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + + + #{code}, + #{type}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update UCM_CT_BASE + + CODE = #{code}, + TYPE = #{type}, + REMARK = #{remark}, + ATTR1 = #{attr1}, + ATTR2 = #{attr2}, + ATTR3 = #{attr3}, + ATTR4 = #{attr4}, + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + UPDATE_TIME = #{updateTime}, + + where CT_BASE_ID = #{ctBaseId} + + + + delete from UCM_CT_BASE where CT_BASE_ID = #{ctBaseId} + + + + delete from UCM_CT_BASE where CT_BASE_ID in + + #{ctBaseId} + + + \ No newline at end of file