From d4029665a1d0b7161d33c70bb6ed233ddec1774f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=8D=E5=96=9C?= Date: Mon, 25 Nov 2024 18:58:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8A=A0=E8=BD=BD=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/UcmCtBaseController.java | 41 +++++++ .../java/com/ktg/mes/wm/domain/box/Box.java | 66 +++++++++++ .../com/ktg/mes/wm/domain/box/BoxItem.java | 108 ++++++++++++++++++ .../resources/mapper/md/BaseKnifeMapper.xml | 60 +--------- 4 files changed, 218 insertions(+), 57 deletions(-) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/Box.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/BoxItem.java 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 index edefdd3..9efe0dd 100644 --- 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 @@ -1,18 +1,24 @@ package com.ktg.mes.wm.controller; +import com.alibaba.fastjson.JSON; import com.ktg.common.annotation.Log; import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.core.page.TableDataInfo; import com.ktg.common.enums.BusinessType; import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.BaseKnife; +import com.ktg.mes.md.mapper.BaseKnifeMapper; import com.ktg.mes.wm.domain.UcmCtBase; +import com.ktg.mes.wm.domain.box.Box; +import com.ktg.mes.wm.domain.box.BoxItem; import com.ktg.mes.wm.service.IUcmCtBaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; /** @@ -27,6 +33,41 @@ public class UcmCtBaseController extends BaseController { @Autowired private IUcmCtBaseService ucmCtBaseService; + @Autowired + private BaseKnifeMapper baseKnifeMapper; + + @PostMapping("/open/load-items-info") + public List loadItemsInfo( + @RequestBody List boxItemList + ) { + List result = new ArrayList<>(); + + boxItemList.forEach(boxItem -> { + System.out.println(boxItem.getBoxItemRfid().trim()); + BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByRfid(boxItem.getBoxItemRfid().trim()); + if (baseKnife != null && baseKnife.getBaseKnifeId() > 0) { + boxItem.setBoxItemCode(baseKnife.getKnifeCode()); + boxItem.setBoxItemName(baseKnife.getKnifeName()); + boxItem.setBoxItemTypeName(baseKnife.getKnifeType()); + boxItem.setBoxItemLife(baseKnife.getKnifeLife() + "%"); + } + result.add(boxItem); + }); + + return result; + } + + @PostMapping("/open/upload-box") + public String uploadBox( + @RequestBody List boxList + ) { + boxList.forEach(box -> { + System.out.println(JSON.toJSONString(box)); + }); + + return "失败,正在调试中..."; + } + /** * 查询料箱管理列表 */ diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/Box.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/Box.java new file mode 100644 index 0000000..29d5f66 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/Box.java @@ -0,0 +1,66 @@ +package com.ktg.mes.wm.domain.box; + +import java.util.List; + +/** + * 料箱实例 + */ +public class Box { + private Long number = null; + private String boxRfid = null; + private List boxItemList = null; + private Boolean isUnbind = null; + + public Box() { + super(); + } + + public Box(Long number, String boxRfid, List boxItemList, Boolean isUnbind) { + this.number = number; + this.boxRfid = boxRfid; + this.boxItemList = boxItemList; + this.isUnbind = isUnbind; + } + + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + + public String getBoxRfid() { + return boxRfid; + } + + public void setBoxRfid(String boxRfid) { + this.boxRfid = boxRfid; + } + + public List getBoxItemList() { + return boxItemList; + } + + public void setBoxItemList(List boxItemList) { + this.boxItemList = boxItemList; + } + + public Boolean getIsUnbind() { + return isUnbind; + } + + public void setSetUnbind(Boolean isUnbind) { + this.isUnbind = isUnbind; + } + + @Override + public String toString() { + return "Box{" + + "number=" + number + + ", boxRfid='" + boxRfid + '\'' + + ", boxItemList=" + boxItemList + + ", isUnbind=" + isUnbind + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/BoxItem.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/BoxItem.java new file mode 100644 index 0000000..30dcdca --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/box/BoxItem.java @@ -0,0 +1,108 @@ +package com.ktg.mes.wm.domain.box; + +/** + * 料箱物料实例 + */ +public class BoxItem { + private Long number = null; + private String boxRfid = null; + private String boxItemRfid = null; + private String boxItemCardCodeType = null; + private String boxItemName = null; + private String boxItemCode = null; + private String boxItemTypeName = null; + private String boxItemLife = null; + + public BoxItem() { + super(); + } + + public BoxItem(Long number, String boxRfid, String boxItemRfid, String boxItemCardCodeType, String boxItemName, String boxItemCode, String boxItemTypeName, String boxItemLife) { + this.number = number; + this.boxRfid = boxRfid; + this.boxItemRfid = boxItemRfid; + this.boxItemCardCodeType = boxItemCardCodeType; + this.boxItemName = boxItemName; + this.boxItemCode = boxItemCode; + this.boxItemTypeName = boxItemTypeName; + this.boxItemLife = boxItemLife; + } + + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + + public String getBoxRfid() { + return boxRfid; + } + + public void setBoxRfid(String boxRfid) { + this.boxRfid = boxRfid; + } + + public String getBoxItemRfid() { + return boxItemRfid; + } + + public void setBoxItemRfid(String boxItemRfid) { + this.boxItemRfid = boxItemRfid; + } + + public String getBoxItemCardCodeType() { + return boxItemCardCodeType; + } + + public void setBoxItemCardCodeType(String boxItemCardCodeType) { + this.boxItemCardCodeType = boxItemCardCodeType; + } + + public String getBoxItemName() { + return boxItemName; + } + + public void setBoxItemName(String boxItemName) { + this.boxItemName = boxItemName; + } + + public String getBoxItemCode() { + return boxItemCode; + } + + public void setBoxItemCode(String boxItemCode) { + this.boxItemCode = boxItemCode; + } + + public String getBoxItemTypeName() { + return boxItemTypeName; + } + + public void setBoxItemTypeName(String boxItemTypeName) { + this.boxItemTypeName = boxItemTypeName; + } + + public String getBoxItemLife() { + return boxItemLife; + } + + public void setBoxItemLife(String boxItemLife) { + this.boxItemLife = boxItemLife; + } + + @Override + public String toString() { + return "BoxItem{" + + "number=" + number + + ", boxRfid='" + boxRfid + '\'' + + ", boxItemRfid='" + boxItemRfid + '\'' + + ", boxItemCardCodeType='" + boxItemCardCodeType + '\'' + + ", boxItemName='" + boxItemName + '\'' + + ", boxItemCode='" + boxItemCode + '\'' + + ", boxItemTypeName='" + boxItemTypeName + '\'' + + ", boxItemLife='" + boxItemLife + '\'' + + '}'; + } +} diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index c08e86b..1c8e252 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -210,63 +210,9 @@ where BK.BASE_KNIFE_ID = #{baseKnifeId} - + + where BK.RFID = #{rfId}