1. 空托出库 2. 手动新增出库单
This commit is contained in:
parent
b2c0cc3b34
commit
49eccb5512
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
|
|
@ -1 +0,0 @@
|
|||
custom: http://doc.ruoyi.vip/ruoyi-vue/other/donate.html
|
||||
|
|
@ -50,6 +50,7 @@ public class AppGoodsController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -94,4 +93,14 @@ public class AppGoodsTypeController extends BaseController
|
|||
{
|
||||
return toAjax(appGoodsTypeService.deleteAppGoodsTypeByTypeIds(typeIds));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/goodsTypeTree")
|
||||
public AjaxResult goodsTypeTree(AppGoodsType appGoodsType) {
|
||||
return success(appGoodsTypeService.selectGoodsTypeTreeList(appGoodsType));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,8 +111,13 @@ public class AppPmsController extends BaseController {
|
|||
//生成wms统一订单号
|
||||
String orderId= OrderCodeFactory.getOrderCode("WMS", "");
|
||||
for(PmsOrderOutRequest orderOutRequest : orderOutRequests) {
|
||||
if (StringUtils.isEmpty(orderOutRequest.getListId())
|
||||
|| orderOutRequest.getOrderType() == null
|
||||
//如果是内部inner=true,不需要判断listId
|
||||
if(!orderOutRequest.isInner()){
|
||||
if(StringUtils.isEmpty(orderOutRequest.getListId())){
|
||||
return error("请求数据不完整。");
|
||||
}
|
||||
}
|
||||
if (orderOutRequest.getOrderType() == null
|
||||
|| StringUtils.isEmpty(orderOutRequest.getGoodsId())
|
||||
|| orderOutRequest.getGoodsNum() == null
|
||||
|| StringUtils.isEmpty(orderOutRequest.getGoodsDesc())) {
|
||||
|
|
@ -143,7 +148,11 @@ public class AppPmsController extends BaseController {
|
|||
AppPmsOrderOut appPmsOrderOut = new AppPmsOrderOut();
|
||||
appPmsOrderOut.setRecordId(UUID.randomUUID().toString());
|
||||
appPmsOrderOut.setOrderId(orderId);
|
||||
appPmsOrderOut.setListId(orderOutRequest.getListId());
|
||||
if(orderOutRequest.isInner()){
|
||||
appPmsOrderOut.setListId(orderId);
|
||||
}else {
|
||||
appPmsOrderOut.setListId(orderOutRequest.getListId());
|
||||
}
|
||||
appPmsOrderOut.setOrderType(Long.valueOf(orderOutRequest.getOrderType()));
|
||||
appPmsOrderOut.setCustomerId(orderOutRequest.getCustomerId());
|
||||
appPmsOrderOut.setGoodsId(orderOutRequest.getGoodsId());
|
||||
|
|
@ -152,10 +161,15 @@ public class AppPmsController extends BaseController {
|
|||
appPmsOrderOut.setOrderStatus(0);
|
||||
appPmsOrderOut.setCreateTime(new Date());
|
||||
appPmsOrderOut.setUpdateTime(new Date());
|
||||
appPmsOrderOut.setShelvesNum(BigDecimal.valueOf(orderOutRequest.getGoodsNum()));
|
||||
appPmsOrderOut.setPickNum(BigDecimal.ZERO);
|
||||
appPmsOrderOut.setTrNum(BigDecimal.ZERO);
|
||||
appPmsOrderOut.setCreateBy("PMS出库接口");
|
||||
appPmsOrderOut.setCreateTime(new Date());
|
||||
appPmsOrderOut.setUpdateTime(new Date());
|
||||
if(orderOutRequest.isInner()){
|
||||
appPmsOrderOut.setCreateBy(getUsername());
|
||||
}else{
|
||||
appPmsOrderOut.setCreateBy("PMS出库接口");
|
||||
}
|
||||
try {
|
||||
appPmsOrderOutService.insertAppPmsOrderOut(appPmsOrderOut);
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import com.ruoyi.app.domain.AppStock;
|
||||
import com.ruoyi.app.domain.AppTaskBak;
|
||||
import com.ruoyi.app.service.IAppStockService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.web.controller.section.EnhanceDataList;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -73,6 +74,19 @@ public class AppStockController extends BaseController
|
|||
return success(appStockService.selectAppStockByStockId(stockId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@GetMapping(value = "/queryListByGoodsId")
|
||||
public AjaxResult queryListByGoodsId(AppStock appStock)
|
||||
{
|
||||
if(StringUtils.isBlank(appStock.getGoodsId())){
|
||||
return error("查询物料编号不能为空");
|
||||
}
|
||||
List<AppStock> appStocks = appStockService.queryListByGoodsId(appStock.getGoodsId());
|
||||
return success("查询成功",appStocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -547,6 +547,20 @@ public class AppTaskController extends BaseController
|
|||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库单出库请求
|
||||
* appPmsOrderOutList 出库单列表
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation("请求出库")
|
||||
@PostMapping("/manualCk")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Anonymous
|
||||
public AjaxResult manualCk(@RequestBody List<AppStock> appStocks)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库单出库请求
|
||||
* appPmsOrderOutList 出库单列表
|
||||
|
|
@ -1188,7 +1202,6 @@ public class AppTaskController extends BaseController
|
|||
return error("该任务状态不是待捡货,请检查!");
|
||||
}
|
||||
}
|
||||
logger.info("1111111111111111111111111");
|
||||
for(PickCompleteReq request : requests) {
|
||||
// 更新捡货任务数量
|
||||
//根据taskId,查询该条任务
|
||||
|
|
@ -1209,7 +1222,6 @@ public class AppTaskController extends BaseController
|
|||
if(CollectionUtils.isEmpty(appPmsOrderOuts)){
|
||||
return error("数据服务异常,请重试");
|
||||
}
|
||||
logger.info("2222222222222222222222222222222222");
|
||||
AppPmsOrderOut appPmsOrderOut1 = appPmsOrderOuts.get(0);
|
||||
if(appPmsOrderOut1.getTrNum() == null) appPmsOrderOut1.setTrNum(BigDecimal.ZERO);
|
||||
appPmsOrderOut1.setTrNum(appPmsOrderOut1.getTrNum().add(request.getPickNum()));
|
||||
|
|
@ -1221,9 +1233,7 @@ public class AppTaskController extends BaseController
|
|||
}
|
||||
|
||||
appPmsOrderOut1.setIsLock("0");
|
||||
logger.info("3333333333333333333");
|
||||
appPmsOrderOutService.updateAppPmsOrderOut(appPmsOrderOut1);
|
||||
logger.info("444444444444444444444444");
|
||||
}
|
||||
logger.info("拣货成功===》》》》》》》》》》》》》》》》》》");
|
||||
return success("捡货成功");
|
||||
|
|
|
|||
|
|
@ -36,6 +36,15 @@ public class PmsOrderOutRequest {
|
|||
* 备用2
|
||||
*/
|
||||
private String spare2;
|
||||
private boolean inner;
|
||||
|
||||
public boolean isInner() {
|
||||
return inner;
|
||||
}
|
||||
|
||||
public void setInner(boolean inner) {
|
||||
this.inner = inner;
|
||||
}
|
||||
|
||||
public String getListId() {
|
||||
return listId;
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public class TaskExecutor {
|
|||
public void completeWmsTask() {
|
||||
//completeNormalTask();
|
||||
completeNormalInTask(); // 通常入库任务
|
||||
// completeNormalOutTask(); // 通常出库任务
|
||||
completeNormalOutTask(); // 空托盘出库
|
||||
completeNormalMoveTask(); // 通常移库任务
|
||||
completePickOutTask();// 拣货任务
|
||||
}
|
||||
|
|
@ -337,71 +337,26 @@ public class TaskExecutor {
|
|||
if (appTasks == null || appTasks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PmsOutFeedBack pmsOutFeedBack = new PmsOutFeedBack();
|
||||
List<PmsOutFeedBackRecord> recordList = new ArrayList<>();
|
||||
for (AppTask task : appTasks) {
|
||||
|
||||
//调用接口,组装数据
|
||||
AppPmsOrderOut appPmsOrderOut = new AppPmsOrderOut();
|
||||
appPmsOrderOut.setOrderId(task.getOrderId());
|
||||
appPmsOrderOut.setGoodsId(task.getGoodsId());
|
||||
List<AppPmsOrderOut> appPmsOrderOuts = appPmsOrderOutMapper.selectAppPmsOrderOutList(appPmsOrderOut);
|
||||
if (CollectionUtils.isEmpty(appPmsOrderOuts)) {
|
||||
continue;
|
||||
}
|
||||
AppPmsOrderOut appPmsOrderOut1 = appPmsOrderOuts.get(0);
|
||||
PmsOutFeedBackRecord recordListItem = new PmsOutFeedBackRecord();
|
||||
recordListItem.setAmount(task.getOpNum().intValue());
|
||||
recordListItem.setBusinessOrder(appPmsOrderOut1.getListId());
|
||||
recordListItem.setMaterialsNo(task.getGoodsId());
|
||||
recordList.add(recordListItem);
|
||||
}
|
||||
|
||||
pmsOutFeedBack.setRecordList(recordList);
|
||||
String url = sysConfigService.selectConfigByKey("pms.outComplete");
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
throw new RuntimeException("pms.outComplete配置为空");
|
||||
}
|
||||
PmsCommonRes pmsCommonRes = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(url, JSON.toJSONString(pmsOutFeedBack)), PmsCommonRes.class);
|
||||
logger.info("pms出库反馈请求信息:{},结果:{}", JSON.toJSONString(pmsOutFeedBack), JSON.toJSONString(pmsCommonRes));
|
||||
|
||||
// 归档旧数据
|
||||
for (AppTask task : appTasks) {
|
||||
BigDecimal opNum = task.getOpNum();
|
||||
AppTaskBak appTaskBak = new AppTaskBak();
|
||||
BeanUtils.copyProperties(task, appTaskBak);
|
||||
appTaskBakService.insertAppTaskBak(appTaskBak); // 将任务数据归档
|
||||
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
|
||||
|
||||
if (opNum.compareTo(task.getStockNum()) >= 0) { // 需求数量大于库存数量
|
||||
int deleteAppStockByStockId = appStockService.deleteAppStockByStockId(task.getStockId());
|
||||
logger.info("出库捡选删除库存:{},删除结果:{}", task.getStockId(), deleteAppStockByStockId);
|
||||
|
||||
} else {
|
||||
// 更新库存剩余数量
|
||||
AppStock update = new AppStock();
|
||||
update.setStockId(task.getStockId());
|
||||
update.setRemainNum(task.getStockNum().subtract(opNum));
|
||||
update.setPackingNum(BigDecimal.ZERO);
|
||||
appStockService.updateAppStock(update);
|
||||
logger.info("出库捡选更新库存剩余数量:{},更新结果:{}", JSON.toJSONString(update), appStockService.updateAppStock(update));
|
||||
if(task.getGoodsId().equals("0")) {
|
||||
AppStock appStock = new AppStock();
|
||||
appStock.setVehicleId(task.getVehicleId());
|
||||
List<AppStock> appStocks = appStockService.selectAppStockList(appStock);
|
||||
//如果数量为0,则删除
|
||||
for (AppStock appStock1 : appStocks) {
|
||||
appStockService.deleteAppStockByStockId(appStock1.getStockId());
|
||||
updateLocation(appStock1.getLocationId(),0);
|
||||
}
|
||||
AppTaskBak appTaskBak = new AppTaskBak();
|
||||
BeanUtils.copyProperties(task, appTaskBak);
|
||||
appTaskBakService.insertAppTaskBak(appTaskBak); // 将任务数据归档
|
||||
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
|
||||
}
|
||||
|
||||
}
|
||||
//java8 stream流过滤出appTasks数组中的stockId对应的vehicleId 去重
|
||||
List<String> locations = appTasks.stream().map(AppTask::getLocationId).distinct().collect(Collectors.toList());
|
||||
List<String> vehicles = appTasks.stream().map(AppTask::getVehicleId).distinct().collect(Collectors.toList());
|
||||
//更新库存中中这些vehicleId对应的stock_status为0,并且把locationId置空
|
||||
for (String vehicleId : vehicles) {
|
||||
AppStock appStock = new AppStock();
|
||||
appStock.setVehicleId(vehicleId);
|
||||
appStock.setStockStatus(0);
|
||||
appStockService.updateSts(appStock);
|
||||
}
|
||||
for (String locationId : locations){
|
||||
appStockService.updateNewLocation(locationId,"");
|
||||
//更新库位表状态
|
||||
updateLocation(locationId,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
package com.ruoyi.app.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.TreeEntity;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料类别管理对象 app_goods_type
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-04
|
||||
*/
|
||||
public class AppGoodsType extends TreeEntity
|
||||
public class AppGoodsType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -22,6 +27,21 @@ public class AppGoodsType extends TreeEntity
|
|||
@Excel(name = "物料类别名称")
|
||||
private String typeName;
|
||||
|
||||
/** 父菜单名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 子部门 */
|
||||
private List<AppGoodsType> children = new ArrayList<>();
|
||||
|
||||
public void setTypeId(Long typeId)
|
||||
{
|
||||
this.typeId = typeId;
|
||||
|
|
@ -41,6 +61,46 @@ public class AppGoodsType extends TreeEntity
|
|||
return typeName;
|
||||
}
|
||||
|
||||
public String getParentName() {
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public String getAncestors() {
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors) {
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
public List<AppGoodsType> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<AppGoodsType> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class AppStock extends BaseEntity
|
|||
private String providerName;
|
||||
|
||||
/** 剩余数量 */
|
||||
@Excel(name = "剩余数量")
|
||||
@Excel(name = "库存数量")
|
||||
private BigDecimal remainNum;
|
||||
|
||||
/** 入库数量 */
|
||||
|
|
@ -121,7 +121,11 @@ public class AppStock extends BaseEntity
|
|||
private BigDecimal packingNum;
|
||||
@Excel(name = "生产日期")
|
||||
private String productionDate;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
@Excel(name = "物料描述")
|
||||
private String goodsDesc;
|
||||
public String getWareDate() {
|
||||
return wareDate;
|
||||
}
|
||||
|
|
@ -130,7 +134,13 @@ public class AppStock extends BaseEntity
|
|||
this.wareDate = wareDate;
|
||||
}
|
||||
|
||||
public String getGoodsDesc() {
|
||||
return goodsDesc;
|
||||
}
|
||||
|
||||
public void setGoodsDesc(String goodsDesc) {
|
||||
this.goodsDesc = goodsDesc;
|
||||
}
|
||||
|
||||
public Integer getGoodsAge() {
|
||||
return goodsAge;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package com.ruoyi.app.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class AppTreeSelect implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点ID */
|
||||
private Long id;
|
||||
|
||||
/** 节点名称 */
|
||||
private String label;
|
||||
|
||||
/** 节点禁用 */
|
||||
private boolean disabled = false;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<AppTreeSelect> children;
|
||||
|
||||
public AppTreeSelect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AppTreeSelect(AppGoodsType goodsType)
|
||||
{
|
||||
this.id = goodsType.getTypeId();
|
||||
this.label = goodsType.getTypeName();
|
||||
this.children = goodsType.getChildren().stream().map(AppTreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public boolean isDisabled()
|
||||
{
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled)
|
||||
{
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public List<AppTreeSelect> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<AppTreeSelect> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
|
|
@ -67,4 +67,6 @@ public interface AppStockMapper
|
|||
int updateSts(AppStock appStock);
|
||||
|
||||
int updateLocationWithVehicleId(@Param("vehicleId") String vehicleId,@Param("location") String location);
|
||||
|
||||
List<AppStock> queryListByGoodsId(String goodsId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.app.service;
|
||||
|
||||
import com.ruoyi.app.domain.AppGoodsType;
|
||||
import com.ruoyi.app.domain.AppTreeSelect;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -59,4 +62,27 @@ public interface IAppGoodsTypeService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAppGoodsTypeByTypeId(Long typeId);
|
||||
|
||||
/**
|
||||
* 获取物料类别下拉树
|
||||
* @param appGoodsType
|
||||
* @return
|
||||
*/
|
||||
List<AppTreeSelect> selectGoodsTypeTreeList(AppGoodsType appGoodsType);
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param goodsTypes 物料类别
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<AppGoodsType> buildGoodsTypeTree(List<AppGoodsType> goodsTypes);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param goodsTypes 物料类别
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
public List<AppTreeSelect> buildGoodsTypeTreeSelect(List<AppGoodsType> goodsTypes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,4 +68,6 @@ public interface IAppStockService
|
|||
List<AppStock> selectStockByGoodsId(AppStock tMiStock);
|
||||
|
||||
int updateSts(AppStock tMiStock3);
|
||||
|
||||
List<AppStock> queryListByGoodsId(String goodsId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
package com.ruoyi.app.service.impl;
|
||||
|
||||
import com.ruoyi.app.domain.AppGoodsType;
|
||||
import com.ruoyi.app.domain.AppTreeSelect;
|
||||
import com.ruoyi.app.mapper.AppGoodsTypeMapper;
|
||||
import com.ruoyi.app.service.IAppGoodsTypeService;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 物料类别管理Service业务层处理
|
||||
|
|
@ -84,4 +93,94 @@ public class AppGoodsTypeServiceImpl implements IAppGoodsTypeService {
|
|||
public int deleteAppGoodsTypeByTypeId(Long typeId) {
|
||||
return appGoodsTypeMapper.deleteAppGoodsTypeByTypeId(typeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppTreeSelect> selectGoodsTypeTreeList(AppGoodsType appGoodsType) {
|
||||
List<AppGoodsType> goodsTypes = appGoodsTypeMapper.selectAppGoodsTypeList(new AppGoodsType());
|
||||
return buildGoodsTypeTreeSelect(goodsTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppTreeSelect> buildGoodsTypeTreeSelect(List<AppGoodsType> depts)
|
||||
{
|
||||
List<AppGoodsType> deptTrees = buildGoodsTypeTree(depts);
|
||||
return deptTrees.stream().map(AppTreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppGoodsType> buildGoodsTypeTree(List<AppGoodsType> depts)
|
||||
{
|
||||
List<AppGoodsType> returnList = new ArrayList<AppGoodsType>();
|
||||
List<Long> tempList = depts.stream().map(AppGoodsType::getTypeId).collect(Collectors.toList());
|
||||
for (AppGoodsType dept : depts)
|
||||
{
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(dept.getParentId()))
|
||||
{
|
||||
recursionFn(depts, dept);
|
||||
returnList.add(dept);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = depts;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<AppGoodsType> list, AppGoodsType t)
|
||||
{
|
||||
// 得到子节点列表
|
||||
List<AppGoodsType> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (AppGoodsType tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<AppGoodsType> getChildList(List<AppGoodsType> list, AppGoodsType t)
|
||||
{
|
||||
List<AppGoodsType> tlist = new ArrayList<AppGoodsType>();
|
||||
Iterator<AppGoodsType> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
AppGoodsType n = (AppGoodsType) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getTypeId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<AppGoodsType> list, AppGoodsType t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.app.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.app.domain.AppStock;
|
||||
|
|
@ -113,4 +114,9 @@ public class AppStockServiceImpl implements IAppStockService
|
|||
public int updateSts(AppStock appStock) {
|
||||
return appStockMapper.updateSts(appStock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppStock> queryListByGoodsId(String goodsId) {
|
||||
return appStockMapper.queryListByGoodsId(goodsId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,14 @@
|
|||
<result property="orderStatus" column="order_status" />
|
||||
<result property="isLock" column="is_lock" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppPmsOrderOutVo">
|
||||
select record_id, list_id, order_type, customer_id, goods_id, goods_num, goods_desc, spare1, spare2,pick_num,tr_num,shelves_num,stock_num,order_status,is_lock,order_id from app_pms_order_out
|
||||
select record_id, list_id, order_type, customer_id, goods_id, goods_num, goods_desc, spare1, spare2,pick_num,tr_num,shelves_num,stock_num,order_status,is_lock,order_id,create_time,create_by,update_time from app_pms_order_out
|
||||
</sql>
|
||||
|
||||
<select id="selectAppPmsOrderOutList" parameterType="AppPmsOrderOut" resultMap="AppPmsOrderOutResult">
|
||||
|
|
@ -40,6 +43,7 @@
|
|||
<if test="isLock != null and isLock != ''"> and is_lock = #{isLock}</if>
|
||||
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAppPmsOrderOutByListId" parameterType="String" resultMap="AppPmsOrderOutResult">
|
||||
|
|
@ -66,6 +70,9 @@
|
|||
<if test="orderStatus != null">order_status,</if>
|
||||
<if test="isLock != null">is_lock,</if>
|
||||
<if test="orderId != null">order_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -85,6 +92,9 @@
|
|||
<if test="orderStatus != null">#{orderStatus},</if>
|
||||
<if test="isLock != null">#{isLock},</if>
|
||||
<if test="orderId != null">#{orderId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
|
||||
</trim>
|
||||
</insert>
|
||||
|
|
@ -106,6 +116,7 @@
|
|||
<if test="stockNum != null">stock_num = #{stockNum},</if>
|
||||
<if test="isLock != null">is_lock = #{isLock},</if>
|
||||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
</trim>
|
||||
where record_id = #{recordId}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@
|
|||
<result property="occupyNum" column="occupy_num" />
|
||||
<result property="packingNum" column="packing_num" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="goodsDesc" column="goods_desc" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppStockVo">
|
||||
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 from app_stock
|
||||
ware_date, storage_mode,storage_id, area_id, goods_type_id, occupy_num, packing_num, production_date,goods_desc from app_stock
|
||||
</sql>
|
||||
|
||||
<select id="selectAppStockList" parameterType="AppStock" resultMap="AppStockResult">
|
||||
|
|
@ -54,6 +55,7 @@
|
|||
<if test="goodsStatus != null "> and goods_status = #{goodsStatus}</if>
|
||||
<if test="stockStatus != null "> and stock_status = #{stockStatus}</if>
|
||||
<if test="storageId != null"> and storage_id = #{storageId}</if>
|
||||
<if test="goodsDesc != null"> and goods_desc = #{goodsDesc}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectStockByGoodsId" parameterType="AppStock" resultMap="AppStockResult">
|
||||
|
|
@ -99,6 +101,7 @@
|
|||
<if test="occupyNum != null">occupy_num,</if>
|
||||
<if test="packingNum != null">packing_num,</if>
|
||||
<if test="productionDate != null">production_date,</if>
|
||||
<if test="goodsDesc != null">goods_desc,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="stockId != null">#{stockId},</if>
|
||||
|
|
@ -129,6 +132,7 @@
|
|||
<if test="occupyNum != null">#{occupyNum},</if>
|
||||
<if test="packingNum != null">#{packingNum},</if>
|
||||
<if test="productionDate != null">#{productionDate},</if>
|
||||
<if test="goodsDesc != null">#{goodsDesc},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -163,6 +167,7 @@
|
|||
<if test="occupyNum != null">occupy_num = #{occupyNum},</if>
|
||||
<if test="packingNum != null">packing_num = #{packingNum},</if>
|
||||
<if test="productionDate != null">production_date = #{productionDate},</if>
|
||||
<if test="goodsDesc != null">goods_desc = #{goodsDesc},</if>
|
||||
</trim>
|
||||
where stock_id = #{stockId}
|
||||
</update>
|
||||
|
|
@ -183,4 +188,17 @@
|
|||
#{stockId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="queryListByGoodsId" resultType="AppStock">
|
||||
select goods_id as "goodsId"
|
||||
,goods_name as "goodsName"
|
||||
,goods_desc as "goodsDesc"
|
||||
,sum(remain_num) as "remainNum"
|
||||
from app_stock
|
||||
where
|
||||
(goods_id like concat('%', #{goodsId}, '%') or goods_name like concat('%', #{goodsId}, '%')
|
||||
or goods_desc like concat('%', #{goodsId}, '%'))
|
||||
and stock_status = 0 and location_id is not null
|
||||
GROUP BY goods_id,goods_name,goods_desc
|
||||
order by goods_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user