Commit e5ce1009 zshaohui

1.虚拟仓功能提交

1 个父辈 86420a20
......@@ -172,6 +172,11 @@ public class MenuInit {
addDefaultFunctionMenu(22, msd, "MSD追溯性", "msdData", "neolight/msdData/index", "MSDData");
addDefaultFunctionMenu(23, msd, "MSD设置", "msdSetting", "neolight/msdSetting/index", "MSDSet");
Menu virtual = Menu.CreatePMenu("虚拟仓", 5, "virtual", "virtual",null);
addDefaultFunctionMenu(24, virtual, "虚拟仓管理", "virtualManager", "virtualStorage/virtualManager/index", "virtualManager");
addDefaultFunctionMenu(25, virtual, "虚拟库位管理", "virtualLocationManager", "virtualStorage/virtualLocationManager/index", "virtualLocation");
addDefaultFunctionMenu(26, virtual, "虚拟仓操作", "virtualOperations", "virtualStorage/virtualOperations/index", "virtualOperations");
//锡膏管理:设备概览.库存.追溯性.设置
Menu solderPaste = Menu.CreatePMenu("锡膏管理", 5, "solderPaste", "sMana",null);
......
package com.neotel.smfcore.core.barcode.enums;
//物料信息来源
public class BARCODE_SOURCE {
//虚拟仓
public static final String VIRTUAL = "virtual";
}
......@@ -10,6 +10,7 @@ import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.PointUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
......@@ -87,6 +88,22 @@ public class StorageController {
@GetMapping
@PreAuthorize("@el.check('storage:list')")
public PageData<StorageDto> query(StorageQueryCriteria criteria, Pageable pageable){
List<String> storageIdList = new ArrayList<>();
Collection<Storage> storages = dataCache.getAllStorage().values();
String pageType = criteria.getPageType();
for (Storage storage : storages) {
if (BARCODE_SOURCE.VIRTUAL.equals(pageType)){
if (!storage.isVirtual()){
continue;
}
}else {
if (storage.isVirtual()){
continue;
}
}
storageIdList.add(storage.getId());
}
criteria.setStorageIdList(storageIdList);
Query query= QueryHelp.getQuery(criteria);
PageData<Storage> pages=storageManager.findByPage(query,pageable);
List<StorageDto> StorageDtos=storageMapper.toDto(pages.getContent());
......@@ -146,7 +163,7 @@ public class StorageController {
@ApiOperation("根据组权限返回所有料仓")
@GetMapping(value = "/all")
// @PreAuthorize("@el.check('storage:list')")
public List<StorageSearchDto> query(String groupId) {
public List<StorageSearchDto> query(String groupId,String type) {
// String userId = SecurityUtils.getCurrentUserId();
// User user = userManager.get(userId);
Set<String> mygroups = new HashSet<>();
......@@ -164,6 +181,15 @@ public class StorageController {
List<Storage> myStorages = new ArrayList<>();
for (Storage s : allStorages
) {
if (BARCODE_SOURCE.VIRTUAL.equals(type)){
if (!s.isVirtual()){
continue;
}
} else {
if (s.isVirtual()){
continue;
}
}
if (mygroups != null && !mygroups.isEmpty()) {
if (mygroups.contains(s.getGroupId())) {
myStorages.add(s);
......@@ -285,12 +311,20 @@ public class StorageController {
}
@ApiOperation("返回所有料仓类型")
@GetMapping(value = "/typeList")
public List<String> typeList() {
public List<String> typeList(String type) {
List<DeviceType> availableTypeList= DeviceType.availableTypeList();
List<String> allList=new ArrayList<>();
for (DeviceType type :
for (DeviceType deviceType :
availableTypeList) {
allList.add(type.getName());
if (BARCODE_SOURCE.VIRTUAL.equals(type)){
if (DeviceType.VIRTUAL.getName().equals(deviceType.getName())) {
allList.add(deviceType.getName());
}
}else {
if (!DeviceType.VIRTUAL.getName().equals(deviceType.getName())) {
allList.add(deviceType.getName());
}
}
}
return allList;
}
......
......@@ -11,6 +11,7 @@ import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE;
import com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto;
import com.neotel.smfcore.core.barcode.rest.bean.dto.CodeDto;
import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.CodeMapper;
......@@ -94,7 +95,25 @@ public class StoragePosController {
if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
criteria.setStorageIdList(null);
}
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
List<String> storageIdList = new ArrayList<>();
List<String> groupStorageIdList = QueryHelp.getGroupStorageIdList(criteria.getStorageIdList());
if (groupStorageIdList != null && !groupStorageIdList.isEmpty()){
for (String groupId : groupStorageIdList) {
Storage storage = dataCache.getStorageById(groupId);
if (BARCODE_SOURCE.VIRTUAL.equals(criteria.getType())){
if (storage.isVirtual()){
storageIdList.add(groupId);
}
} else {
if (!storage.isVirtual()){
storageIdList.add(groupId);
}
}
}
}
criteria.setStorageIdList(storageIdList);
String blurry = criteria.getBlurry();
if(!Strings.isNullOrEmpty(blurry)){
//去除库位中的SOxxxx
......
......@@ -36,4 +36,6 @@ public class StoragePosQueryCriteria {
@ApiModelProperty("是否使用")
@QueryCondition
private Boolean used;
private String type;
}
......@@ -6,6 +6,8 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
@Data
public class StorageQueryCriteria {
@QueryCondition(blurry = "name,cid")
......@@ -22,4 +24,9 @@ public class StorageQueryCriteria {
private String cid;
@QueryCondition
private String type;
@QueryCondition(type = QueryCondition.Type.IN, propName = "id")
private List<String> storageIdList;
private String pageType;
}
package com.neotel.smfcore.core.virtual.controller;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
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.rest.bean.mapstruct.TaskMapper;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
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.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "虚拟仓操作")
@Slf4j
@RequestMapping("/virtualOperate")
@RestController
public class VirtualOperateController {
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
private CodeResolve codeResolve;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private IComponentManager componentManager;
@Autowired
private TaskService taskService;
@Autowired
private IDataLogManager dataLogManager;
@Autowired
private BarcodeMapper barcodeMapper;
@Autowired
private DataCache dataCache;
@Autowired
private TaskMapper taskMapper;
@ApiOperation("物料放入料盒中")
@PostMapping(value = "/reelToBox")
@AnonymousAccess
public ResultBean reelToBox(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("barcode");//料盒条码
String operageStr = paramMap.get("operatePN");//操作信息
//判断条码是否存在
Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
}
//判断是不是按料号进行入库
Component component = componentManager.findOneByPN(operageStr);
if (component != null) {
return ResultBean.newOkResult(operageStr);
}
//解析物料信息
String newCodeStr = "=1x1=" + operageStr;
CodeBean codeBean = codeResolve.resolveSingleCode(newCodeStr);
if (!codeBean.isValid()){
return ResultBean.newOkResult(operageStr);
}
//判断物料是否存在库位中
Barcode subBarcode = codeBean.getBarcode();
StoragePos pos = storagePosManager.getByBarcode(subBarcode.getBarcode());
if (pos != null) {
throw new ValidateException("smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()});
}
String hostBarcodeId = subBarcode.getHostBarcodeId();
if (StringUtils.isNotEmpty(hostBarcodeId)){
Barcode hostBarcode = barcodeManager.get(hostBarcodeId);
if (hostBarcode != null){
throw new ValidateException("smfcore.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()});
}
}
//设置数量
int newCount = subBarcode.getAmount();
if (newCount <= 0) {
newCount = 1;
}
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(newCount);
barcodeManager.saveBarcode(subBarcode);
barcode = finishTask(barcode, OP.PUT_IN, subBarcode, subBarcode.getAmount());
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]入库到料盒[" + barcode.getBarcode() + "]数量:" + barcode.getAmount());
return ResultBean.newOkResult("");
}
@ApiOperation("物料从料盒中取出")
@PostMapping(value = "/reelFromBox")
@AnonymousAccess
public ResultBean reelFromBox(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("barcode");//料盒条码
String operageStr = paramMap.get("operatePN");//操作信息
Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
}
//返回料盒信息
Component component = componentManager.findOneByPN(operageStr);
if (component != null) {
return ResultBean.newOkResult(operageStr);
}
CodeBean codeBean = codeResolve.resolveSingleCode(operageStr);
if (!codeBean.isValid()) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{operageStr});
}
//判断是否在此料箱中
Barcode subBarcode = codeBean.getBarcode();
String hostBarcodeId = subBarcode.getHostBarcodeId();
if (StringUtils.isEmpty(hostBarcodeId)) {
throw new ValidateException("smfcore.materialBox.noReel", "料盒中未找到对应物料");
}
if (hostBarcodeId.equals(barcode.getId())) {
int qty = subBarcode.getAmount();
//出库
subBarcode.setAmount(0);
finishTask(barcode, OP.CHECKOUT, subBarcode, qty);
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]从料盒[" + barcode.getBarcode() + "]出库,数量:" + qty);
} else {
//在别的料盒中
Barcode hostBarcode = barcodeManager.get(subBarcode.getHostBarcodeId());
if (hostBarcode != null) {
throw new ValidateException("smfcore.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()});
}
}
return ResultBean.newOkResult("");
}
@ApiOperation("按pn进行入库或者出库调用")
@PostMapping(value = "/sureOperate")
@PreAuthorize("@el.check('materialBox')")
public ResultBean sureOperate(@RequestBody Map<String, String> paramMap) {
Barcode barcode = null;
try {
//1.查找元器件pn是否存在,存在时需要弹框输入数量
//2.pn不存在,解析条码 成功,作为RI处理
//解析不成功,当做PN自动生成
String code = paramMap.get("barcode");//料盒条码
String operageStr = paramMap.get("operatePN");//操作信息
String qtyStr = paramMap.get("qty");//数量
int opQty = Integer.valueOf(qtyStr);
barcode = barcodeManager.findByBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
}
//用+或-分割,如果最后几位是数量,按手动输入处理
String pnStr = operageStr;
int opType = OP.NON_OP;
if (opQty < 0) {
opType = OP.CHECKOUT;
} else if (opQty > 0) {
opType = OP.PUT_IN;
} else {
//请输入正确的数量
throw new ValidateException("smfcore.materialBox.qtyError", "请输入正确的数量");
}
Component component = autoGetComponent(pnStr, opQty);
//查看该库位中是否有相同的物料,有的话,数量累加
Barcode subBarcode = barcode.getSubCode(pnStr);
if (opType == OP.PUT_IN) {
//入库
if (subBarcode != null) {
int oldAmount = subBarcode.getAmount();
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(oldAmount + opQty);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, opType, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + oldAmount + " + " + opQty + " = " + subBarcode.getAmount());
} else {
subBarcode = autoGetBarcode(barcode, component, pnStr, opQty);
barcode = finishTask(barcode, opType, subBarcode, opQty);
log.info(barcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + barcode.getAmount());
}
} else {
//出库
if (subBarcode != null) {
int oldAmount = subBarcode.getAmount();
if (oldAmount < opQty) {
throw new ValidateException("smfcore.materialBox.quantityshort", "物料数量不足");
}
int newAmount = oldAmount - opQty;
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(newAmount);
subBarcode = barcodeManager.save(subBarcode);
barcode = finishTask(barcode, opType, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒[" + barcode.getPosName() + "]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
} else {
//无库存
throw new ValidateException("smfcore.materialBox.noReel", "料盒中未找到对应物料");
}
}
} catch (Exception e) {
log.error(e.toString());
throw new ValidateException("smfcore.error", "出错{0}", new String[]{e.toString()});
}
return ResultBean.newOkResult(barcodeMapper.toDto(barcode));
}
@ApiOperation("料箱/物料放到库位中")
@PostMapping(value = "/boxToPosName")
@AnonymousAccess
public ResultBean boxToPosName(@RequestBody Map<String, String> paramMap) {
String boxStr = paramMap.get("boxStr");
String posNameStr = paramMap.get("posName");
String describe = paramMap.get("describe");
//判断料箱是否存在
Barcode barcode = barcodeManager.findByBarcode(boxStr);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{boxStr});
}
//判断物料是否存在库位中
if (StringUtils.isNotEmpty(barcode.getPosName())) {
throw new ValidateException("smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{barcode.getPosName()});
}
//判断库位是否存在
StoragePos pos = storagePosManager.getByPosName(posNameStr);
if (pos == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"posName", posNameStr});
}
Barcode posBarcode = pos.getBarcode();
if (posBarcode != null) {
throw new ValidateException("smfcore.error.pos.hasReel", "库位[{0}]中已有物料,无法入库", new String[]{posNameStr});
}
//判断是不是虚拟仓的库位
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (!storage.isVirtual()) {
throw new ValidateException("smfcore.pos.noVirtual", "[{0}]不是虚拟仓的库位", new String[]{posNameStr});
}
barcode.setDescribe(describe);
//开始入库
taskService.addTaskToFinished(pos, barcode, SecurityUtils.getLoginUsername());
return ResultBean.newOkResult("");
}
@ApiOperation("料箱或者物料从库位中取出")
@RequestMapping(value = "/boxOutFromPosName")
@AnonymousAccess
public ResultBean boxOutFromPosName(@RequestBody Map<String, String> paramMap) {
String boxStr = paramMap.get("boxStr");
//判断料箱是否存在
Barcode barcode = codeResolve.resolveOneValideBarcode(boxStr);
if (barcode == null) {
throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{boxStr});
}
//判断库位是否存在
StoragePos pos = storagePosManager.getByBarcode(barcode.getBarcode());
if (pos == null) {
throw new ValidateException("smfcore.virtual.posNoBarcode", "[{0}]不在库位中", new String[]{barcode.getBarcode()});
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (!storage.isVirtual()){
throw new ValidateException("smfcore.virtual.barcodeNotExistVirtualPos", "[{0}]库位为[{1}],不属于虚拟仓库位", new String[]{barcode.getBarcode(),pos.getPosName()});
}
//开始入库
taskService.addTaskToFinished(pos, barcode, SecurityUtils.getLoginUsername());
return ResultBean.newOkResult("");
}
@ApiOperation("取出物料")
@PostMapping("exeOut")
@PreAuthorize("@el.check('materialBox')")
public ResultBean exeOut(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("barcode");//料盒条码
String subPN = paramMap.get("subPN");//物料条码
String qtyStr = paramMap.get("qty");//数量
Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
Barcode subBarcode = barcode.getSubCode(subPN);
if (subBarcode == null) {
throw new ValidateException("smfcore.materialBox.noReel", "料盒中未找到对应物料");
}
int opQty = Integer.valueOf(qtyStr);
int oldAmount = subBarcode.getAmount();
if (oldAmount < opQty) {
throw new ValidateException("smfcore.materialBox.quantityshort", "物料数量不足");
}
int newAmount = oldAmount - opQty;
subBarcode.setAmount(newAmount);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, OP.CHECKOUT, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒[" + barcode.getPosName() + "]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
return ResultBean.newOkResult("");
}
@ApiOperation("获取虚拟仓任务")
@RequestMapping("/getVirtualTask")
@AnonymousAccess
public ResultBean getVirtualTask() {
List<DataLog> resultTaskList = new ArrayList<>();
for (DataLog task : taskService.getAllTasks()) {
if (BARCODE_SOURCE.VIRTUAL.equals(task.getSourceType())) {
resultTaskList.add(task);
continue;
}
String storageId = task.getStorageId();
if (StringUtils.isNotEmpty(storageId)) {
Storage storage = dataCache.getStorageById(storageId);
if (storage.isVirtual()) {
resultTaskList.add(task);
continue;
}
}
}
if (resultTaskList != null && !resultTaskList.isEmpty()) {
resultTaskList = resultTaskList.stream().sorted(Comparator.comparing(DataLog::getCreateDate).reversed()).collect(Collectors.toList());
}
return ResultBean.newOkResult(taskMapper.toDto(resultTaskList));
}
@ApiOperation("获取列表信息")
@RequestMapping("/getVirtualListInformation")
@AnonymousAccess
public ResultBean getVirtualListInformation() {
Map<String, Integer> resultMap = new HashMap<>();
int reelCount = 0;
int boxCount = 0;
int todayInCount = 0;
int todayOutCount = 0;
List<String> virtualStorageIdList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
if (storage.isVirtual()) {
virtualStorageIdList.add(storage.getId());
}
}
if (virtualStorageIdList != null && !virtualStorageIdList.isEmpty()) {
Criteria c = Criteria.where("storageId").in(virtualStorageIdList);
Query q = new Query(c);
q.fields().include("barcode.type");
List<StoragePos> storagePosList = storagePosManager.findByQuery(q);
if (storagePosList != null && !storagePosList.isEmpty()) {
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode != null){
//COMPONENT_TYPE.FIXTURE 为料箱数据
if (barcode.getType() == COMPONENT_TYPE.FIXTURE){
boxCount ++;
} else {
reelCount ++;
}
}
}
}
//获取到进入出入库数据
Date startDate = DateUtil.addDaysFromToday(0);
Date endDate = DateUtil.addDays(startDate,1);
c = Criteria.where("createDate").gte(startDate).lt(endDate).and("status").in(OP_STATUS.FINISHED.name(),OP_STATUS.END.name());
q = new Query(c);
q.fields().include("storageId","sourceType");
List<DataLog> dataLogList = dataLogManager.findByQuery(q);
if (dataLogList != null && !dataLogList.isEmpty()){
for (DataLog dataLog : dataLogList) {
String storageId = dataLog.getStorageId();
if (StringUtils.isNotEmpty(storageId)){
Storage storage = dataCache.getStorageById(storageId);
if (storage.isVirtual()) {
if (dataLog.isCheckOutTask()){
todayOutCount ++;
} else {
todayInCount ++;
}
continue;
}
}
if (BARCODE_SOURCE.VIRTUAL.equals(dataLog.getSourceType())){
if (dataLog.isCheckOutTask()){
todayOutCount ++;
} else {
todayInCount ++;
}
}
}
}
}
resultMap.put("reelCount", reelCount);
resultMap.put("boxCount", boxCount);
resultMap.put("todayInCount", todayInCount);
resultMap.put("todayOutCount", todayOutCount);
return ResultBean.newOkResult(resultMap);
}
/**
* 完成出入库任务
* @param pidBarcode 料箱
* @param subBarcode 箱内物料
* @param opQty 数量
* @throws ValidateException*/
private Barcode finishTask(Barcode pidBarcode, int opType, Barcode subBarcode, int opQty) throws ValidateException {
//更新barcode缓存
pidBarcode.UpdateSubCode(subBarcode);
if (opType == OP.CHECKOUT && subBarcode.getAmount() <= 0) {
//数量为0直接删除
barcodeManager.delete(subBarcode);
}
barcodeManager.saveBarcode(pidBarcode);
DataLog task = new DataLog();
task.setStatus(OP_STATUS.FINISHED.name());
task.setPartNumber(subBarcode.getPartNumber());
task.setBarcode(subBarcode.getBarcode());
task.setNum(opQty);
task.setType(opType);
if (task.isCheckOutTask()) {
opQty = -opQty;
}
task.setCid(pidBarcode.getPartNumber());
task.setStorageName(pidBarcode.getBarcode());
task.setPosName(pidBarcode.getBarcode());
task.setOperator(SecurityUtils.getLoginUsername());
task.setSourceType(BARCODE_SOURCE.VIRTUAL);
task = dataLogManager.save(task);
taskService.moveTaskToFinished(task);
return pidBarcode;
}
private Barcode autoGetBarcode(Barcode barcode,Component component, String pnStr,int opQty){
//条码设置为P+PosId+C+ComponentId
String barcodeStr = "P" + barcode.getId() + "C" + component.getId();
Barcode subBarcode = barcodeManager.findByBarcode(barcodeStr);
if (subBarcode == null) {
//不存在,需要创建条码和库位
subBarcode = new Barcode();
subBarcode.setBarcode(barcodeStr);
subBarcode.setPlateSize(1);
subBarcode.setHeight(1);
subBarcode.setPartNumber(pnStr);
}
subBarcode.setAmount(opQty);
subBarcode.setUsedDate(new Date());
subBarcode.setPutInTime(System.currentTimeMillis());
subBarcode.updateSluggishTime(dataCache.getPNsluggishDay(barcode.getPartNumber()));
subBarcode.setCheckOutDate(null, "");
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode = barcodeManager.save(subBarcode);
return subBarcode;
}
private Component autoGetComponent(String pnStr,int opQty){
Component component = componentManager.findOneByPN(pnStr);
if(component == null){
component = new Component();
component.setHeight(1);
component.setPartNumber(pnStr);
component.setPlateSize(1);
component.setType(COMPONENT_TYPE.OTHERS);
component.setAmount(opQty);
component = componentManager.save(component);
}
return component;
}
}
......@@ -423,4 +423,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
\ No newline at end of file
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
smfcore.pos.noVirtual=[{0}]\u4E0D\u662F\u865A\u62DF\u4ED3\u7684\u5E93\u4F4D
smfcore.virtual.posNoBarcode=[{0}]\u4E0D\u5728\u5E93\u4F4D\u4E2D
smfcore.virtual.barcodeNotExistVirtualPos=[{0}]\u5E93\u4F4D\u4E3A[{1}],\u4E0D\u5C5E\u4E8E\u865A\u62DF\u4ED3\u5E93\u4F4D
smfcore.virtual=\u865A\u62DF\u4ED3
smfcore.virtualManager=\u865A\u62DF\u4ED3\u7BA1\u7406
smfcore.virtualLocationManager=\u865A\u62DF\u5E93\u4F4D\u7BA1\u7406
smfcore.virtualOperations=\u865A\u62DF\u4ED3\u64CD\u4F5C
\ No newline at end of file
......@@ -413,4 +413,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Log-\u00DCberwachung
smfcore.materialTrace=Materialverfolgung
smfcore.message.critical=Kritischer Fehler
\ No newline at end of file
smfcore.message.critical=Kritischer Fehler
smfcore.pos.noVirtual=[{0}] ist kein virtueller Lagerplatz
smfcore.virtual.posNoBarcode=[{0}] ist nicht im Lagerplatz
smfcore.virtual.barcodeNotExistVirtualPos=[{0}] Lagerplatz [{1}] geh\u00F6rt nicht zum virtuellen Lagerplatz
smfcore.virtual=Virtuelles Lager
smfcore.virtualManager=Verwaltung des virtuellen Lagers
smfcore.virtualLocationManager=Verwaltung virtueller Lagerpl\u00E4tze
smfcore.virtualOperations=Vorg\u00E4nge im virtuellen Lager
\ No newline at end of file
......@@ -414,4 +414,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Log Monitoring
smfcore.materialTrace=Material Trace
smfcore.message.critical=Critical
\ No newline at end of file
smfcore.message.critical=Critical
smfcore.pos.noVirtual=[{0}] is not a virtual warehouse location
smfcore.virtual.posNoBarcode=[{0}] is not in the storage location
smfcore.virtual.barcodeNotExistVirtualPos=[{0}] Storage location [{1}] does not belong to the virtual warehouse location
smfcore.virtual=Virtual Warehouse
smfcore.virtualManager=Virtual Warehouse Management
smfcore.virtualLocationManager=Virtual Location Management
smfcore.virtualOperations=Virtual Warehouse Operations
\ No newline at end of file
......@@ -413,4 +413,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=Surveillance des Journaux
smfcore.materialTrace=Tra\u00E7abilit\u00E9 des mati\u00E8res
smfcore.message.critical=Erreur Critique
\ No newline at end of file
smfcore.message.critical=Erreur Critique
smfcore.pos.noVirtual=[{0}] n'est pas un emplacement d'entrep\u00F4t virtuel
smfcore.virtual.posNoBarcode=[{0}] n'est pas dans l'emplacement de stockage
smfcore.virtual.barcodeNotExistVirtualPos=[{0}] L'emplacement [{1}] n'appartient pas \u00E0 l'emplacement de stockage virtuel
smfcore.virtual=Entrep\u00F4t virtuel
smfcore.virtualManager=Gestion de l'entrep\u00F4t virtuel
smfcore.virtualLocationManager=Gestion des emplacements virtuels
smfcore.virtualOperations=Op\u00E9rations de l'entrep\u00F4t virtuel
\ No newline at end of file
......@@ -410,4 +410,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u30ED\u30B0\u76E3\u8996
smfcore.materialTrace=\u30DE\u30C6\u30EA\u30A2\u30EB\u30C8\u30EC\u30FC\u30B9
smfcore.message.critical=\u91CD\u5927\u30A8\u30E9\u30FC
\ No newline at end of file
smfcore.message.critical=\u91CD\u5927\u30A8\u30E9\u30FC
smfcore.pos.noVirtual=[{0}]\u306F\u4EEE\u60F3\u5009\u5EAB\u306E\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u3067\u306F\u3042\u308A\u307E\u305B\u3093
smfcore.virtual.posNoBarcode=[{0}]\u306F\u5728\u5EAB\u5834\u6240\u306B\u3042\u308A\u307E\u305B\u3093
smfcore.virtual.barcodeNotExistVirtualPos=[{0}] \u30ED\u30B1\u30FC\u30B7\u30E7\u30F3[{1}]\u306F\u4EEE\u60F3\u5009\u5EAB\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u306B\u5C5E\u3057\u3066\u3044\u307E\u305B\u3093
smfcore.virtual=\u4EEE\u60F3\u5009\u5EAB
smfcore.virtualManager=\u4EEE\u60F3\u5009\u5EAB\u7BA1\u7406
smfcore.virtualLocationManager=\u4EEE\u60F3\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u7BA1\u7406
smfcore.virtualOperations=\u4EEE\u60F3\u5009\u5EAB\u64CD\u4F5C
\ No newline at end of file
......@@ -410,4 +410,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u5FD7\u76D1\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
\ No newline at end of file
smfcore.message.critical=\u4E25\u91CD\u9519\u8BEF
smfcore.pos.noVirtual=[{0}]\u4E0D\u662F\u865A\u62DF\u4ED3\u7684\u5E93\u4F4D
smfcore.virtual.posNoBarcode=[{0}]\u4E0D\u5728\u5E93\u4F4D\u4E2D
smfcore.virtual.barcodeNotExistVirtualPos=[{0}]\u5E93\u4F4D\u4E3A[{1}],\u4E0D\u5C5E\u4E8E\u865A\u62DF\u4ED3\u5E93\u4F4D
smfcore.virtual=\u865A\u62DF\u4ED3
smfcore.virtualManager=\u865A\u62DF\u4ED3\u7BA1\u7406
smfcore.virtualLocationManager=\u865A\u62DF\u5E93\u4F4D\u7BA1\u7406
smfcore.virtualOperations=\u865A\u62DF\u4ED3\u64CD\u4F5C
\ No newline at end of file
......@@ -410,4 +410,11 @@ smfcore.language.displayLanName.fr-FR=Fran\u00E7ais
smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor=\u65E5\u8A8C\u76E3\u63A7
smfcore.materialTrace=\u7269\u6599\u8FFD\u6EAF
smfcore.message.critical=\u56B4\u91CD\u932F\u8AA4
\ No newline at end of file
smfcore.message.critical=\u56B4\u91CD\u932F\u8AA4
smfcore.pos.noVirtual=[{0}]\u4E0D\u662F\u865B\u64EC\u5009\u7684\u5EAB\u4F4D
smfcore.virtual.posNoBarcode=[{0}]\u4E0D\u5728\u5EAB\u4F4D\u4E2D
smfcore.virtual.barcodeNotExistVirtualPos=[{0}]\u5EAB\u4F4D\u70BA[{1}]\uFF0C\u4E0D\u5C6C\u65BC\u865B\u64EC\u5009\u5EAB\u4F4D
smfcore.virtual=\u865B\u64EC\u5009
smfcore.virtualManager=\u865B\u64EC\u5009\u7BA1\u7406
smfcore.virtualLocationManager=\u865B\u64EC\u5EAB\u4F4D\u7BA1\u7406
smfcore.virtualOperations=\u865B\u64EC\u5009\u64CD\u4F5C
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!