Commit 467324c9 sunke

Merge remote-tracking branch 'origin/master'

2 个父辈 f11f6c78 ef46faa2
正在显示 15 个修改的文件 包含 380 行增加19 行删除
...@@ -99,7 +99,7 @@ public class InListController { ...@@ -99,7 +99,7 @@ public class InListController {
if (inListItems.size() <= 0) { if (inListItems.size() <= 0) {
continue; continue;
} }
InList inList = new InList(name, INLIST_STATUS.WAIT, inListItems); InList inList = new InList(name, INLIST_STATUS.WAIT, inListItems,0L);
InList dbList = inListManager.findByName(name); InList dbList = inListManager.findByName(name);
if (dbList != null) { if (dbList != null) {
......
...@@ -26,4 +26,8 @@ public class InList extends BasePo implements Serializable { ...@@ -26,4 +26,8 @@ public class InList extends BasePo implements Serializable {
private List<InListItem> inListItems; private List<InListItem> inListItems;
/**
* 开始入库单入库时间,超时需要发送邮件
*/
private long startTime=0L;
} }
...@@ -2,7 +2,6 @@ package com.neotel.smfcore.core.kanban.rest; ...@@ -2,7 +2,6 @@ package com.neotel.smfcore.core.kanban.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
...@@ -23,20 +22,16 @@ import com.neotel.smfcore.core.storage.service.po.Storage; ...@@ -23,20 +22,16 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.manager.impl.DataLogManagerImpl; import com.neotel.smfcore.core.system.service.manager.impl.DataLogManagerImpl;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.service.po.Humiture;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil; import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.annotation.AnonymousPutMapping; import com.neotel.smfcore.security.annotation.AnonymousPutMapping;
import com.neotel.smfcore.security.service.manager.IGroupManager; import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.security.service.manager.impl.GroupManagerImpl;
import com.neotel.smfcore.security.service.manager.impl.UserManagerImpl; import com.neotel.smfcore.security.service.manager.impl.UserManagerImpl;
import com.neotel.smfcore.security.service.po.Group; import com.neotel.smfcore.security.service.po.Group;
import com.neotel.smfcore.security.service.po.User; import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javafx.concurrent.Task;
import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -44,7 +39,6 @@ import org.springframework.data.domain.Pageable; ...@@ -44,7 +39,6 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -470,6 +464,13 @@ public class BoxKanbanController { ...@@ -470,6 +464,13 @@ public class BoxKanbanController {
} }
} }
} }
//如果是锡膏料仓,需要把回温区物料数量,冷藏区物料数量显示
if(storage.isSolderPaste()){
Integer warmUseCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.warmPosUseCount);
Integer coldingUseCount=dataCache.getSpUsePosCount(storage.getCid(),DataCache.coldingPosUseCount);
boxDto.getData().put(DataCache.warmPosUseCount,warmUseCount.toString());
boxDto.getData().put(DataCache.warmPosUseCount,coldingUseCount.toString());
}
return boxDto; return boxDto;
} }
......
...@@ -17,7 +17,6 @@ import java.util.List; ...@@ -17,7 +17,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@RequestMapping("/rest/api/micron")
@Slf4j @Slf4j
public class MicronApi extends BaseSmfApiListener { public class MicronApi extends BaseSmfApiListener {
......
...@@ -17,6 +17,10 @@ import java.util.*; ...@@ -17,6 +17,10 @@ import java.util.*;
*/ */
@Slf4j @Slf4j
public class Micron20031Api { public class Micron20031Api {
public static String MODE_DISABLE_SAP="DISABLE_SAP";
public static String MODE_DISABLE_MAM="DISABLE_MAM";
public static String MODE_DISABLE_MAM_AND_SAP="DISABLE_MAM_AND_SAP";
public static String MODE_ENABLE_MAM_SAP="ENABLE_MAM_SAP";
private static String AUTH_TOKEN = ""; private static String AUTH_TOKEN = "";
...@@ -151,19 +155,24 @@ public class Micron20031Api { ...@@ -151,19 +155,24 @@ public class Micron20031Api {
* //Input: MatReqNo, MaterialType * //Input: MatReqNo, MaterialType
* //Output: MatReqNo, Micron Part Number, Lot No, Quantity, UnitOfMeasures, MaterialType, Message, Status * //Output: MatReqNo, Micron Part Number, Lot No, Quantity, UnitOfMeasures, MaterialType, Message, Status
*/ */
public static DepositMatReqBean getMatReqDetail(String matReqNo) throws ApiException { public static List<DepositMatReqBean> getMatReqDetail(String matReqNo) throws ApiException {
//pnMap的key为pn, value为库存数量 //pnMap的key为pn, value为库存数量
String getMatReqDetailUrl = ""; String getMatReqDetailUrl = "";
String auth = getAuthToken(); String auth = getAuthToken();
Map<String,Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
dataMap.put("MatReqNo",matReqNo); dataMap.put("MatReqNo", matReqNo);
dataMap.put("MaterialType",MATERIAL_TYPE); dataMap.put("MaterialType", MATERIAL_TYPE);
log.info("调用MES接口 getMatReqDetail,参数:"+JsonUtil.toJsonStr(dataMap)); log.info("调用MES接口 getMatReqDetail,参数:" + JsonUtil.toJsonStr(dataMap));
String resultStr = HttpHelper.postJsonWithAuth(getMatReqDetailUrl, dataMap, auth); String resultStr = HttpHelper.postJsonWithAuth(getMatReqDetailUrl, dataMap, auth);
log.info("调用MES接口 getMatReqDetail 返回:" + resultStr); log.info("调用MES接口 getMatReqDetail 返回:" + resultStr);
DepositMatReqBean depositMatReqBean = JsonUtil.toObj(resultStr,DepositMatReqBean.class); Map<String, Object> resultMap = JsonUtil.toMap(resultStr);
return depositMatReqBean; List<DepositMatReqBean> beans = new ArrayList<>();
if (resultMap.containsKey("materialDocList")) {
beans = (List<DepositMatReqBean>) resultMap.get("materialDocList");
}
// DepositMatReqBean depositMatReqBean = JsonUtil.toObj(resultStr,DepositMatReqBean.class);
return beans;
} }
/** /**
......
package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.inList.enums.INLIST_STATUS;
import com.neotel.smfcore.core.inList.service.po.InList;
import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.storage.service.po.Storage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.swing.text.html.InlineView;
@Slf4j
public class MicronSpApiListener extends BaseSmfApiListener {
@Autowired
private InListCache inListCache;
@Override
public boolean isForThisApi(String apiName) {
return false;
}
@Override
public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException {
//判断是否是入库单入库
for (Storage storage :
params.getStorageList()) {
if (ObjectUtil.isNotEmpty(storage.getInListName())) {
//如果入库单还在执行中,验证是否可以入库
InList inList = inListCache.getInList(storage.getInListName());
if (inList.getStatus() < INLIST_STATUS.WAIT) {
try {
Barcode resultBarcode = Micron20031Api.depositCreateMA(barcode, params.getLoginUser());
if(resultBarcode!=null){
return resultBarcode;
}
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve depositCreateMA error: " + apiException.getMessage());
return null;
}
}
//普通入库验证 调用return
try {
Barcode resultBarcode = Micron20031Api.returnMaterial(barcode, Micron20031Api.MODE_ENABLE_MAM_SAP, params.getLoginUser());
if(resultBarcode!=null){
return resultBarcode;
}
} catch (ApiException apiException) {
log.error("MicronSpApiListener canPutInAfterResolve returnMaterial error: " + apiException.getMessage());
return null;
}
}
}
return null;
}
}
...@@ -53,6 +53,10 @@ public class MicronSpController { ...@@ -53,6 +53,10 @@ public class MicronSpController {
Integer used = 0; Integer used = 0;
if (pos.isUsed()) { if (pos.isUsed()) {
used = 1; used = 1;
boolean AuthoriseNg= pos.getBarcode().getAppendData("AuthoriseNg") ;
if(AuthoriseNg){
used=2;
}
} }
// used=1; // used=1;
......
package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.rest.bean.dto.InListDto;
import com.neotel.smfcore.core.inList.rest.bean.mapstruct.InListMapper;
import com.neotel.smfcore.core.inList.service.manager.IInListManager;
import com.neotel.smfcore.core.inList.service.po.InList;
import com.neotel.smfcore.core.inList.service.po.InListItem;
import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "20031:load Desposit/Return")
@RequestMapping("/rest/micron/sp")
public class MicronSpLoadController {
@Autowired
private InListCache inListCache;
@Autowired
private IInListManager inListManager;
@Autowired
private InListMapper inListMapper;
@Autowired
private IStorageManager storageManager;
@Autowired
private DataCache dataCache;
@ApiOperation("获取入库单详情")
@GetMapping(value = "/desposit/getMatReqDetail")
public ResultBean getMatReqDetail(String matReqNo) {
if (ObjectUtil.isEmpty(matReqNo)) {
return ResultBean.newOkResult(null);
}
try {
//先查询入库单是否存在
InList inList = inListCache.getInList(matReqNo);
if (inList == null) {
List<DepositMatReqBean> beans = Micron20031Api.getMatReqDetail(matReqNo);
inList = new InList();
inList.setName(matReqNo);
List<InListItem> items = new ArrayList<>();
for (DepositMatReqBean bean :
beans) {
InListItem item = new InListItem();
item.setPN(bean.getMicronPN());
item.setNum(bean.getQuantity());
item.setName(matReqNo);
items.add(item);
}
inList.setInListItems(items);
log.info("load 获取到入库单:" + inList.getName() + ",共" + items.size() + "条工单详情");
inList = inListManager.createWithItems(inList);
inListCache.addInListToMap(inList);
//保存入库单
// return ResultBean.newOkResult(reqBean);
}
InListDto inListDto = inListMapper.toDto(inList);
return ResultBean.newOkResult(inListDto);
} catch (ApiException e) {
return ResultBean.newErrorResult(1, e.getMessage(), e.getMessage());
}
}
@ApiOperation("开始入库单 入库")
@RequestMapping(value = "/desposit/start")
public ResultBean startDesposit(String matReqNo) {
InList inList = inListCache.getInList(matReqNo);
if (inList == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
Storage storage = dataCache.getOneStorageByType(DeviceType.AUTO);
if (storage == null) {
//未找到料仓,无法开始入库
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
inList.setStartTime(System.currentTimeMillis());
inListManager.save(inList);
inListCache.addInListToMap(inList);
storage.setInListName(matReqNo);
log.info("设置料仓[" + storage.getName() + "]的入库单为:[" + matReqNo + "],同时更新入库单开始时间");
storageManager.save(storage);
dataCache.reloadStorage(storage, storage.getCid());
return ResultBean.newOkResult(matReqNo);
}
@ApiOperation("开始回库 ")
@RequestMapping(value = "/return/start")
public ResultBean startReturn() {
Storage storage = dataCache.getOneStorageByType(DeviceType.AUTO);
if (storage == null) {
//未找到料仓,无法开始入库
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
storage.setInListName("");
log.info("设置料仓[" + storage.getName() + "]开始 return ");
storageManager.save(storage);
dataCache.reloadStorage(storage, storage.getCid());
return ResultBean.newOkResult("");
}
}
package com.neotel.smfcore.custom.micron20031;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto;
import com.neotel.smfcore.core.storage.rest.mapstruct.StoragePosMapper;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.util.TaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@Api(tags = "20031:Unload Withdraw_new/Withdraw_Offline/Removal")
@RequestMapping("/rest/micron/sp")
public class MicronSpUnloadController {
@Autowired
private DataCache dataCache;
@Autowired
private TaskService taskService;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private StoragePosMapper storagePosMapper;
@ApiOperation("出库:Withdraw Offline GetEquipIDList")
@GetMapping(value = "/unload/offlineIdList")
public ResultBean getEquipIdList() {
try {
List<String> equipIdList = Micron20031Api.getEquipIDList();
return ResultBean.newOkResult(equipIdList);
} catch (ApiException e) {
return ResultBean.newErrorResult(1, e.getMessage(), e.getMessage());
}
}
@ApiOperation("出库:Withdraw Offline GetMicronPN")
@GetMapping(value = "/unload/getMicronPN")
public ResultBean GetMicronPN(String lotId,String lineId) {
try {
String pn = Micron20031Api.getMicronPN(lotId, lineId);
//根据PN查找对应的物料,验证成功后返回
Criteria c = Criteria.where("used").is(true);
c.and("barcode.partNumber").is(pn);
c.and("barcode.appendData.AuthoriseNg").ne(true);
List<StoragePos> posList = storagePosManager.findByQuery(new Query(c));
for (StoragePos pos :
posList) {
try {
//验证
Micron20031Api.chkAuthoriseToDispatch(pos.getBarcode(), Micron20031Api.MODE_ENABLE_MAM_SAP, SecurityUtils.getCurrentUsername());
log.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch 成功");
StoragePosDto dto = storagePosMapper.toDto(pos);
return ResultBean.newOkResult(dto);
} catch (ApiException ex) {
log.error("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] chkAuthoriseToDispatch 失败:" + ex.toString());
//需要标记此物料
Barcode barcode = pos.getBarcode();
barcode.updateAppendData("AuthoriseNg", true);
pos.setBarcode(barcode);
storagePosManager.save(pos);
log.info("unload/getMicronPN [" + pn + "] barcode [" + pos.getBarcode().getBarcode() + "] 标记为NG");
}
}
return ResultBean.newOkResult(pn);
} catch (ApiException e) {
return ResultBean.newErrorResult(1, e.getMessage(), e.getMessage());
}
}
@ApiOperation("开始出库")
@PutMapping("/unload/checkout")
public ResultBean checkout( @RequestBody Map<String,String> params) {
String posName = params.get("posName");
StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null) {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
}
return ResultBean.newOkResult("");
}
}
package com.neotel.smfcore.custom.micron20031.bean; package com.neotel.smfcore.custom.micron20031.bean.dto;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.neotel.smfcore.custom.micron20031.bean; package com.neotel.smfcore.custom.micron20031.bean.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.neotel.smfcore.custom.micron20031.bean; package com.neotel.smfcore.custom.micron20031.bean.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.neotel.smfcore.custom.micron20031.bean; package com.neotel.smfcore.custom.micron20031.bean.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.neotel.smfcore.custom.micron20031.bean.dto;
import com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SpUnloadDto {
@ApiModelProperty("库位ID")
private String id;
@ApiModelProperty("料仓ID")
private String storageId;
@ApiModelProperty("库位号")
private String posName;
@ApiModelProperty("条码")
private String barcode;
@ApiModelProperty("物料编号")
private String partNumber;
@ApiModelProperty("数量")
private int num;
@ApiModelProperty("出库结果,默认1=成功,0=失败")
private int unloadState = 1;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!