完成加载接口

This commit is contained in:
刘名喜 2024-11-25 18:58:51 +08:00
parent a012aa0743
commit d4029665a1
4 changed files with 218 additions and 57 deletions

View File

@ -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<BoxItem> loadItemsInfo(
@RequestBody List<BoxItem> boxItemList
) {
List<BoxItem> 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<Box> boxList
) {
boxList.forEach(box -> {
System.out.println(JSON.toJSONString(box));
});
return "失败,正在调试中...";
}
/**
* 查询料箱管理列表
*/

View File

@ -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<BoxItem> boxItemList = null;
private Boolean isUnbind = null;
public Box() {
super();
}
public Box(Long number, String boxRfid, List<BoxItem> 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<BoxItem> getBoxItemList() {
return boxItemList;
}
public void setBoxItemList(List<BoxItem> 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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -210,63 +210,9 @@
where BK.BASE_KNIFE_ID = #{baseKnifeId}
</select>
<select id="selectBaseKnifeByRfid" parameterType="Long" resultMap="BaseKnifeMdItemResult">
select a.BASE_KNIFE_ID
, a.MBB_BD_MRL_ID
, a.RFID
, a.KNIFE_CODE
, a.KNIFE_NAME
, a.KNIFE_UNIT
, a.KNIFE_TYPE
, a.SAFE_STOCK
, a.STANDARD_QUANTITY
, a.AREA_CODE
, a.KNIFE_LIFE
, a.KNIFE_FINE_STATE
, a.RESET_COUNT
, a.ITEM_OR_PRODUCT
, a.PLAN_SHEET
, a.REMARK
, a.ATTR1
, a.ATTR2
, a.ATTR3
, a.ATTR4
, a.CREATE_BY
, a.CREATE_TIME
, a.UPDATE_BY
, a.UPDATE_TIME
, a.IS_LOCKED
, a.LOCKED_START_TIME
, a.LOCKED_END_TIME
, b.ITEM_ID as sub_ITEM_ID
, b.ITEM_CODE as sub_ITEM_CODE
, b.ITEM_NAME as sub_ITEM_NAME
, b.SPECIFICATION as sub_SPECIFICATION
, b.UNIT_OF_MEASURE as sub_UNIT_OF_MEASURE
, b.ITEM_OR_PRODUCT as sub_ITEM_OR_PRODUCT
, b.ITEM_TYPE_ID as sub_ITEM_TYPE_ID
, b.ITEM_TYPE_CODE as sub_ITEM_TYPE_CODE
, b.ITEM_TYPE_NAME as sub_ITEM_TYPE_NAME
, b.ENABLE_FLAG as sub_ENABLE_FLAG
, b.SAFE_STOCK_FLAG as sub_SAFE_STOCK_FLAG
, b.MIN_STOCK as sub_MIN_STOCK
, b.MAX_STOCK as sub_MAX_STOCK
, b.REMARK as sub_REMARK
, b.ATTR1 as sub_ATTR1
, b.ATTR2 as sub_ATTR2
, b.ATTR3 as sub_ATTR3
, b.ATTR4 as sub_ATTR4
, b.CREATE_BY as sub_CREATE_BY
, b.CREATE_TIME as sub_CREATE_TIME
, b.UPDATE_BY as sub_UPDATE_BY
, b.UPDATE_TIME as sub_UPDATE_TIME
, b.HIGH_VALUE as sub_HIGH_VALUE
, b.UNIT_NAME as sub_UNIT_NAME
, b.MODEL_NUMBER as sub_MODEL_NUMBER
, b.STANDARD_NUMBER as sub_STANDARD_NUMBER
from BASE_KNIFE a
left join MD_ITEM b on b.ITEM_ID = a.BASE_KNIFE_ID
where a.RFID = #{rfId} limit 1
<select id="selectBaseKnifeByRfid" parameterType="String" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
where BK.RFID = #{rfId}
</select>
<insert id="insertBaseKnife" parameterType="BaseKnife" useGeneratedKeys="true" keyProperty="baseKnifeId">