diff --git a/src/main/java/com/zg/framework/config/SecurityConfig.java b/src/main/java/com/zg/framework/config/SecurityConfig.java index b577993..78f5250 100644 --- a/src/main/java/com/zg/framework/config/SecurityConfig.java +++ b/src/main/java/com/zg/framework/config/SecurityConfig.java @@ -122,6 +122,7 @@ public class SecurityConfig "/AutoInventory/**", "/ws/**", "/photo/**", + "/wisdom/bill/delivery/list", "/wisdom/record/**", "/wisdom/stock/**", "/system/media/**", diff --git a/src/main/java/com/zg/project/information/domain/ConstructionTeam.java b/src/main/java/com/zg/project/information/domain/ConstructionTeam.java index 111ad6e..bae4a5a 100644 --- a/src/main/java/com/zg/project/information/domain/ConstructionTeam.java +++ b/src/main/java/com/zg/project/information/domain/ConstructionTeam.java @@ -25,7 +25,7 @@ public class ConstructionTeam extends BaseEntity private String teamName; /** 施工队编号 */ - @Excel(name = "施工队编号") +// @Excel(name = "施工队编号") private String teamCode; /** 创建人 */ diff --git a/src/main/java/com/zg/project/information/service/impl/ConstructionTeamServiceImpl.java b/src/main/java/com/zg/project/information/service/impl/ConstructionTeamServiceImpl.java index 21ae400..5513bac 100644 --- a/src/main/java/com/zg/project/information/service/impl/ConstructionTeamServiceImpl.java +++ b/src/main/java/com/zg/project/information/service/impl/ConstructionTeamServiceImpl.java @@ -146,26 +146,17 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService StringBuilder failureMsg = new StringBuilder(); Date now = new Date(); - // ===== ① Excel 内去重 ===== - Set teamCodeSet = new HashSet<>(); + // ===== ① Excel 内名称去重 ===== Set teamNameSet = new HashSet<>(); for (ConstructionTeam team : teamList) { - String teamCode = team.getTeamCode(); String teamName = team.getTeamName(); - if (StringUtils.isBlank(teamCode) || StringUtils.isBlank(teamName)) + if (StringUtils.isBlank(teamName)) { failureNum++; - failureMsg.append("
施工队名称/编号不能为空,已跳过。"); - continue; - } - - if (!teamCodeSet.add(teamCode)) - { - failureNum++; - failureMsg.append("
施工队编号重复(Excel 内):").append(teamCode); + failureMsg.append("
施工队名称不能为空,已跳过。"); continue; } @@ -177,28 +168,17 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService } } - // ===== ② 数据库内去重 ===== + // ===== ② 数据库校验 + 自动生成编号 ===== for (ConstructionTeam team : teamList) { try { - // 跳过前面校验失败的数据 - if (StringUtils.isBlank(team.getTeamCode()) || StringUtils.isBlank(team.getTeamName())) + if (StringUtils.isBlank(team.getTeamName())) { continue; } - // 按编号查 - ConstructionTeam existByCode = - constructionTeamMapper.selectByTeamCode(team.getTeamCode()); - if (existByCode != null) - { - failureNum++; - failureMsg.append("
施工队编号已存在:").append(team.getTeamCode()); - continue; - } - - // 按名称查 + // 按名称查重 ConstructionTeam existByName = constructionTeamMapper.selectByTeamName(team.getTeamName()); if (existByName != null) @@ -208,6 +188,14 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService continue; } + // ===== 自动生成唯一编号 ===== + String code; + do { + code = generateTeamCode(); + } while (constructionTeamMapper.selectByTeamCode(code) != null); + + team.setTeamCode(code); + // ===== 新增 ===== team.setCreatedBy(operName); team.setCreatedAt(now); @@ -226,9 +214,7 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService catch (Exception e) { failureNum++; - failureMsg.append("
施工队编号:") - .append(team.getTeamCode()) - .append(",施工队名称:") + failureMsg.append("
施工队名称:") .append(team.getTeamName()) .append(" 导入失败:") .append(e.getMessage()); @@ -245,5 +231,4 @@ public class ConstructionTeamServiceImpl implements IConstructionTeamService return "导入成功,共 " + successNum + " 条数据"; } - } diff --git a/src/main/java/com/zg/project/wisdom/controller/RkBillController.java b/src/main/java/com/zg/project/wisdom/controller/RkBillController.java index a5e342d..68aae49 100644 --- a/src/main/java/com/zg/project/wisdom/controller/RkBillController.java +++ b/src/main/java/com/zg/project/wisdom/controller/RkBillController.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.github.pagehelper.PageHelper; import com.zg.project.wisdom.domain.dto.BorrowReturnDTO; import com.zg.project.wisdom.domain.dto.RkBillCreateDTO; +import com.zg.project.wisdom.domain.vo.DeliveryBillVO; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -136,4 +137,20 @@ public class RkBillController extends BaseController return toAjax(rkBillService.returnBorrow(dto)); } + /** + * 配送出库单据查询 + * @param + * @return + */ + @GetMapping("/delivery/list") + public AjaxResult listDelivery(RkBill query) { + + query.setIsDelivery("1"); + + List list = rkBillService.selectDeliveryBillList(query); + + return AjaxResult.success(list); + + } + } diff --git a/src/main/java/com/zg/project/wisdom/domain/RkInfo.java b/src/main/java/com/zg/project/wisdom/domain/RkInfo.java index 62bc93b..74e4915 100644 --- a/src/main/java/com/zg/project/wisdom/domain/RkInfo.java +++ b/src/main/java/com/zg/project/wisdom/domain/RkInfo.java @@ -127,6 +127,15 @@ public class RkInfo extends BaseEntity @Excel(name = "供应商名称") private String gysMc; + /** SAP订单编号 */ + @Excel(name = "SAP订单编号") + private String sapNo; + + /** 行号 */ + @Excel(name = "行号") + private String xh; + + /** 计划交货金额 */ @Excel(name = "计划交货金额") @JsonSerialize(using = BigDecimalSerializer.class) @@ -137,14 +146,6 @@ public class RkInfo extends BaseEntity @JsonSerialize(using = BigDecimalSerializer.class) private BigDecimal htDj; - /** SAP订单编号 */ - @Excel(name = "SAP订单编号") - private String sapNo; - - /** 行号 */ - @Excel(name = "行号") - private String xh; - /** 计划交货数量 */ @Excel(name = "计划交货数量") @JsonSerialize(using = BigDecimalSerializer.class) @@ -164,6 +165,11 @@ public class RkInfo extends BaseEntity @JsonSerialize(using = BigDecimalSerializer.class) private BigDecimal realQty; + /** 导出用:总金额 = realQty * htDj(不落库) */ + @Excel(name = "总金额") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal totalAmount; + /** 库位码 */ @Excel(name = "库位码") private String pcode; @@ -579,6 +585,14 @@ public class RkInfo extends BaseEntity return realQty; } + public BigDecimal getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(BigDecimal totalAmount) { + this.totalAmount = totalAmount; + } + public void setPcode(String pcode) { this.pcode = pcode; @@ -846,6 +860,7 @@ public class RkInfo extends BaseEntity .append("isUpdate", getIsUpdate()) .append("startDate", startDate) .append("endDate", endDate) + .append("totalAmount", totalAmount) .toString(); } } diff --git a/src/main/java/com/zg/project/wisdom/domain/RkRecord.java b/src/main/java/com/zg/project/wisdom/domain/RkRecord.java index b847660..bf7c74b 100644 --- a/src/main/java/com/zg/project/wisdom/domain/RkRecord.java +++ b/src/main/java/com/zg/project/wisdom/domain/RkRecord.java @@ -142,6 +142,14 @@ public class RkRecord extends BaseEntity @Excel(name = "供应商名称") private String gysMc; + /** SAP订单编号 */ + @Excel(name = "SAP订单编号") + private String sapNo; + + /** 行号 */ + @Excel(name = "行号") + private String xh; + /** 计划交货金额 */ @Excel(name = "计划交货金额") @JsonSerialize(using = BigDecimalSerializer.class) @@ -152,14 +160,6 @@ public class RkRecord extends BaseEntity @JsonSerialize(using = BigDecimalSerializer.class) private BigDecimal htDj; - /** SAP订单编号 */ - @Excel(name = "SAP订单编号") - private String sapNo; - - /** 行号 */ - @Excel(name = "行号") - private String xh; - /** 计划交货数量 */ @Excel(name = "计划交货数量") @JsonSerialize(using = BigDecimalSerializer.class) @@ -179,6 +179,11 @@ public class RkRecord extends BaseEntity @JsonSerialize(using = BigDecimalSerializer.class) private BigDecimal realQty; + /** 导出用:总金额 = realQty * htDj(不落库) */ + @Excel(name = "总金额") + @JsonSerialize(using = BigDecimalSerializer.class) + private BigDecimal totalAmount; + /** 库位码 */ @Excel(name = "库位码") private String pcode; @@ -606,6 +611,14 @@ public class RkRecord extends BaseEntity return realQty; } + public BigDecimal getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(BigDecimal totalAmount) { + this.totalAmount = totalAmount; + } + public void setPcode(String pcode) { this.pcode = pcode; @@ -864,6 +877,7 @@ public class RkRecord extends BaseEntity .append("htQty", getHtQty()) .append("dw", getDw()) .append("realQty", getRealQty()) + .append("totalAmount", totalAmount) .append("pcode", getPcode()) .append("pcodeId", getPcodeId()) .append("trayCode", getTrayCode()) diff --git a/src/main/java/com/zg/project/wisdom/domain/vo/DeliveryBillVO.java b/src/main/java/com/zg/project/wisdom/domain/vo/DeliveryBillVO.java new file mode 100644 index 0000000..a73cdb0 --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/domain/vo/DeliveryBillVO.java @@ -0,0 +1,39 @@ +package com.zg.project.wisdom.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.zg.project.wisdom.domain.RkRecord; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 待配送出库单据 VO + * 以 rk_bill 为主 + 多条 rk_record 明细 + */ +@Data +public class DeliveryBillVO implements Serializable { + + /** 单据号(对应 rk_bill.bill_no) */ + private String billNo; + + /** 施工队编码 */ + private String teamCode; + + /** 施工队名称 */ + private String teamName; + + /** 理货员名称 */ + private String operatorName; + + /** 出库/操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operationTime; + + /** 是否需要配送(0否,1是,2配送中,3配送完成) */ + private String isDelivery; + + /** 该单据下的货物明细 */ + private List recordList; +} diff --git a/src/main/java/com/zg/project/wisdom/mapper/RkRecordMapper.java b/src/main/java/com/zg/project/wisdom/mapper/RkRecordMapper.java index c3f0d27..e210832 100644 --- a/src/main/java/com/zg/project/wisdom/mapper/RkRecordMapper.java +++ b/src/main/java/com/zg/project/wisdom/mapper/RkRecordMapper.java @@ -145,4 +145,8 @@ public interface RkRecordMapper * */ StockStatisticVO selectRecordStatisticByCondition(RkRecord query); + /** + * 根据单据号查询出入库记录 + * */ + List selectByBillNo(String billNo); } diff --git a/src/main/java/com/zg/project/wisdom/service/IRkBillService.java b/src/main/java/com/zg/project/wisdom/service/IRkBillService.java index 5f810f6..64d77ea 100644 --- a/src/main/java/com/zg/project/wisdom/service/IRkBillService.java +++ b/src/main/java/com/zg/project/wisdom/service/IRkBillService.java @@ -4,6 +4,7 @@ import java.util.List; import com.zg.project.wisdom.domain.RkBill; import com.zg.project.wisdom.domain.dto.BorrowReturnDTO; import com.zg.project.wisdom.domain.dto.RkBillCreateDTO; +import com.zg.project.wisdom.domain.vo.DeliveryBillVO; /** * 库存单据Service接口 @@ -77,4 +78,11 @@ public interface IRkBillService * 还料入库 */ int returnBorrow(BorrowReturnDTO dto); + + /** + * 配送出库单据查询 + * @param + * @return + */ + List selectDeliveryBillList(RkBill query); } diff --git a/src/main/java/com/zg/project/wisdom/service/impl/RkBillServiceImpl.java b/src/main/java/com/zg/project/wisdom/service/impl/RkBillServiceImpl.java index 709dcfe..17c6d0c 100644 --- a/src/main/java/com/zg/project/wisdom/service/impl/RkBillServiceImpl.java +++ b/src/main/java/com/zg/project/wisdom/service/impl/RkBillServiceImpl.java @@ -1,6 +1,7 @@ package com.zg.project.wisdom.service.impl; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -18,6 +19,7 @@ import com.zg.project.wisdom.domain.RkRecord; import com.zg.project.wisdom.domain.dto.BorrowReturnDTO; import com.zg.project.wisdom.domain.dto.BorrowReturnItemDTO; import com.zg.project.wisdom.domain.dto.RkBillCreateDTO; +import com.zg.project.wisdom.domain.vo.DeliveryBillVO; import com.zg.project.wisdom.mapper.GysJhMapper; import com.zg.project.wisdom.mapper.RkInfoMapper; import com.zg.project.wisdom.mapper.RkRecordMapper; @@ -697,4 +699,29 @@ public class RkBillServiceImpl implements IRkBillService return dto.getItems().size(); } + @Override + public List selectDeliveryBillList(RkBill query) { + + // 1. 查询出库单据 + List billList = rkBillMapper.selectRkBillList(query); + + List result = new ArrayList<>(); + + for (RkBill bill : billList) { + + DeliveryBillVO vo = new DeliveryBillVO(); + BeanUtils.copyProperties(bill, vo); + + // 2. 查询该单据对应的record明细 + List records = + rkRecordMapper.selectByBillNo(bill.getBillNo()); + + vo.setRecordList(records); + + result.add(vo); + } + + return result; + } + } diff --git a/src/main/resources/application-druid.yml b/src/main/resources/application-druid.yml index 7724b83..d864e74 100644 --- a/src/main/resources/application-druid.yml +++ b/src/main/resources/application-druid.yml @@ -8,6 +8,7 @@ spring: master: # url: jdbc:mysql://47.100.212.83:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.1.28:3306/wisdomnew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:mysql://192.168.1.251:3306/wisdomnew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a9965ee..ede9d67 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,7 +16,7 @@ zg: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 8086 + port: 8087 servlet: # 应用的访问路径 context-path: / diff --git a/src/main/resources/mybatis/wisdom/RkBillMapper.xml b/src/main/resources/mybatis/wisdom/RkBillMapper.xml index af1bb47..a89c973 100644 --- a/src/main/resources/mybatis/wisdom/RkBillMapper.xml +++ b/src/main/resources/mybatis/wisdom/RkBillMapper.xml @@ -117,7 +117,7 @@ AND rb.bill_no = #{billNo} - + AND rb.operation_type = #{operationType} diff --git a/src/main/resources/mybatis/wisdom/RkInfoMapper.xml b/src/main/resources/mybatis/wisdom/RkInfoMapper.xml index 795561a..37a9422 100644 --- a/src/main/resources/mybatis/wisdom/RkInfoMapper.xml +++ b/src/main/resources/mybatis/wisdom/RkInfoMapper.xml @@ -43,6 +43,7 @@ + @@ -72,32 +73,27 @@ SELECT ri.*, - /* 出入库类型名称 */ - COALESCE(sit.type_name, sot.type_name) AS operation_type_name, + /* ===== 新增:计算总金额 ===== */ + ri.real_qty * ri.ht_dj AS total_amount, - /* 物资类型名称 */ + COALESCE(sit.type_name, sot.type_name) AS operation_type_name, mt.type_name AS wl_type_name, - /* 仓库信息 */ wh.warehouse_name, wh.parent_warehouse_code, wh.parent_warehouse_name, - /* 理货员 */ su.nick_name AS operator_name, - /* 库龄 */ DATEDIFF(CURRENT_DATE, ri.operation_time) AS stock_age FROM rk_info ri - LEFT JOIN stock_in_type sit ON ri.operation_type = sit.type_code LEFT JOIN stock_out_type sot ON ri.operation_type = sot.type_code LEFT JOIN material_type mt ON ri.wl_type = mt.type_code LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code LEFT JOIN sys_user su ON ri.operator = su.user_id - + + +