Commit da0b61c3 zshaohui

指定用户增加所有线体

1 个父辈 f0088d8f
......@@ -655,6 +655,96 @@ public class DeviceController {
return ResultBean.newOkResult(data);
}
@ApiOperation("获取空库位信息")
@RequestMapping("/service/store/findEmptyPosNameByCid")
@AnonymousAccess
public ResultBean findEmptyPosNameByCid(String cid) {
Storage storage = dataCache.getStorage(cid);
List<Map<String,Object>> resultList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks();
List<StoragePos> storagePosList = storagePosManager.findEmptyByStorageId(storage.getId());
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode == null) {
boolean hasTask = false;
for (DataLog dataLog : allTasks) {
if (!dataLog.isFinished() && !dataLog.isCancel()) {
if (pos.getId().equals(dataLog.getPosId())) {
hasTask = true;
break;
}
}
}
if (hasTask) {
continue;
}
Set<String> allLockPosIds = ReelLockPosUtil.getAllLockPosIds();
if (allLockPosIds.contains(pos.getId())) {
continue;
}
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("w",pos.getW());
resultMap.put("h",pos.getH());
resultMap.put("posName",pos.getPosName());
resultList.add(resultMap);
}
}
return ResultBean.newOkResult(resultList);
}
@ApiOperation("获取最近的库位信息")
@RequestMapping("/service/store/getNearPosByOutPosName")
@AnonymousAccess
public ResultBean getNearPosByOutPosName(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("code");
String outPosName = paramMap.get("outPosName");
String cid = paramMap.get("cid");
log.info("获取最新的库位信息,条码为:" + code + ",库位为:" + outPosName + ",cid为:" + cid);
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null){
return ResultBean.newErrorResult(-1,"",code+"不是有效的条码");
}
//判断任务是否存在
DataLog dataLog = null;
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog task : allTasks) {
if (task.isPutInTask()){
if (!task.isCancel() && !task.isFinished()){
if (barcode.getBarcode().equals(task.getBarcode())){
dataLog = task;
break;
}
}
}
}
if (dataLog == null){
return ResultBean.newErrorResult(-1,"","");
}
Storage storage = dataCache.getStorage(cid);
Collection<String> excludePosIds = taskService.excludePosIds();
StoragePos pos = storagePosManager.getEmptyPosByStorageNew(storage, barcode, excludePosIds, outPosName);
if (pos == null){
return ResultBean.newErrorResult(-1,"","未找到对应的库位信息");
}
dataLog.setPosId(pos.getId());
dataLog.setPosName(pos.getPosName());
taskService.updateQueueTask(dataLog);
Map<String,String> resultMap = new HashMap<>();
resultMap.put("posId",pos.getId());
resultMap.put("posName",pos.getPosName());
return ResultBean.newOkResult(resultMap);
}
private StoragePos findFormList(List<StoragePos> list ,String posName)
{
for (StoragePos pos :
......
......@@ -47,6 +47,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException;
StoragePos getEmptyPosByStorageNew(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId) throws ValidateException;
List<StoragePos> findNotEmpty();
List<StoragePos> findByStorage(String storageId);
......
......@@ -592,6 +592,50 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
return pos;
}
public StoragePos getEmptyPosByStorageNew(Storage storage, Barcode barcode, Collection<String> excludePosIds,String lastPosId) throws ValidateException {
Criteria c = Criteria.where("storageId").is(storage.getId());
COMPATIBLE_TYPE compatibleType = storage.getCompatibleType();
if (compatibleType == COMPATIBLE_TYPE.EXACT_MATCH) {//完全匹配
c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight());
} else if (compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE) {//同厚度兼容
c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//除7寸外,完全兼容
} else if (compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE) {//同尺寸兼容
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
}
c = c.and("enabled").is(true)//可用
.and("used").is(false);//未使用
//去除的仓位
if (excludePosIds != null && !excludePosIds.isEmpty()) {
c = c.and("id").nin(excludePosIds);
}
Query query = new Query(c);
String msg = "";
if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
} else {
Point point = PointUtil.getPosPoint(lastPosId, false);
query.addCriteria(Criteria.where("coordinate").nearSphere(point));
msg += "getEmptyPosByStorage 根据就近坐标查询[" + lastPosId + "][" + point.getX() + "," + point.getY() + "]";
}
StoragePos pos = storagePosDao.findOne(query);
if ((!ObjectUtil.isNotEmpty(msg)) && (pos != null)) {
Point targetP = PointUtil.getPosPoint(lastPosId, false);
log.info(msg + "结果:[" + pos.getPosName() + "][" + targetP.getX() + "," + targetP.getY() + "]");
}
return pos;
}
@Override
public List<StoragePos> findNotEmpty(){
return findNotEmptyByStorageId(null);
......
......@@ -600,7 +600,7 @@ public class LizhenApi extends DefaultSmfApiListener {
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("werks", werks);
dataMap.put("werks", "W339");
dataMap.put("reelid", "");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info(barcode.getBarcode()+"保存物料入参为:" + param+"地址为:"+ save2DReelInfoUrl);
......@@ -617,12 +617,25 @@ public class LizhenApi extends DefaultSmfApiListener {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("ipn", oldTask.getPartNumber());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
dataMap.put("create_empno", SecurityUtils.getLoginUsername());
Barcode barcode = barcodeManager.findByBarcode(oldTask.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
dataMap.put("date_code", barcode.getDateCode());
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor_name", barcode.getProvider());
dataMap.put("batch_id", "");
//dataMap.put("vendorcode", barcode.getProviderNumber());
}
dataMap.put("create_empno", StringUtils.isEmpty(SecurityUtils.getLoginUsername()) ? storage.getMachineId() : SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
......
......@@ -153,10 +153,10 @@ public class InnerBoxRestController {
taskService.removeFinishedTask(opTask);
//设置绑定库位
StorageExport storageExport = StorageExportUtil.getExport(outlet);
//LiteOrder liteOrder = liteOrderManager.get(opTask.getSourceId());
//if (liteOrder != null) {
storageExport.setLine(opTask.getLine());
storageExport.setHSerial(opTask.getOrderNo());
LiteOrder liteOrder = liteOrderManager.get(opTask.getSourceId());
if (liteOrder != null) {
storageExport.setLine(liteOrder.getLine());
storageExport.setHSerial(liteOrder.getOrderNo());
int remainTaskCount = 0;
List<DataLog> dataLogList = taskService.getAllTasks();
......@@ -173,7 +173,7 @@ public class InnerBoxRestController {
//storageExport.setCacheID(liteOrder.getCacheID());
log.info(opTask.getBarcode() + "任务完成,更新出料口信息:" + JSON.toJSONString(storageExport));
StorageExportUtil.updateExport(outlet, storageExport);
//}
}
}
return ResultBean.newOkResult(StorageExportUtil.getExport(outlet));
......@@ -353,7 +353,9 @@ public class InnerBoxRestController {
@ApiOperation("料箱离开工位")
@RequestMapping("/boxOutStation")
@AnonymousAccess
public ResultBean boxOutStation(String export, String material,String orderNo) {
public synchronized ResultBean boxOutStation(String export, String material,String orderNo) {
log.info("收到料箱离开工位,出料口为:"+export+",工单号为:"+orderNo);
StorageExport storageExport = StorageExportUtil.getExport(export);
//如果工单号不为空,返回出料口的工单号是否相同,如果不同,直接返回,不清空
......@@ -374,6 +376,7 @@ public class InnerBoxRestController {
}
}
}
log.info("出料口为:"+export+",剩余当前任务数量为:"+remainTaskCount);
if (remainTaskCount > 0){
if (StringUtils.isNotEmpty(orderNo)) {
return ResultBean.newErrorResult(-1, "", export + "当前任务数大于0,不清空");
......@@ -508,7 +511,7 @@ public class InnerBoxRestController {
for (LiteOrder liteOrder : liteOrders) {
if (!liteOrder.isMaiZheng()) {
if (liteOrder.isNew() || liteOrder.isTaskFinished()) {
if (liteOrder.isNew() /*|| liteOrder.isTaskFinished()*/) {
String result = liteOrderCache.checkOutLiteOrder(liteOrder.getOrderNo(), false, export);
log.info("出料口:"+export+"有空料箱," + "新的工单为:" + liteOrder.getOrderNo() + "结果为:" + result);
if (StringUtils.isBlank(result)) {
......
......@@ -146,6 +146,7 @@ public class StorageExportUtil {
}
if (StringUtils.isBlank(storageExport.getHSerial())) {
log.info(orderNo+"获取到出料口信息为:"+JSON.toJSONString(storageExport));
exportStr = export;
break;
}
......
package com.neotel.smfcore.custom.lizhen.setting.controller;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
......@@ -19,11 +20,22 @@ public class LineController {
@Value("${3f.line}")
private String line;
@Value("${3f.allline}")
private String allline;
@ApiOperation("获取所有线体")
@RequestMapping("/getAllLine")
@AnonymousAccess
//@AnonymousAccess
public ResultBean getAllLine(){
String[] split = line.split(",");
String[] split;
if ("bgcgAdmin".equals(SecurityUtils.getLoginUsername())){
split = allline.split(",");
} else {
split = line.split(",");
}
List<String> lineList = Arrays.asList(split);
lineList = lineList.stream().distinct().collect(Collectors.toList());
Collections.sort(lineList);
......
......@@ -14,8 +14,8 @@ api:
barcodeInfoUrl: http://10.68.25.42:8001/Sct/GetReelInfo
#入库
save2DReelInfoUrl: http://10.68.25.75:8002/SmtAutoWH/Save2DReelInfo
save2DReelInfoUrl: http://10.68.27.68:8002/SmtAutoWH/Save2DReelInfo
#发料
commonGIRecordUrl: http://10.68.25.75:8002/Sct/CommonGIRecord
commonGIRecordUrl: http://10.68.27.68:8002/Sct/CommonGIRecord
#退料
commonRMRecordUrl: http://10.68.25.75:8002/Sct/CommonRMRecord
\ No newline at end of file
commonRMRecordUrl: http://10.68.27.68:8002/Sct/CommonRMRecord
\ No newline at end of file
......@@ -15,8 +15,8 @@ api:
barcodeInfoUrl: http://10.68.25.42:8001/Sct/GetReelInfo
#入库
save2DReelInfoUrl: http://10.68.25.75:8002/SmtAutoWH/Save2DReelInfo
save2DReelInfoUrl: http://10.68.27.68:8002/SmtAutoWH/Save2DReelInfo
#发料
commonGIRecordUrl: http://10.68.25.75:8002/Sct/CommonGIRecord
commonGIRecordUrl: http://10.68.27.68:8002/Sct/CommonGIRecord
#退料
commonRMRecordUrl: http://10.68.25.75:8002/Sct/CommonRMRecord
\ No newline at end of file
commonRMRecordUrl: http://10.68.27.68:8002/Sct/CommonRMRecord
\ No newline at end of file
3f:
line: C02-3FSMT-18,C02-3FSMT-19,C02-3FSMT-17,C02-3FSMT-14,C02-3FSMT-13,C02-3FSMT-16,C02-3FSMT-15,C02-3FSMT-19
\ No newline at end of file
line: C02-3FSMT-18,C02-3FSMT-19,C02-3FSMT-17,C02-3FSMT-14,C02-3FSMT-13,C02-3FSMT-16,C02-3FSMT-15,C02-3FSMT-19
allline: C02-3FSMT-18,C02-3FSMT-19,C02-3FSMT-17,C02-3FSMT-14,C02-3FSMT-13,C02-3FSMT-16,C02-3FSMT-15,C02-3FSMT-19,C02-3FSMT-09,C02-3FSMT-08,C02-3FSMT-06,C02-3FSMT-07,C02-3FSMT-04,C02-3FSMT-05,C02-3FSMT-03
\ No newline at end of file
3f:
line: C02-3FSMT-09,C02-3FSMT-08,C02-3FSMT-06,C02-3FSMT-07,C02-3FSMT-04,C02-3FSMT-05,C02-3FSMT-03
\ No newline at end of file
line: C02-3FSMT-09,C02-3FSMT-08,C02-3FSMT-06,C02-3FSMT-07,C02-3FSMT-04,C02-3FSMT-05,C02-3FSMT-03
allline: C02-3FSMT-18,C02-3FSMT-19,C02-3FSMT-17,C02-3FSMT-14,C02-3FSMT-13,C02-3FSMT-16,C02-3FSMT-15,C02-3FSMT-19,C02-3FSMT-09,C02-3FSMT-08,C02-3FSMT-06,C02-3FSMT-07,C02-3FSMT-04,C02-3FSMT-05,C02-3FSMT-03
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!