Bladeren bron

客户/供应商模块编码

ChenYang 1 jaar geleden
bovenliggende
commit
7195259172

+ 43 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/org/OrgController.java

@@ -0,0 +1,43 @@
+package com.ruoyi.web.controller.warewms.org;
+
+import com.ruoyi.ams.bionutrition.org.bean.dto.OrgDTO;
+import com.ruoyi.ams.bionutrition.org.service.IOrgSevice;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 入库单Controller
+ *
+ * @author ruoyi
+ * @date 2022-10-12
+ */
+@RestController
+@RequestMapping("/base/org")
+public class OrgController extends BaseController {
+
+
+    @Autowired
+    private IOrgSevice orgSevice;
+
+
+    /**
+     * 查询入库单列表
+     */
+    @PreAuthorize("@ss.hasPermi('docAsn:docAsn:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(OrgDTO orgDTO) {
+        startPage();
+        List<OrgDTO> orgList = orgSevice.getOrgDTOList(orgDTO);
+        return getDataTable(orgList);
+    }
+
+
+
+}

+ 1 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -73,7 +73,7 @@ spring:
                 min-idle: 0
                 # 连接池中的最大空闲连接
                 max-idle: 8
-                # 连接池的最大数据库连接
+                # 连接池的最大数据库连接
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms

+ 1 - 2
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java

@@ -9,11 +9,11 @@ import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
+import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.business.domain.FilterLockInvLocationDTO;
 import com.ruoyi.ams.config.domain.AsnSoStrategy;
 import com.ruoyi.ams.config.domain.FlowConfigHeader;
 import com.ruoyi.ams.config.domain.dto.InWarehouseDTO;
-import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
 import com.ruoyi.ams.config.domain.dto.OutWarehouseDTO;
 import com.ruoyi.ams.config.mapper.AsnSoStrategyMapper;
@@ -40,7 +40,6 @@ import com.ruoyi.base.service.IBaseIdsequenceService;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.service.IBaseWarehouseService;
 import com.ruoyi.base.utils.IdSequenceUtils;
-import com.ruoyi.framework.web.domain.server.Sys;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 7
ruoyi-common/src/main/java/com/ruoyi/common/constant/base/BizEnum.java

@@ -1,7 +0,0 @@
-package com.ruoyi.common.constant.base;
-
-public interface BizEnum{
-
-	<T> T getCode();
-
-}

+ 2 - 2
ruoyi-common/src/main/java/com/ruoyi/common/constant/base/EnumUtils.java

