Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
| | |
| | | String index = fieldsIndex.toString(); |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | for (Fields field : fields) { |
| | | Map<String, String> extendFields = (Map<String, String>) params.get("extendFields"); |
| | | if (!Objects.isNull(extendFields)) { |
| | | if (!Objects.isNull(extendFields.get(field.getFields()))) { |
| | | if (!Objects.isNull(params.get(field.getFields()))) { |
| | | FieldsItem indexItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>() |
| | | .eq(FieldsItem::getUuid, index) |
| | | .eq(FieldsItem::getFieldsId, field.getId())); |
| | |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setUuid(index) |
| | | .setFieldsId(field.getId()) |
| | | .setValue(extendFields.get(field.getFields()).toString()); |
| | | .setValue(params.get(field.getFields()).toString()); |
| | | if (!fieldsItemService.save(item)) { |
| | | throw new CoolException("扩展字段修改失败!!"); |
| | | } |
| | | } else { |
| | | indexItem.setValue(extendFields.get(field.getFields()).toString()); |
| | | indexItem.setValue(params.get(field.getFields()).toString()); |
| | | if (!fieldsItemService.updateById(indexItem)) { |
| | | throw new CoolException("扩展字段修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | saveFields(params, uuid16); |
| | | saveFields(params, params.get("index").toString()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.domain.PageResult; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @PostMapping("/matnr/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | // if (!Objects.isNull(map.get("groupId"))) { |
| | | // return R.ok(matnrService.getPages(map)); |
| | | // } else { |
| | | // BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | // PageParam<Matnr, BaseParam> pageParam = new PageParam<>(baseParam, Matnr.class); |
| | | // return R.ok().add(matnrService.getMatnrPage(pageParam, map)); |
| | | // } |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Matnr, BaseParam> pageParam = new PageParam<>(baseParam, Matnr.class); |
| | | return R.ok().add(matnrService.getMatnrPage(pageParam)); |
| | | return R.ok().add(matnrService.getMatnrPage(pageParam, map)); |
| | | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | |
| | | throw new CoolException("名称不能为空!!"); |
| | | } |
| | | matnr.setUpdateBy(getLoginUserId()); |
| | | if (!matnrService.updateById(matnr)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Matnr matnr1 = matnrService.getById(matnr.getId()); |
| | | params.put("fieldsIndex", matnr1.getFieldsIndex()); |
| | | if (!Objects.isNull(matnr1.getFieldsIndex())) { |
| | | params.put("fieldsIndex", matnr1.getFieldsIndex()); |
| | | } else { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | params.put("index", uuid16); |
| | | matnr.setFieldsIndex(uuid16); |
| | | } |
| | | FieldsUtils.updateFieldsValue(params); |
| | | } |
| | | |
| | | if (!matnrService.updateById(matnr)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(matnr); |
| | | } |
| | | |
| | |
| | | import com.vincent.rsf.server.manager.service.WarehouseService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | ExcelUtil.build(ExcelUtil.create(list, Warehouse.class), response); |
| | | } |
| | | |
| | | @ApiOperation("获取仓库树状图") |
| | | @PreAuthorize("hasAuthority('manager:warehouse:list')") |
| | | @PostMapping("/warehouse/areas") |
| | | public R getAreasForWarehouse(@RequestBody Map<String, Object> param) { |
| | | return R.ok(warehouseService.getAllWarehouseAreas(param)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @version 1.0 |
| | | * @title WarehouseAreasDto |
| | | * @description |
| | | * @create 2025/3/26 13:16 |
| | | */ |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class WarehouseAreasDto { |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("man_warehouse") |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 库区 |
| | | */ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("库区") |
| | | private List<WarehouseAreas> children; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private Integer flagWare; |
| | | |
| | | |
| | | public Warehouse() {} |
| | | |
| | | public Warehouse(String name,String code,String factory,String address,String longitude,String latgitude,Double length,Double width,Double height,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("是否仓库") |
| | | private Integer flagWare; |
| | | /** |
| | | * 备注 |
| | | */ |
| | |
| | | import com.vincent.rsf.server.manager.entity.Warehouse; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface WarehouseMapper extends BaseMapper<Warehouse> { |
| | | |
| | | List<Warehouse> selectByName(@Param("name") String name); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | |
| | | R saveMatnrs(Map<String, Object> matnr); |
| | | |
| | | PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam); |
| | | PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam, Map<String, Object> map); |
| | | |
| | | Matnr selectMatnrById(Long id); |
| | | |
| | | boolean bindMatnrs(MatnrToGroupParams params); |
| | | |
| | | boolean batchUpdate(MatnrToGroupParams params); |
| | | |
| | | PageParam<Matnr, BaseParam> getPages(Map<String, Object> map); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.manager.entity.Warehouse; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface WarehouseService extends IService<Warehouse> { |
| | | |
| | | List<Warehouse> getAllWarehouseAreas(Map<String, Object> param); |
| | | } |
| | |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.R; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("matnrService") |
| | | public class MatnrServiceImpl extends ServiceImpl<MatnrMapper, Matnr> implements MatnrService { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) { |
| | | IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, pageParam.buildWrapper(true)); |
| | | /**获取物料分页信息 */ |
| | | List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | if (!mapList.isEmpty()) { |
| | | mapList.forEach(map -> { |
| | | if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam, Map<String, Object> params) { |
| | | QueryWrapper<Matnr> queryWrapper = pageParam.buildWrapper(true); |
| | | if (params.containsKey("groupId")) { |
| | | Object groupId = params.get("groupId"); |
| | | if (!Objects.isNull(groupId)) { |
| | | List<MatnrGroup> matnrGroups = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getParentId, Long.parseLong(groupId.toString())).select(MatnrGroup::getId)); |
| | | if (!matnrGroups.isEmpty()) { |
| | | List<Long> longs = matnrGroups.stream().map(MatnrGroup::getId).collect(Collectors.toList()); |
| | | queryWrapper.or().in("group_id", longs); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | // IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, queryWrapper); |
| | | // /**获取物料分页信息 */ |
| | | // List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | // if (!mapList.isEmpty()) { |
| | | // mapList.forEach(map -> { |
| | | // if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | // FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true)); |
| | | /**拼接扩展字段*/ |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, queryWrapper); |
| | | List<Matnr> records = page.getRecords(); |
| | | for (Matnr record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getPages(Map<String, Object> map) { |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @desc 更新扩展物料扩展字段值 |
| | | * @param matnr |
| | |
| | | */ |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | // Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | try { |
| | | FieldsUtils.saveFields(extendFields, uuid16); |
| | | FieldsUtils.saveFields(matnr, uuid16); |
| | | matnr1.setFieldsIndex(uuid16); |
| | | } catch (Exception ex) { |
| | | log.error(ex.toString()); |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.mapper.WarehouseMapper; |
| | | import com.vincent.rsf.server.manager.entity.Warehouse; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("warehouseService") |
| | | public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService { |
| | | |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | @Override |
| | | public List<Warehouse> getAllWarehouseAreas(Map<String, Object> param) { |
| | | List<Warehouse> filters = new ArrayList<>(); |
| | | List<Long> wareIds = new ArrayList<>(); |
| | | Object name = param.get("name"); |
| | | boolean isEmpty = !Objects.isNull(name) && !StringUtils.isBlank(name.toString()); |
| | | if (isEmpty) { |
| | | filters = this.baseMapper.selectByName(name.toString()); |
| | | wareIds = filters.stream().map(Warehouse::getId).collect(Collectors.toList()); |
| | | } |
| | | List<Warehouse> warehouses = this.list(new LambdaQueryWrapper<Warehouse>().in(!wareIds.isEmpty(), Warehouse::getId, wareIds)); |
| | | if (warehouses.isEmpty()) { |
| | | throw new CoolException("仓库为空,请添加仓库后再操作!!"); |
| | | } |
| | | List<Long> list = warehouses.stream().map(Warehouse::getId).collect(Collectors.toList()); |
| | | List<WarehouseAreas> warehouseAreas = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>() |
| | | .like(isEmpty, WarehouseAreas::getName, !Objects.isNull(name) ? name.toString() : "") |
| | | .in(!warehouses.isEmpty(), WarehouseAreas::getWarehouseId, list) |
| | | ); |
| | | if (warehouseAreas.isEmpty()) { |
| | | return warehouses; |
| | | } |
| | | warehouses.forEach(warehouse -> { |
| | | warehouse.setFlagWare(1); |
| | | List<WarehouseAreas> areas = new ArrayList<>(); |
| | | warehouseAreas.forEach(warehouseAreas1 -> { |
| | | if (warehouse.getId().equals(warehouseAreas1.getWarehouseId())) { |
| | | warehouseAreas1.setFlagWare(0); |
| | | areas.add(warehouseAreas1); |
| | | } |
| | | }); |
| | | warehouse.setChildren(areas); |
| | | }); |
| | | return warehouses; |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vincent.rsf.server.manager.mapper.WarehouseMapper"> |
| | | |
| | | <select id="selectByName" resultType="com.vincent.rsf.server.manager.entity.Warehouse"> |
| | | SELECT wh.id AS id FROM man_warehouse wh LEFT JOIN man_warehouse_areas wa on wh.id = wa.warehouse_id |
| | | WHERE wh.`name` LIKE CONCAT('%',#{name},'%') OR wa.`name` LIKE CONCAT('%',#{name},'%') |
| | | </select> |
| | | </mapper> |