add inTask && add selectAvailVehicle
This commit is contained in:
parent
47cd81f4c9
commit
c15d821f32
|
|
@ -5,7 +5,9 @@ import java.util.*;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.ruoyi.app.domain.*;
|
import com.ruoyi.app.domain.*;
|
||||||
|
import com.ruoyi.app.domain.DTO.OtherStockInRequest;
|
||||||
import com.ruoyi.app.service.*;
|
import com.ruoyi.app.service.*;
|
||||||
import com.ruoyi.app.service.impl.AppPendingStorageServiceImpl;
|
import com.ruoyi.app.service.impl.AppPendingStorageServiceImpl;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
|
@ -14,6 +16,7 @@ import com.ruoyi.common.utils.uuid.IdUtils;
|
||||||
import com.ruoyi.web.controller.section.EnhanceDataList;
|
import com.ruoyi.web.controller.section.EnhanceDataList;
|
||||||
import com.ruoyi.web.domain.*;
|
import com.ruoyi.web.domain.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.aspectj.weaver.loadtime.Aj;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
@ -22,14 +25,7 @@ import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -67,6 +63,9 @@ public class AppTaskController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppPendingStorageServiceImpl appPendingStorageServiceImpl;
|
private AppPendingStorageServiceImpl appPendingStorageServiceImpl;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAppVehicleService appVehicleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询【请填写功能名称】列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -628,4 +627,52 @@ public class AppTaskController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/createInRequest")
|
||||||
|
public AjaxResult createInRequest(@RequestBody OtherStockInRequest otherStockInRequest) {
|
||||||
|
return _createInRequest(otherStockInRequest.getData(), otherStockInRequest.getVehicleNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AjaxResult _createInRequest(List<AppPendingStorageRequest> appPendingStorageRequestList, String vehicleNo) {
|
||||||
|
AppVehicle appVehicle = appVehicleService.selectAppVehicleByVehicleId(vehicleNo);
|
||||||
|
if (appVehicle != null && appVehicle.getVehicleStatus() == 1) {
|
||||||
|
logger.error("载具{}已经在库存中,请勿重复入库!", vehicleNo);
|
||||||
|
return error("该托盘已经在库存中,请勿重复入库!");
|
||||||
|
}
|
||||||
|
AppTask taskQuery = new AppTask();
|
||||||
|
taskQuery.setVehicleId(vehicleNo);
|
||||||
|
List<AppTask> sameTaskList = appTaskService.selectAppTaskList(taskQuery);
|
||||||
|
if (sameTaskList.size() > 0) {
|
||||||
|
logger.error("载具{}存在其他任务,请勿重复入库!", vehicleNo);
|
||||||
|
return error("该载具存在其他任务,请勿重复入库!");
|
||||||
|
}
|
||||||
|
for (AppPendingStorageRequest appPendingStorageRequest : appPendingStorageRequestList) {
|
||||||
|
AppTask appTask = new AppTask();
|
||||||
|
appTask.setTaskId("RK"+System.currentTimeMillis());
|
||||||
|
appTask.setWcsTaskId("RK"+System.currentTimeMillis());
|
||||||
|
appTask.setTaskType(1);
|
||||||
|
appTask.setTaskStatus(0);
|
||||||
|
appTask.setOrigin("B0-00-00-00");
|
||||||
|
appTask.setTaskPriority(1);
|
||||||
|
appTask.setVehicleId(vehicleNo);
|
||||||
|
appTask.setGoodsId(appPendingStorageRequest.getGoodsId());
|
||||||
|
appTask.setOpNum(BigDecimal.valueOf(1));
|
||||||
|
appTask.setOpUser("user");
|
||||||
|
String destination = appLocationService.sendLocation();
|
||||||
|
appTask.setDestination(destination);
|
||||||
|
appTaskService.insertAppTask(appTask);
|
||||||
|
|
||||||
|
AppLocation location_update = new AppLocation();
|
||||||
|
location_update.setLocationStatus(1);
|
||||||
|
location_update.setLocationId(destination);
|
||||||
|
location_update.setUpdateTime(new Date());
|
||||||
|
appLocationService.updateAppLocation(location_update);
|
||||||
|
}
|
||||||
|
appVehicle.setIsEmpty(0L);
|
||||||
|
appVehicle.setVehicleStatus(1L);
|
||||||
|
appVehicle.setLastInTime(new Date());
|
||||||
|
appVehicleService.updateAppVehicle(appVehicle);
|
||||||
|
return AjaxResult.success("创建入库任务成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.AppTask;
|
import com.ruoyi.app.domain.AppTask;
|
||||||
import com.ruoyi.app.domain.AppVehicle;
|
import com.ruoyi.app.domain.AppVehicle;
|
||||||
|
import com.ruoyi.app.domain.DTO.AppAvailVehicle;
|
||||||
import com.ruoyi.app.service.IAppVehicleService;
|
import com.ruoyi.app.service.IAppVehicleService;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.web.controller.section.EnhanceDataList;
|
import com.ruoyi.web.controller.section.EnhanceDataList;
|
||||||
|
|
@ -106,4 +107,10 @@ public class AppVehicleController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(appVehicleService.deleteAppVehicleByVehicleIds(vehicleIds));
|
return toAjax(appVehicleService.deleteAppVehicleByVehicleIds(vehicleIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("listAvail")
|
||||||
|
@Anonymous
|
||||||
|
public List<AppAvailVehicle> selectAppAvailVehicleList() {
|
||||||
|
return appVehicleService.selectAppAvailVehicleList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ public class SecurityConfig
|
||||||
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/kk", "/system/storage/**", "/app/location/count", "/app/vehicle/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/createOutRequest", "/system/storage/**", "/app/location/count", "/app/vehicle/**").permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ public class AppStock extends BaseEntity
|
||||||
|
|
||||||
/** 库存状态 */
|
/** 库存状态 */
|
||||||
@Excel(name = "库存状态")
|
@Excel(name = "库存状态")
|
||||||
|
// 0: 未出库
|
||||||
|
// 1: 出库中
|
||||||
private Long stockStatus;
|
private Long stockStatus;
|
||||||
|
|
||||||
/** 入库用户 */
|
/** 入库用户 */
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ public class AppVehicle extends BaseEntity
|
||||||
this.vehicleStatus = vehicleStatus;
|
this.vehicleStatus = vehicleStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0: 入库中
|
||||||
|
* 1: 在库中
|
||||||
|
* 2: 出库中
|
||||||
|
* @return vehicleStatus
|
||||||
|
*/
|
||||||
public Long getVehicleStatus()
|
public Long getVehicleStatus()
|
||||||
{
|
{
|
||||||
return vehicleStatus;
|
return vehicleStatus;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.ruoyi.app.domain.DAO;
|
||||||
|
|
||||||
|
public class AppVehicleInfo {
|
||||||
|
|
||||||
|
private String vehicleId;
|
||||||
|
|
||||||
|
private int vehicleStatus;
|
||||||
|
|
||||||
|
private String locationId;
|
||||||
|
|
||||||
|
private int isEmpty;
|
||||||
|
|
||||||
|
private int isLock;
|
||||||
|
|
||||||
|
public String getVehicleId() {
|
||||||
|
return vehicleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVehicleId(String vehicleId) {
|
||||||
|
this.vehicleId = vehicleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVehicleStatus() {
|
||||||
|
return vehicleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVehicleStatus(int vehicleStatus) {
|
||||||
|
this.vehicleStatus = vehicleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocationId() {
|
||||||
|
return locationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocationId(String locationId) {
|
||||||
|
this.locationId = locationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIsEmpty() {
|
||||||
|
return isEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsEmpty(int isEmpty) {
|
||||||
|
this.isEmpty = isEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIsLock() {
|
||||||
|
return isLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsLock(int isLock) {
|
||||||
|
this.isLock = isLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AppVehicleInfo{" +
|
||||||
|
"vehicleId='" + vehicleId + '\'' +
|
||||||
|
", vehicleStatus=" + vehicleStatus +
|
||||||
|
", locationId='" + locationId + '\'' +
|
||||||
|
", isEmpty=" + isEmpty +
|
||||||
|
", isLock=" + isLock +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.ruoyi.app.domain.DTO;
|
||||||
|
|
||||||
|
public class AppAvailVehicle {
|
||||||
|
private String vehicleId;
|
||||||
|
|
||||||
|
private Integer vehicleStatus;
|
||||||
|
|
||||||
|
private String locationId;
|
||||||
|
|
||||||
|
public String getVehicleId() {
|
||||||
|
return vehicleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVehicleId(String vehicleId) {
|
||||||
|
this.vehicleId = vehicleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVehicleStatus() {
|
||||||
|
return vehicleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVehicleStatus(Integer vehicleStatus) {
|
||||||
|
this.vehicleStatus = vehicleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocationId() {
|
||||||
|
return locationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocationId(String locationId) {
|
||||||
|
this.locationId = locationId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.app.mapper;
|
package com.ruoyi.app.mapper;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.AppVehicle;
|
import com.ruoyi.app.domain.AppVehicle;
|
||||||
|
import com.ruoyi.app.domain.DAO.AppVehicleInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -59,4 +60,11 @@ public interface AppVehicleMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAppVehicleByVehicleIds(String[] vehicleIds);
|
public int deleteAppVehicleByVehicleIds(String[] vehicleIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取vehicle列表
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<AppVehicleInfo> selectVehicleList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.app.service;
|
package com.ruoyi.app.service;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.AppVehicle;
|
import com.ruoyi.app.domain.AppVehicle;
|
||||||
|
import com.ruoyi.app.domain.DTO.AppAvailVehicle;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -59,4 +60,9 @@ public interface IAppVehicleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAppVehicleByVehicleId(String vehicleId);
|
public int deleteAppVehicleByVehicleId(String vehicleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态为在库中的所有可用的载具
|
||||||
|
*/
|
||||||
|
public List<AppAvailVehicle> selectAppAvailVehicleList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
package com.ruoyi.app.service.impl;
|
package com.ruoyi.app.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.AppVehicle;
|
import com.ruoyi.app.domain.AppVehicle;
|
||||||
|
import com.ruoyi.app.domain.DAO.AppVehicleInfo;
|
||||||
|
import com.ruoyi.app.domain.DTO.AppAvailVehicle;
|
||||||
import com.ruoyi.app.mapper.AppVehicleMapper;
|
import com.ruoyi.app.mapper.AppVehicleMapper;
|
||||||
import com.ruoyi.app.service.IAppVehicleService;
|
import com.ruoyi.app.service.IAppVehicleService;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -91,4 +95,27 @@ public class AppVehicleServiceImpl implements IAppVehicleService
|
||||||
{
|
{
|
||||||
return appVehicleMapper.deleteAppVehicleByVehicleId(vehicleId);
|
return appVehicleMapper.deleteAppVehicleByVehicleId(vehicleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态为在库中的所有可用的载具
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<AppAvailVehicle> selectAppAvailVehicleList() {
|
||||||
|
List<AppVehicleInfo> appVehicleInfoList = appVehicleMapper.selectVehicleList();
|
||||||
|
List<AppAvailVehicle> response = new ArrayList<AppAvailVehicle>();
|
||||||
|
for (AppVehicleInfo appVehicleInfo : appVehicleInfoList) {
|
||||||
|
// 1: 在库内
|
||||||
|
System.out.println(appVehicleInfo);
|
||||||
|
if (appVehicleInfo != null && appVehicleInfo.getVehicleId() != null && !StringUtils.isEmpty(appVehicleInfo.getVehicleId())) {
|
||||||
|
if (appVehicleInfo.getVehicleStatus() == 1 && appVehicleInfo.getIsEmpty() != 0 && appVehicleInfo.getIsLock() == 0) {
|
||||||
|
AppAvailVehicle appAvailVehicle = new AppAvailVehicle();
|
||||||
|
appAvailVehicle.setVehicleId(appVehicleInfo.getVehicleId());
|
||||||
|
appAvailVehicle.setVehicleStatus(1);
|
||||||
|
appAvailVehicle.setLocationId(appVehicleInfo.getLocationId());
|
||||||
|
response.add(appAvailVehicle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,14 @@
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="AppVehicleInfo" id="AppVehicleInfoResult">
|
||||||
|
<result property="vehicleId" column="vehicle_id" />
|
||||||
|
<result property="vehicleStatus" column="vehicle_status" />
|
||||||
|
<result property="locationId" column="location_id" />
|
||||||
|
<result property="isEmpty" column="is_empty" />
|
||||||
|
<result property="isLock" column="is_lock" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAppVehicleVo">
|
<sql id="selectAppVehicleVo">
|
||||||
select vehicle_id, vehicle_type, vehicle_status, location_id, is_empty, is_lock, last_in_time, last_in_user, remark from app_vehicle
|
select vehicle_id, vehicle_type, vehicle_status, location_id, is_empty, is_lock, last_in_time, last_in_user, remark from app_vehicle
|
||||||
</sql>
|
</sql>
|
||||||
|
|
@ -89,4 +97,8 @@
|
||||||
#{vehicleId}
|
#{vehicleId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectVehicleList" resultMap="AppVehicleInfoResult">
|
||||||
|
select vehicle_id, vehicle_status, is_empty, is_lock, location_id from app_vehicle
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user