Browse Source

发货计划模块代码 + 销售订单(暂时滞后)模块代码

master
chenfang 2 years ago
parent
commit
966ce68ccd
  1. 8
      win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java
  2. 118
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/DeliverPlanMainController.java
  3. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailBaseVO.java
  4. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailExcelVO.java
  5. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailExportReqVO.java
  6. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailPageReqVO.java
  7. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainBaseVO.java
  8. 45
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainExcelVO.java
  9. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainImportVO.java
  10. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/deliverPlan/DeliverPlanMainConvert.java
  11. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/deliverPlan/DeliverPlanDetailDO.java
  12. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverPlan/DeliverPlanDetailMapper.java
  13. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverPlan/DeliverPlanMainMapper.java
  14. 9
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverRequest/DeliverRequestMainMapper.java
  15. 1
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanDetailService.java
  16. 37
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanDetailServiceImpl.java
  17. 65
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanMainService.java
  18. 242
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanMainServiceImpl.java
  19. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java
  20. 203
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/sale/SaleMainServiceImpl.java

8
win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java

@ -703,6 +703,14 @@ public interface ErrorCodeConstants {
ErrorCode DELIVER_PLAN_MAIN_NOT_EXISTS = new ErrorCode(1_000_118_000, "发货计划主不存在");
ErrorCode DELIVER_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_000_118_001, "发货计划子不存在");
ErrorCode DELIVER_PLAN_STATUS_NOT_NEW = new ErrorCode(1_000_118_002, "发货计划不是新增状态");
ErrorCode DELIVER_PLAN_REQUEST_EXISTS = new ErrorCode(1_000_118_003, "发货计划存在成品发货申请");
ErrorCode DELIVER_PLAN_CANNOT_CLOSE = new ErrorCode(1_000_118_004, "发货计划状态不支持关闭");
ErrorCode DELIVER_PLAN_CANNOT_SUBMIT = new ErrorCode(1_000_118_005, "发货计划状态不支持提交");
ErrorCode DELIVER_PLAN_CANNOT_AGREE = new ErrorCode(1_000_118_006, "发货计划状态不支持审批同意");
ErrorCode DELIVER_PLAN_CANNOT_REFUSE = new ErrorCode(1_000_118_007, "发货计划状态不支持审批驳回");
ErrorCode DELIVER_PLAN_CANNOT_PUBLISH = new ErrorCode(1_000_118_008, "发货计划状态不支持发布");
ErrorCode DELIVER_PLAN_CANNOT_OPEN = new ErrorCode(1_000_118_009, "发货计划状态不支持打开");
ErrorCode DELIVER_PLAN_CANNOT_RESETTING = new ErrorCode(1_000_118_010, "发货计划状态不支持重置");
//发货申请ErrorCode
ErrorCode DELIVER_REQUEST_MAIN_NOT_EXISTS = new ErrorCode(1_000_119_000, "发货申请主不存在");
ErrorCode DELIVER_REQUEST_NOT_EXISTS = new ErrorCode(1_000_119_000, "发货申请不存在");

118
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/DeliverPlanMainController.java

