From 14c02e9c6dfadcb8a1e34aa360a07bfe6274f275 Mon Sep 17 00:00:00 2001 From: 15066119699 Date: Thu, 13 Mar 2025 15:13:14 +0800 Subject: [PATCH] 1 --- .../web/controller/app/AppTaskController.java | 56 ++++ .../app/AppWaveConstituteController.java | 67 +++++ .../java/com/ruoyi/app/domain/AppWave.java | 36 ++- .../ruoyi/app/domain/AppWaveConstitute.java | 279 ++++++++++++++++++ .../resources/mapper/app/AppStockMapper.xml | 15 +- .../resources/mapper/app/AppWaveMapper.xml | 18 +- 6 files changed, 448 insertions(+), 23 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveConstituteController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWaveConstitute.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java index c4032354..1551a38a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java @@ -8,6 +8,7 @@ import javax.xml.stream.Location; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.ruoyi.app.domain.*; import com.ruoyi.app.domain.DTO.OtherStockInRequest; import com.ruoyi.app.domain.DTO.PickCompleteReq; @@ -15,6 +16,7 @@ import com.ruoyi.app.service.*; import com.ruoyi.app.service.impl.AppPendingStorageServiceImpl; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.constant.AppConstants; +import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.OrderCodeFactory; @@ -78,6 +80,8 @@ public class AppTaskController extends BaseController private IAppVehicleService appVehicleService; @Autowired private IAppPmsOrderOutService appPmsOrderOutService; + @Autowired + private IAppWaveService appWaveService; /** * 查询【请填写功能名称】列表 */ @@ -509,7 +513,59 @@ public class AppTaskController extends BaseController { return success(); } + /** + * 出库单生成波次请求 + * appPmsOrderOutList 生成波次列表 + * @return 结果 + */ + @ApiOperation("生成波次") + @PostMapping("/createWaveRequestByOrders") + @Transactional(rollbackFor = Exception.class) + @Anonymous + public AjaxResult createWaveRequestByOrders(@RequestBody List appPmsOrderOutList) + { + logger.info("接收生成波次请求:{}", JSONObject.toJSONString(appPmsOrderOutList)); + //1.判断是否已生成波次 + String orderCode = OrderCodeFactory.getOrderCode("", ""); + for (AppPmsOrderOut appPmsOrderOut : appPmsOrderOutList) { + if(appPmsOrderOut.getGenerateWave() == 1){ + return error("已生成波次的,不能重复生成"); + } + //如果部分手动出库或者全部出库的,也不能再次生成波次 + if(appPmsOrderOut.getOrderStatus() == 1 || appPmsOrderOut.getOrderStatus() == 2){ + return error("手动部分出库或者全部出库的,不能再次生成波次"); + } + //状态为锁定的也不能再次生成波次 + if(StringUtils.compare("1", appPmsOrderOut.getIsLock()) == 0){ + return error("锁定的,不能再次生成波次"); + } + AppPmsOrderOut appPmsOrderOut1 = new AppPmsOrderOut(); + appPmsOrderOut1.setRecordId(appPmsOrderOut.getRecordId()); + appPmsOrderOut1.setOrderWave(orderCode); + appPmsOrderOut1.setGenerateWave(1); + appPmsOrderOut1.setUpdateTime(new Date()); + appPmsOrderOut1.setUpdateBy(getUsername()); + appPmsOrderOutService.updateAppPmsOrderOut(appPmsOrderOut1); + + } + + AppWave appWave = new AppWave(); + appWave.setWaveStatus(0); + appWave.setIsChad(0); + appWave.setOutRule(1); + appWave.setCreateTime(new Date()); + appWave.setUpdateTime(new Date()); + appWave.setCreateBy(getUsername()); + appWave.setUpdateBy(getUsername()); + appWave.setRemark(""); + appWave.setWaveDestination("1"); + appWave.setWaveId(orderCode); + appWave.setOrderWbs(orderCode); + + appWaveService.insertAppWave(appWave); + return success("创建波次成功"); + } /** * 出库单出库请求 * appPmsOrderOutList 出库单列表 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveConstituteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveConstituteController.java new file mode 100644 index 00000000..fad0c389 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveConstituteController.java @@ -0,0 +1,67 @@ +package com.ruoyi.web.controller.app; + +import java.util.List; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.app.domain.AppPmsOrderOut; +import com.ruoyi.app.domain.AppWaveConstitute; +import com.ruoyi.app.service.IAppPmsOrderOutService; +import org.springframework.beans.BeanUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 波次构成Controller + * + * @author ruoyi + * @date 2025-03-13 + */ +@RestController +@RequestMapping("/system/waveConstitute") +public class AppWaveConstituteController extends BaseController +{ + @Autowired + private IAppPmsOrderOutService appPmsOrderOutService; + + /** + * 查询波次构成列表 + */ + @PreAuthorize("@ss.hasPermi('system:waveConstitute:list')") + @GetMapping("/list") + public TableDataInfo list(AppPmsOrderOut appPmsOrderOut) + { + startPage(); + List list = appPmsOrderOutService.selectAppPmsOrderOutList(appPmsOrderOut); + return getDataTable(list); + } + + /** + * 导出波次构成列表 + */ + @PreAuthorize("@ss.hasPermi('system:waveConstitute:export')") + @Log(title = "波次构成", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, AppPmsOrderOut appPmsOrderOut) + { + List list = appPmsOrderOutService.selectAppPmsOrderOutList(appPmsOrderOut); + List result = list.stream().map(data -> convertAppWaveConstitute(data)).collect(Collectors.toList()); + ExcelUtil util = new ExcelUtil(AppWaveConstitute.class); + util.exportExcel(response, result, "波次构成数据"); + } + + private AppWaveConstitute convertAppWaveConstitute(AppPmsOrderOut data) { + AppWaveConstitute appWaveConstitute = new AppWaveConstitute(); + BeanUtils.copyProperties(data,appWaveConstitute); + return appWaveConstitute; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWave.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWave.java index cd9dc33e..16ef1f4e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWave.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWave.java @@ -20,15 +20,15 @@ public class AppWave extends BaseEntity /** 出库规则 */ @Excel(name = "出库规则") - private Long outRule; + private Integer outRule; /** 是否插队 */ @Excel(name = "是否插队") - private Long isChad; + private Integer isChad; /** 状态 */ @Excel(name = "状态") - private Long waveStatus; + private Integer waveStatus; /** 订单WBS */ @Excel(name = "订单WBS") @@ -47,33 +47,31 @@ public class AppWave extends BaseEntity { return waveId; } - public void setOutRule(Long outRule) - { + + public Integer getOutRule() { + return outRule; + } + + public void setOutRule(Integer outRule) { this.outRule = outRule; } - public Long getOutRule() - { - return outRule; + public Integer getIsChad() { + return isChad; } - public void setIsChad(Long isChad) - { + + public void setIsChad(Integer isChad) { this.isChad = isChad; } - public Long getIsChad() - { - return isChad; + public Integer getWaveStatus() { + return waveStatus; } - public void setWaveStatus(Long waveStatus) - { + + public void setWaveStatus(Integer waveStatus) { this.waveStatus = waveStatus; } - public Long getWaveStatus() - { - return waveStatus; - } public void setOrderWbs(String orderWbs) { this.orderWbs = orderWbs; diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWaveConstitute.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWaveConstitute.java new file mode 100644 index 00000000..a7c54767 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWaveConstitute.java @@ -0,0 +1,279 @@ +package com.ruoyi.app.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 波次构成对象 app_pms_order_out + * + * @author ruoyi + * @date 2025-03-13 + */ +public class AppWaveConstitute extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 波次号 */ + @Excel(name = "波次号") + private String orderWave; + + /** 记录号 */ + private String recordId; + + /** wms订单号 */ + @Excel(name = "wms订单号") + private String orderId; + + /** 出库单号 */ + @Excel(name = "出库单号") + private String listId; + + /** 出库单类型 */ + @Excel(name = "出库单类型") + private Integer orderType; + + /** 客户名称 */ +// @Excel(name = "客户名称") + private String customerId; + + /** 物料号 */ + @Excel(name = "物料号") + private String goodsId; + + /** 订单出库数量 */ + @Excel(name = "订单出库数量") + private BigDecimal goodsNum; + + /** 总出库数量 */ + @Excel(name = "总出库数量") + private BigDecimal pickNum; + + /** 确认出库数量 */ + @Excel(name = "确认出库数量") + private BigDecimal trNum; + + /** 本次出库数量 */ + @Excel(name = "本次出库数量") + private BigDecimal shelvesNum; + + /** 库存数量 */ + @Excel(name = "库存数量") + private BigDecimal stockNum; + + /** 物料描述 */ + @Excel(name = "物料描述") + private String goodsDesc; + +// /** 预留1 */ +// @Excel(name = "预留1") + private String spare1; +// +// /** 预留2 */ +// @Excel(name = "预留2") + private String spare2; + + /** 订单状态 0:未出库 1:部分出库 2:全部出库 */ + @Excel(name = "订单状态", readConverterExp = "0=未出库,1=部分出库,2=全部出库") + private Integer orderStatus; + + /** 是否锁定 */ + @Excel(name = "是否锁定", readConverterExp = "0=否,1=是") + private String isLock; + + /** 0:未生成 1:生成波次 */ +// @Excel(name = "0:未生成 1:生成波次") + private Integer generateWave; + + public void setRecordId(String recordId) + { + this.recordId = recordId; + } + + public String getRecordId() + { + return recordId; + } + public void setOrderId(String orderId) + { + this.orderId = orderId; + } + + public String getOrderId() + { + return orderId; + } + public void setListId(String listId) + { + this.listId = listId; + } + + public String getListId() + { + return listId; + } + public void setOrderType(Integer orderType) + { + this.orderType = orderType; + } + + public Integer getOrderType() + { + return orderType; + } + public void setCustomerId(String customerId) + { + this.customerId = customerId; + } + + public String getCustomerId() + { + return customerId; + } + public void setGoodsId(String goodsId) + { + this.goodsId = goodsId; + } + + public String getGoodsId() + { + return goodsId; + } + public void setGoodsNum(BigDecimal goodsNum) + { + this.goodsNum = goodsNum; + } + + public BigDecimal getGoodsNum() + { + return goodsNum; + } + public void setPickNum(BigDecimal pickNum) + { + this.pickNum = pickNum; + } + + public BigDecimal getPickNum() + { + return pickNum; + } + public void setTrNum(BigDecimal trNum) + { + this.trNum = trNum; + } + + public BigDecimal getTrNum() + { + return trNum; + } + public void setShelvesNum(BigDecimal shelvesNum) + { + this.shelvesNum = shelvesNum; + } + + public BigDecimal getShelvesNum() + { + return shelvesNum; + } + public void setStockNum(BigDecimal stockNum) + { + this.stockNum = stockNum; + } + + public BigDecimal getStockNum() + { + return stockNum; + } + public void setGoodsDesc(String goodsDesc) + { + this.goodsDesc = goodsDesc; + } + + public String getGoodsDesc() + { + return goodsDesc; + } + public void setSpare1(String spare1) + { + this.spare1 = spare1; + } + + public String getSpare1() + { + return spare1; + } + public void setSpare2(String spare2) + { + this.spare2 = spare2; + } + + public String getSpare2() + { + return spare2; + } + public void setOrderStatus(Integer orderStatus) + { + this.orderStatus = orderStatus; + } + + public Integer getOrderStatus() + { + return orderStatus; + } + public void setIsLock(String isLock) + { + this.isLock = isLock; + } + + public String getIsLock() + { + return isLock; + } + public void setGenerateWave(Integer generateWave) + { + this.generateWave = generateWave; + } + + public Integer getGenerateWave() + { + return generateWave; + } + public void setOrderWave(String orderWave) + { + this.orderWave = orderWave; + } + + public String getOrderWave() + { + return orderWave; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("orderId", getOrderId()) + .append("listId", getListId()) + .append("orderType", getOrderType()) + .append("customerId", getCustomerId()) + .append("goodsId", getGoodsId()) + .append("goodsNum", getGoodsNum()) + .append("pickNum", getPickNum()) + .append("trNum", getTrNum()) + .append("shelvesNum", getShelvesNum()) + .append("stockNum", getStockNum()) + .append("goodsDesc", getGoodsDesc()) + .append("spare1", getSpare1()) + .append("spare2", getSpare2()) + .append("orderStatus", getOrderStatus()) + .append("isLock", getIsLock()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("generateWave", getGenerateWave()) + .append("orderWave", getOrderWave()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/app/AppStockMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppStockMapper.xml index 2134231d..166c7c48 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppStockMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppStockMapper.xml @@ -20,7 +20,6 @@ - @@ -34,11 +33,15 @@ + + + + select stock_id, list_id, vehicle_id, location_id, goods_id, goods_name, goods_unit, provider_id, provider_name, remain_num, origin_num, batch_no, inv_age, goods_status, stock_status, create_time, create_user, last_update_time, last_update_user, remark , - ware_date, storage_mode,storage_id, area_id, goods_type_id, occupy_num, packing_num, production_date,goods_desc from app_stock + ware_date, storage_mode,storage_id, area_id, goods_type_id, occupy_num, packing_num, production_date,goods_desc, create_by, update_by,update_time from app_stock @@ -44,6 +48,10 @@ order_wbs, remark, wave_destination, + create_time, + create_by, + update_time, + update_by, #{waveId}, @@ -53,6 +61,10 @@ #{orderWbs}, #{remark}, #{waveDestination}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, @@ -65,6 +77,8 @@ order_wbs = #{orderWbs}, remark = #{remark}, wave_destination = #{waveDestination}, + update_time = #{updateTime}, + update_by = #{updateBy}, where wave_id = #{waveId} @@ -79,4 +93,4 @@ #{waveId} - \ No newline at end of file +