Commit 72e0d79b LN

手动取消入库任务时禁用库位

1 个父辈 89a914a8
......@@ -23,6 +23,6 @@ public class HumitureQueryCriteria {
private String humitureId;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "createDate")
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private BetweenData<Date> createDate;
}
......@@ -234,7 +234,7 @@ public class TaskController {
if(task.isCancel()||task.isFinished()||task.isEnd()){
throw new ValidateException("smfcore.taskHasEnd","任务{0}已取消或已结束",new String[]{task.getPosName()} );
}
taskService.cancelTask(taskId);
taskService.cancelTaskAndDisPos(taskId);
}
return new ResponseEntity<>(HttpStatus.OK);
}
......
......@@ -16,6 +16,7 @@ import com.neotel.smfcore.core.device.bean.StatusBean;
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.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE;
......@@ -243,6 +244,29 @@ public class TaskService {
return cancelTask(task);
}
public boolean cancelTaskAndDisPos(String taskId) {
DataLog task = dataLogDao.findOneById(taskId);
boolean result = cancelTask(task);
if (result) {
if (task.isPutInTask()) {
//禁用库位
StoragePos pos = storagePosManager.get(task.getPosId());
if (pos != null) {
pos.setEnabled(false);
storagePosManager.save(pos);
dataCache.updateDisablePos(pos);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功,禁用库位[" + task.getPosName() + "]");
DeviceMessageUtil.addEnabledPosMessage(pos, SecurityUtils.getCurrentUsername());
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage != null) {
dataCache.reloadStorage(storage, storage.getCid());
}
}
}
}
return result;
}
/**
* 清除某个已经完成或取消的任务
*/
......
......@@ -57,12 +57,15 @@ public class MicronDeviceController {
// String[] types=new String[]{"pizzaBox","pcb","tray","reel"};
Map<String, Integer> resultMap = new HashMap<>();
for (DataLog task : dataLogs
) {
String taskType = MicronDataCache.GetMaterialType(task);
int count = resultMap.getOrDefault(taskType, 0) + 1;
resultMap.put(taskType, count);
String key = taskType + "_out";
if (task.isPutInTask()) {
key = taskType + "_in";
}
int count = resultMap.getOrDefault(key, 0) + 1;
resultMap.put(key, count);
}
return ResultBean.newOkResult(resultMap);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!