@ -3,14 +3,22 @@ package com.win.module.wms.controller.deliverPlan;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.framework.excel.core.util.ConvertUtil;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import com.win.module.wms.controller.deliverPlan.vo.*;
import com.win.module.wms.controller.purchasereceiptRequest.vo.PurchasereceiptRequestMainExcelVO;
import com.win.module.wms.convert.deliverPlan.DeliverPlanMainConvert;
import com.win.module.wms.convert.purchasereceiptRequest.PurchasereceiptRequestMainConvert;
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanDetailDO;
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanMainDO;
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestDetailDO;
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestMainDO;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.service.deliverPlan.DeliverPlanDetailService;
import com.win.module.wms.service.deliverPlan.DeliverPlanMainService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -41,6 +49,8 @@ public class DeliverPlanMainController {
@Resource
private DeliverPlanMainService deliverPlanMainService;
@Resource
private DeliverPlanDetailService deliverPlanDetailService;
@Resource
private AdminUserApi userApi;
@PostMapping("/create")
@ -58,6 +68,62 @@ public class DeliverPlanMainController {
return success(true);
}
@PutMapping("/close")
@Operation(summary = "关闭发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:close')")
public CommonResult<Boolean> closeDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.closeDeliverPlanMain(id);
return success(true);
}
@PutMapping("/open")
@Operation(summary = "打开发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:open')")
public CommonResult<Boolean> openDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.openDeliverPlanMain(id);
return success(true);
}
@PutMapping("/submit")
@Operation(summary = "提交发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:submit')")
public CommonResult<Boolean> submitDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.submitDeliverPlanMain(id);
return success(true);
}
@PutMapping("/agree")
@Operation(summary = "审批通过发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:agree')")
public CommonResult<Boolean> agreeDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.agreeDeliverPlanMain(id);
return success(true);
}
@PutMapping("/refies")
@Operation(summary = "审批驳回发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:refies')")
public CommonResult<Boolean> refiesDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.refiesDeliverPlanMain(id);
return success(true);
}
@PutMapping("/publish")
@Operation(summary = "发布发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:publish')")
public CommonResult<Boolean> publishDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.publishDeliverPlanMain(id);
return success(true);
}
@PutMapping("/resetting")
@Operation(summary = "重置发货计划主")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:resetting')")
public CommonResult<Boolean> resettingDeliverPlanMain(@RequestParam("id") Long id) {
deliverPlanMainService.resettingDeliverPlanMain(id);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除发货计划主")
@Parameter(name = "id", description = "编号", required = true)
@ -101,7 +167,8 @@ public class DeliverPlanMainController {
for(DeliverPlanMainRespVO vo : result.getList()) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
//后端创建个字段作为前端展示的虚拟字段
vo.setCreator(user.getNickname());
vo.setCreator(userApi.getUser(Long.valueOf(vo.getCreator())).getNickname());
vo.setUpdater(userApi.getUser(Long.valueOf(vo.getUpdater())).getNickname());
}
return success(result);
}
@ -114,12 +181,49 @@ public class DeliverPlanMainController {
List<DeliverPlanMainDO> list = deliverPlanMainService.getDeliverPlanMainList(exportReqVO);
// 导出 Excel
List<DeliverPlanMainExcelVO> datas = DeliverPlanMainConvert.INSTANCE.convertList02(list);
Map<Integer, String[]> mapDropDown = new HashMap<>();
List<DeliverPlanMainExcelVO> resultList = this.getExcelVo(list, mapDropDown);
for(DeliverPlanMainExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
//后端创建个字段作为前端展示的虚拟字段
vo.setCreator(user.getNickname());
}
ExcelUtils.write(response, "发货计划主.xls", "数据", DeliverPlanMainExcelVO.class, datas);
ExcelUtils.write(response, "发货计划主.xls", "数据", DeliverPlanMainExcelVO.class, resultList,mapDropDown);
}
@PostMapping("/export-excel-senior")
@Operation(summary = "导出发货计划主 Excel")
@PreAuthorize("@ss.hasPermission('wms:deliver-plan-main:export')")
@OperateLog(type = EXPORT)
public void exportPurchasereceiptRequestMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException {
List<DeliverPlanMainDO> list = deliverPlanMainService.getDeliverPlanMainList(conditions);
//组装vo
Map<Integer, String[]> mapDropDown = new HashMap<>();
List<DeliverPlanMainExcelVO> resultList = this.getExcelVo(list, mapDropDown);
// 导出 Excel
ExcelUtils.write(response, "采购收货申请主.xlsx", "数据", DeliverPlanMainExcelVO.class, resultList, mapDropDown);
}
private List<DeliverPlanMainExcelVO> getExcelVo(List<DeliverPlanMainDO> list, Map<Integer, String[]> mapDropDown) {
String[] status = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PLAN_STATUS);
mapDropDown.put(9, status);
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE);
mapDropDown.put(12, available);
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM);
mapDropDown.put(21, uom);
mapDropDown.put(22, available);
List<DeliverPlanMainExcelVO> resultList = new ArrayList<>();
// 导出
for(DeliverPlanMainDO mainDO : list) {
List<DeliverPlanDetailDO> subList = deliverPlanDetailService.selectListByID(mainDO.getId());
for(DeliverPlanDetailDO detailDO : subList) {
DeliverPlanMainExcelVO vo = DeliverPlanMainConvert.INSTANCE.convert(mainDO, detailDO);
AdminUserRespDTO user = userApi.getUser(Long.valueOf(mainDO.getCreator()));
vo.setCreator(user.getNickname());
resultList.add(vo);
}
}
return resultList;
}
@GetMapping("/get-import-template")
@ -128,10 +232,12 @@ public class DeliverPlanMainController {
// 手动创建导出 demo
List<DeliverPlanMainImportVO> list = new ArrayList<>();
Map<Integer, String[]> mapDropDown = new HashMap<>();
// String[] purchaseReturnReason = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PURCHASE_RETURN_REASON);
// mapDropDown.put(16, purchaseReturnReason);
// String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM);
// mapDropDown.put(25, uom);
String[] status = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PLAN_STATUS);
mapDropDown.put(9, status);
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE);
mapDropDown.put(12, available);
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM);
mapDropDown.put(12, uom);
// 输出
ExcelUtils.write(response, "发货计划信息导入模板.xlsx", "发货计划信息列表", DeliverPlanMainImportVO.class, list, mapDropDown);
}

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailBaseVO.java

