| | |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <ReferenceInput |
| | | source="warehouseId" |
| | | label="table.field.loc.warehouseId" |
| | | reference="warehouse" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput |
| | | source="areaId" |
| | | label="table.field.loc.areaId" |
| | | reference="warehouseAreas" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput>, |
| | | <TextInput source="code" label="table.field.loc.code" />, |
| | | <TextInput source="type" label="table.field.loc.type" />, |
| | | <TextInput source="name" label="table.field.loc.name" />, |
| | | <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />, |
| | | <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />, |
| | | <TextInput source="barcode" label="table.field.loc.barcode" />, |
| | | <TextInput source="unit" label="table.field.loc.unit" />, |
| | | <TextInput source="size" label="table.field.loc.size" />, |
| | | <NumberInput source="row" label="table.field.loc.row" />, |
| | | <NumberInput source="col" label="table.field.loc.col" />, |
| | | <NumberInput source="lev" label="table.field.loc.lev" />, |
| | | <NumberInput source="channel" label="table.field.loc.channel" />, |
| | | <NumberInput source="maxParts" label="table.field.loc.maxParts" />, |
| | | <NumberInput source="maxPack" label="table.field.loc.maxPack" />, |
| | | <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />, |
| | | <TextInput source="locAttrs" label="table.field.loc.locAttrs" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | const LocList = () => { |
| | | const translate = useTranslate(); |
| | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [initDialog, setInitDialog] = useState(false); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_use_stas')) || []; |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <ReferenceInput |
| | | source="warehouseId" |
| | | label="table.field.loc.warehouseId" |
| | | reference="warehouse" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput |
| | | source="areaId" |
| | | label="table.field.loc.areaId" |
| | | reference="warehouseAreas" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput>, |
| | | <AutocompleteInput |
| | | choices={dicts} |
| | | optionText="label" |
| | | label="table.field.loc.useStatus" |
| | | source="useStatus" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | alwaysOn |
| | | />, |
| | | <TextInput source="code" label="table.field.loc.code" />, |
| | | <TextInput source="type" label="table.field.loc.type" />, |
| | | <TextInput source="name" label="table.field.loc.name" />, |
| | | <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />, |
| | | <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />, |
| | | <TextInput source="barcode" label="table.field.loc.barcode" />, |
| | | <TextInput source="unit" label="table.field.loc.unit" />, |
| | | <TextInput source="size" label="table.field.loc.size" />, |
| | | <NumberInput source="row" label="table.field.loc.row" />, |
| | | <NumberInput source="col" label="table.field.loc.col" />, |
| | | <NumberInput source="lev" label="table.field.loc.lev" />, |
| | | <NumberInput source="channel" label="table.field.loc.channel" />, |
| | | <NumberInput source="maxParts" label="table.field.loc.maxParts" />, |
| | | <NumberInput source="maxPack" label="table.field.loc.maxPack" />, |
| | | <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />, |
| | | <TextInput source="locAttrs" label="table.field.loc.locAttrs" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='loc' /> |
| | | {/* <SelectColumnsButton preferenceKey='loc' /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | |
| | | } |
| | | } |
| | | return ( |
| | | ((record?.taskStatus < 98) || (record?.taskType >= 101 && record?.taskStatus < 198)) ? (<ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskAltIcon />} onConfirm={clickComplete} />) : (<></>) |
| | | ((record?.taskStatus < 98) || (record?.taskType >= 101 && record?.taskStatus < 198)) || (record?.taskType == 11 && record?.taskStatus == 101) ? (<ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskAltIcon />} onConfirm={clickComplete} />) : (<></>) |
| | | ) |
| | | } |
| | | |
| | |
| | | width: 100, |
| | | editable: false, |
| | | }, |
| | | { |
| | | field: 'workQty', |
| | | headerName: translate('table.field.locItem.workQty'), |
| | | width: 100, |
| | | type: 'number', |
| | | editable: false, |
| | | }, |
| | | // { |
| | | // field: 'workQty', |
| | | // headerName: translate('table.field.locItem.workQty'), |
| | | // width: 100, |
| | | // type: 'number', |
| | | // editable: false, |
| | | // }, |
| | | { |
| | | field: 'matnrCode', |
| | | headerName: translate('table.field.locItem.matnrCode'), |
| | |
| | | { field: 'maktx', headerName: translate('table.field.locItem.maktx'), width: 300 }, |
| | | { field: 'batch', headerName: translate('table.field.locItem.batch'), width: 100 }, |
| | | { field: 'anfme', headerName: translate('table.field.locItem.anfme'), width: 100 }, |
| | | { field: 'workQty', headerName: translate('table.field.locItem.workQty'), width: 100 }, |
| | | // { field: 'workQty', headerName: translate('table.field.locItem.workQty'), width: 100 }, |
| | | { field: 'unit', headerName: translate('table.field.locItem.unit'), width: 100 }, |
| | | |
| | | ]) |
| | |
| | | } |
| | | const http = async (sta, items) => { |
| | | console.log(items); |
| | | const filZores = items.filter(item => item.outQty <= 0.0); |
| | | const filter = items.filter(item => (item.outQty + item.workQty) > item.anfme); |
| | | if (filter.length > 0 || filZores.length > 0) { |
| | | notify(translate('toolbar.request.error.out_stock_qty')) |
| | | return |
| | | } |
| | | // const filZores = items.filter(item => item.outQty <= 0.0); |
| | | // const filter = items.filter(item => (item.outQty + item.workQty) > item.anfme); |
| | | // if (filter.length > 0 || filZores.length > 0) { |
| | | // notify(translate('toolbar.request.error.out_stock_qty')) |
| | | // return |
| | | // } |
| | | const { data: { code, data, msg } } = await request.post(`/locItem/generate/task`, { siteNo: sta, items: items }); |
| | | if (code === 200) { |
| | | notify(msg); |
| | |
| | | width: 100, |
| | | editable: false, |
| | | }, |
| | | { |
| | | field: 'workQty', |
| | | headerName: translate('table.field.locItem.workQty'), |
| | | width: 100, |
| | | type: 'number', |
| | | editable: false, |
| | | }, |
| | | // { |
| | | // field: 'workQty', |
| | | // headerName: translate('table.field.locItem.workQty'), |
| | | // width: 100, |
| | | // type: 'number', |
| | | // editable: false, |
| | | // }, |
| | | { |
| | | field: 'locCode', |
| | | headerName: translate('table.field.locItem.locCode'), |
| | |
| | | width: 100, |
| | | editable: false, |
| | | }, |
| | | { |
| | | field: 'workQty', |
| | | headerName: translate('table.field.locItem.workQty'), |
| | | width: 100, |
| | | type: 'number', |
| | | editable: false, |
| | | }, |
| | | // { |
| | | // field: 'workQty', |
| | | // headerName: translate('table.field.locItem.workQty'), |
| | | // width: 100, |
| | | // type: 'number', |
| | | // editable: false, |
| | | // }, |
| | | { |
| | | field: 'locCode', |
| | | headerName: translate('table.field.locItem.locCode'), |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | |
| | | @PreAuthorize("hasAuthority('manager:deliveryItem:list')") |
| | | @PostMapping("/deliveryItem/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(deliveryItemService.list(), DeliveryItem.class), response); |
| | | if (!Cools.isEmpty(map) && !Cools.isEmpty(map.get("ids"))) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<Long> jsonArray = JSONArray.parseArray(JSONArray.toJSONString(map.get("ids")), Long.class); |
| | | // if (jsonArray.isEmpty()) { |
| | | // ExcelUtil.build(ExcelUtil.create(deliveryItemService.getOne(new La), DeliveryItem.class), response); |
| | | // } else { |
| | | // ExcelUtil.build(ExcelUtil.create(deliveryItemService.list(), DeliveryItem.class), response); |
| | | // } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/deliveryItem/import") |
| | | @ApiOperation("DO单导入接口") |
| | | @PreAuthorize("hasAuthority('manager:asnOrderItem:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | return R.error("文件不能为空!!"); |
| | | } |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | |
| | | return R.ok(); |
| | | // return deliveryItemService.excelImport(file, hashMap, getLoginUserId()); |
| | | } |
| | | |
| | | } |
| | |
| | | @Excel(name = "*DO单号") |
| | | @ApiModelProperty(value= "*PO单号") |
| | | @ExcelComment(value = "poCode", example = "PO25413975") |
| | | private String poCode; |
| | | private String doCode; |
| | | |
| | | @Excel(name = "*行号") |
| | | @ApiModelProperty(value= "*行号") |
| | |
| | | @Excel(name = "数量") |
| | | @ApiModelProperty(value= "数量") |
| | | @ExcelComment(value = "anfme", example = "75") |
| | | private Double anfme; |
| | | private String anfme; |
| | | |
| | | /** |
| | | * 供应商编码 |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.utils.LocUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.TaskType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.service.impl.LocServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | | import com.vincent.rsf.server.system.service.ConfigService; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private TaskItemLogService taskItemLogService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private LocServiceImpl locService; |
| | | |
| | | @Value("${wcs-slave.doubleLocs}") |
| | | private List<Integer> rows; |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | |
| | | /** |
| | | * @param |
| | |
| | | } |
| | | |
| | | /** |
| | | * 任务自动下发 |
| | | * @throws Exception |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void taskToWCS() throws Exception { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getTaskType, list).orderByDesc(Task::getSort)); |
| | | for (Task task : tasks) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode())); |
| | | if (Objects.isNull(loc)) { |
| | | continue; |
| | | } |
| | | //判断是否深库位 |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应的浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | if (StringUtils.isBlank(shallowLoc)) { |
| | | continue; |
| | | } |
| | | Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | //如果浅库位不在库跳出循环 |
| | | continue; |
| | | } |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + ""); |
| | | //生成移库任务 |
| | | locItemService.genMoveTask(params, loginUserId); |
| | | } |
| | | //TODO 调用下发任务接口 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 每五秒校验深库位是否为空,如果浅库位有货,将浅库位移至深库位 |
| | | */ |
| | | @Scheduled(cron = "0/35 * * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void shallocToDeep() throws Exception { |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .in(Loc::getRow, rows)); |
| | | if (locs.isEmpty()) { |
| | | return; |
| | | } |
| | | for (Loc loc : locs) { |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(one) || !one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | continue; |
| | | } |
| | | taskService.moveToDeep(SystemAuthUtils.getLoginUserId(), shallowLoc); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public interface DeliveryItemService extends IService<DeliveryItem> { |
| | | |
| | | // R excelImport(MultipartFile file, Map<String, Object> hashMap, Long loginUserId) throws Exception; |
| | | } |
| | |
| | | |
| | | R generateTasks(GenerateTaskParams waitPakin, Long loginUserId); |
| | | |
| | | R generateFlatWarehouseTasks(WaitPakin waitPakins,String locCode, Long loginUserId); |
| | | R generateFlatWarehouseTasks(WaitPakin waitPakins, String locCode, Long loginUserId); |
| | | |
| | | R generateAGVTasks(WaitPakin waitPakins,String locCode,String orgSta, Long loginUserId); |
| | | R generateAGVTasks(WaitPakin waitPakins, String locCode, String orgSta, Long loginUserId); |
| | | |
| | | // R completeTask(String id); |
| | | void completeTask(List<Task> task) throws Exception; |
| | | // R completeTask(String id); |
| | | void completeTask(List<Task> task) throws Exception; |
| | | |
| | | R removeTask(Long[] ids, Long loginUserId); |
| | | |
| | |
| | | Task taskToTop(Long id, Long loginUserId) throws Exception; |
| | | |
| | | Task operateComplete(Long id, Long loginUserId); |
| | | } |
| | | |
| | | void moveToDeep(Long loginUserId, String curLoc) throws Exception; |
| | | } |
| | |
| | | public synchronized R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), AsnOrderTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | List<AsnOrderTemplate> resultList = result.getList(); |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.DeliveryTemplate; |
| | | import com.vincent.rsf.server.manager.enums.CompanysType; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.enums.QlyIsptResult; |
| | | import com.vincent.rsf.server.manager.mapper.DeliveryItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.DeliveryService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("deliveryItemService") |
| | | public class DeliveryItemServiceImpl extends ServiceImpl<DeliveryItemMapper, DeliveryItem> implements DeliveryItemService { |
| | | |
| | | @Autowired |
| | | private DeliveryService deliveryService; |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | @Autowired |
| | | private CompanysService companysService; |
| | | @Autowired |
| | | private DeliveryItemService deliveryItemService; |
| | | |
| | | // private |
| | | /** |
| | | * excel DO单导入 |
| | | * |
| | | * @param file |
| | | * @param hashMap |
| | | * @param loginUserId |
| | | * @return |
| | | */ |
| | | // @Override |
| | | // public R excelImport(MultipartFile file, Map<String, Object> hashMap, Long loginUserId) throws Exception { |
| | | // ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), DeliveryTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | // if (result.getList().isEmpty()) { |
| | | // throw new CoolException("表格内容不能为空!!"); |
| | | // } |
| | | // List<DeliveryTemplate> resultList = result.getList(); |
| | | // Map<String, List<DeliveryTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(DeliveryTemplate::getDoCode)); |
| | | // StringBuffer sbFaild = new StringBuffer(); |
| | | // for (String key : listMap.keySet()) { |
| | | // if (StringUtils.isBlank(key)) { |
| | | // throw new CoolException("单号不能为空!!"); |
| | | // } |
| | | // DeliveryTemplate template = listMap.get(key).stream().findFirst().get(); |
| | | // Delivery order = deliveryService.getOne(new LambdaQueryWrapper<Delivery>().eq(Delivery::getCode, key)); |
| | | // if (!Objects.isNull(order)) { |
| | | // sbFaild.append(template.getDoCode()).append(",已添加!!"); |
| | | // throw new CoolException(sbFaild.toString()); |
| | | // } |
| | | // order = new Delivery(); |
| | | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // Date date = dateFormat.parse(template.getArrTime()); |
| | | // if (Objects.isNull(date)) { |
| | | // throw new CoolException("时间格式错误!!"); |
| | | // } |
| | | // if (Objects.isNull((OrderType.getTypeVal(template.getType())))) { |
| | | // sbFaild.append(template.getDoCode()).append(",单据状态不存在!!"); |
| | | // throw new CoolException(sbFaild.toString()); |
| | | // } |
| | | // if (Objects.isNull((OrderWorkType.getWorkType(template.getWkType())))) { |
| | | // sbFaild.append(template.getDoCode()).append(",业务状态不存在!!"); |
| | | // throw new CoolException(sbFaild.toString()); |
| | | // } |
| | | // |
| | | // order.setCode(template.getDoCode()) |
| | | // .setPoCode(template.getPoCode()) |
| | | // .setMemo(template.getMemo()) |
| | | // .setArrTime(date) |
| | | // .setUpdateBy(loginUserId) |
| | | // .setLogisNo(template.getLogicNo()) |
| | | // .setCreateBy(loginUserId) |
| | | // .setType(OrderType.getTypeVal(template.getType())) |
| | | // .setWkType(OrderWorkType.getWorkType(template.getWkType())); |
| | | // if (!deliveryService.save(order)) { |
| | | // throw new CoolException("单据保存失败!!"); |
| | | // } |
| | | // List<DeliveryItem> items = new ArrayList<>(); |
| | | // for (DeliveryTemplate orderTemplate : listMap.get(key)) { |
| | | // DeliveryItem orderItem = new DeliveryItem(); |
| | | // if (StringUtils.isBlank(orderTemplate.getMatnrCode())) { |
| | | // throw new CoolException(orderTemplate.getDoCode() + ":物料编码不能为空!!"); |
| | | // } |
| | | // if (StringUtils.isBlank(orderTemplate.getAnfme())) { |
| | | // throw new CoolException(orderTemplate.getDoCode() + ":数量不能为空!!"); |
| | | // } |
| | | // if (StringUtils.isBlank(orderTemplate.getType())) { |
| | | // throw new CoolException(orderTemplate.getDoCode() + ":单据类型不能为空!!"); |
| | | // } |
| | | // if (StringUtils.isBlank(orderTemplate.getWkType())) { |
| | | // throw new CoolException(orderTemplate.getDoCode() + ":业务类型不能为空!!"); |
| | | // } |
| | | // |
| | | // Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>() |
| | | // .eq(Matnr::getCode, orderTemplate.getMatnrCode())); |
| | | // if (Objects.isNull(matnr)) { |
| | | // sbFaild.append(orderTemplate.getMatnrCode()).append("物料不存在"); |
| | | // throw new CoolException(sbFaild.toString()); |
| | | // } |
| | | // String trackCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, matnr); |
| | | // orderItem.setDeliveryId(order.getId()) |
| | | // .setDeliveryCode(order.getCode()) |
| | | // .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | // .setPlatItemId(orderTemplate.getPlatItemId()) |
| | | // .setAnfme(Double.parseDouble(orderTemplate.getAnfme())) |
| | | // .setIsptResult(QlyIsptResult.getDescVal(orderTemplate.getIsptResult())) |
| | | //// .setTrackCode(trackCode) |
| | | // .setBarcode(trackCode) |
| | | // .setPlatOrderCode(orderTemplate.getPlatOrderCode()) |
| | | // .setPlatWorkCode(orderTemplate.getPlatWorkCode()) |
| | | // .setProjectCode(orderTemplate.getProjectCode()) |
| | | // .setPoCode(orderTemplate.getDoCode()) |
| | | // .setPurUnit(matnr.getUnit()) |
| | | // .setCreateBy(loginUserId) |
| | | // .setUpdateBy(loginUserId) |
| | | // .setSpec(matnr.getSpec()) |
| | | // .setModel(matnr.getModel()) |
| | | // .setMaktx(matnr.getName()) |
| | | // .setMatnrCode(matnr.getCode()) |
| | | // .setMatnrId(matnr.getId()) |
| | | // .setStockUnit(matnr.getUnit()); |
| | | // if (!Objects.isNull(orderTemplate.getSplrCode())) { |
| | | // Companys companys = companysService.getOne(new LambdaQueryWrapper<Companys>() |
| | | // .eq(Companys::getType, CompanysType.COMPANYS_TYPE_SUPPLIER.val) |
| | | // .eq(Companys::getCode, orderTemplate.getSplrCode())); |
| | | // if (!Objects.isNull(companys)) { |
| | | // orderItem.setSplrCode(companys.getCode()).setSplrName(companys.getName()); |
| | | // } else { |
| | | // sbFaild.append("供应商:" + orderTemplate.getSplrCode()).append("不存在"); |
| | | // throw new CoolException(sbFaild.toString()); |
| | | // } |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | // items.add(orderItem); |
| | | // |
| | | // if (!deliveryItemService.save(orderItem)) { |
| | | // throw new CoolException("单据明细保存失败!!"); |
| | | // } |
| | | // } |
| | | // if (!items.isEmpty()) { |
| | | //// double qty = items.stream().mapToDouble(AsnOrderItem::getQty).sum(); |
| | | // double anfme = items.stream().mapToDouble(DeliveryItem::getAnfme).sum(); |
| | | // if (!deliveryService.update(new LambdaUpdateWrapper<Delivery>() |
| | | //// .set(AsnOrder::getQty, qty) |
| | | // .set(Delivery::getAnfme, anfme) |
| | | // .eq(Delivery::getId, order.getId()))) { |
| | | // throw new CoolException("单据数量修改失败!!"); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // return null; |
| | | // } |
| | | } |
| | |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败!!"); |
| | | } |
| | | |
| | | Task moveTask = new Task(); |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(one)) { |
| | | throw new CoolException("对应库位不存在!!"); |
| | | } |
| | | map.setOrgLoc(one.getCode()); |
| | | //优先生成移库任务 |
| | | if (!one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | moveTask = genMoveTask(map, loginUserId); |
| | | } |
| | | } |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setParentId(moveTask.getId()) |
| | | .setTargSite(siteNo) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateBy(loginUserId) |
| | |
| | | throw new CoolException("站点不支持拣料出库!!"); |
| | | } |
| | | task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).setWarehType(deviceSite.getDevice()); |
| | | |
| | | } else { |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | |
| | | throw new CoolException("任务创建失败!!"); |
| | | } |
| | | |
| | | if (!Objects.isNull(moveTask.getId())) { |
| | | moveTask.setParentId(task.getId()); |
| | | if (!taskService.saveOrUpdate(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(one)) { |
| | | throw new CoolException("对应库位不存在!!"); |
| | | } |
| | | Task workTask = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, one.getBarcode())); |
| | | if (Objects.isNull(workTask)) { |
| | | map.setOrgLoc(one.getCode()); |
| | | //优先生成移库任务 |
| | | if (one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | moveTask = genMoveTask(map, loginUserId); |
| | | task.setParentId(moveTask.getId()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("主任务关联失败!!"); |
| | | } |
| | | } |
| | | } else { |
| | | workTask.setSort(task.getSort() + 1).setParentId(task.getId()); |
| | | if (!taskService.updateById(workTask)) { |
| | | throw new CoolException("优先级修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // if (!Objects.isNull(moveTask.getId())) { |
| | | // moveTask.setParentId(task.getId()).setSort(moveTask.getSort() - 1); |
| | | // if (!taskService.saveOrUpdate(moveTask)) { |
| | | // throw new CoolException("任务信息修改失败!!"); |
| | | // } |
| | | // } |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | |
| | | if (Objects.isNull(map.getOrgLoc()) || StringUtils.isBlank(map.getOrgLoc())) { |
| | | throw new CoolException("源库位不能为空!"); |
| | | } |
| | | |
| | | Loc orgLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, map.getOrgLoc())); |
| | | if (Objects.isNull(orgLoc)) { |
| | | throw new CoolException("源库位不存在!!"); |
| | | } |
| | | |
| | | // if (orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_X.type ) ) { |
| | | // throw new CoolException("源库位有任务正在执行中..."); |
| | | // } |
| | | |
| | | orgLoc.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | |
| | | if (!locService.updateById(orgLoc)) { |
| | | throw new CoolException("出库预约失败!!"); |
| | | } |
| | | |
| | | Loc targetLoc = new Loc(); |
| | | Loc targetLoc; |
| | | if (Objects.isNull(map.getTarLoc()) || StringUtils.isBlank(map.getTarLoc())) { |
| | | //目标库位为空,自动获取新库位 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | |
| | | .setSourceStaNo(Integer.parseInt(deviceSite.getSite())) |
| | | .setLocType1(Integer.parseInt(orgLoc.getType()) |
| | | ); |
| | | InTaskMsgDto locNo = null; |
| | | InTaskMsgDto locNo; |
| | | try { |
| | | locNo = wcsService.getLocNo(param); |
| | | } catch (Exception e) { |
| | |
| | | .setUpdateBy(loginUserId) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateTime(new Date()) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setBarcode(orgLoc.getBarcode()); |
| | | |
| | | if (!taskService.save(task)) { |
| | |
| | | .setSourceCode(item.getLocCode()) |
| | | .setSource(item.getId()) |
| | | .setUpdateTime(new Date()) |
| | | .setOrderType(OrderType.ORDER_OUT.type) |
| | | .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)); |
| | | .setOrderType(OrderType.ORDER_IN.type) |
| | | .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type)); |
| | | taskItems.add(taskItem); |
| | | } |
| | | if (!taskItemService.saveBatch(taskItems)) { |
| | |
| | | } |
| | | |
| | | modiftyTaskSort(task, loginUserId); |
| | | |
| | | // |
| | | |
| | | // if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | // task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | // } else { |
| | | task.setTaskStatus(task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id); |
| | | // } |
| | | if (!this.updateById(task)) { |
| | | throw new CoolException("完成任务失败"); |
| | | } |
| | |
| | | // |
| | | // return moveTask; |
| | | // } |
| | | } else { |
| | | //浅库位,判断深对应深库位是否为空,如果为空生成一个移库任务,将托盘送入深库位 |
| | | String deepLoc = LocUtils.getDeepLoc(curLoc); |
| | | if (StringUtils.isBlank(deepLoc)) { |
| | | throw new CoolException("数据异常,请联系管理员!"); |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, deepLoc)); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | } |
| | | //判断深库位是否为空 |
| | | if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(curLoc).setTarLoc(deepLoc); |
| | | //生成移深库位任务 |
| | | locItemService.genMoveTask(params, loginUserId); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /** |
| | | * 任务完成后,判断深库位是否为空,如果为空生成移库任务 |
| | | * @param loginUserId |
| | | * @param curLoc |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void moveToDeep(Long loginUserId, String curLoc) throws Exception { |
| | | //浅库位,判断深对应深库位是否为空,如果为空生成一个移库任务,将托盘送入深库位 |
| | | String deepLoc = LocUtils.getDeepLoc(curLoc); |
| | | if (StringUtils.isBlank(deepLoc)) { |
| | | throw new CoolException("数据异常,请联系管理员!"); |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, deepLoc)); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | } |
| | | //判断深库位是否为空 |
| | | if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(curLoc).setTarLoc(deepLoc); |
| | | //生成移深库位任务 |
| | | locItemService.genMoveTask(params, loginUserId); |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R removeTask(Long[] ids, Long loginUserId) { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type,TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, |
| | | TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type, |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, |
| | | TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type, |
| | | TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Task> tasks = this.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, list) |
| | |
| | | } |
| | | for (Task task : tasks) { |
| | | //取消移库任务 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_OUT.id)) { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id)) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | |
| | | outTask.setParentId(moveTask.getId()); |
| | | if (!this.updateById(outTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | |
| | | } |
| | | |
| | | } else { |
| | | throw new CoolException("无法生成新的移库任务,取消失败!!"); |
| | | // throw new CoolException("无法生成新的移库任务,取消失败!!"); |
| | | } |
| | | } |
| | | |