@@ -8,14 +8,14 @@ import java.util.Arrays;
 
 
 /**
- * @see BizEnum 该类中的枚举都可以使用改工具类,即继承自BizEnum即可
+ * @see IBaseEnum 该类中的枚举都可以使用改工具类,即继承自BizEnum即可
  * @description 通过code来获取枚举对象方法,根据Code找不到对应枚举会返回Null,调用者请避免NPE
  * @author chenyang
  */
 @Slf4j
 public class EnumUtils {
 
-	public static <T extends BizEnum> T getEnumByCode(Object code, Class<T> enumClass){
+	public static <C ,T extends IBaseEnum<C>> T getEnumByCode(C code, Class<T> enumClass){
 
 		//参数校验
 		if(ObjectUtil.isNull(code)) return null;

+ 7 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/base/IBaseEnum.java

@@ -0,0 +1,7 @@
+package com.ruoyi.common.constant.base;
+
+public interface IBaseEnum<T> {
+
+	T getCode();
+
+}

+ 3 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/bean/entity/WarewmsExtEntity.java

@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.util.Date;
 
+@EqualsAndHashCode(callSuper = true)
 @Data
 @Accessors(chain = true)
 public class WarewmsExtEntity extends WarewmsEntity {
@@ -29,4 +31,5 @@ public class WarewmsExtEntity extends WarewmsEntity {
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Date updateDate;
 
+    private String remark;
 }

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/mapper/BaseDao.java

@@ -7,6 +7,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @author chenyang
  *
  */
-public interface BaseDao<T> extends BaseMapper<T> {
+public interface WarewmsMapper<T> extends BaseMapper<T> {
 
 }

+ 55 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/org/bean/dto/OrgDTO.java

@@ -0,0 +1,55 @@
+package com.ruoyi.ams.bionutrition.org.bean.dto;
+
+import com.ruoyi.common.core.bean.dto.WarewmsExtDTO;
+
+public class OrgDTO extends WarewmsExtDTO {
+    private static final long serialVersionUID = -5857432637699543656L;
+
+    /**
+     * 客户/供应商编码
+     */
+    private String orgCode;
+
+    /**
+     * 客户/供应商全称
+     */
+    private String orgName;
+
+    /**
+     * 客户/供应商状态 1-启动 0-停用
+     */
+    private String orgStatus;
+
+    /**
+     * 通信地址
+     */
+    private String orgAddress;
+
+    /**
+     * 联系人
+     */
+    private String orgContacts;
+
+
+    /**
+     * 联系电话
+     */
+    private String orgPhoneNum;
+
+    /**
+     * 开户行
+     */
+    private String orgAccountsBank;
+
+    /**
+     * 企业统一代码
+     */
+    private String orgCreditCode;
+
+
+    /**
+     * 组织类型 00客户,10供应商
+     * @see com.ruoyi.base.constant.type.BizEnum.OrgType#getCode()
+     */
+    private String orgType;
+}

+ 64 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/org/bean/entity/OrgEntity.java

@@ -0,0 +1,64 @@
+package com.ruoyi.ams.bionutrition.org.bean.entity;
+
+import com.ruoyi.common.core.bean.entity.WarewmsExtEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class OrgEntity extends WarewmsExtEntity {
+
+    private static final long serialVersionUID = 4779952752594209822L;
+
+    /**
+     * 客户/供应商编码
+     */
+    private String orgCode;
+
+    /**
+     * 客户/供应商全称
+     */
+    private String orgName;
+
+     /**
+     * 客户/供应商状态 1-启动 0-停用
+     */
+    private String orgStatus;
+
+    /**
+     * 通信地址
+     */
+    private String orgAddress;
+
+    /**
+     * 联系人
+     */
+    private String orgContacts;
+
+
+    /**
+     * 联系电话
+     */
+    private String orgPhoneNum;
+
+    /**
+     * 开户行
+     */
+    private String orgAccountsBank;
+
+    /**
+     * 企业统一代码
+     */
+    private String orgCreditCode;
+
+
+    /**
+     * 组织类型 00客户,10供应商
+     * @see com.ruoyi.base.constant.type.BizEnum.OrgType#getCode()
+     */
+    private String orgType;
+
+
+
+}

+ 10 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/org/mapper/OrgMapper.java

@@ -0,0 +1,10 @@
+package com.ruoyi.ams.bionutrition.org.mapper;
+
+import com.ruoyi.ams.bionutrition.org.bean.entity.OrgEntity;
+import com.ruoyi.framework.mapper.WarewmsMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface OrgMapper extends WarewmsMapper<OrgEntity> {
+
+}

+ 16 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/org/service/IOrgSevice.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ams.bionutrition.org.service;
+
+import com.ruoyi.ams.bionutrition.org.bean.dto.OrgDTO;
+import com.ruoyi.ams.bionutrition.org.bean.entity.OrgEntity;
+import com.ruoyi.framework.service.CrudService;
+
+import java.util.List;
+
+public interface IOrgSevice extends CrudService<OrgEntity, OrgDTO> {
+
+    /**
+     * 获取机构列表
+     * @author
+     */
+    List<OrgDTO> getOrgDTOList(OrgDTO orgDTO);
+}

+ 43 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/org/service/impl/OrgServiceImpl.java

@@ -0,0 +1,43 @@
+package com.ruoyi.ams.bionutrition.org.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.ams.bionutrition.org.bean.dto.OrgDTO;
+import com.ruoyi.ams.bionutrition.org.bean.entity.OrgEntity;
+import com.ruoyi.ams.bionutrition.org.mapper.OrgMapper;
+import com.ruoyi.ams.bionutrition.org.service.IOrgSevice;
+import com.ruoyi.base.constant.type.BizEnum;
+import com.ruoyi.common.utils.ConvertUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.service.impl.CrudServiceImpl;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class OrgServiceImpl extends CrudServiceImpl<OrgMapper, OrgEntity, OrgDTO> implements IOrgSevice {
+
+
+    @Override
+    public List<OrgDTO> getOrgDTOList(OrgDTO orgDTO) {
+        List<OrgEntity> orgEntities = baseDao.selectList(getWrapper(BeanUtil.beanToMap(orgDTO)));
+        return CollectionUtil.isNotEmpty(orgEntities)?
+                ConvertUtils.sourceToTarget(orgEntities, OrgDTO.class) : Lists.newArrayList();
+    }
+
+
+    @Override
+    public QueryWrapper<OrgEntity> getWrapper(Map<String, Object> params) {
+        QueryWrapper<OrgEntity> queryWrapper = new QueryWrapper<>();
+        String orgStatus = StringUtils.isBlank((String)params.get("orgStatus"))
+                ? BizEnum.OrgStatus.Enable.getCode() : BizEnum.OrgStatus.Disable.getCode();
+        queryWrapper.lambda().eq(OrgEntity::getOrgStatus, orgStatus);
+        queryWrapper.lambda().eq(StringUtils.isNotBlank((String)params.get("orgName")), OrgEntity::getOrgName, params.get("orgName"));
+        return queryWrapper;
+    }
+
+
+}

+ 58 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/type/BizEnum.java

@@ -0,0 +1,58 @@
+package com.ruoyi.base.constant.type;
+
+import com.ruoyi.common.constant.base.IBaseEnum;
+
+public class BizEnum {
+
+    /**
+     *   供应商-00 客户-10
+     */
+    public enum OrgType implements IBaseEnum<String> {
+        /**
+         * 供应商
+         */
+        SUPPLIER("00"),
+        /**
+         * 客户
+         */
+        CUSTOMER("01");
+
+        private final String code;
+
+        OrgType(String code) {
+            this.code = code;
+        }
+
+        @Override
+        public String getCode() {
+            return code;
+        }
+    }
+
+
+    /**
+     *  机构状态
+     */
+    public enum OrgStatus implements IBaseEnum<String> {
+        /**
+         * 供应商
+         */
+        Enable("1"),
+        /**
+         * 客户
+         */
+        Disable("0");
+
+        private final String code;
+
+        OrgStatus(String code) {
+            this.code = code;
+        }
+
+        @Override
+        public String getCode() {
+            return code;
+        }
+    }
+
+}