|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const ABORT_SIGNAL = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const DEFAULT_PAGE_SIZE = 10; | 
|---|
|  |  |  | export const DEFAULT_PAGE_SIZE = 15; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const DEFAULT_ITEM_PAGE_SIZE = 10; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | siteInit: 'site init', | 
|---|
|  |  |  | batch: 'batch', | 
|---|
|  |  |  | pick: 'Pick', | 
|---|
|  |  |  | check: 'Check', | 
|---|
|  |  |  | confirm: 'confirm', | 
|---|
|  |  |  | cancel: "cancel", | 
|---|
|  |  |  | query: "Query", | 
|---|
|  |  |  | 
|---|
|  |  |  | continue: '继续收货', | 
|---|
|  |  |  | batch: '批量操作', | 
|---|
|  |  |  | confirm: '确认', | 
|---|
|  |  |  | check: '盘点', | 
|---|
|  |  |  | pick: '拣料', | 
|---|
|  |  |  | bulkExport: "批量导出", | 
|---|
|  |  |  | selectSite: '选择站点', | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | editMode="row" | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50]} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Box > | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | editMode="row" | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | editMode="row" | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | editMode="row" | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | editMode="row" | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | pageSizeOptions={[10, 25, 50, 100]} | 
|---|
|  |  |  | pageSizeOptions={[15, 25, 50, 100]} | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | selectionModel={selectedRows} | 
|---|
|  |  |  | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  | import ColorizeOutlinedIcon from '@mui/icons-material/ColorizeOutlined'; | 
|---|
|  |  |  | import GradingOutlinedIcon from '@mui/icons-material/GradingOutlined'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | <EditButton label="toolbar.detail" /> | 
|---|
|  |  |  | <DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton> | 
|---|
|  |  |  | <CancelButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | <CheckButton /> | 
|---|
|  |  |  | <PickButton /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | 
|---|
|  |  |  | export default TaskList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const CheckButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const checkClick = async () => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/task/pick/` + record.id); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | refresh(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return (record?.taskStatus == 199 && record?.taskType == 107 ? <ConfirmButton label={"toolbar.check"} startIcon={<GradingOutlinedIcon />} onConfirm={checkClick} /> : <></>) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 拣料出库 | 
|---|
|  |  |  | * @returns | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok().add(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成库存出库任务 | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:locItem:list')") | 
|---|
|  |  |  | @PostMapping("/locItem/generate/task") | 
|---|
|  |  |  | public R generateTask(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return locItemService.generateTask(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成移库任务 | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:locItem:list')") | 
|---|
|  |  |  | @PostMapping("/locItem/generate/move/task") | 
|---|
|  |  |  | public R genMoveTask(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | if (Objects.isNull(map)) { | 
|---|
|  |  |  | return R.error("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return locItemService.gentMoveTask(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成盘点出库任务 | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:locItem:list')") | 
|---|
|  |  |  | @PostMapping("/locItem/generate/check/task") | 
|---|
|  |  |  | public R genStatisticalTask(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | if (Objects.isNull(map)) { | 
|---|
|  |  |  | return R.error("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return locItemService.generateTask(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:locItem:list')") | 
|---|
|  |  |  | @PostMapping("/locItem/list") | 
|---|
|  |  |  | public R list(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Objects.isNull(ids) || ids.length < 1) { | 
|---|
|  |  |  | return R.error("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return taskService.removeTask(ids); | 
|---|
|  |  |  | return taskService.removeTask(ids); | 
|---|
|  |  |  | //        return R.ok("Delete Success").add(ids); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); | 
|---|
|  |  |  | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); | 
|---|
|  |  |  | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() | 
|---|
|  |  |  | .eq(Task::getId, id) | 
|---|
|  |  |  | .in(Task::getTaskStatus, longs)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Task task : tasks) { | 
|---|
|  |  |  | task.setTaskStatus(task.getTaskType() < (short) 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 拣料出库 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:task:update')") | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException("能数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return R.ok(taskService.pickTask(id)); | 
|---|
|  |  |  | return R.ok(taskService.pickOrCheckTask(id, "pick")); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | throw new CoolException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 盘点出库 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:task:update')") | 
|---|
|  |  |  | @ApiOperation("拣料出库") | 
|---|
|  |  |  | @PostMapping("/task/check/{id}") | 
|---|
|  |  |  | public R checkTask(@PathVariable Long id) { | 
|---|
|  |  |  | if (Objects.isNull(id)) { | 
|---|
|  |  |  | throw new CoolException("能数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return R.ok(taskService.pickOrCheckTask(id, "check")); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | throw new CoolException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | TASK_TYPE_MERGE_IN("54", "并板再入库"), | 
|---|
|  |  |  | TASK_TYPE_CHECK_IN("57", "盘点再入库"), | 
|---|
|  |  |  | TASK_TYPE_OUT("101", "出库"), | 
|---|
|  |  |  | TASK_TYPE_PICK_AGAIN_IN("103", "拣料出库"), | 
|---|
|  |  |  | TASK_TYPE_PICK_AGAIN_OUT("103", "拣料出库"), | 
|---|
|  |  |  | TASK_TYPE_MERGE_OUT("104", "并板出库"), | 
|---|
|  |  |  | TASK_TYPE_CHECK_OUT("107", "盘点出库"), | 
|---|
|  |  |  | TASK_TYPE_EMPITY_OUT("110", "空板出库"), | 
|---|
|  |  |  | 
|---|
|  |  |  | public interface LocItemService extends IService<LocItem> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | R generateTask(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | R gentMoveTask(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | R removeTask(Long[] ids); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Task pickTask(Long id) throws Exception; | 
|---|
|  |  |  | Task pickOrCheckTask(Long id, String oType) throws Exception; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void complateInTask(List<Task> tasks) throws Exception; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.vincent.rsf.server.system.constant.SerialRuleCode; | 
|---|
|  |  |  | import com.vincent.rsf.server.system.utils.SerialRuleUtils; | 
|---|
|  |  |  | import lombok.Synchronized; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库存出库生成出库任务 | 
|---|
|  |  |  | * type: check 盘点, stock: 库存出库 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | @Synchronized | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public R generateTask(Map<String, Object> map) { | 
|---|
|  |  |  | String type; | 
|---|
|  |  |  | if (!Objects.isNull(map.get("type")) && StringUtils.isNotBlank(map.get("type").toString())) { | 
|---|
|  |  |  | type = map.get("type").toString(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | type = "stock"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(map.get("siteNo"))) { | 
|---|
|  |  |  | throw new CoolException("站点不能为空!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | List<LocItem> locItemList = listMap.get(key); | 
|---|
|  |  |  | Double outQty = locItemList.stream().mapToDouble(LocItem::getOutQty).sum(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Task serviceOne = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, loc.getBarcode())); | 
|---|
|  |  |  | if (!Objects.isNull(serviceOne)) { | 
|---|
|  |  |  | throw new CoolException("托盘任务执行中,不能重复创建!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Double useQty  = Math.round((outQty + workQty) * 10000) / 10000.0; | 
|---|
|  |  |  | if (orgQty.compareTo(useQty) > 0) { | 
|---|
|  |  |  | //拣料出库 | 
|---|
|  |  |  | task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_IN.type); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //全板出库 | 
|---|
|  |  |  | task.setTaskType(TaskType.TASK_TYPE_OUT.type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (type.equals("stock")) { | 
|---|
|  |  |  | Double useQty  = Math.round((outQty + workQty) * 10000) / 10000.0; | 
|---|
|  |  |  | if (orgQty.compareTo(useQty) > 0) { | 
|---|
|  |  |  | //拣料出库 | 
|---|
|  |  |  | task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //全板出库 | 
|---|
|  |  |  | task.setTaskType(TaskType.TASK_TYPE_OUT.type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (type.equals("check")) { | 
|---|
|  |  |  | //盘点出库 | 
|---|
|  |  |  | task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!taskService.save(task)) { | 
|---|
|  |  |  | throw new CoolException("任务创建失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | item.setWorkQty(qty); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (! locItemService.updateById(item)) { | 
|---|
|  |  |  | if (!locItemService.updateById(item)) { | 
|---|
|  |  |  | throw new CoolException("库存信息修改失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok("任务生成完成!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成移库任务 | 
|---|
|  |  |  | * @param map | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R gentMoveTask(Map<String, Object> map) { | 
|---|
|  |  |  | if (Objects.isNull(map.get("targetLoc"))) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(map.get("orgLoc"))) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) { | 
|---|
|  |  |  | //53.拣料再入库 | 
|---|
|  |  |  | pickComplateInStock(task); | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { | 
|---|
|  |  |  | //57.盘点再入库 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { | 
|---|
|  |  |  | //全托出库 | 
|---|
|  |  |  | complateOutStock(task); | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)) { | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { | 
|---|
|  |  |  | //拣料出库 | 
|---|
|  |  |  | //                Task seviceOne = pickTask(task.getId()); | 
|---|
|  |  |  | //移除原始库存 | 
|---|
|  |  |  | complateOutStock(task); | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) | 
|---|
|  |  |  | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type) | 
|---|
|  |  |  | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) | 
|---|
|  |  |  | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) | 
|---|
|  |  |  | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) | 
|---|
|  |  |  | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public Task pickTask(Long id) throws Exception { | 
|---|
|  |  |  | public Task pickOrCheckTask(Long id, String oType) throws Exception { | 
|---|
|  |  |  | Task task = this.getById(id); | 
|---|
|  |  |  | if (Objects.isNull(task)) { | 
|---|
|  |  |  | throw new CoolException("当前任务不存在!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)) { | 
|---|
|  |  |  | throw new CoolException("非拣料出库 ,不可执行此操作!!"); | 
|---|
|  |  |  | Integer type; | 
|---|
|  |  |  | if (oType.equals("check")) { | 
|---|
|  |  |  | //盘点入库 | 
|---|
|  |  |  | type = TaskType.TASK_TYPE_CHECK_IN.type; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { | 
|---|
|  |  |  | throw new CoolException("非盘点出库 ,不可执行此操作!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //拣料入库 | 
|---|
|  |  |  | type = TaskType.TASK_TYPE_PICK_IN.type; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { | 
|---|
|  |  |  | throw new CoolException("非拣料出库 ,不可执行此操作!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>() | 
|---|
|  |  |  | 
|---|
|  |  |  | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, task); | 
|---|
|  |  |  | //更新任务主单 | 
|---|
|  |  |  | task.setTaskCode(ruleCode) | 
|---|
|  |  |  | .setTaskType(TaskType.TASK_TYPE_PICK_IN.type) | 
|---|
|  |  |  | .setTaskType(type) | 
|---|
|  |  |  | .setBarcode(task.getBarcode()) | 
|---|
|  |  |  | .setTaskStatus(TaskStsType.GENERATE_IN.id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //TODO 根据物料的库位类型生成新的库位 | 
|---|
|  |  |  | TaskInParam param = new TaskInParam(); | 
|---|
|  |  |  | param.setSourceStaNo(Integer.parseInt(task.getTargSite())) | 
|---|
|  |  |  | .setIoType(Integer.parseInt(TaskType.TASK_TYPE_PICK_IN.type + "")) | 
|---|
|  |  |  | .setIoType(type) | 
|---|
|  |  |  | .setLocType1(Integer.parseInt(loc.getType())); | 
|---|
|  |  |  | InTaskMsgDto locInfo = wcsService.getLocNo(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | //更新库位明细 | 
|---|
|  |  |  | subtractLocItem(loc); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("<UNK>", e); | 
|---|
|  |  |  | throw new CoolException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException("库位状态修改失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)) { | 
|---|
|  |  |  | if (!task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { | 
|---|
|  |  |  | if (!this.update(new LambdaUpdateWrapper<Task>() | 
|---|
|  |  |  | .eq(Task::getId, task.getId()) | 
|---|
|  |  |  | .set(Task::getTaskStatus, TaskStsType.UPDATED_OUT.id))) { | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public void saveStockItems(List<TaskItem> items, Long id, String code, Short wkType, String type) throws Exception { | 
|---|
|  |  |  | public void saveStockItems(List<TaskItem> items, Long id, String code, Short wkType, String type) throws | 
|---|
|  |  |  | Exception { | 
|---|
|  |  |  | Stock stock = new Stock(); | 
|---|
|  |  |  | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); | 
|---|
|  |  |  | if (StringUtils.isBlank(ruleCode)) { | 
|---|