接收扫描器传递来的数据

This commit is contained in:
刘名喜 2024-11-26 17:19:14 +08:00
parent c25c26f6f2
commit f0f5d00496
4 changed files with 93 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import com.ktg.mes.wm.domain.box.Box;
import com.ktg.mes.wm.domain.box.BoxItem;
import com.ktg.mes.wm.domain.box.RfidCard;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import org.springframework.beans.factory.annotation.Autowired;
@ -72,6 +73,28 @@ public class UcmCtBaseController extends BaseController {
}
}
@PostMapping("/open/upload-temp-box-list-info")
public String uploadTempBoxListInfo(
@RequestBody List<RfidCard> rfidCardList
) {
try {
return ucmCtBaseService.uploadTempBoxListInfo(rfidCardList);
} catch (Exception e) {
return e.getMessage();
}
}
@PostMapping("/open/upload-temp-box-item-list-info")
public String uploadTempBoxItemListInfo(
@RequestBody List<RfidCard> rfidCardList
) {
try {
return ucmCtBaseService.uploadTempBoxItemListInfo(rfidCardList);
} catch (Exception e) {
return e.getMessage();
}
}
/**
* 查询料箱管理列表
*/

View File

@ -0,0 +1,44 @@
package com.ktg.mes.wm.domain.box;
import java.util.List;
/**
* 料箱实例
*/
public class RfidCard {
private Long number = null;
private String rfid = null;
public RfidCard() {
super();
}
public RfidCard(Long number, String rfid) {
this.number = number;
this.rfid = rfid;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public String getRfid() {
return rfid;
}
public void setRfid(String rfid) {
this.rfid = rfid;
}
@Override
public String toString() {
return "RfidCard{" +
"number=" + number +
", rfid='" + rfid + '\'' +
'}';
}
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.box.Box;
import com.ktg.mes.wm.domain.box.RfidCard;
import java.util.List;
@ -66,4 +67,8 @@ public interface IUcmCtBaseService
int unbindUcmCtBase(String boxCode, String itemCode);
String bindAndUnbindUcmCtBase(List<Box> boxList);
String uploadTempBoxListInfo(List<RfidCard> rfidCardList);
String uploadTempBoxItemListInfo(List<RfidCard> rfidCardList);
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.wm.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.core.redis.RedisCache;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
@ -8,13 +10,16 @@ import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import com.ktg.mes.wm.domain.box.Box;
import com.ktg.mes.wm.domain.box.BoxItem;
import com.ktg.mes.wm.domain.box.RfidCard;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static org.apache.commons.lang3.SystemUtils.getUserName;
@ -244,4 +249,20 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
}
return "OK";
}
@Override
public String uploadTempBoxListInfo(List<RfidCard> rfidCardList) {
System.out.println("料箱工具========================================");
System.out.println(JSON.toJSONString(rfidCardList));
System.out.println("==============================================");
return "OK";
}
@Override
public String uploadTempBoxItemListInfo(List<RfidCard> rfidCardList) {
System.out.println("物料工具========================================");
System.out.println(JSON.toJSONString(rfidCardList));
System.out.println("==============================================");
return "OK";
}
}