rsf-admin/src/page/basicInfo/basContainer/BasContainerCreate.jsx
@@ -103,7 +103,7 @@ /> </Grid> <Grid item xs={6} display="flex" gap={1}> <ReferenceArrayInput source="areaIds" reference="warehouseAreas"> <ReferenceArrayInput source="areas" reference="warehouseAreas"> <SelectArrayInput label="table.field.basStation.crossZoneArea" optionText="name" rsf-admin/src/page/basicInfo/basContainer/BasContainerEdit.jsx
@@ -82,7 +82,7 @@ /> </Stack> <Stack direction='row' gap={2}> <ReferenceArrayInput source="areaIds" reference="warehouseAreas"> <ReferenceArrayInput source="areas" reference="warehouseAreas"> <SelectArrayInput label="table.field.basContainer.areas" optionText="name" rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx
@@ -1,4 +1,4 @@ import { useState, useRef, useEffect, useMemo, useCallback } from 'react'; import { useState, useRef, useEffect, useMemo, useCallback } from 'react'; import { Stack, Chip, Dialog, DialogTitle, DialogContent, IconButton, CircularProgress } from '@mui/material'; import { useTranslate, useRecordContext } from 'react-admin'; import CloseIcon from '@mui/icons-material/Close'; @@ -20,11 +20,11 @@ }; const fetchAreaNames = async () => { if (!record?.areaIds || record.areaIds.length === 0) return; if (!record?.areas || record.areas.length === 0) return; setLoading(true); try { const res = await request.post(`/warehouseAreas/many/${record.areaIds.join(',')}`); try { const res = await request.post(`/warehouseAreas/many/${record.areas.join(',')}`); if (res?.data?.code === 200) { setAreaNames(res.data.data || []); } @@ -36,10 +36,10 @@ }; useEffect(() => { if (record?.areaIds && record.areaIds.length !== 0 && record.areaIds.length > 0) { if (record?.areas && record.areas.length !== 0 && record.areas.length > 0) { fetchAreaNames(); } }, [record]); }, [record]); if (loading) { return <CircularProgress size={20} />; @@ -47,10 +47,10 @@ return ( <> <Stack direction="row" gap={1} flexWrap="wrap" <Stack direction="row" gap={1} flexWrap="wrap" onClick={handleOpen} sx={{ cursor: 'pointer' }} > @@ -67,16 +67,16 @@ label={`+${areaNames.length - 1}`} /> )} {areaNames.length === 0 && record.areaIds && record.areaIds.length > 0 && ( {areaNames.length === 0 && record.areas && record.areas.length > 0 && ( <Chip size="small" label={`${record.areaIds.length} 个区域`} label={`${record.areas.length} 个区域`} /> )} </Stack> <Dialog open={open} <Dialog open={open} onClose={handleClose} maxWidth="md" fullWidth rsf-admin/src/page/system/role/AssignPermissions_warehouse.jsx
@@ -11,7 +11,7 @@ const DEFAULT_EXPAND_ALL = true; const AssignPermissionsMatnr = (props) => { const AssignPermissionsWarehouse = (props) => { const { role, originMenuIds, setDrawerVal, closeCallback, authType } = props; const translate = useTranslate(); const notify = useNotify(); @@ -377,4 +377,4 @@ ) } export default AssignPermissionsMatnr; export default AssignPermissionsWarehouse; rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/PdaOutStockController.java
@@ -3,10 +3,13 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; import com.vincent.rsf.framework.common.SpringUtils; import com.vincent.rsf.server.api.entity.dto.ContainerWaveDto; import com.vincent.rsf.server.api.entity.params.CallForEmptyContainersParam; import com.vincent.rsf.server.api.entity.params.ContainerWaveParam; import com.vincent.rsf.server.api.entity.params.OrderOutGetType; import com.vincent.rsf.server.api.service.PdaOutStockService; import com.vincent.rsf.server.common.domain.BaseParam; import com.vincent.rsf.server.common.domain.PageParam; @@ -14,6 +17,7 @@ import com.vincent.rsf.server.manager.entity.WkOrderItem; import com.vincent.rsf.server.manager.service.OutStockItemService; import com.vincent.rsf.server.manager.service.OutStockService; import com.vincent.rsf.server.system.constant.DictTypeCode; import com.vincent.rsf.server.system.controller.BaseController; import com.vincent.rsf.server.system.entity.DictData; import com.vincent.rsf.server.system.service.DictDataService; @@ -39,6 +43,8 @@ private OutStockService outStockService; @Resource private OutStockItemService outStockItemService; @Autowired private DictDataService dictDataService; @PreAuthorize("hasAuthority('manager:task:list')") @GetMapping("/outStockTaskItem/{barcode}") @@ -95,4 +101,18 @@ return R.ok().add(outStockItemService.list(new LambdaQueryWrapper<>(WkOrderItem.class).eq(WkOrderItem::getDeleted, 0) .eq(WkOrderItem::getOrderCode, param.getString("orderId")))); } @PostMapping("/orderOut/getType") public R orderOutGetType(@RequestBody OrderOutGetType orderOutGetType) { if (Cools.isEmpty(orderOutGetType)){ return R.ok(); } List<DictData> dictData = dictDataService.list(new LambdaQueryWrapper<DictData>() .eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_BUSINESS_TYPE) .in(DictData::getValue, orderOutGetType.getType()) ); return R.ok(dictData); } } rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/OrderOutGetType.java
New file @@ -0,0 +1,11 @@ package com.vincent.rsf.server.api.entity.params; import lombok.Data; import java.util.List; @Data public class OrderOutGetType { private List<Long> type; } rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasContainerController.java
@@ -32,18 +32,6 @@ BaseParam baseParam = buildParam(map, BaseParam.class); PageParam<BasContainer, BaseParam> pageParam = new PageParam<>(baseParam, BasContainer.class); PageParam<BasContainer, BaseParam> page = basContainerService.page(pageParam, pageParam.buildWrapper(true)); for (BasContainer container : page.getRecords()) { if (!Cools.isEmpty(container.getAreas())) { String content = container.getAreas().substring(1, container.getAreas().length() - 1); String[] parts = content.split(","); Long[] longArray = new Long[parts.length]; for (int i = 0; i < parts.length; i++) { longArray[i] = Long.parseLong(parts[i].trim()); } container.setAreaIds(longArray); } } return R.ok().add(page); } @@ -63,13 +51,6 @@ @GetMapping("/basContainer/{id}") public R get(@PathVariable("id") Long id) { BasContainer basContainer = basContainerService.getById(id); String content = basContainer.getAreas().substring(1, basContainer.getAreas().length() - 1); String[] parts = content.split(","); Long[] longArray = new Long[parts.length]; for (int i = 0; i < parts.length; i++) { longArray[i] = Long.parseLong(parts[i].trim()); } basContainer.setAreaIds(longArray); return R.ok().add(basContainer); } @@ -85,9 +66,6 @@ if (null != container) { return R.error("该类型已被初始化"); } if (null !=basContainer.getAreaIds()){ basContainer.setAreas(Arrays.toString(basContainer.getAreaIds())); } if (!basContainerService.save(basContainer)) { return R.error("Save Fail"); } @@ -100,9 +78,6 @@ public R update(@RequestBody BasContainer basContainer) { basContainer.setUpdateBy(getLoginUserId()); basContainer.setUpdateTime(new Date()); if (null !=basContainer.getAreaIds()){ basContainer.setAreas(Arrays.toString(basContainer.getAreaIds())); } if (!basContainerService.updateById(basContainer)) { return R.error("Update Fail"); } rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasContainer.java
@@ -6,6 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.annotation.JsonProperty; import com.vincent.rsf.server.system.entity.DictData; import com.vincent.rsf.server.system.service.DictDataService; import lombok.experimental.Accessors; @@ -23,10 +25,11 @@ import com.vincent.rsf.server.system.entity.User; import java.io.Serializable; import java.util.Date; import java.util.List; @Data @Accessors(chain = true) @TableName("man_bas_container") @TableName(value = "man_bas_container", autoResultMap = true) public class BasContainer implements Serializable { private static final long serialVersionUID = 1L; @@ -34,10 +37,9 @@ /** * id */ @ApiModelProperty(value= "id") @ApiModelProperty(value = "id") @TableId(value = "id", type = IdType.AUTO) private Long id; @ApiModelProperty("唯一编码") private String code; @@ -45,77 +47,79 @@ /** * 容器类型 */ @ApiModelProperty(value= "容器类型") @ApiModelProperty(value = "容器类型") private Long containerType; /** * 容器条码类型 */ @ApiModelProperty(value= "容器条码类型") @ApiModelProperty(value = "容器条码类型") private String codeType; /** * 可入库区 */ @ApiModelProperty(value= "可入库区") private String areas; @ApiModelProperty(value = "可入库区") @TableField(typeHandler = JacksonTypeHandler.class) private List<Integer> areas; /** * 是否删除 1: 是 0: 否 * 是否删除 1: 是 0: 否 */ @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") @ApiModelProperty(value = "是否删除 1: 是 0: 否 ") private Integer deleted; /** * 状态 */ @ApiModelProperty(value= "状态") @ApiModelProperty(value = "状态") private Integer status; /** * 租户 */ @ApiModelProperty(value= "租户") @ApiModelProperty(value = "租户") private Integer tenantId; /** * 添加人员 */ @ApiModelProperty(value= "添加人员") @ApiModelProperty(value = "添加人员") private Long createBy; /** * 添加时间 */ @ApiModelProperty(value= "添加时间") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "添加时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** * 修改人员 */ @ApiModelProperty(value= "修改人员") @ApiModelProperty(value = "修改人员") private Long updateBy; /** * 修改时间 */ @ApiModelProperty(value= "修改时间") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "修改时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; /** * 备注 */ @ApiModelProperty(value= "备注") @ApiModelProperty(value = "备注") private String memo; @TableField(exist = false) private Long[] areaIds; public BasContainer() {} public BasContainer(Long containerType,String codeType,String areas,Integer deleted,Integer status,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { public BasContainer() { } public BasContainer(Long containerType, String codeType, List<Integer> areas, Integer deleted, Integer status, Integer tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { this.containerType = containerType; this.codeType = codeType; this.areas = areas; @@ -150,51 +154,50 @@ DictDataService service = SpringUtils.getBean(DictDataService.class); DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>() .eq(DictData::getDictTypeCode, "sys_container_type") .eq(DictData::getValue, this.containerType) ); if (!Cools.isEmpty(dictData)){ .eq(DictData::getValue, this.containerType)); if (!Cools.isEmpty(dictData)) { return String.valueOf(dictData.getLabel()); } return ""; } 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: rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/BasContainerServiceImpl.java
@@ -38,44 +38,44 @@ @Override @Transactional(rollbackFor = Exception.class) public R init(InitContainerParams params, Long loginUserId) { if (Objects.isNull(params.getStartNo())) { throw new CoolException("容器起始值不能为空!!"); } if (Objects.isNull(params.getEndNo())) { throw new CoolException("容器结束值不能为空!!"); } // if (Objects.isNull(params.getStartNo())) { // throw new CoolException("容器起始值不能为空!!"); // } // if (Objects.isNull(params.getEndNo())) { // throw new CoolException("容器结束值不能为空!!"); // } // // WarehouseAreas areas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>().eq(WarehouseAreas::getId, 42L)); // if (Objects.isNull(areas)) { // throw new CoolException("库区不存在,请联系管理员!!"); // } // // if (params.getFlagInit()) { // this.remove(new LambdaQueryWrapper<>()); // } // // List<BasContainer> containerList = new ArrayList<>(); // for (int i = params.getStartNo(); i <= params.getEndNo() ; i++) { // BasContainer container = new BasContainer(); // String code = StringUtils.leftPad(i + "", params.getLength(), "0"); // if (!params.getContainerType().equals(3L)) { // params.setPrefix("81"); // } // container.setAreas(areas.getName()) // .setCodeType(QRCodeType.QRCODE_TYPE_BARCODE.desc) // .setCode(params.getPrefix() + code) // .setCreateTime(new Date()) // .setCreateBy(loginUserId) // .setUpdateBy(loginUserId) // .setUpdateTime(new Date()) // .setContainerType(params.getContainerType()); // containerList.add(container); // } // // if (!this.saveBatch(containerList)) { // throw new CoolException("容器保存失败,请检查编码是否有重复!!"); // } WarehouseAreas areas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>().eq(WarehouseAreas::getId, 42L)); if (Objects.isNull(areas)) { throw new CoolException("库区不存在,请联系管理员!!"); } if (params.getFlagInit()) { this.remove(new LambdaQueryWrapper<>()); } List<BasContainer> containerList = new ArrayList<>(); for (int i = params.getStartNo(); i <= params.getEndNo() ; i++) { BasContainer container = new BasContainer(); String code = StringUtils.leftPad(i + "", params.getLength(), "0"); if (!params.getContainerType().equals(3L)) { params.setPrefix("81"); } container.setAreas(areas.getName()) .setCodeType(QRCodeType.QRCODE_TYPE_BARCODE.desc) .setCode(params.getPrefix() + code) .setCreateTime(new Date()) .setCreateBy(loginUserId) .setUpdateBy(loginUserId) .setUpdateTime(new Date()) .setContainerType(params.getContainerType()); containerList.add(container); } if (!this.saveBatch(containerList)) { throw new CoolException("容器保存失败,请检查编码是否有重复!!"); } return R.ok("新增成功!!").add(containerList); return R.ok("新增成功!!"); } }