| | |
| | | }, |
| | | })); |
| | | |
| | | 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} |
| | |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | import BillStatusField from "../../components/BillStatusField"; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import MyField from "../../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.delivery"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={false} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='delivery' /> |
| | | <ImportButton value={'delivery'} /> |
| | | {/* <MyExportButton /> */} |
| | |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <BillStatusField cellClassName="status" source="exceStatus" label="table.field.asnOrder.exceStatus" /> |
| | | {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | |
| | | } |
| | | } |
| | | 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} />) : (<></>) |
| | | ) |
| | | } |
| | | |
| | |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickCancel = (event) => { |
| | | event.stopPropagation(); |
| | | const clickCancel = () => { |
| | | cancleTask(record) |
| | | }; |
| | | //取消任务 |
| | |
| | | } |
| | | return ( |
| | | (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ? |
| | | <Button |
| | | onClick={clickCancel} |
| | | label="toolbar.cancel"> |
| | | <CancelIcon /> |
| | | </Button> |
| | | <ConfirmButton |
| | | onConfirm={clickCancel} |
| | | startIcon={<CancelIcon />} |
| | | label={"toolbar.cancel"}> |
| | | </ConfirmButton> |
| | | : |
| | | <></> |
| | | ) |
| | |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | } |
| | | return ( |
| | | (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ? |
| | |
| | | label="toolbar.top"> |
| | | <AlignVerticalTopIcon /> |
| | | </Button> |
| | | : |
| | | <></> |
| | | : |
| | | <></> |
| | | ) |
| | | } |
| | | |
| | |
| | | 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.alibaba.fastjson.JSONObject; |
| | | 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.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Delivery; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.DeliveryTemplate; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.service.SerialRuleService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | 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.*; |
| | |
| | | |
| | | @Autowired |
| | | private DeliveryService deliveryService; |
| | | @Autowired |
| | | private DeliveryItemService deliveryItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @PostMapping("/delivery/page") |
| | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @PostMapping("/delivery/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(deliveryService.list(), Delivery.class), response); |
| | | if (!Cools.isEmpty(map) && !Cools.isEmpty(map.get("ids"))) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<Delivery> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | List<Long> ids = JSONArray.parseArray(JSONObject.toJSONString(map.get("ids")), Long.class); |
| | | if (!ids.isEmpty()) { |
| | | orders = deliveryService.list(new LambdaQueryWrapper<Delivery>().in(Delivery::getId, ids)); |
| | | } else { |
| | | orders = deliveryService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | } else { |
| | | orders = deliveryService.list(); |
| | | } |
| | | List<DeliveryTemplate> orderTemplates = new ArrayList<>(); |
| | | for (Delivery order : orders) { |
| | | List<DeliveryItem> orderItems = deliveryItemService.list(new LambdaQueryWrapper<DeliveryItem>().eq(DeliveryItem::getDeliveryId, order.getId())); |
| | | for (DeliveryItem item : orderItems) { |
| | | if (Objects.isNull(item)) { |
| | | continue; |
| | | } |
| | | DeliveryTemplate template = new DeliveryTemplate(); |
| | | template.setDoCode(order.getCode()) |
| | | .setType(OrderType.getValType(order.getType())) |
| | | .setWkType(OrderWorkType.getWorkDesc(order.getWkType())) |
| | | .setAnfme(item.getAnfme() + "") |
| | | .setMaktx(item.getMaktx()) |
| | | .setMemo(item.getMemo()) |
| | | .setMatnrCode(item.getMatnrCode()) |
| | | .setPlatItemId(item.getPlatItemId()) |
| | | .setSplrBatch(item.getSplrBatch()) |
| | | .setSplrName(item.getSplrName()) |
| | | .setSplrCode(item.getSplrCode()); |
| | | orderTemplates.add(template); |
| | | } |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, DeliveryTemplate.class), response); |
| | | } |
| | | |
| | | @PostMapping("/delivery/import") |
| | | @ApiOperation("DO单导入接口") |
| | | @PreAuthorize("hasAuthority('manager:delivery: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("导入成功").add(deliveryItemService.excelImport(file, hashMap, getLoginUserId())); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/delivery/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:delivery:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | DeliveryTemplate template = ExcelUtil.mockData(DeliveryTemplate.class); |
| | | List<DeliveryTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, DeliveryTemplate.class, true), response); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Companys; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | 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.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.vincent.rsf.server.manager.service.impl.DeliveryServiceImpl; |
| | | 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.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private DeliveryItemService deliveryItemService; |
| | | |
| | | |
| | | @Autowired |
| | | private CompanysService companysService; |
| | | @Autowired |
| | | private DeliveryServiceImpl deliveryService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deliveryItem:list')") |
| | | @PostMapping("/deliveryItem/page") |
| | |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:remove')") |
| | | @OperationLog("Delete 任务工作档") |
| | | @OperationLog("取消/删除工作极档") |
| | | @ApiOperation("取消/删除工作极档") |
| | | @PostMapping("/task/remove/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (Objects.isNull(ids) || ids.length < 1) { |
| | | return R.error("参数不能为空!!"); |
| | |
| | | import com.vincent.rsf.server.system.constant.DictTypeCode; |
| | | import com.vincent.rsf.server.system.entity.DictData; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_delivery") |
| | | public class Delivery implements Serializable { |
| | | |
| | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @ApiModelProperty(value = "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 采购单号 |
| | | */ |
| | | @ApiModelProperty(value= "采购单号") |
| | | @ApiModelProperty(value = "采购单号") |
| | | private String code; |
| | | |
| | | /** |
| | | * erp主单标识 |
| | | */ |
| | | @ApiModelProperty(value= "erp主单标识") |
| | | @ApiModelProperty(value = "erp主单标识") |
| | | private String platId; |
| | | |
| | | /** |
| | | * 单据类型 |
| | | */ |
| | | @ApiModelProperty(value= "单据类型") |
| | | @ApiModelProperty(value = "单据类型") |
| | | private String type; |
| | | |
| | | /** |
| | | * 业务类型 |
| | | */ |
| | | @ApiModelProperty(value= "业务类型") |
| | | @ApiModelProperty(value = "业务类型") |
| | | private String wkType; |
| | | |
| | | /** |
| | | * 单据来源 |
| | | */ |
| | | @ApiModelProperty(value= "单据来源") |
| | | @ApiModelProperty(value = "单据来源") |
| | | private String source; |
| | | |
| | | /** |
| | | * 出库数量 |
| | | */ |
| | | @ApiModelProperty(value= "出库数量") |
| | | @ApiModelProperty(value = "出库数量") |
| | | private Double anfme; |
| | | |
| | | /** |
| | | * 已出库数量 |
| | | */ |
| | | @ApiModelProperty(value= "已出库数量") |
| | | @ApiModelProperty(value = "已出库数量") |
| | | private Double qty; |
| | | |
| | | /** |
| | | * 执行中数量 |
| | | */ |
| | | @ApiModelProperty(value= "执行中数量") |
| | | @ApiModelProperty(value = "执行中数量") |
| | | private Double workQty; |
| | | |
| | | /** |
| | | * 平台单号 |
| | | */ |
| | | @ApiModelProperty(value= "平台单号") |
| | | @ApiModelProperty(value = "平台单号") |
| | | private String platCode; |
| | | |
| | | /** |
| | | * 计划出库时间 |
| | | */ |
| | | @ApiModelProperty(value= "计划出库时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "计划出库时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 计划出库结束时间 |
| | | */ |
| | | @ApiModelProperty(value= "计划出库结束时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "计划出库结束时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 状态 1: 已完成 0: 待执行 2: 未完成 |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 已完成 0: 待执行 2: 未完成 ") |
| | | @ApiModelProperty(value = "状态 1: 正常 0: 禁用") |
| | | private Integer status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "状态 1: 执行中 0: 未执行 2: 部分完成 3:已完成 ") |
| | | private Short exceStatus; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @ApiModelProperty(value = "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 租户 |
| | | */ |
| | | @ApiModelProperty(value= "租户") |
| | | @ApiModelProperty(value = "租户") |
| | | private Integer tenantId; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | @ApiModelProperty(value = "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @ApiModelProperty(value = "添加时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | @ApiModelProperty(value = "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @ApiModelProperty(value = "修改时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | @ApiModelProperty(value = "备注") |
| | | private String memo; |
| | | |
| | | public Delivery() {} |
| | | public Delivery() { |
| | | } |
| | | |
| | | public Delivery(String code,String platId,String type,String wkType,String source,Double anfme,Double qty,Double workQty,String platCode,Date startTime,Date endTime,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | public Delivery(String code, String platId, String type, String wkType, String source, Double anfme, Double qty, Double workQty, String platCode, Date startTime, Date endTime, Integer status, Integer deleted, Integer tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { |
| | | this.code = code; |
| | | this.platId = platId; |
| | | this.type = type; |
| | |
| | | // ); |
| | | |
| | | |
| | | public String getType$(){ |
| | | if (Cools.isEmpty(this.type)){ |
| | | public String getExceStatus$() { |
| | | if (Cools.isEmpty(this.exceStatus)) { |
| | | return null; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>() |
| | | .eq(DictData::getDictTypeCode, DictTypeCode.SYS_PO_EXCE_STATUS) |
| | | .eq(DictData::getValue, this.exceStatus)); |
| | | if (Objects.isNull(dictData)) { |
| | | return null; |
| | | } |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public String getType$() { |
| | | if (Cools.isEmpty(this.type)) { |
| | | return ""; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public String getWkType$(){ |
| | | if (Cools.isEmpty(this.wkType)){ |
| | | public String getWkType$() { |
| | | if (Cools.isEmpty(this.wkType)) { |
| | | return ""; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public String getStartTime$(){ |
| | | if (Cools.isEmpty(this.startTime)){ |
| | | public String getStartTime$() { |
| | | if (Cools.isEmpty(this.startTime)) { |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.startTime); |
| | | } |
| | | |
| | | public String getEndTime$(){ |
| | | if (Cools.isEmpty(this.endTime)){ |
| | | public String getEndTime$() { |
| | | if (Cools.isEmpty(this.endTime)) { |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.endTime); |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | public String getStatus$() { |
| | | if (null == this.status) { |
| | | return null; |
| | | } |
| | | switch (this.status) { |
| | | case 1: |
| | | return "已完成"; |
| | | case 0: |
| | | return "待执行"; |
| | | case 2: |
| | | case 2: |
| | | return " 未完成"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | public String getCreateBy$() { |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | if (!Cools.isEmpty(user)) { |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | public String getCreateTime$() { |
| | | if (Cools.isEmpty(this.createTime)) { |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | public String getUpdateBy$() { |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | if (!Cools.isEmpty(user)) { |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | public String getUpdateTime$() { |
| | | if (Cools.isEmpty(this.updateTime)) { |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | public Boolean getStatusBool() { |
| | | if (null == this.status) { |
| | | return null; |
| | | } |
| | | switch (this.status) { |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.vincent.rsf.server.manager.service.TaskService; |
| | | import com.vincent.rsf.server.system.constant.DictTypeCode; |
| | | import com.vincent.rsf.server.system.entity.DictData; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | // public String getParentId$() { |
| | | // if (Cools.isEmpty(this.parentId)) { |
| | | // return null; |
| | | // } |
| | | // TaskService taskService = SpringUtils.getBean(TaskService.class); |
| | | // Task task = taskService.getById(this.parentId); |
| | | // return task.getTaskCode(); |
| | | // } |
| | | |
| | | |
| | | public String getTaskStatus$(){ |
| | | if (Cools.isEmpty(this.taskStatus)) { |
| | | return null; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Excel(name = "*DO单号") |
| | | @ApiModelProperty(value= "*PO单号") |
| | | @ExcelComment(value = "poCode", example = "PO25413975") |
| | | private String poCode; |
| | | @ApiModelProperty(value= "*DO单号") |
| | | @ExcelComment(value = "doCode", example = "DO25413975") |
| | | private String doCode; |
| | | |
| | | @Excel(name = "*行号") |
| | | @ApiModelProperty(value= "*行号") |
| | |
| | | @Excel(name = "物料名称") |
| | | @ApiModelProperty(value= "物料名称") |
| | | @ExcelComment(value = "matnrName", example = "TC-03128寸连体内上托") |
| | | private String matnrName; |
| | | private String maktx; |
| | | |
| | | |
| | | /** |
| | |
| | | @Excel(name = "数量") |
| | | @ApiModelProperty(value= "数量") |
| | | @ExcelComment(value = "anfme", example = "75") |
| | | private Double anfme; |
| | | private String anfme; |
| | | |
| | | /** |
| | | * 供应商编码 |
| | |
| | | @ExcelComment(value = "splrBatch", example = "20250401") |
| | | private String splrBatch; |
| | | |
| | | /** |
| | | * 供应商名称 |
| | | */ |
| | | @Excel(name = "供应商名称") |
| | | @ApiModelProperty(value= "供应商名称") |
| | | @ExcelComment(value = "splrName", example = "中扬立库技术有限公司") |
| | | private String splrName; |
| | | |
| | | |
| | | @Excel(name = "预计送达时间") |
| | | @ApiModelProperty("预计送达时间") |
| | |
| | | |
| | | 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 + ""); |
| | | //生成移库任务 |
| | | Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | moveTask.setSort(task.getSort() + 1); |
| | | if (!taskService.updateById(moveTask)) { |
| | | throw new Exception("任务优先级更新失败!!"); |
| | | } |
| | | } |
| | | //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.*; |
| | | 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; |
| | | |
| | | /** |
| | | * 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()) |
| | | .setType(OrderType.getTypeVal(template.getType())) |
| | | .setWkType(OrderWorkType.getWorkType(template.getWkType())) |
| | | .setMemo(template.getMemo()) |
| | | .setSource(OrderSourceType.ORDER_SOURCE_TYPE_ERP.desc) |
| | | .setAnfme(Double.parseDouble(template.getAnfme())) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId); |
| | | 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()); |
| | | } |
| | | orderItem.setDeliveryId(order.getId()) |
| | | .setDeliveryCode(order.getCode()) |
| | | .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | .setPlatItemId(orderTemplate.getPlatItemId()) |
| | | .setAnfme(Double.parseDouble(orderTemplate.getAnfme())) |
| | | .setUnit(matnr.getUnit()) |
| | | .setCreateBy(loginUserId) |
| | | .setUpdateBy(loginUserId) |
| | | .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | .setMaktx(matnr.getName()) |
| | | .setMatnrCode(matnr.getCode()) |
| | | .setMatnrId(matnr.getId()); |
| | | 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 anfme = items.stream().mapToDouble(DeliveryItem::getAnfme).sum(); |
| | | if (!deliveryService.update(new LambdaUpdateWrapper<Delivery>() |
| | | .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>() |
| | |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("当前站点不支持盘点出库!!"); |
| | | } |
| | | |
| | | task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice()); |
| | | } |
| | | |
| | | if (!taskService.save(task)) { |
| | | 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); |
| | | } |
| | | } 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()); |
| | | moveTask.setParentId(task.getId()).setSort(moveTask.getSort() + 1); |
| | | if (!taskService.saveOrUpdate(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | } |
| | | task.setParentId(moveTask.getId()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("主任务关联失败!!"); |
| | | } |
| | | } |
| | | |
| | |
| | | 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("无法生成新的移库任务,取消失败!!"); |
| | | } |
| | | } |
| | | |
| | |
| | | # global-config:
|
| | | # field-strategy: 0
|
| | | configuration:
|
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
| | | map-underscore-to-camel-case: true
|
| | | cache-enabled: true
|
| | | call-setters-on-nulls: true
|