Commit 29e7db1e LN

增加并盘出库,湿敏管理功能

1 个父辈 776ff2ea
......@@ -355,6 +355,91 @@ public class StoragePosController {
}
@ApiOperation("并盘出库")
@PutMapping("/mergerCheckout")
public ResultBean mergerCheckout(@Validated @RequestBody CheckOutDto checkOutDto) {
if (checkOutDto.getPids() == null) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
if (checkOutDto.getSingleOut() == null) {
checkOutDto.setSingleOut(true + "");
}
String isSingleOutStr = checkOutDto.getSingleOut();
boolean isSingleOut = Boolean.valueOf(isSingleOutStr);
List<StoragePos> posList = new ArrayList<>();
for (String pid : checkOutDto.getPids()) {
StoragePos pos = storagePosManager.get(pid);
if (pos == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid});
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
}
if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料", new String[]{pos.getPosName()});
}
taskService.canAddTask(pos.getBarcode().getBarcode(), pos.getPosName());
posList.add(pos);
}
for (StoragePos pos : posList) {
Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info("并盘出库:料仓【" + storage.getName() + "_" + storage.getCid() + "】仓位【" + pos.getPosName() + "】");
taskService.mergerCheckout(storage, pos, isSingleOut, SecurityUtils.getCurrentUsername());
}
return ResultBean.newOkResult("");
}
@ApiOperation("湿敏物料出库查找")
@GetMapping("/findLockMsl")
@PreAuthorize("@el.check('checkOut')")
public PageData<StoragePosDto> findLockMsl(StoragePosFindCriteria criteria, Pageable pageable, HttpServletRequest request) {
Query query=getPosFindCriteria(criteria);
query.addCriteria(Criteria.where("barcode.lockMsl").is(true));
PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos, pages.getTotalElements());
}
@ApiOperation("湿敏物料出库")
@PutMapping("/lockMslOut")
@PreAuthorize("@el.check('checkOut')")
public ResultBean lockMslOut(@Validated @RequestBody CheckOutDto checkOutDto) {
if (checkOutDto.getPids() == null) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
if (checkOutDto.getSingleOut() == null) {
checkOutDto.setSingleOut(true + "");
}
String isSingleOutStr = checkOutDto.getSingleOut();
boolean isSingleOut = Boolean.valueOf(isSingleOutStr);
for (String pid : checkOutDto.getPids()) {
StoragePos pos = storagePosManager.get(pid);
if (pos == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid});
// throw new ValidateException("位置[" + pid + "]不存在");
}
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, isSingleOut,SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
}
}
return ResultBean.newOkResult("");
}
@ApiOperation("解析出库条码")
@PutMapping("/resolveCode/{blurry}")
public CodeDto resolveCode(@PathVariable String blurry) {
......
......@@ -109,24 +109,6 @@ public class TaskService {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()});
// Barcode barcode=new Barcode();
// SimpleDateFormat formatter= new SimpleDateFormat("HHmmss");
// Date date = new Date(System.currentTimeMillis());
// barcode.setBarcode("EO-"+formatter.format(date)+pos.getId());
// log.info("库位[" + pos.getPosName() + "]中已无物料,空出,模拟条码:"+barcode.getBarcode());
// barcode.setHeight(pos.getH());
// barcode.setPlateSize(pos.getW());
// barcode.setAmount(999);
// DataLog task = new DataLog(storage, barcode, pos);
// task.setType(OP.CHECKOUT);
// task.setPutInDate(barcode.getPutInDate());
// task.setStatus(OP_STATUS.WAIT.name());
// task.setSingleOut(isSingleOut);
// task.setOperator(opUserName);
// addTaskToExecute(task);
// return "";
}
DataLog task = new DataLog(storage, pos.getBarcode(), pos);
......@@ -143,6 +125,31 @@ public class TaskService {
}
/**
* 并盘出库方法,需提前验证是否可出库
* @param storage
* @param pos
* @param isSingleOut
* @param opUserName
* @return
* @throws ValidateException
*/
public synchronized void mergerCheckout(Storage storage, StoragePos pos, boolean isSingleOut, String opUserName) throws ValidateException {
if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg);
throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()});
}
DataLog task = new DataLog(storage, pos.getBarcode(), pos);
task.setType(OP.CHECKOUT);
task.setOutType(1);//并盘出库
task.setPutInDate(pos.getBarcode().getPutInDate());
task.setStatus(OP_STATUS.WAIT.name());
task.setSingleOut(isSingleOut);
task.setOperator(opUserName);
addTaskToExecute(task);
}
/**
* 触发任务状态改变事件
*
* @param task
......@@ -193,6 +200,23 @@ public class TaskService {
}
/**
* 是否可以添加任务,判断库位或条码是否已在操作中
*/
public boolean canAddTask(String barcode,String posName){
Collection<DataLog> tasks = taskMap.values();
for (DataLog task : tasks) {
if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) {
log.info("二维码:[" + barcode + "]已在操作队列中,操作失败");
throw new ValidateException("smfcore.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
} else if (task.getPosName().equals(posName)&& ObjectUtil.isNotEmpty(posName)) {
log.info("位置:[" + posName + "]已在操作队列中,操作失败");
throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
}
}
return true;
}
/**
* 获取所有任务队列中的任务(等待中和执行中)
*/
public Collection<DataLog> getQueueTasks() {
......
......@@ -15,6 +15,7 @@ import lombok.NoArgsConstructor;
public class InOutApiInfo {
// warehousingType Integer 是 入库类型(0普通入库1退料入库2并盘入库3截料入库)
// jobNo String 32 否 入库类型为退料入库的需要提供工单号
// trayId String 41 是 料盘ID/唯一码
// qty Integer 是 数量
// baseCode String 16 是 基地
......@@ -28,11 +29,14 @@ public class InOutApiInfo {
public static InOutApiInfo inputInfo(int inType,String trayId,int qty)
{
return new InOutApiInfo(inType,0,trayId,qty,"","");
return new InOutApiInfo(inType,0,trayId,qty,"","","");
}
public static InOutApiInfo inputInfo(int inType,String trayId,int qty,String jobNo)
{
return new InOutApiInfo(inType,0,trayId,qty,"","",jobNo);
}
public static InOutApiInfo outInfo(int outType,String trayId,int qty,String baseCode,String lgort){
return new InOutApiInfo(0,outType,trayId,qty,baseCode,lgort);
return new InOutApiInfo(0,outType,trayId,qty,baseCode,lgort,"");
}
/**
......@@ -59,4 +63,9 @@ public class InOutApiInfo {
* 库位
*/
private String lgort;
/**
* 入库类型为退料入库的需要提供工单号
*/
private String jobNo;
}
......@@ -13,16 +13,15 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class ScheduleTaskInfo {
// jobNo String 32 是 工单号/合单号
//jobNo String 32 是 工单号/合单号
// replenishmentNo String 32 否 补料单号(补料单业务补料单为必填项)
// station String 40 是 站位号
// factoryCode String 8 是 工厂
// baseCode String 8 是 基地
// lgort  String 8 是 库位
// qty Integer 数量
// interceptFlag Integer 截料标识(0为不截料,1为截料)
// interceptQty Integer 截料数量
// trayId String 41 是 料盘ID
/**
* 工单号/合单号
*/
......@@ -38,7 +37,7 @@ public class ScheduleTaskInfo {
/**
*工厂
*/
private String factoryCode;
private String baseCode;
/**
*库位
*/
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!