@ -52,6 +52,9 @@ public class DeliverPlanDetailBaseVO {
@Schema(description = "计划数量")
private BigDecimal planQty;
@Schema(description = "发货数量")
private BigDecimal shippedQty;
@Schema(description = "计量单位")
private String uom;

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailExcelVO.java

@ -50,6 +50,9 @@ public class DeliverPlanDetailExcelVO {
@ExcelProperty("计划数量")
private BigDecimal planQty;
@ExcelProperty("发货数量")
private BigDecimal shippedQty;
@ExcelProperty(value = "计量单位", converter = DictConvert.class)
@DictFormat("uom") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
private String uom;

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailExportReqVO.java

@ -46,6 +46,9 @@ public class DeliverPlanDetailExportReqVO {
@Schema(description = "计划数量")
private BigDecimal planQty;
@Schema(description = "发货数量")
private BigDecimal shippedQty;
@Schema(description = "计量单位")
private String uom;

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanDetailPageReqVO.java

@ -48,6 +48,9 @@ public class DeliverPlanDetailPageReqVO extends PageParam {
@Schema(description = "计划数量")
private BigDecimal planQty;
@Schema(description = "发货数量")
private BigDecimal shippedQty;
@Schema(description = "计量单位")
private String uom;

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainBaseVO.java

@ -1,5 +1,6 @@
package com.win.module.wms.controller.deliverPlan.vo;
import com.win.framework.excel.core.annotations.OnlyOne;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -23,6 +24,7 @@ public class DeliverPlanMainBaseVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime planDate;
@OnlyOne
@Schema(description = "单据号")
private String number;

45
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainExcelVO.java

@ -1,7 +1,10 @@
package com.win.module.wms.controller.deliverPlan.vo;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
@ -26,9 +29,11 @@ public class DeliverPlanMainExcelVO {
private String customerCode;
@ExcelProperty("计划日期")
@ColumnWidth(value = 21)
private LocalDateTime planDate;
@ExcelProperty("单据号")
@ColumnWidth(value = 20)
private String number;
@ExcelProperty("业务类型")
@ -38,15 +43,18 @@ public class DeliverPlanMainExcelVO {
private String remark;
@ExcelProperty("创建时间")
@ColumnWidth(value = 21)
private LocalDateTime createTime;
@ExcelProperty("创建者用户名")
private String creator;
@ExcelProperty("开始时间")
@ColumnWidth(value = 21)
private LocalDateTime beginTime;
@ExcelProperty("结束时间")
@ColumnWidth(value = 21)
private LocalDateTime endTime;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@ -54,12 +62,47 @@ public class DeliverPlanMainExcelVO {
private String status;
@ExcelProperty("最后更新时间")
@ColumnWidth(value = 21)
private LocalDateTime updateTime;
@ExcelProperty("最后更新者用户名")
private String updater;
@ExcelProperty("是否可用")
@ExcelProperty(value = "是否可用", converter = DictConvert.class)
@DictFormat("true_false")
private String available;
//子表导出字段
@ExcelProperty("销售订单号")
private String soNumber;
@ExcelProperty("销售订单行")
private String soLine;
@ExcelProperty("客户月台")
private String customerDockCode;
@ExcelProperty("项目")
private String project;
@ExcelProperty("物品代码")
@ColumnWidth(value = 15)
private String itemCode;
@ExcelProperty("备注")
private String remarkDetail;
@ExcelProperty("计划数量")
private BigDecimal planQty;
@ExcelProperty("发货数量")
private BigDecimal shippedQty;
@ExcelProperty(value = "计量单位", converter = DictConvert.class)
@DictFormat("uom") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
private String uom;
@ExcelProperty("是否可用")
private String availableDetail;
}

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverPlan/vo/DeliverPlanMainImportVO.java

@ -13,7 +13,7 @@ import java.math.BigDecimal;
/**
* 采购索赔申请子 Excel VO
* 发货计划申请 Excel VO
*
* @author 超级管理员
*/
@ -32,19 +32,30 @@ public class DeliverPlanMainImportVO {
@ExcelProperty("计划日期")
private String planDate;
@ExcelProperty("开始日期")
private String beginTime;
@ExcelProperty("结束日期")
private String endTime;
//子表数据
@ExcelProperty("销售订单号")
private String soNumber;
@ExcelProperty("销售订单行")
private BigDecimal soLine;
@ExcelProperty("物品代码")
private String itemCode;
@ExcelProperty("计划数量")
private BigDecimal qty;
@ExcelProperty(value = "计量单位", converter = DictConvert.class)
@DictFormat(DictTypeConstants.UOM)
private String uom;
@ExcelProperty("客户月台代码")
private String customerDockCode;
}

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/deliverPlan/DeliverPlanMainConvert.java

@ -42,5 +42,16 @@ public interface DeliverPlanMainConvert {
})
DeliverPlanMainImportErrorVO convert(DeliverPlanMainCreateReqVO mainVo, DeliverPlanDetailDO detailDo);
@Mappings({
@Mapping(source = "mainDO.number", target = "number"),
@Mapping(source = "mainDO.remark", target = "remark"),
@Mapping(source = "mainDO.createTime", target = "createTime"),
@Mapping(source = "mainDO.creator", target = "creator"),
@Mapping(source = "mainDO.updateTime", target = "updateTime"),
@Mapping(source = "mainDO.updater", target = "updater"),
@Mapping(source = "mainDO.available", target = "available"),
@Mapping(source = "detailDO.remark", target = "remarkDetail"),
@Mapping(source = "detailDO.available", target = "availableDetail"),
})
DeliverPlanMainExcelVO convert(DeliverPlanMainDO mainDO, DeliverPlanDetailDO detailDO);
}

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/deliverPlan/DeliverPlanDetailDO.java

@ -1,5 +1,6 @@
package com.win.module.wms.dal.dataobject.deliverPlan;
import com.sun.xml.bind.v2.TODO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
@ -67,6 +68,10 @@ public class DeliverPlanDetailDO extends BaseDO {
* 计划数量
*/
private BigDecimal planQty;
/**
* 发货数量
*/
private BigDecimal shippedQty;
/**
* 计量单位
*

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverPlan/DeliverPlanDetailMapper.java

@ -32,6 +32,7 @@ public interface DeliverPlanDetailMapper extends BaseMapperX<DeliverPlanDetailDO
.betweenIfPresent(DeliverPlanDetailDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DeliverPlanDetailDO::getCreator, reqVO.getCreator())
.eqIfPresent(DeliverPlanDetailDO::getPlanQty, reqVO.getPlanQty())
.eqIfPresent(DeliverPlanDetailDO::getShippedQty, reqVO.getShippedQty())
.eqIfPresent(DeliverPlanDetailDO::getUom, reqVO.getUom())
.betweenIfPresent(DeliverPlanDetailDO::getUpdateTime, reqVO.getUpdateTime())
.eqIfPresent(DeliverPlanDetailDO::getUpdater, reqVO.getUpdater())
@ -53,6 +54,7 @@ public interface DeliverPlanDetailMapper extends BaseMapperX<DeliverPlanDetailDO
.betweenIfPresent(DeliverPlanDetailDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DeliverPlanDetailDO::getCreator, reqVO.getCreator())
.eqIfPresent(DeliverPlanDetailDO::getPlanQty, reqVO.getPlanQty())
.eqIfPresent(DeliverPlanDetailDO::getShippedQty, reqVO.getShippedQty())
.eqIfPresent(DeliverPlanDetailDO::getUom, reqVO.getUom())
.betweenIfPresent(DeliverPlanDetailDO::getUpdateTime, reqVO.getUpdateTime())
.eqIfPresent(DeliverPlanDetailDO::getUpdater, reqVO.getUpdater())
@ -60,4 +62,8 @@ public interface DeliverPlanDetailMapper extends BaseMapperX<DeliverPlanDetailDO
.orderByDesc(DeliverPlanDetailDO::getId));
}
default List<DeliverPlanDetailDO> selectList(Long masterId){
return selectList(new LambdaQueryWrapperX<DeliverPlanDetailDO>().eq(DeliverPlanDetailDO::getMasterId,masterId));
}
}

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverPlan/DeliverPlanMainMapper.java

@ -61,4 +61,7 @@ public interface DeliverPlanMainMapper extends BaseMapperX<DeliverPlanMainDO> {
.orderByDesc(DeliverPlanMainDO::getId));
}
default List<DeliverPlanMainDO> selectSeniorList(CustomConditions conditions){
return selectList(QueryWrapperUtils.structure(conditions));
}
}

9
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/deliverRequest/DeliverRequestMainMapper.java

@ -11,6 +11,8 @@ import com.win.module.wms.controller.deliverRequest.vo.DeliverRequestMainExportR
import com.win.module.wms.controller.deliverRequest.vo.DeliverRequestMainPageReqVO;
import com.win.module.wms.dal.dataobject.deliverRequest.DeliverRequestMainDO;
import com.win.module.wms.dal.dataobject.issueRequest.IssueRequestMainDO;
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobMainDO;
import com.win.module.wms.enums.order.OrderStatusEnum;
import org.apache.ibatis.annotations.Mapper;
/**
@ -57,6 +59,13 @@ public interface DeliverRequestMainMapper extends BaseMapperX<DeliverRequestMain
default PageResult<DeliverRequestMainDO> selectSenior(CustomConditions conditions) {
return selectPage(conditions, QueryWrapperUtils.structure(conditions));
}
default Long selectByDeliverPlanNumber(String deliverPlanNumber) {
return selectCount(new LambdaQueryWrapperX<DeliverRequestMainDO>()
.eq(DeliverRequestMainDO::getDeliverPlanNumber, deliverPlanNumber)
.ne(DeliverRequestMainDO::getStatus, OrderStatusEnum.CLOSED.getCode()));
}
default List<DeliverRequestMainDO> selectList(DeliverRequestMainExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<DeliverRequestMainDO>()
.eqIfPresent(DeliverRequestMainDO::getDeliverPlanNumber, reqVO.getDeliverPlanNumber())

1
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanDetailService.java

@ -79,4 +79,5 @@ public interface DeliverPlanDetailService {
*/
List<DeliverPlanDetailDO> getDeliverPlanDetailList(DeliverPlanDetailExportReqVO exportReqVO);
List<DeliverPlanDetailDO> selectListByID(Long id);
}

37
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanDetailServiceImpl.java

@ -1,10 +1,15 @@
package com.win.module.wms.service.deliverPlan;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.wms.controller.deliverPlan.vo.DeliverPlanDetailCreateReqVO;
import com.win.module.wms.controller.deliverPlan.vo.DeliverPlanDetailExportReqVO;
import com.win.module.wms.controller.deliverPlan.vo.DeliverPlanDetailPageReqVO;
import com.win.module.wms.controller.deliverPlan.vo.DeliverPlanDetailUpdateReqVO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import com.win.module.wms.service.deliverJob.DeliverJobMainService;
import com.win.module.wms.service.itembasic.ItembasicService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -31,12 +36,19 @@ public class DeliverPlanDetailServiceImpl implements DeliverPlanDetailService {
@Resource
private DeliverPlanDetailMapper deliverPlanDetailMapper;
@Resource
private ItembasicService itembasicService;
@Resource
private DeliverJobMainService deliverJobMainService;
@Resource
private TrendsApi trendsApi;
@Override
public Long createDeliverPlanDetail(DeliverPlanDetailCreateReqVO createReqVO) {
// 插入
DeliverPlanDetailDO deliverPlanDetail = DeliverPlanDetailConvert.INSTANCE.convert(createReqVO);
validateDetailCreate(deliverPlanDetail);
deliverPlanDetailMapper.insert(deliverPlanDetail);
trendsApi.createTrends(deliverPlanDetail.getId(), "DeliverPlanDetail", "增加了发货计划子表", TrendsTypeEnum.CREATE);
// 返回
return deliverPlanDetail.getId();
}
@ -47,6 +59,7 @@ public class DeliverPlanDetailServiceImpl implements DeliverPlanDetailService {
validateDeliverPlanDetailExists(updateReqVO.getId());
// 更新
DeliverPlanDetailDO updateObj = DeliverPlanDetailConvert.INSTANCE.convert(updateReqVO);
trendsApi.createTrends(updateObj.getId(), "DeliverPlanDetail", "修改了发货计划子表", TrendsTypeEnum.UPDATE);
deliverPlanDetailMapper.updateById(updateObj);
}
@ -87,4 +100,26 @@ public class DeliverPlanDetailServiceImpl implements DeliverPlanDetailService {
return deliverPlanDetailMapper.selectList(exportReqVO);
}
@Override
public List<DeliverPlanDetailDO> selectListByID(Long masterId){
return deliverPlanDetailMapper.selectList(masterId);
}
//校验子表公共方法(适用于新增/修改)
private void validateDetailCreate(DeliverPlanDetailDO deliverPlanDetailDO) {
ItembasicDO itembasicDO = this.validatorItembasic(deliverPlanDetailDO.getItemCode());
if ( !deliverPlanDetailDO.getUom().equals(itembasicDO.getUom())) {
throw exception(UOM_ERROR, deliverPlanDetailDO.getUom());
}
//TODO 暂时注释
//this.validatorDetailExist(deliverPlanDetailDO.getSoNumber(), deliverPlanDetailDO.getSoLine(), deliverPlanDetailDO.getItemCode());
}
private ItembasicDO validatorItembasic(String itemCode) {
return itembasicService.selectItembasic(itemCode);
}
//子表校验客户代码
private void validatorDetailExist(String soNumber, String soLine, String itemCode) {
deliverJobMainService.saleDetailExist(soNumber, soLine, itemCode);
}
}

65
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanMainService.java

@ -6,6 +6,7 @@ import com.win.module.wms.controller.deliverPlan.vo.*;
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanMainDO;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
@ -77,6 +78,14 @@ public interface DeliverPlanMainService {
*/
List<DeliverPlanMainDO> getDeliverPlanMainList(DeliverPlanMainExportReqVO exportReqVO);
/**
* 获得发货计划主列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 发货计划主列表
*/
List<DeliverPlanMainDO> getDeliverPlanMainList(CustomConditions conditions);
/**
* 批量导入采购索赔申请主信息
* @param datas 导入采购索赔申请主信息列表
@ -86,4 +95,60 @@ public interface DeliverPlanMainService {
*/
public List<DeliverPlanMainImportErrorVO> importDeliverPlanMainList(List<DeliverPlanMainCreateReqVO> datas, Integer mode, boolean updatePart);
/**
* 更新发货计划的已发货数量
* @param pnumber
* @param pitemCode
* @param pshippedQty
*/
public void updatePlanDeliveShippedQty(String pnumber, String pitemCode, BigDecimal pshippedQty);
/**
* 关闭
* @param id
* @return
*/
public Integer closeDeliverPlanMain(Long id);
/**
* 打开
* @param id
* @return
*/
public Integer openDeliverPlanMain(Long id);
/**
* 提交审批
* @param id
* @return
*/
public Integer submitDeliverPlanMain(Long id);
/**
* 审批通过
* @param id
* @return
*/
public Integer agreeDeliverPlanMain(Long id);
/**
* 审批驳回
* @param id
* @return
*/
public Integer refiesDeliverPlanMain(Long id);
/**
* 发布
* @param id
* @return
*/
public Integer publishDeliverPlanMain(Long id);
/**
* 重置
* @param id
* @return
*/
public Integer resettingDeliverPlanMain(Long id);
}

242
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/deliverPlan/DeliverPlanMainServiceImpl.java

@ -1,12 +1,14 @@
package com.win.module.wms.service.deliverPlan;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.exception.ServiceException;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.system.api.dict.DictDataApi;
import com.win.module.system.api.dict.dto.DictDataRespDTO;
import com.win.module.system.api.serialnumber.SerialNumberApi;
import com.win.module.system.enums.serialNumber.RuleCodeEnum;
import com.win.module.wms.controller.deliverPlan.vo.*;
@ -18,11 +20,11 @@ import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanDetailDO;
import com.win.module.wms.dal.dataobject.deliverPlan.DeliverPlanMainDO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import com.win.module.wms.dal.dataobject.requestsetting.RequestsettingDO;
import com.win.module.wms.dal.dataobject.sale.SaleDetailDO;
import com.win.module.wms.dal.mysql.deliverPlan.DeliverPlanDetailMapper;
import com.win.module.wms.dal.mysql.deliverPlan.DeliverPlanMainMapper;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.enums.request.RequestStatusEnum;
import com.win.module.wms.dal.mysql.deliverRequest.DeliverRequestMainMapper;
import com.win.module.wms.enums.plan.PlanStatusEnum;
import com.win.module.wms.enums.plan.PlanStatusState;
import com.win.module.wms.service.businesstype.BusinesstypeService;
import com.win.module.wms.service.customer.CustomerService;
import com.win.module.wms.service.deliverJob.DeliverJobMainService;
@ -33,9 +35,11 @@ import com.win.module.wms.service.shift.ShiftService;
import com.win.module.wms.service.supplieritem.SupplieritemService;
import com.win.module.wms.util.JobUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -57,6 +61,8 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
@Resource
private DeliverPlanDetailMapper deliverPlanDetailMapper;
@Resource
private DeliverRequestMainMapper deliverRequestMainMapper;
@Resource
private ItembasicService itembasicService;
@Resource
private JobUtils jobUtils;
@ -78,30 +84,28 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
private TrendsApi trendsApi;
@Resource
private RequestsettingService requestsettingService;
@Resource
private DictDataApi dictDataApi;
@Override
public Long createDeliverPlanMain(DeliverPlanMainCreateReqVO createReqVO) {
RequestsettingDO requestsettingDO = requestsettingService.selectRequestsettingExist("DeliverPlan");
DeliverPlanMainDO deliverPlanMainDO = validatorToCreate(createReqVO);
//调用自动执行方法
if(RequestStatusEnum.HANDLING.getCode().equals(deliverPlanMainDO.getStatus())) {
}
trendsApi.createTrends(requestsettingDO.getId(), "DeliverPlan", "增加了发货计划", TrendsTypeEnum.CREATE);
trendsApi.createTrends(requestsettingDO.getId(), "DeliverPlanMain", "增加了发货计划", TrendsTypeEnum.CREATE);
return deliverPlanMainDO.getId();
}
@Override
@Transactional
public void updateDeliverPlanMain(DeliverPlanMainUpdateReqVO updateReqVO) {
RequestsettingDO requestsettingDO = requestsettingService.selectRequestsettingExist("DeliverPlan");
// 校验存在
validateDeliverPlanMainExists(updateReqVO.getId());
DeliverPlanMainDO deliverPlanMainDO = validatorToUpdate(updateReqVO);
if(RequestStatusEnum.HANDLING.getCode().equals(deliverPlanMainDO.getStatus())) {
DeliverPlanMainDO deliverPlanMainDO = validateDeliverPlanMainExists(updateReqVO.getId());
if(!PlanStatusEnum.NEW.getCode().equals(deliverPlanMainDO.getStatus())) {
throw exception(DELIVER_PLAN_STATUS_NOT_NEW);
}
trendsApi.createTrends(requestsettingDO.getId(), "DeliverPlan", "修改了发货计划", TrendsTypeEnum.CREATE);
deliverPlanMainMapper.updateById(deliverPlanMainDO);
trendsApi.createTrends(updateReqVO.getId(), "DeliverPlanMain", deliverPlanMainDO.toString(), TrendsTypeEnum.UPDATE);
}
@Override
@ -112,10 +116,169 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
deliverPlanMainMapper.deleteById(id);
}
private void validateDeliverPlanMainExists(Long id) {
if (deliverPlanMainMapper.selectById(id) == null) {
private DeliverPlanMainDO validateDeliverPlanMainExists(Long id) {
DeliverPlanMainDO deliverPlanMainDO = deliverPlanMainMapper.selectById(id);
if (deliverPlanMainDO == null) {
throw exception(DELIVER_PLAN_MAIN_NOT_EXISTS);
}
return deliverPlanMainDO;
}
/**
* 更新发货计划的已发货数量
* @param pnumber
* @param pitemCode
* @param pshippedQty
*/
@Override
public void updatePlanDeliveShippedQty(String pnumber, String pitemCode, BigDecimal pshippedQty){
QueryWrapper<DeliverPlanMainDO> mainDOQueryWrapper = new QueryWrapper<>();
DeliverPlanDetailDO deliverPlanDetailDO = null;
mainDOQueryWrapper.eq("number",pnumber);
mainDOQueryWrapper.eq("status","6");
DeliverPlanMainDO deliverPlanMainDO = deliverPlanMainMapper.selectOne(mainDOQueryWrapper);
if(deliverPlanMainDO != null){
QueryWrapper<DeliverPlanDetailDO> detailDOQueryWrapper = new QueryWrapper<>();
detailDOQueryWrapper.eq("number",pnumber);
detailDOQueryWrapper.eq("itembasic",pitemCode);
detailDOQueryWrapper.eq("available","TRUE");
deliverPlanDetailDO = deliverPlanDetailMapper.selectOne(detailDOQueryWrapper);
deliverPlanDetailDO.setShippedQty(pshippedQty);
if(deliverPlanDetailDO.getPlanQty() == deliverPlanDetailDO.getShippedQty()){
deliverPlanDetailDO.setAvailable("FALSE");
}
}
ifDetailAllFinish(deliverPlanMainDO);
}
//判断如果主表下子表状态全为FALSE 则修改计划状态为完成
private void ifDetailAllFinish(DeliverPlanMainDO deliverPlanMainDO){
QueryWrapper<DeliverPlanDetailDO> detailDOQueryWrapper = new QueryWrapper<>();
detailDOQueryWrapper.eq("master_id",deliverPlanMainDO.getId());
List<DeliverPlanDetailDO> deliverPlanDetailDOS = deliverPlanDetailMapper.selectList(detailDOQueryWrapper);
Integer count = 0;
for (DeliverPlanDetailDO deliverPlanDetailDO : deliverPlanDetailDOS) {
if("TRUE".equals(deliverPlanDetailDO.getAvailable())){
count++;
}
}
if(count <= 0){
deliverPlanMainDO.setStatus("7");
}
}
@Override
@Transactional
public Integer closeDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
Long count = deliverRequestMainMapper.selectByDeliverPlanNumber(mainDO.getNumber());
if(count > 0) {
throw new ServiceException(DELIVER_PLAN_REQUEST_EXISTS);
}
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.close();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_CLOSE);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "关闭了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer openDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
Long count = deliverRequestMainMapper.selectByDeliverPlanNumber(mainDO.getNumber());
if(count > 0) {
throw new ServiceException(DELIVER_PLAN_REQUEST_EXISTS);
}
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.open();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_OPEN);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "打开了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer submitDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.submit();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_SUBMIT);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "提交了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer agreeDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.agree();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_AGREE);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "审批通过了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer refiesDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.reject();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_REFUSE);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "审批驳回了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer publishDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.execute();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_PUBLISH);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "发布了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@Transactional
public Integer resettingDeliverPlanMain(Long id) {
// 校验存在存在下级单据
DeliverPlanMainDO mainDO = validateDeliverPlanMainExists(id);
PlanStatusState planStatusState = new PlanStatusState(mainDO.getStatus());
boolean flag = planStatusState.resetting();
if(!flag) {
throw new ServiceException(DELIVER_PLAN_CANNOT_RESETTING);
}
mainDO.setStatus(planStatusState.getState().getCode());//增加操作记录
trendsApi.createTrends(id, "deliverPlan", "重置了发货计划", TrendsTypeEnum.UPDATE);
return deliverPlanMainMapper.updateById(mainDO);
}
@Override
@ -143,6 +306,11 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
return deliverPlanMainMapper.selectList(exportReqVO);
}
@Override
public List<DeliverPlanMainDO> getDeliverPlanMainList(CustomConditions conditions) {
return deliverPlanMainMapper.selectSeniorList(conditions);
}
@Override
public List<DeliverPlanMainImportErrorVO> importDeliverPlanMainList(List<DeliverPlanMainCreateReqVO> datas, Integer mode, boolean updatePart) {
if (CollUtil.isEmpty(datas)) {
@ -150,7 +318,7 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
}
List<DeliverPlanMainImportErrorVO> errorList = new ArrayList<>();
datas.forEach(createReqVO -> {
BusinesstypeDO businesstypeDO = new BusinesstypeDO();
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("DeliverPlan");
DeliverPlanMainDO mainDo = DeliverPlanMainConvert.INSTANCE.convert(createReqVO);
String messageMain = validateDeliverPlanMainImport(mainDo, businesstypeDO);
List<DeliverPlanDetailCreateReqVO> subList = createReqVO.getSubList();
@ -170,8 +338,7 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
}
//写入数据
if (flag) {
mainDo.setStatus(DictFrameworkUtils.parseDictDataValue(DictTypeConstants.REQUEST_STATUS, "新增"));
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("DeliverRequestRequest");
mainDo.setStatus(PlanStatusEnum.NEW.getCode());
if (businesstypeDO != null) {
mainDo.setBusinessType(businesstypeDO.getCode());
}
@ -181,7 +348,6 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
for (DeliverPlanDetailDO detailDO : subDOList) {
detailDO.setNumber(mainDo.getNumber());
detailDO.setMasterId(mainDo.getId());
detailDO.setCustomerDockCode(null);
}
deliverPlanDetailMapper.insertBatch(subDOList);
}
@ -211,7 +377,6 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
}
//校验业务类型相关属性
try {
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("DeliverPlan");
if (businesstypeDO != null) {
mainDo.setBusinessType(businesstypeDO.getCode());
}
@ -238,13 +403,13 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
} catch (ServiceException ex) {
messageDetail += ex.getMessage() + ",";
}
//TODO 滞后
// 校验物品标包信息
try {
SaleDetailDO saleDetailDO = deliverJobMainService.saleDetailExist(detailDo.getSoNumber(), detailDo.getSoLine(), detailDo.getItemCode());
} catch (ServiceException ex) {
messageDetail += ex.getMessage() + ",";
}
// try {
// deliverJobMainService.saleDetailExist(detailDo.getSoNumber(), detailDo.getSoLine(), detailDo.getItemCode());
// } catch (ServiceException ex) {
// messageDetail += ex.getMessage() + ",";
// }
return messageDetail;
}
@ -260,6 +425,7 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
}
String number = serialNumberApi.generateCode(RuleCodeEnum.SUPPLIER_DELIVER_REQUEST.getCode());
deliverPlanMainDO.setNumber(number);
deliverPlanMainDO.setStatus(PlanStatusEnum.NEW.getCode());
deliverPlanMainMapper.insert(deliverPlanMainDO);
for (DeliverPlanDetailDO deliverPlanDetailDO : subDOList) {
deliverPlanDetailDO.setNumber(deliverPlanMainDO.getNumber());
@ -270,21 +436,6 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
return deliverPlanMainDO;
}
//修改方法(主和子)
private DeliverPlanMainDO validatorToUpdate(DeliverPlanMainUpdateReqVO updateReqVO) {
BusinesstypeDO businesstypeDO = new BusinesstypeDO();
DeliverPlanMainDO deliverPlanMainDO = validateMainMethod(updateReqVO,businesstypeDO);
//子表校验
List<DeliverPlanDetailUpdateReqVO> subList = updateReqVO.getSubList();
List<DeliverPlanDetailDO> subDOList = DeliverPlanDetailConvert.INSTANCE.convertList05(subList);
for (DeliverPlanDetailDO deliverPlanDetailDO : subDOList) {
validateDetailMethod(deliverPlanDetailDO);
}
deliverPlanMainMapper.updateById(deliverPlanMainDO);
deliverPlanDetailMapper.updateBatch(subDOList);
return deliverPlanMainDO;
}
//校验主表公共方法(适用于新增/修改)
private DeliverPlanMainDO validateMainMethod(DeliverPlanMainBaseVO baseVO, BusinesstypeDO businesstypeDO){
DeliverPlanMainDO deliverPlanMainDO = DeliverPlanMainConvert.INSTANCE.convert(baseVO);
@ -297,9 +448,10 @@ public class DeliverPlanMainServiceImpl implements DeliverPlanMainService {
private void validateDetailMethod(DeliverPlanDetailDO deliverPlanDetailDO) {
ItembasicDO itembasicDO = this.validatorItembasic(deliverPlanDetailDO.getItemCode());
if ( !deliverPlanDetailDO.getUom().equals(itembasicDO.getUom())) {
throw exception(UOM_ERROR, deliverPlanDetailDO.getUom());
String label = dictDataApi.selectDictValue(itembasicDO.getUom()).getLabel();
throw exception(UOM_ERROR, label);
}
this.validatorDetailExist(deliverPlanDetailDO.getSoNumber(), deliverPlanDetailDO.getSoLine(), deliverPlanDetailDO.getItemCode());
//this.validatorDetailExist(deliverPlanDetailDO.getSoNumber(), deliverPlanDetailDO.getSoLine(), deliverPlanDetailDO.getItemCode());
}
//主表校验客户代码

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java

@ -246,8 +246,9 @@ public class RequestsettingServiceImpl implements RequestsettingService {
public RequestsettingDO selectRequestsettingExist(String pcode){
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("code",pcode);
queryWrapper.eq("available","TRUE");
RequestsettingDO requestsettingDO = requestsettingMapper.selectOne(queryWrapper);
if(requestsettingDO != null && "TRUE".equals(requestsettingDO.getAvailable())){
if(requestsettingDO != null){
return requestsettingDO;
}else {
throw exception(REQUESTSETTING_NOT_EXISTS);

203
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/sale/SaleMainServiceImpl.java

@ -6,32 +6,44 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.exception.ServiceException;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.validation.ValidationUtils;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.system.api.serialnumber.SerialNumberApi;
import com.win.module.system.enums.serialNumber.RuleCodeEnum;
import com.win.module.wms.controller.sale.vo.*;
import com.win.module.wms.convert.sale.SaleDetailConvert;
import com.win.module.wms.convert.sale.SaleMainConvert;
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO;
import com.win.module.wms.dal.dataobject.customer.CustomerDO;
import com.win.module.wms.dal.dataobject.customeritem.CustomeritemDO;
import com.win.module.wms.dal.dataobject.documentsetting.DocumentsettingDO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO;
import com.win.module.wms.dal.dataobject.sale.SaleDetailDO;
import com.win.module.wms.dal.dataobject.sale.SaleMainDO;
import com.win.module.wms.dal.mysql.sale.SaleDetailMapper;
import com.win.module.wms.dal.mysql.sale.SaleMainMapper;
import com.win.module.wms.enums.order.OrderStatusEnum;
import com.win.module.wms.service.customer.CustomerService;
import com.win.module.wms.service.customeritem.CustomeritemService;
import com.win.module.wms.service.documentsetting.DocumentsettingService;
import com.win.module.wms.service.itembasic.ItembasicService;
import com.win.module.wms.service.itempackaging.ItempackagingService;
import com.win.module.wms.util.JobUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.wms.enums.ErrorCodeConstants.PURCHASECLAIM_REQUEST_IMPORT_LIST_IS_EMPTY;
import static com.win.module.wms.enums.ErrorCodeConstants.SALE_MAIN_NOT_EXISTS;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
/**
* 销售订单主 Service 实现类
@ -51,17 +63,41 @@ public class SaleMainServiceImpl implements SaleMainService {
@Resource
private ItembasicService itembasicService;
@Resource
private ItempackagingService itempackagingService;
@Resource
private CustomeritemService customeritemService;
@Resource
private JobUtils jobUtils;
@Resource
private Validator validator;
@Resource
private SerialNumberApi serialNumberApi;
@Resource
private DocumentsettingService documentsettingService;
@Resource
private TrendsApi trendsApi;
@Override
public Long createSaleMain(SaleMainCreateReqVO createReqVO) {
// 插入
SaleMainDO saleMain = SaleMainConvert.INSTANCE.convert(createReqVO);
saleMainMapper.insert(saleMain);
SaleMainDO mainDO = SaleMainConvert.INSTANCE.convert(createReqVO);
this.validateSaleMainCreate(mainDO);
List<SaleDetailDO> subDOList = SaleDetailConvert.INSTANCE.convertList03(createReqVO.getSubList());
for (SaleDetailDO detailDO : subDOList) {
this.validateSaleDetailCreate(mainDO, detailDO);
}
String number = serialNumberApi.generateCode(RuleCodeEnum.SALE_ORDER.getCode());
mainDO.setNumber(number);
saleMainMapper.insert(mainDO);
for (SaleDetailDO detailDO : subDOList) {
detailDO.setMasterId(mainDO.getId().toString());
detailDO.setNumber(mainDO.getNumber());
}
saleDetailMapper.insertBatch(subDOList);
DocumentsettingDO documentsettingDO = documentsettingService.selectDocumentsettingExist("SaleOrder");
trendsApi.createTrends(documentsettingDO.getId(), "SaleOrder", "增加了销售订单", TrendsTypeEnum.CREATE);
// 返回
return saleMain.getId();
return mainDO.getId();
}
@Override
public PageResult<SaleMainDO> getSaleMainSenior(CustomConditions conditions) {
@ -71,9 +107,15 @@ public class SaleMainServiceImpl implements SaleMainService {
@Override
public void updateSaleMain(SaleMainUpdateReqVO updateReqVO) {
// 校验存在
validateSaleMainExists(updateReqVO.getId());
// 更新
SaleMainDO saleMainDO = validateSaleMainExists(updateReqVO.getId());
SaleMainDO updateObj = SaleMainConvert.INSTANCE.convert(updateReqVO);
// 更新
// if(saleMainDO.getStatus().equals(OrderStatusEnum.READY.getCode())) {
// throw exception(PURCHASERECEIPT_REQUEST_STATUS_NOT_NEW);
// }
DocumentsettingDO documentsettingDO = documentsettingService.selectDocumentsettingExist("SaleOrder");
trendsApi.createTrends(documentsettingDO.getId(), "SaleOrder", "修改了销售订单", TrendsTypeEnum.UPDATE);
saleMainMapper.updateById(updateObj);
}
@ -85,10 +127,12 @@ public class SaleMainServiceImpl implements SaleMainService {
saleMainMapper.deleteById(id);
}
private void validateSaleMainExists(Long id) {
if (saleMainMapper.selectById(id) == null) {
private SaleMainDO validateSaleMainExists(Long id) {
SaleMainDO saleMainDO = saleMainMapper.selectById(id);
if(saleMainDO == null){
throw exception(SALE_MAIN_NOT_EXISTS);
}
return saleMainDO;
}
@Override
@ -226,4 +270,139 @@ public class SaleMainServiceImpl implements SaleMainService {
}
return errorList;
}
/**
* 校验主表导入并赋值一些参数未完全实现
* @param mainDO
* @return
*/
private String validateSaleMainImport(SaleMainDO mainDO) {
StringBuilder message = new StringBuilder();
try {
validateCustomer(mainDO);
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
try {
ValidationUtils.validate(validator, mainDO);
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
mainDO.setBusinessType("SaleOrder");
return message.toString();
}
/**
* 校验子表导入并赋值一些参数未完全实现
* @param detailDo
* @return
*/
private String validateSaleDetailImport(SaleMainDO mainDo, SaleDetailDO detailDo) {
StringBuilder message = new StringBuilder();
ItembasicDO itembasicDO = null;
try {
itembasicDO = this.validateItem(detailDo);
} catch (Exception e) {
message.append(e.getMessage()).append(",");
}
if(!detailDo.getUom().equals(itembasicDO.getUom())) {
message.append("计量单位【").append(detailDo.getUom()).append("】错误,应该是【").append(itembasicDO.getUom()).append("】").append(",");
}
try {
ItempackagingDO itempackagingDO = this.validateItempackaging(detailDo);
detailDo.setStdPackQty(itempackagingDO.getStdPackQty());
detailDo.setStdPackUnit(itempackagingDO.getStdPackUnit());
} catch (Exception e) {
message.append(e.getMessage()).append(",");
}
try {
CustomeritemDO customeritemDO = this.validateCustomerItem(mainDo, detailDo);
detailDo.setConvertRate(customeritemDO.getConvertRate());
detailDo.setCustomerPackQty(customeritemDO.getPackQty());
detailDo.setCustomerPackUnit(customeritemDO.getPackUnit());
BigDecimal bigDecimal = new BigDecimal(0);
detailDo.setShippedQty(bigDecimal);
detailDo.setReceivedQty(bigDecimal);
detailDo.setReturnedQty(bigDecimal);
} catch (Exception e) {
message.append(e.getMessage()).append(",");
}
try {
ValidationUtils.validate(validator, detailDo);
} catch (Exception e) {
message.append(e.getMessage()).append(",");
}
return message.toString();
}
/**
* 校验主表创建并赋值一些参数
* @param detailDo
* @return
*/
private void validateSaleMainCreate(SaleMainDO mainDo) {
validateCustomer(mainDo);
mainDo.setBusinessType("SaleOrder");
}
/**
* 校验子表创建并赋值一些参数
* @param detailDo
* @return
*/
private void validateSaleDetailCreate(SaleMainDO mainDo, SaleDetailDO detailDo) {
ItembasicDO itembasicDO = this.validateItem(detailDo);
if(!itembasicDO.getUom().equals(itembasicDO.getUom())) {
throw exception(ITEMBASIC_UOM_EXCEPTION, itembasicDO.getUom(), itembasicDO.getUom());
}
ItempackagingDO itempackagingDO = this.validateItempackaging(detailDo);
detailDo.setStdPackQty(itempackagingDO.getStdPackQty());
detailDo.setStdPackUnit(itempackagingDO.getStdPackUnit());
CustomeritemDO customeritemDO = this.validateCustomerItem(mainDo, detailDo);
detailDo.setConvertRate(customeritemDO.getConvertRate());
detailDo.setCustomerPackQty(customeritemDO.getPackQty());
detailDo.setCustomerPackUnit(customeritemDO.getPackUnit());
BigDecimal bigDecimal = new BigDecimal(0);
detailDo.setShippedQty(bigDecimal);
detailDo.setReceivedQty(bigDecimal);
detailDo.setReturnedQty(bigDecimal);
}
/**
* 校验物品信息并赋值
* @param detailDo
* @return
*/
private ItembasicDO validateItem(SaleDetailDO detailDo) {
ItembasicDO itembasicDO = itembasicService.selectItembasic(detailDo.getItemCode());
detailDo.setProjectCode(itembasicDO.getProject());
return itembasicDO;
}
/**
* 校验客户信息并赋值
* @param mainDO
* @return
*/
private CustomerDO validateCustomer(SaleMainDO mainDO) {
return customerService.selectCustomerExist(mainDO.getCustomerCode());
}
/**
* 校验物品包装信息并赋值
* @param detailDO
* @return
*/
private ItempackagingDO validateItempackaging(SaleDetailDO detailDO) {
return itempackagingService.selectItemPackagingExist(detailDO.getItemCode());
}
/**
* 校验客户物品信息并赋值
* @param mainDO
* @return
*/
private CustomeritemDO validateCustomerItem(SaleMainDO mainDO,SaleDetailDO detailDO) {
return customeritemService.selectCustomeritemExist(mainDO.getCustomerCode(),detailDO.getItemCode());
}
}

Loading…
Cancel
Save