no message
parent
46236c69d9
commit
b31e2f2e27
|
|
@ -70,14 +70,6 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
@Query("from Task t where t.pickDetail.id =:pickDetailId and t.planQty > t.moveQty")
|
@Query("from Task t where t.pickDetail.id =:pickDetailId and t.planQty > t.moveQty")
|
||||||
List<Task> findByPickDetailNotAllTask(Long pickDetailId);
|
List<Task> findByPickDetailNotAllTask(Long pickDetailId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据出库单明细查询已完成的Task集合
|
|
||||||
*
|
|
||||||
* @param pickDetailId 出库明细ID
|
|
||||||
*/
|
|
||||||
@Query("from Task t where t.pickDetail.id =:pickDetailId and t.planQty = t.moveQty")
|
|
||||||
List<Task> findByPickDetailAllTask(Long pickDetailId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询任务列表
|
* 查询任务列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.rest;
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
|
|
@ -20,6 +20,7 @@ import com.youchain.annotation.Log;
|
||||||
import com.youchain.businessdata.domain.Task;
|
import com.youchain.businessdata.domain.Task;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.service.TaskService;
|
||||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||||
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -29,14 +30,18 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author houjianlan
|
||||||
* @author houjianlan
|
* @website https://eladmin.vip
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "task管理")
|
@Api(tags = "task管理")
|
||||||
|
|
@ -45,6 +50,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
public class TaskController {
|
public class TaskController {
|
||||||
|
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
|
|
@ -55,38 +61,38 @@ public class TaskController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询task")
|
@ApiOperation("查询task")
|
||||||
public ResponseEntity<Object> queryTask(TaskQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTask(TaskQueryCriteria criteria, Pageable pageable) {
|
||||||
return new ResponseEntity<>(taskService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(taskService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/queryAsnTask")
|
@GetMapping(value = "/queryAsnTask")
|
||||||
@ApiOperation("查询task")
|
@ApiOperation("查询task")
|
||||||
public ResponseEntity<Object> queryAsnTask(TaskQueryCriteria criteria){
|
public ResponseEntity<Object> queryAsnTask(TaskQueryCriteria criteria) {
|
||||||
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(taskService.queryAll(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/queryPickTask")
|
@GetMapping("/queryPickTask")
|
||||||
@Log("拣货确认-拣货记录")
|
@Log("拣货确认-拣货记录")
|
||||||
@ApiOperation("拣货确认-拣货记录")
|
@ApiOperation("拣货确认-拣货记录")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryPickTask(TaskQueryCriteria criteria){
|
public ResponseEntity<Object> queryPickTask(TaskQueryCriteria criteria) {
|
||||||
return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(taskService.queryAll(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增task")
|
@Log("新增task")
|
||||||
@ApiOperation("新增task")
|
@ApiOperation("新增task")
|
||||||
@PreAuthorize("@el.check('task:add')")
|
@PreAuthorize("@el.check('task:add')")
|
||||||
public ResponseEntity<Object> createTask(@Validated @RequestBody Task resources){
|
public ResponseEntity<Object> createTask(@Validated @RequestBody Task resources) {
|
||||||
return new ResponseEntity<>(taskService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(taskService.create(resources), HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改task")
|
@Log("修改task")
|
||||||
@ApiOperation("修改task")
|
@ApiOperation("修改task")
|
||||||
@PreAuthorize("@el.check('task:edit')")
|
@PreAuthorize("@el.check('task:edit')")
|
||||||
public ResponseEntity<Object> updateTask(@Validated @RequestBody Task resources){
|
public ResponseEntity<Object> updateTask(@Validated @RequestBody Task resources) {
|
||||||
taskService.update(resources);
|
taskService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
@ -99,4 +105,18 @@ public class TaskController {
|
||||||
taskService.deleteAll(ids);
|
taskService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/cancelAllocate")
|
||||||
|
@Log("手工取消")
|
||||||
|
@ApiOperation("手工取消")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> cancelAllocate(long pickDetailId, double quantity) {
|
||||||
|
try {
|
||||||
|
taskService.cancelAllocate(pickDetailId, quantity);
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,12 +145,6 @@ public interface TaskService {
|
||||||
*/
|
*/
|
||||||
List<Task> findByPickDetailNotAllTask(Long pickDetailId);
|
List<Task> findByPickDetailNotAllTask(Long pickDetailId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据出库单明细查询已完成的Task集合
|
|
||||||
*
|
|
||||||
* @param pickDetailId 明细ID
|
|
||||||
*/
|
|
||||||
List<Task> findByPickDetailAllTask(Long pickDetailId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询任务集合
|
* 查询任务集合
|
||||||
|
|
@ -174,10 +168,6 @@ public interface TaskService {
|
||||||
*/
|
*/
|
||||||
void materialPick();
|
void materialPick();
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务轮询叫料反空车至备料缓存区
|
|
||||||
*/
|
|
||||||
void callEmptyStock(Point point);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务轮询出库单叫料
|
* 定时任务轮询出库单叫料
|
||||||
|
|
@ -215,7 +205,7 @@ public interface TaskService {
|
||||||
*
|
*
|
||||||
* @param taskId 任务ID
|
* @param taskId 任务ID
|
||||||
*/
|
*/
|
||||||
void pickBarBack(long taskId, double pickedQuantity) throws Exception;
|
void pickBarBack(long taskId, double pickedQuantity);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,11 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AgvTask findById(Long id) {
|
public AgvTask findById(Long id) {
|
||||||
return agvTaskRepository.findById(id).orElseGet(AgvTask::new);
|
AgvTask agvTask = agvTaskRepository.findById(id).orElseGet(AgvTask::new);
|
||||||
|
if (agvTask.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return agvTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -175,7 +179,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
" and agv.status not in ('OPEN','FINISH','CANCEL') ";
|
" and agv.status not in ('OPEN','FINISH','CANCEL') ";
|
||||||
Query query = entityMapper.createQuery(hql);
|
Query query = entityMapper.createQuery(hql);
|
||||||
Long count = (Long) query.getSingleResult();
|
Long count = (Long) query.getSingleResult();
|
||||||
return count<2;
|
return count < 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -206,7 +210,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryWeeklyTaskCounts() {
|
public Map<String, Object> queryWeeklyTaskCounts() {
|
||||||
List<Object[]> objectList = agvTaskRepository.queryWeeklyTaskCounts();
|
List<Object[]> objectList = agvTaskRepository.queryWeeklyTaskCounts();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.StockService;
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
import com.youchain.businessdata.domain.Inventory;
|
||||||
|
import com.youchain.businessdata.domain.InventoryLog;
|
||||||
import com.youchain.businessdata.domain.ItemKey;
|
import com.youchain.businessdata.domain.ItemKey;
|
||||||
import com.youchain.businessdata.service.InventoryLogService;
|
import com.youchain.businessdata.service.InventoryLogService;
|
||||||
import com.youchain.businessdata.service.ItemKeyService;
|
import com.youchain.businessdata.service.ItemKeyService;
|
||||||
|
|
@ -90,7 +91,11 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory findById(Long id) {
|
public Inventory findById(Long id) {
|
||||||
return inventoryRepository.findById(id).orElseGet(Inventory::new);
|
Inventory inventory = inventoryRepository.findById(id).orElseGet(Inventory::new);
|
||||||
|
if (inventory.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,11 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PickDetail findById(Long id) {
|
public PickDetail findById(Long id) {
|
||||||
return pickDetailRepository.findById(id).orElseGet(PickDetail::new);
|
PickDetail pickDetail = pickDetailRepository.findById(id).orElseGet(PickDetail::new);
|
||||||
|
if (pickDetail.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return pickDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,12 @@ public class PickServiceImpl implements PickService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public Pick findById(Long id) {
|
public Pick findById(Long id) {
|
||||||
return pickRepository.findById(id).orElseGet(Pick::new);
|
Pick pick = pickRepository.findById(id).orElseGet(Pick::new);
|
||||||
|
if (pick.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return pick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -170,7 +173,7 @@ public class PickServiceImpl implements PickService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject returnPickJson(Task task) {
|
public JSONObject returnPickJson(Task task) {
|
||||||
Pick pick=task.getPickDetail().getPick();
|
Pick pick = task.getPickDetail().getPick();
|
||||||
int complete = getCompleteStatus(pick);
|
int complete = getCompleteStatus(pick);
|
||||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
//需求工位
|
//需求工位
|
||||||
|
|
@ -181,7 +184,7 @@ public class PickServiceImpl implements PickService {
|
||||||
String itemCode = task.getPickDetail().getPropC3() == null ? task.getPickDetail().getItem().getCode() : task.getPickDetail().getPropC3();
|
String itemCode = task.getPickDetail().getPropC3() == null ? task.getPickDetail().getItem().getCode() : task.getPickDetail().getPropC3();
|
||||||
jsonObject.put("MaterialCode", itemCode);
|
jsonObject.put("MaterialCode", itemCode);
|
||||||
//数量
|
//数量
|
||||||
jsonObject.put("number", task.getMoveQty()== null ? 0 : task.getMoveQty().intValue());
|
jsonObject.put("number", task.getMoveQty() == null ? 0 : task.getMoveQty().intValue());
|
||||||
//taskId
|
//taskId
|
||||||
jsonObject.put("taskId", task.getPickDetail().getPick().getTaskCode());
|
jsonObject.put("taskId", task.getPickDetail().getPick().getTaskCode());
|
||||||
//complete 完成标识;0未完成;1完成
|
//complete 完成标识;0未完成;1完成
|
||||||
|
|
@ -203,7 +206,7 @@ public class PickServiceImpl implements PickService {
|
||||||
String message = null;
|
String message = null;
|
||||||
String resultJson = null;
|
String resultJson = null;
|
||||||
Dict dict = dictRepository.findDictByName("OPEN");
|
Dict dict = dictRepository.findDictByName("OPEN");
|
||||||
PickDetail pickDetail=task.getPickDetail();
|
PickDetail pickDetail = task.getPickDetail();
|
||||||
if (dict == null) {
|
if (dict == null) {
|
||||||
pickDetail.setSourceId(1L);
|
pickDetail.setSourceId(1L);
|
||||||
pickDetail.setSourceName("成功");
|
pickDetail.setSourceName("成功");
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,11 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Task findById(Long id) {
|
public Task findById(Long id) {
|
||||||
return taskRepository.findById(id).orElseGet(Task::new);
|
Task task = taskRepository.findById(id).orElseGet(Task::new);
|
||||||
|
if (task.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -155,11 +159,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return taskRepository.findByPickDetailNotAllTask(pickDetailId);
|
return taskRepository.findByPickDetailNotAllTask(pickDetailId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Task> findByPickDetailAllTask(Long pickDetailId) {
|
|
||||||
return taskRepository.findByPickDetailAllTask(pickDetailId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Task> findTaskByContains(String taskType, String taskStatus, String srcStockCode) {
|
public List<Task> findTaskByContains(String taskType, String taskStatus, String srcStockCode) {
|
||||||
return taskRepository.findTaskByContains(taskType, taskStatus, srcStockCode);
|
return taskRepository.findTaskByContains(taskType, taskStatus, srcStockCode);
|
||||||
|
|
@ -223,39 +222,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void callEmptyStock(Point point) {
|
|
||||||
String dstAreaCode = AreaNameDic.XJJLQ.equals(point.getArea().getName()) ? AreaNameDic.XJFBCQ : AreaNameDic.DJFBCQ;
|
|
||||||
|
|
||||||
//容器
|
|
||||||
Stock stock = stockService.findByPointCode(point.getCode());
|
|
||||||
if (stock == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//起点
|
|
||||||
Point srcPoint = stock.getPoint();
|
|
||||||
|
|
||||||
//终点
|
|
||||||
List<Point> pointList = pointService.queryPoints(null, BaseStatus.FREE, BaseStatus.BOX, dstAreaCode);
|
|
||||||
if (pointList.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Point endPoint = pointList.get(0);
|
|
||||||
|
|
||||||
//有任务则直接返回
|
|
||||||
if (!agvTaskService.findByEndSlotCode(endPoint.getCode(), BizStatus.JL_Back, "RACK_MOVE")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//终点占用
|
|
||||||
pointService.usedPoint(endPoint);
|
|
||||||
|
|
||||||
//创建任务
|
|
||||||
agvTaskService.createAgvTask(BizStatus.JL_Back, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callJlTask(Pick pick) {
|
public void callJlTask(Pick pick) {
|
||||||
|
|
@ -434,17 +400,25 @@ public class TaskServiceImpl implements TaskService {
|
||||||
for (Task task : tasks) {
|
for (Task task : tasks) {
|
||||||
//根据task找到对应的库存
|
//根据task找到对应的库存
|
||||||
Inventory inv = inventoryService.findById(task.getInvId());
|
Inventory inv = inventoryService.findById(task.getInvId());
|
||||||
inv.setQueuedQty(inv.getQueuedQty() - pd.getAllocatedQty());
|
if (inv != null) {
|
||||||
inventoryService.update(inv);
|
inv.setQueuedQty(inv.getQueuedQty() - quantity);
|
||||||
|
inventoryService.update(inv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(task.getAgvTask()!=null){
|
||||||
|
AgvTask agvTask= agvTaskService.findById(task.getAgvTask().getId());
|
||||||
|
if(agvTask!=null){
|
||||||
|
agvTaskService.deleteAll(new Long[]{agvTask.getId()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//删除Task
|
//删除Task
|
||||||
taskRepository.delete(task);
|
taskRepository.delete(task);
|
||||||
|
|
||||||
pd.setAllocatedQty(pd.getAllocatedQty() - quantity);
|
pd.setAllocatedQty(pd.getAllocatedQty() - quantity);
|
||||||
if (pd.getAllocatedQty() == 0) {
|
|
||||||
pd.setStatus(BizStatus.OPEN);
|
|
||||||
}
|
|
||||||
pickDetailService.update(pd);
|
pickDetailService.update(pd);
|
||||||
|
|
||||||
|
pickService.refreshPickStatus(pd.getPick());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -497,33 +471,36 @@ public class TaskServiceImpl implements TaskService {
|
||||||
public void pickBarBack(long taskId, double pickedQuantity) {
|
public void pickBarBack(long taskId, double pickedQuantity) {
|
||||||
Task task = findById(taskId);
|
Task task = findById(taskId);
|
||||||
PickDetail pickDetail = task.getPickDetail();
|
PickDetail pickDetail = task.getPickDetail();
|
||||||
if (task.getInvId() == null) {
|
double srcQty = 0;
|
||||||
throw new BadRequestException("未找到库存相应记录!");
|
Inventory inv = null;
|
||||||
|
if (task.getInvId() != null) {
|
||||||
|
inv = inventoryService.findById(task.getInvId());
|
||||||
|
if (inv != null) {
|
||||||
|
//退回库存
|
||||||
|
srcQty = inv.getQueuedQty();
|
||||||
|
synchronized (inv) {
|
||||||
|
inv.setQueuedQty(inv.getQueuedQty() + pickedQuantity);
|
||||||
|
inv.setQuantity(inv.getQuantity() + pickedQuantity);
|
||||||
|
inventoryService.update(inv);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Inventory inv = inventoryService.findById(task.getInvId());
|
|
||||||
|
|
||||||
//退回库存
|
//退回Task
|
||||||
double srcQty = inv.getQueuedQty();
|
task.setMoveQty(task.getMoveQty() - pickedQuantity);
|
||||||
synchronized (inv) {
|
taskRepository.save(task);
|
||||||
inv.setQueuedQty(inv.getQueuedQty() + pickedQuantity);
|
|
||||||
inv.setQuantity(inv.getQuantity() + pickedQuantity);
|
//退回拣货数量
|
||||||
inventoryService.update(inv);
|
pickDetail.setPickedQty(pickDetail.getPickedQty() - pickedQuantity);
|
||||||
|
pickDetailService.update(pickDetail);
|
||||||
|
|
||||||
|
//更新出库单状态
|
||||||
|
pickService.refreshPickStatus(pickDetail.getPick());
|
||||||
|
|
||||||
|
|
||||||
//退回Task
|
|
||||||
task.setMoveQty(task.getMoveQty() - pickedQuantity);
|
|
||||||
taskRepository.save(task);
|
|
||||||
|
|
||||||
//退回拣货数量
|
|
||||||
pickDetail.setPickedQty(pickDetail.getPickedQty() - pickedQuantity);
|
|
||||||
pickDetailService.update(pickDetail);
|
|
||||||
|
|
||||||
//更新出库单状态
|
|
||||||
pickService.refreshPickStatus(pickDetail.getPick());
|
|
||||||
|
|
||||||
}
|
|
||||||
//添加库存日志
|
//添加库存日志
|
||||||
inventoryLogService.createInventoryLog(BizStatus.PICK_CANCEL, BizStatus.ADD, task.getPickDetail().getPo(), task.getItemKey(), task.getDstPoint(), task.getSrcPoint(), task.getSrcStock(), task.getDstStock(), srcQty, pickedQuantity, BizStatus.PICK, task.getId(), inv.getId(), "");
|
inventoryLogService.createInventoryLog(BizStatus.PICK_CANCEL, BizStatus.ADD, task.getPickDetail().getPo(), task.getItemKey(), task.getDstPoint(), task.getSrcPoint(), task.getSrcStock(), task.getDstStock(), srcQty, pickedQuantity, BizStatus.PICK, task.getId(), inv == null ? null : inv.getId(), "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,8 +581,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
//更新Task
|
//更新Task
|
||||||
double planQty = task.getPlanQty();
|
double planQty = task.getPlanQty();
|
||||||
String status = task.getTaskStatus();
|
String status = task.getTaskStatus();
|
||||||
task.setInvId(inventory==null?null:inventory.getId());
|
task.setInvId(inventory == null ? null : inventory.getId());
|
||||||
task.setNewInvId(newInventory==null?null:newInventory.getId());
|
task.setNewInvId(newInventory == null ? null : newInventory.getId());
|
||||||
task.setMoveQty(task.getMoveQty() + moveQty);
|
task.setMoveQty(task.getMoveQty() + moveQty);
|
||||||
task.setDstStock(dstStock);
|
task.setDstStock(dstStock);
|
||||||
task.setDstStockCode(dstStock.getCode());
|
task.setDstStockCode(dstStock.getCode());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue