From 1b6bb08d91153570410a21edae73d09b7767c3d7 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Tue, 14 Jan 2025 08:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=B8=BB=E5=AD=90=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WmsAllocateOrderDetailController.java | 2 +- .../WmsInstockDetailController.java | 9 ++++- .../controller/WmsInstockOrderController.java | 6 +-- .../WmsOutstockDetailController.java | 14 ++++++- .../WmsOutstockOrderController.java | 5 ++- .../wms/domain/WmsAllocateOrderDetail.java | 3 ++ .../dromara/wms/domain/WmsInstockDetail.java | 1 + .../dromara/wms/domain/WmsOutstockDetail.java | 3 +- .../wms/domain/bo/WmsOutstockDetailBo.java | 3 ++ .../domain/vo/WmsAllocateOrderDetailVo.java | 2 + .../wms/domain/vo/WmsOutstockDetailVo.java | 2 + .../wms/service/IWmsInstockDetailService.java | 4 +- .../wms/service/IWmsInstockOrderService.java | 2 +- .../service/IWmsOutstockDetailService.java | 5 ++- .../wms/service/IWmsOutstockOrderService.java | 3 +- .../WmsAllocateOrderDetailServiceImpl.java | 24 ++++++++++-- .../impl/WmsInstockDetailServiceImpl.java | 33 ++++++++++------ .../impl/WmsInstockOrderServiceImpl.java | 12 ++++-- .../impl/WmsOutstockDetailServiceImpl.java | 35 +++++++++++++---- .../impl/WmsOutstockOrderServiceImpl.java | 38 ++++++++++++++++--- 20 files changed, 162 insertions(+), 44 deletions(-) diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsAllocateOrderDetailController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsAllocateOrderDetailController.java index 42b43134..61ad9830 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsAllocateOrderDetailController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsAllocateOrderDetailController.java @@ -107,7 +107,7 @@ public class WmsAllocateOrderDetailController extends BaseController { @SaCheckPermission("system:allocateOrderDetail:remove") @Log(title = "调拨子", businessType = BusinessType.DELETE) @DeleteMapping("removeDetail/{aoDId}") - public R removeDetail(@NotEmpty(message = "主键不能为空") + public R removeDetail( @PathVariable Long aoDId) { return toAjax(wmsAllocateOrderDetailService.deleteById(aoDId)); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java index b06435f1..43559c61 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java @@ -77,7 +77,7 @@ public class WmsInstockDetailController extends BaseController { @Log(title = "入库单-物料", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add(@RequestBody WmsInstockDetailBo bo) { + public R add(@RequestBody List bo) { return toAjax(wmsInstockDetailService.insertByBo(bo)); } @@ -104,4 +104,11 @@ public class WmsInstockDetailController extends BaseController { @PathVariable Long[] instockDetailIds) { return toAjax(wmsInstockDetailService.deleteWithValidByIds(List.of(instockDetailIds), true)); } + + @SaCheckPermission("system:instockDetail:remove") + @Log(title = "入库单-物料", businessType = BusinessType.DELETE) + @DeleteMapping("/removeInstockDetail/{instockDetailId}") + public R removeInstockDetail( @PathVariable Long instockDetailId) { + return toAjax(wmsInstockDetailService.deleteById(instockDetailId)>0); + } } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java index a8b5e8c6..5fc6bc26 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java @@ -77,8 +77,8 @@ public class WmsInstockOrderController extends BaseController { @Log(title = "入库单", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add( @RequestBody WmsInstockOrderBo bo) { - return toAjax(wmsInstockOrderService.insertByBo(bo)); + public R add( @RequestBody WmsInstockOrderBo bo) { + return R.ok(wmsInstockOrderService.insertByBo(bo)); } /** @@ -88,7 +88,7 @@ public class WmsInstockOrderController extends BaseController { @Log(title = "入库单", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() - public R edit(@Validated(EditGroup.class) @RequestBody WmsInstockOrderBo bo) { + public R edit(@RequestBody WmsInstockOrderBo bo) { return toAjax(wmsInstockOrderService.updateByBo(bo)); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java index c3b4bd5b..141567dd 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java @@ -6,6 +6,9 @@ import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.wms.domain.WmsInstockDetail; +import org.dromara.wms.domain.WmsOutstockDetail; +import org.dromara.wms.domain.bo.WmsInstockDetailBo; import org.dromara.wms.domain.bo.WmsOutstockDetailBo; import org.dromara.wms.domain.vo.WmsOutstockDetailVo; import org.dromara.wms.service.IWmsOutstockDetailService; @@ -77,7 +80,7 @@ public class WmsOutstockDetailController extends BaseController { @Log(title = "出库单-物料", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add(@RequestBody WmsOutstockDetailBo bo) { + public R add(@RequestBody List bo) { return toAjax(wmsOutstockDetailService.insertByBo(bo)); } @@ -101,7 +104,14 @@ public class WmsOutstockDetailController extends BaseController { @Log(title = "出库单-物料", businessType = BusinessType.DELETE) @DeleteMapping("/{outstockDetailIds}") public R remove(@NotEmpty(message = "主键不能为空") - @PathVariable Long[] outstockDetailIds) { + @PathVariable Long outstockDetailIds) { return toAjax(wmsOutstockDetailService.deleteWithValidByIds(List.of(outstockDetailIds), true)); } + + @SaCheckPermission("system:outstockDetail:remove") + @Log(title = "出库单-物料", businessType = BusinessType.DELETE) + @DeleteMapping("detailRemove/{outstockDetailId}") + public R removeOutstockDetailId(@PathVariable Long outstockDetailId) { + return toAjax(wmsOutstockDetailService.deleteById(outstockDetailId)>0); + } } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java index 51950e4d..d215c32b 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java @@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.wms.domain.WmsOutstockOrder; import org.dromara.wms.domain.bo.WmsOutstockOrderBo; import org.dromara.wms.domain.vo.WmsOutstockOrderVo; import org.dromara.wms.service.IWmsOutstockOrderService; @@ -76,8 +77,8 @@ public class WmsOutstockOrderController extends BaseController { @Log(title = "出库单", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add(@Validated(AddGroup.class) @RequestBody WmsOutstockOrderBo bo) { - return toAjax(wmsOutstockOrderService.insertByBo(bo)); + public R add(@RequestBody WmsOutstockOrderBo bo) { + return R.ok(wmsOutstockOrderService.insertByBo(bo)); } /** diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java index 0189b326..1629289b 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsAllocateOrderDetail.java @@ -24,6 +24,7 @@ public class WmsAllocateOrderDetail { /** * 调拨子表主键 */ + @TableId(type = IdType.AUTO) private Long aoDId; /** @@ -74,6 +75,8 @@ public class WmsAllocateOrderDetail { */ @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; + @TableField(exist = false) + private String materialCode; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java index cd36cd45..8611ff87 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java @@ -25,6 +25,7 @@ public class WmsInstockDetail{ /** * 入库单子表主键 */ + @TableId(type = IdType.AUTO) private Long instockDetailId; /** diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java index bbb1c762..0fdc3942 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java @@ -79,8 +79,9 @@ public class WmsOutstockDetail { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; - @TableField(exist = false) + private String materialCode; + private String materialName; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java index 19e97c0b..0509a149 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java @@ -57,6 +57,9 @@ public class WmsOutstockDetailBo extends BaseEntity { // @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) private String materialCategories; private String tenantId; + private String materialCode; + + private String materialName; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java index 34e34ead..1cdb4509 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsAllocateOrderDetailVo.java @@ -90,5 +90,7 @@ public class WmsAllocateOrderDetailVo implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; + private String materialCode; + } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java index 40a7f721..aa099b1f 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java @@ -93,5 +93,7 @@ public class WmsOutstockDetailVo implements Serializable { private String materialCode; + private String materialName; + } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java index b1b1c041..80a200d4 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java @@ -47,7 +47,7 @@ public interface IWmsInstockDetailService { * @param bo 入库单-物料 * @return 是否新增成功 */ - Boolean insertByBo(WmsInstockDetailBo bo); + Boolean insertByBo(List bo); /** * 修改入库单-物料 @@ -65,4 +65,6 @@ public interface IWmsInstockDetailService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + int deleteById(Long instockDetailId); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java index b000ceb4..747db8f7 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java @@ -47,7 +47,7 @@ public interface IWmsInstockOrderService { * @param bo 入库单 * @return 是否新增成功 */ - Boolean insertByBo(WmsInstockOrderBo bo); + WmsInstockOrderVo insertByBo(WmsInstockOrderBo bo); /** * 修改入库单 diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java index 645d3a2f..c68f39e1 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java @@ -1,5 +1,6 @@ package org.dromara.wms.service; +import org.dromara.common.core.domain.R; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.wms.domain.bo.WmsOutstockDetailBo; @@ -47,7 +48,7 @@ public interface IWmsOutstockDetailService { * @param bo 出库单-物料 * @return 是否新增成功 */ - Boolean insertByBo(WmsOutstockDetailBo bo); + Boolean insertByBo(List bo); /** * 修改出库单-物料 @@ -65,4 +66,6 @@ public interface IWmsOutstockDetailService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + int deleteById(Long outstockDetailId); } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java index 8900c56f..f6e99ef0 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java @@ -2,6 +2,7 @@ package org.dromara.wms.service; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.wms.domain.WmsOutstockOrder; import org.dromara.wms.domain.bo.WmsOutstockOrderBo; import org.dromara.wms.domain.vo.WmsOutstockOrderVo; @@ -47,7 +48,7 @@ public interface IWmsOutstockOrderService { * @param bo 出库单 * @return 是否新增成功 */ - Boolean insertByBo(WmsOutstockOrderBo bo); + WmsOutstockOrderVo insertByBo(WmsOutstockOrderBo bo); /** * 修改出库单 diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsAllocateOrderDetailServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsAllocateOrderDetailServiceImpl.java index 9279a460..4c3b0c23 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsAllocateOrderDetailServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsAllocateOrderDetailServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.wms.service.impl; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -8,8 +10,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; +import org.dromara.wms.domain.BaseMaterialInfo; import org.dromara.wms.domain.WmsAllocateOrderDetail; +import org.dromara.wms.domain.WmsBaseWarehouse; +import org.dromara.wms.domain.WmsMoveOrder; import org.dromara.wms.domain.bo.WmsAllocateOrderDetailBo; +import org.dromara.wms.domain.bo.WmsMoveOrderBo; import org.dromara.wms.domain.vo.WmsAllocateOrderDetailVo; import org.dromara.wms.mapper.WmsAllocateOrderDetailMapper; import org.dromara.wms.service.IWmsAllocateOrderDetailService; @@ -49,8 +55,8 @@ public class WmsAllocateOrderDetailServiceImpl implements IWmsAllocateOrderDetai */ @Override public TableDataInfo queryPageList(WmsAllocateOrderDetailBo bo, PageQuery pageQuery) { - LambdaQueryWrapper lqw = buildQueryWrapper(bo); - lqw.orderByDesc(WmsAllocateOrderDetail::getCreateTime); +// LambdaQueryWrapper lqw = buildQueryWrapper(bo); + MPJLambdaWrapper lqw = buildJoinQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); return TableDataInfo.build(result); } @@ -78,6 +84,19 @@ public class WmsAllocateOrderDetailServiceImpl implements IWmsAllocateOrderDetai lqw.eq(bo.getErpSynchronousQty() != null, WmsAllocateOrderDetail::getErpSynchronousQty, bo.getErpSynchronousQty()); return lqw; } + private MPJLambdaWrapper buildJoinQueryWrapper(WmsAllocateOrderDetailBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsAllocateOrderDetail.class) + .selectAll(WmsAllocateOrderDetail.class).select(BaseMaterialInfo::getMaterialCode) + .leftJoin(BaseMaterialInfo.class,BaseMaterialInfo::getMaterialId,WmsAllocateOrderDetail::getMaterialId); + lqw.eq(bo.getAoDId() != null, WmsAllocateOrderDetail::getAoDId, bo.getAoDId()); + lqw.eq(StringUtils.isNotBlank(bo.getAllocateCode()), WmsAllocateOrderDetail::getAllocateCode, bo.getAllocateCode()); + lqw.eq(bo.getMaterialId() != null, WmsAllocateOrderDetail::getMaterialId, bo.getMaterialId()); + lqw.eq(bo.getAllocateOrderQty() != null, WmsAllocateOrderDetail::getAllocateOrderQty, bo.getAllocateOrderQty()); + lqw.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsAllocateOrderDetail::getErpSynchronousStatus, bo.getErpSynchronousStatus()); + lqw.eq(bo.getErpSynchronousQty() != null, WmsAllocateOrderDetail::getErpSynchronousQty, bo.getErpSynchronousQty()).orderByDesc(WmsAllocateOrderDetail::getCreateTime); + return lqw; + } /** * 新增调拨子 @@ -142,7 +161,6 @@ public class WmsAllocateOrderDetailServiceImpl implements IWmsAllocateOrderDetai @Override public List selectAllocateDetails() { - return null; } } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java index 5813ed2d..4b68976e 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java @@ -9,9 +9,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; -import org.dromara.wms.domain.WmsInstockDetail; -import org.dromara.wms.domain.WmsInstockOrder; -import org.dromara.wms.domain.WmsInstockPrint; +import org.dromara.wms.domain.*; +import org.dromara.wms.domain.bo.BaseMaterialInfoBo; +import org.dromara.wms.domain.bo.WmsAllocateOrderDetailBo; import org.dromara.wms.domain.bo.WmsInstockDetailBo; import org.dromara.wms.domain.vo.BaseMaterialInfoVo; import org.dromara.wms.domain.vo.WmsInstockDetailVo; @@ -23,6 +23,7 @@ import org.springframework.beans.BeanUtils; 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.Collection; @@ -109,16 +110,19 @@ public class WmsInstockDetailServiceImpl implements IWmsInstockDetailService { * @return 是否新增成功 */ @Override - public Boolean insertByBo(WmsInstockDetailBo bo) { - WmsInstockDetail add = MapstructUtils.convert(bo, WmsInstockDetail.class); - BaseMaterialInfoVo baseMaterialInfoVo = baseMaterialInfoService.queryById(bo.getMaterialId()); - BeanUtils.copyProperties(baseMaterialInfoVo,add); - validEntityBeforeSave(add); - boolean flag = baseMapper.insert(add) > 0; - if (flag) { - bo.setInstockDetailId(add.getInstockDetailId()); + public Boolean insertByBo(List bo) { + ArrayList list = new ArrayList<>(); + int a = 0; + for (WmsInstockDetailBo detailBo : bo) { + BaseMaterialInfoBo baseMaterialInfo = new BaseMaterialInfoBo(); + baseMaterialInfo.setMaterialId(detailBo.getMaterialId()); + List baseMaterialInfoVos = baseMaterialInfoService.queryList(baseMaterialInfo); + WmsInstockDetail add = MapstructUtils.convert(detailBo, WmsInstockDetail.class); + add.setMaterialCode(baseMaterialInfoVos.get(0).getMaterialCode()); + add.setMaterialName(baseMaterialInfoVos.get(0).getMaterialName()); + a += baseMapper.insert(add); } - return flag; + return a>0; } /** @@ -173,6 +177,11 @@ public class WmsInstockDetailServiceImpl implements IWmsInstockDetailService { //TODO 做一些数据校验,如唯一约束 } + @Override + public int deleteById(Long instockDetailId) { + return baseMapper.deleteById(instockDetailId); + } + /** * 校验并批量删除入库单-物料信息 * diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java index 72fa8d2b..e37b31c3 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java @@ -54,7 +54,10 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService { @Override public WmsInstockOrderVo queryById(Long instockId){ - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); + wrapper.selectAll(WmsInstockOrder.class).select(WmsBaseWarehouse::getWarehouseCode) + .leftJoin(WmsBaseWarehouse.class,WmsBaseWarehouse::getWarehouseId,WmsInstockOrder::getWarehouseId); wrapper.eq(WmsInstockOrder::getInstockId,instockId); return baseMapper.selectVoOne(wrapper); } @@ -127,7 +130,7 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService { * @return 是否新增成功 */ @Override - public Boolean insertByBo(WmsInstockOrderBo bo) { + public WmsInstockOrderVo insertByBo(WmsInstockOrderBo bo) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm"); String orderDate = format.format(date); @@ -148,7 +151,10 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService { if (flag) { bo.setInstockId(add.getInstockId()); } - return flag; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsInstockOrder::getInstockCode,inStockOrder); + WmsInstockOrderVo instockOrderVo = baseMapper.selectVoOne(wrapper); + return instockOrderVo; } public String generateOrder(Integer value){ if (value.toString().length()<3){ diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java index 8e26d9d0..1850ef49 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java @@ -11,14 +11,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.WmsInstockDetail; import org.dromara.wms.domain.WmsInventory; import org.dromara.wms.domain.WmsOutstockDetail; +import org.dromara.wms.domain.bo.BaseMaterialInfoBo; +import org.dromara.wms.domain.bo.WmsInstockDetailBo; import org.dromara.wms.domain.bo.WmsOutstockDetailBo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; import org.dromara.wms.domain.vo.WmsOutstockDetailVo; import org.dromara.wms.mapper.WmsOutstockDetailMapper; +import org.dromara.wms.service.IBaseMaterialInfoService; import org.dromara.wms.service.IWmsOutstockDetailService; +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.Collection; @@ -35,6 +42,9 @@ public class WmsOutstockDetailServiceImpl implements IWmsOutstockDetailService { private final WmsOutstockDetailMapper baseMapper; + @Autowired + private IBaseMaterialInfoService baseMaterialInfoService; + /** * 查询出库单-物料 * @@ -107,14 +117,20 @@ public class WmsOutstockDetailServiceImpl implements IWmsOutstockDetailService { * @return 是否新增成功 */ @Override - public Boolean insertByBo(WmsOutstockDetailBo bo) { - WmsOutstockDetail add = MapstructUtils.convert(bo, WmsOutstockDetail.class); - validEntityBeforeSave(add); - boolean flag = baseMapper.insert(add) > 0; - if (flag) { - bo.setOutstockDetailId(add.getOutstockDetailId()); + public Boolean insertByBo(List bo) { + ArrayList list = new ArrayList<>(); + int rows = 0; + for (WmsOutstockDetailBo detailBo : bo) { + BaseMaterialInfoBo baseMaterialInfo = new BaseMaterialInfoBo(); + baseMaterialInfo.setMaterialId(detailBo.getMaterialId()); + List baseMaterialInfoVos = baseMaterialInfoService.queryList(baseMaterialInfo); + WmsOutstockDetail add = MapstructUtils.convert(detailBo, WmsOutstockDetail.class); + add.setMaterialCode(baseMaterialInfoVos.get(0).getMaterialCode()); + add.setMaterialName(baseMaterialInfoVos.get(0).getMaterialName()); + rows += baseMapper.insert(add); } - return flag; + + return rows>0; } /** @@ -137,6 +153,11 @@ public class WmsOutstockDetailServiceImpl implements IWmsOutstockDetailService { //TODO 做一些数据校验,如唯一约束 } + @Override + public int deleteById(Long outstockDetailId) { + return baseMapper.deleteById(outstockDetailId); + } + /** * 校验并批量删除出库单-物料信息 * diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java index f27af785..6768e3fd 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.wms.service.impl; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -8,7 +10,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.WmsBaseWarehouse; +import org.dromara.wms.domain.WmsOutstockDetail; import org.dromara.wms.domain.WmsOutstockOrder; +import org.dromara.wms.domain.bo.WmsOutstockDetailBo; import org.dromara.wms.domain.bo.WmsOutstockOrderBo; import org.dromara.wms.domain.vo.WmsOutstockOrderVo; import org.dromara.wms.mapper.WmsInstockOrderMapper; @@ -59,12 +65,30 @@ public class WmsOutstockOrderServiceImpl implements IWmsOutstockOrderService { */ @Override public TableDataInfo queryPageList(WmsOutstockOrderBo bo, PageQuery pageQuery) { - LambdaQueryWrapper lqw = buildQueryWrapper(bo); - lqw.orderByDesc(WmsOutstockOrder::getCreateTime); + MPJLambdaWrapper lqw = buildJoinQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); return TableDataInfo.build(result); } - + private MPJLambdaWrapper buildJoinQueryWrapper(WmsOutstockOrderBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsOutstockOrder.class) + .selectAll(WmsOutstockOrder.class) + .select(WmsBaseWarehouse::getWarehouseCode) + .leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsOutstockOrder::getWarehouseId); + lqw.eq(bo.getOutstockId() != null, WmsOutstockOrder::getOutstockId, bo.getOutstockId()); + lqw.eq(bo.getWarehouseId() != null, WmsOutstockOrder::getWarehouseId, bo.getWarehouseId()); + lqw.eq(StringUtils.isNotBlank(bo.getOutstockCode()), WmsOutstockOrder::getOutstockCode, bo.getOutstockCode()); + lqw.eq(StringUtils.isNotBlank(bo.getOutstockType()), WmsOutstockOrder::getOutstockType, bo.getOutstockType()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsOutstockOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderType()), WmsOutstockOrder::getOrderType, bo.getOrderType()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), WmsOutstockOrder::getOrderNo, bo.getOrderNo()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsOutstockOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsOutstockOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsOutstockOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsOutstockOrder::getAuditComments, bo.getAuditComments()) + .orderByAsc(WmsOutstockOrder::getCreateTime); + return lqw; + } /** * 查询符合条件的出库单列表 * @@ -101,7 +125,7 @@ public class WmsOutstockOrderServiceImpl implements IWmsOutstockOrderService { * @return 是否新增成功 */ @Override - public Boolean insertByBo(WmsOutstockOrderBo bo) { + public WmsOutstockOrderVo insertByBo(WmsOutstockOrderBo bo) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm"); String orderDate = format.format(date); @@ -122,7 +146,11 @@ public class WmsOutstockOrderServiceImpl implements IWmsOutstockOrderService { if (flag) { bo.setOutstockId(add.getOutstockId()); } - return flag; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsOutstockOrder::getOutstockCode,outStockOrder); + List vos = baseMapper.selectVoList(wrapper); + + return vos.get(0); } public String generateOrder(Integer value){ if (value.toString().length()<3){