This commit is contained in:
葛林强 2025-03-06 09:03:05 +08:00
commit 8a1ddb8e94
33 changed files with 1386 additions and 121 deletions

View File

@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType;
import com.ruoyi.common.utils.OrderCodeFactory;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.domain.PmsOrderInRequest;
@ -102,6 +103,8 @@ public class AppPmsController extends BaseController {
logger.info("Pms出库单请求{}", orderOutRequests);
int insertRow = 0;
// 判断请求数据完整性
//生成wms统一订单号
String orderId= OrderCodeFactory.getOrderCode("WMS", "");
for(PmsOrderOutRequest orderOutRequest : orderOutRequests) {
if (StringUtils.isEmpty(orderOutRequest.getListId())
|| orderOutRequest.getOrderType() == null
@ -117,6 +120,7 @@ public class AppPmsController extends BaseController {
}
AppPmsOrderOut appPmsOrderOut = new AppPmsOrderOut();
appPmsOrderOut.setRecordId(UUID.randomUUID().toString());
appPmsOrderOut.setOrderId(orderId);
appPmsOrderOut.setListId(orderOutRequest.getListId());
appPmsOrderOut.setOrderType(Long.valueOf(orderOutRequest.getOrderType()));
appPmsOrderOut.setCustomerId(orderOutRequest.getCustomerId());

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.app;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
@ -12,11 +13,17 @@ import com.ruoyi.app.domain.DTO.PickCompleteReq;
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.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.OrderCodeFactory;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.web.controller.section.EnhanceDataList;
import com.ruoyi.web.domain.*;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.BeanUtils;
import org.springframework.http.HttpEntity;
@ -68,7 +75,8 @@ public class AppTaskController extends BaseController
@Autowired
private IAppVehicleService appVehicleService;
@Autowired
private IAppPmsOrderOutService appPmsOrderOutService;
/**
* 查询请填写功能名称列表
*/
@ -490,6 +498,370 @@ public class AppTaskController extends BaseController
return success();
}
/**
* 出库单出库请求
* appPmsOrderOutList 出库单列表
* @return 结果
*/
@ApiOperation("请求出库")
@PostMapping("/createOutRequestByPmsOrders")
@Transactional(rollbackFor = Exception.class)
@Anonymous
public AjaxResult createOutRequestByPmsOrders(@RequestBody List<AppPmsOrderOut> appPmsOrderOutList)
{
// 判断是否为空
if (CollectionUtils.isEmpty(appPmsOrderOutList)) {
return error("出库单明细不能为空");
}
//如果物料编码重复报异常
// 判断goodsId是否重复
if (appPmsOrderOutList.stream().map(AppPmsOrderOut::getGoodsId).distinct().count() != appPmsOrderOutList.size()) {
return error("出库单明细不能有重复物料编码");
}
//
logger.info("请求出库单明细:{}", appPmsOrderOutList);
//value: 以托盘号为key该托盘出库该物料的出库数量为value的map
Map<String,Map<String,BigDecimal>> goodsMap = new HashMap<String,Map<String,BigDecimal>>();
for(AppPmsOrderOut appPmsOrderOut: appPmsOrderOutList){
if(AppConstants.OUT_ORDER_STATUS_2.equals(appPmsOrderOut.getOrderStatus())){
logger.info("已出库完成的忽略:{}",appPmsOrderOut.getGoodsId());
throw new RuntimeException("有出库单已全部出库,请重新选择");
}
if("1".equals(appPmsOrderOut.getIsLock())){
logger.info("已锁定的忽略:{}",appPmsOrderOut.getGoodsId());
throw new RuntimeException("有出库单已锁定,请重新选择");
}
if(appPmsOrderOut.getShelvesNum() == null || appPmsOrderOut.getShelvesNum().compareTo(BigDecimal.ZERO) == 0){
logger.info("出库数量为0忽略{}",appPmsOrderOut.getGoodsId());
throw new RuntimeException("出库数量不能为0请确认");
}
//存储每个托盘的需要出的数量
Map<String,BigDecimal> ctlMap = new HashMap<>();
//根据物料ID查询库存按照先进先出的原则按上架时间倒叙查询
AppStock tMiStock = new AppStock();
tMiStock.setGoodsId(appPmsOrderOut.getGoodsId());
List<AppStock> appStocks = appStockService.selectStockByGoodsId(tMiStock);
if(appStocks.size() == 0){
logger.warn("未找到该物料库存:{}",appPmsOrderOut.getGoodsId());
throw new RuntimeException("未找到该物料库存:"+appPmsOrderOut.getGoodsId());
}
//本次出库数量
BigDecimal shelvesNum = appPmsOrderOut.getShelvesNum();
BigDecimal total = BigDecimal.ZERO;
for(AppStock appStock : appStocks){
total = total.add(appStock.getOriginNum());
if(appPmsOrderOut.getPickNum() == null){
appPmsOrderOut.setPickNum(BigDecimal.ZERO);
}
if(shelvesNum.compareTo(total) == 0){
ctlMap.put(appStock.getVehicleId(),appStock.getOriginNum());
appPmsOrderOut.setPickNum(appPmsOrderOut.getPickNum().add(appStock.getOriginNum()));
break;
}else if(shelvesNum.compareTo(total) > 0){
ctlMap.put(appStock.getVehicleId(),appStock.getOriginNum());
appPmsOrderOut.setPickNum(appPmsOrderOut.getPickNum().add(appStock.getOriginNum()));
}else{
//小于0
BigDecimal subtract = total.subtract(shelvesNum);
BigDecimal subtract1 = appStock.getOriginNum().subtract(subtract);
ctlMap.put(appStock.getVehicleId(),subtract1);
appPmsOrderOut.setPickNum(appPmsOrderOut.getPickNum().add(subtract1));
break;
}
}
//存储在大的map中
goodsMap.put(appPmsOrderOut.getGoodsId(),ctlMap);
logger.info("更新累计出库数量:{}",appPmsOrderOut);
appPmsOrderOut.setIsLock("1");
appPmsOrderOutService.updatePickNum(appPmsOrderOut);
}
//创建出库任务
/**
* 假如 物料A 需要出库的托盘为1 3 8
* 物料B 需要出库的托盘为15
* 则本次出库的总的任务为4个1358
* 根据这个逻辑进行开发
*/
//lambda表达式遍历
//蒋map进行转换转换为以托盘为大key以物料和数量为小map的map
Map<String,Map<String,BigDecimal>> ctlGoodsMap = new HashMap<>();
goodsMap.forEach((goodsId,ctlMap) -> {
ctlMap.forEach((vehicleId,shelvNum) ->{
AtomicBoolean isExist = new AtomicBoolean(false);
ctlGoodsMap.forEach((key,value) -> {
if(vehicleId.equals(key)){
isExist.set(true);
value.put(goodsId,shelvNum);
}
});
if(!isExist.get()){
Map<String,BigDecimal> map = new HashMap<>();
map.put(goodsId,shelvNum);
ctlGoodsMap.put(vehicleId,map);
}
});
});
logger.info("生成以托盘号为主键的map{}",ctlGoodsMap);
//根据每个托盘创建出库任务
//1. 判断出库任务是否已产生该托盘的任务
//获取订单号
String orderId = appPmsOrderOutList.get(0).getOrderId();
ctlGoodsMap.forEach((key,value) ->{
List<AppTask> appTasks = getAppTaskByVehicleId(key,null);
if(!CollectionUtils.isEmpty(appTasks)){
logger.error("该托盘已产生任务:{}",key);
throw new RuntimeException("该托盘已产生任务:"+key);
}
//出库
setCk(key,value,orderId);
});
return success("处理出库请求成功,并已生成出库任务。");
}
private List<AppTask> getAppTaskByVehicleId(String vehicleId,String locationId) {
AppTask appTask =new AppTask();
appTask.setVehicleId(vehicleId);
appTask.setLocationId(locationId);
if(StringUtils.isBlank(locationId)) {
appTask.setTaskType(AppConstants.TASK_TYPE_OUT);
}
//判断该托盘是否产生任务
return appTaskService.selectAppTaskList(appTask);
}
private void setCk(String vehicleId,Map<String,BigDecimal> map,String orderId) {
AppStock appStock = new AppStock();
appStock.setVehicleId(vehicleId);
//该托盘的所有物料
List<AppStock> appStocks = appStockService.selectAppStockList(appStock);
//设置packingNum为空
appStocks.forEach(appStock1 -> {
appStock1.setPackingNum(null);
});
logger.info("该库位:{},库存列表为:{}", vehicleId, appStocks);
//判断是否需要移库
String locId = appStocks.get(0).getLocationId();
int sts = appStocks.get(0).getStockStatus();
if (sts == 1) {
logger.error("该库存为冻结状态,请确认!");
throw new RuntimeException("该库存为冻结状态,请确认!");
}
if (StringUtils.isBlank(locId)) {
throw new RuntimeException("获取库位异常");
}
boolean isTransfer = false;
//根据库位查询库位信息
AppLocation appLocation = appLocationService.selectAppLocationByLocationId(locId);
if (appLocation.getwDepth() == 2) {
//判断01是否有货
String locationId = locId.substring(0, locId.length() - 1) + "01";
List<AppTask> appTasks = getAppTaskByVehicleId(null, locationId);
if (!CollectionUtils.isEmpty(appTasks)) {
logger.error(locationId + "有任务执行,请稍后再试");
throw new RuntimeException(locationId + "有任务执行,请稍后再试!");
}
AppLocation areaLocation = new AppLocation();
areaLocation.setLocationStatus(1);
areaLocation.setLocationId(locationId);
String transferCtl = StringUtils.EMPTY;
List<AppLocation> tBaseStorageAreaLocations = appLocationService.selectAppLocationList(areaLocation);
if (tBaseStorageAreaLocations.size() > 0) {
AppStock AppStock1 = new AppStock();
AppStock1.setLocationId(locationId);
List<AppStock> tMiStocks1 = appStockService.selectAppStockList(AppStock1);
if (tMiStocks1.size() > 0) {
transferCtl = tMiStocks1.get(0).getVehicleId();
isTransfer = true;
}
} else {
AppStock tMiStock1 = new AppStock();
tMiStock1.setLocationId(locationId);
List<AppStock> tMiStocks1 = appStockService.selectAppStockList(tMiStock1);
if (tMiStocks1.size() > 0) {
transferCtl = tMiStocks1.get(0).getVehicleId();
int sts1 = tMiStocks1.get(0).getStockStatus();
if (sts1 == 1) {
logger.error(locId + ":产生出库任务失败");
throw new RuntimeException(locId + ":产生出库任务失败");
}
isTransfer = true;
}
}
//移库
if (isTransfer) {
// 查询空闲库位
List<AppLocation> tBaseStorageAreaLocationList = appLocationService.selectFreeLoc();
if (CollectionUtils.isEmpty(tBaseStorageAreaLocationList)) {
logger.error("没有空闲库位");
throw new RuntimeException("没有空闲库位移库");
}
String toLoc = StringUtils.EMPTY;
for (AppLocation tBaseStorageAreaLocation : tBaseStorageAreaLocationList) {
//如果在浅货位需要判断深货位是否有货
String tempLocationId = tBaseStorageAreaLocation.getLocationId();
if (tBaseStorageAreaLocation.getwDepth() == 1) {
String locationY = tempLocationId.substring(0, tempLocationId.length() - 1) + "02";
AppStock tMiStock5 = new AppStock();
tMiStock5.setLocationId(locationY);
List<AppStock> tMiStocks5 = appStockService.selectAppStockList(tMiStock5);
if (CollectionUtils.isEmpty(tMiStocks5)) {
logger.warn("深货位无库存,切换:{}", locationY);
continue;
}
//判断任务表有没有该库位
List<AppTask> appTasks5 = getAppTaskByVehicleId(null, locationY);
if (!CollectionUtils.isEmpty(appTasks5)) {
logger.warn("深货位有任务,切换:{}", locationY);
continue;
}
toLoc = tBaseStorageAreaLocation.getLocationId();
break;
} else {
//判断该库位如果是在深库位需要判断浅库位是否有货
String locationY = tempLocationId.substring(0, tempLocationId.length() - 1) + "01";
//
AppStock tMiStock5 = new AppStock();
tMiStock5.setLocationId(locationY);
List<AppStock> tMiStocks5 = appStockService.selectAppStockList(tMiStock5);
if (!CollectionUtils.isEmpty(tMiStocks5)) {
logger.warn("浅货位有库存,切换:{}", locationY);
continue;
}
//判断任务表有没有该库位
List<AppTask> appTasks5 = getAppTaskByVehicleId(null, locationY);
if (!CollectionUtils.isEmpty(appTasks5)) {
logger.warn("浅货位有任务,切换:{}", locationY);
continue;
}
toLoc = tBaseStorageAreaLocation.getLocationId();
break;
}
}
if (StringUtils.isBlank(toLoc)) {
logger.error("没有找到移库地址,出库失败");
throw new RuntimeException("没有找到移库地址,出库失败");
}
//创建出库任务
AppTask appTask = new AppTask();
String yc = OrderCodeFactory.getOrderCode("YK", "");
appTask.setTaskId(yc);
appTask.setTaskType(AppConstants.TASK_TYPE_TRANSFER);
appTask.setLocationId(locationId);
appTask.setOrigin(locationId);
appTask.setDestination(toLoc);
appTask.setVehicleId(transferCtl);
appTask.setTaskStatus(AppConstants.LOCATION_STATUS_ENABLE);
appTask.setUpdateTime(new Date());
appTask.setCreateTime(new Date());
LoginUser loginUser = SecurityUtils.getLoginUser();
appTask.setCreateBy(loginUser == null ? "移库任务" : loginUser.getUsername());
appTaskService.insertAppTask(appTask);
logger.info("生成移库任务=====》》》》》从{},到{}", locationId, toLoc);
//冻结库位
AppLocation tBaseStorageAreaLocation = new AppLocation();
tBaseStorageAreaLocation.setLocationStatus(AppConstants.LOCATION_STATUS_DISABLE);
tBaseStorageAreaLocation.setIsWorking(AppConstants.LOCATION_STATUS_DISABLE);
tBaseStorageAreaLocation.setLocationId(toLoc);
appLocationService.updateAppLocation(tBaseStorageAreaLocation);
//锁定库存
AppStock tMiStock3 = new AppStock();
tMiStock3.setVehicleId(transferCtl);
tMiStock3.setStockStatus(AppConstants.LOCATION_STATUS_DISABLE);
appStockService.updateSts(tMiStock3);
}
}
//设置库存里面的出库数量
for (String key : map.keySet()) {
BigDecimal requiredNum = map.get(key);
BigDecimal totalNum = BigDecimal.ZERO;
for (AppStock tMiStock1 : appStocks) {
if (tMiStock1.getGoodsId().equals(key)) {
BigDecimal availableStock = tMiStock1.getOriginNum(); // 当前库存数量
totalNum = totalNum.add(tMiStock1.getOriginNum());
// 判断是否达到或者超过所需出库数量
if (totalNum.compareTo(requiredNum) >= 0) {
// 如果累加的数量已经达到或超过所需数量
BigDecimal excess = totalNum.subtract(requiredNum); // 超出的数量
tMiStock1.setPackingNum(availableStock.subtract(excess)); // 设置本次出库的数量
break; // 不再继续循环已经处理完所需的数量
} else {
// 如果当前库存不足以满足所需出库数量
tMiStock1.setPackingNum(availableStock); // 设置出库的数量为当前库存
}
}
}
}
boolean isExist = false;
for (AppStock tMiStock1 : appStocks) {
if(tMiStock1.getPackingNum() != null) {
if (tMiStock1.getOriginNum().compareTo(tMiStock1.getPackingNum()) > 0) {
isExist = true;
break;
}
}
}
//CkType 1.零捡 2全量 3移库
//boxtype1不需要出库 2零捡 3全出
if (isExist) {
appStocks.forEach(e -> {
e.setCkType(1);
});
} else {
appStocks.forEach(e -> {
e.setCkType(2);
});
}
//是否需要冻结库存
//更新库存
for (AppStock tMiStock1 : appStocks) {
tMiStock1.setUpdateTime(new Date());
tMiStock1.setStockStatus(AppConstants.LOCATION_STATUS_DISABLE);
appStockService.updateAppStock(tMiStock1);
}
//创建出库任务
for (AppStock tMiStock1 : appStocks) {
if(tMiStock1.getPackingNum() != null) {
String code = OrderCodeFactory.getOrderCode("CK", "");
AppTask appTask = new AppTask();
appTask.setGoodsId(tMiStock1.getGoodsId());
//图号
appTask.setVehicleId(tMiStock1.getVehicleId());
appTask.setTaskStatus(AppConstants.LOCATION_STATUS_ENABLE);
appTask.setTaskType(AppConstants.TASK_TYPE_OUT);
appTask.setTaskId(code);
appTask.setOrigin(tMiStock1.getLocationId());
appTask.setLocationId(tMiStock1.getLocationId());
appTask.setOpNum(tMiStock1.getPackingNum());
appTask.setStockNum(tMiStock1.getOriginNum());
appTask.setCkType(tMiStock1.getCkType());
appTaskService.insertAppTask(appTask);
}
}
}
/**
* 请求出库
* @param outRequest 出库请求
@ -507,10 +879,23 @@ public class AppTaskController extends BaseController
|| outRequest.getNeedNum() == null || outRequest.getNeedNum().compareTo(BigDecimal.ZERO) <= 0) {
return error("请求参数不完整。");
}
handleOutRequest(outRequest);
// if (totalNeedNum.compareTo(outRequest.getNeedNum()) == 0) {
// // 没有库存
// return error("没有库存");
// } else if (totalNeedNum.compareTo(BigDecimal.ZERO) > 0) {
// return error("库存不足");
// } else {
// return success("处理出库请求成功,并已生成出库任务。");
// }
return success("处理出库请求成功,并已生成出库任务。");
}
private void handleOutRequest(TaskOutRequest outRequest) {
// 根据需求查询库存正常
AppStock stockQuery = new AppStock();
stockQuery.setGoodsId(outRequest.getGoodsId());
stockQuery.setStockStatus(0L);
stockQuery.setStockStatus(0);
List<AppStock> appStocks = appStockService.selectAppStockList(stockQuery);
BigDecimal totalNeedNum = outRequest.getNeedNum();
for (AppStock appStock : appStocks) {
@ -576,7 +961,7 @@ public class AppTaskController extends BaseController
totalNeedNum = totalNeedNum.subtract(appStock.getRemainNum());
appStock.setRemainNum(BigDecimal.ZERO);
}
appStock.setStockStatus(1L);// 设置状态出库中
appStock.setStockStatus(1);// 设置状态出库中
// 生成出库任务并将此任务的preTask设置为移库任务
AppTask outTask = new AppTask();
outTask.setTaskId(IdUtils.fastUUID());
@ -599,14 +984,7 @@ public class AppTaskController extends BaseController
// 更新库存
appStockService.updateAppStock(appStock);
}
if (totalNeedNum.compareTo(outRequest.getNeedNum()) == 0) {
// 没有库存
return error("没有库存");
} else if (totalNeedNum.compareTo(BigDecimal.ZERO) > 0) {
return error("库存不足");
} else {
return success("处理出库请求成功,并已生成出库任务。");
}
}
/**

View File

@ -11,9 +11,22 @@ public class AppConstants {
/**
* 货位状态 0 启用 1 禁用
*/
public static final Integer APP_LOCATION_STATUS_ENABLE = 0;
public static final Integer LOCATION_STATUS_ENABLE = 0;
/**
* 货位状态 0 启用 1 禁用
* 库位状态 0正常 1占用
*/
public static final Integer APP_LOCATION_STATUS_DISABLE = 1;
public static final Integer LOCATION_STATUS_DISABLE = 1;
/**
* 出库状态 0 未完成 1 部分出库 2 全部出库
*/
public static final String OUT_ORDER_STATUS_0 = "0";
public static final String OUT_ORDER_STATUS_1 = "1";
public static final String OUT_ORDER_STATUS_2 = "2";
//1:出库 2入库 3:移库
public static final Integer TASK_TYPE_OUT = 2;
public static final Integer TASK_TYPE_IN = 1;
public static final Integer TASK_TYPE_TRANSFER = 3;
//
}

View File

@ -0,0 +1,116 @@
package com.ruoyi.common.utils;
import org.apache.commons.lang3.StringUtils;
import java.security.SecureRandom;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 订单编码码生成器生成32位数字编码
*
* @author tony.wu
* @生成规则 1位单号类型+17位时间戳+14位(用户id加密&随机数)
*
*/
public class OrderCodeFactory {
/**
* 订单类别头
*/
//private static final String ORDER_CODE = "1";
/**
* 随即编码
*/
private static final int[] r = new int[]{7, 9, 6, 2, 8, 1, 3, 0, 5, 4};
/**
* 用户id和随机数总长度
*/
private static final int maxLength = 10;
/**
* 更具id进行加密+加随机数组成固定长度编码
*/
private static String toCode(String id) {
if(StringUtils.isBlank(id)){
id = "10000";
}
StringBuilder idsbs = new StringBuilder();
for (int i = id.length() - 1; i >= 0; i--) {
idsbs.append(r[id.charAt(i) - '0']);
}
return idsbs.append(getRandom(maxLength - id.length())).toString();
}
/**
* 生成时间戳
*/
private static String getDateTime() {
DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
return sdf.format(new Date());
}
/**
* 生成固定长度随机码
*
* @param n 长度
*/
private static long getRandom(long n) {
long min = 1, max = 9;
for (int i = 1; i < n; i++) {
min *= 10;
max *= 10;
}
//Fix缺陷 20200908 10:37 Random-->SecureRandom
// 使用SecureRandom 生成更安全的随机数
long rangeLong = (((long) (new SecureRandom().nextDouble() * (max - min)))) + min;
return rangeLong;
}
/**
* 生成不带类别标头的编码
*
* @param userId
*/
private static synchronized String getCode(String userId) {
return getDateTime() + toCode(userId);
}
/**
* 生成订单单号编码
*
* @param userId
*/
public static String getOrderCode(String order_code, String userId) {
return order_code + getCode(userId);
}
/**
* 生成退货单号编码
*
* @param userId
*/
public static String getReturnCode(String return_order,String userId) {
return return_order + getCode(userId);
}
/**
* 生成退款单号编码
*
* @param userId
*/
public static String getRefundCode(String refund_order,String userId) {
return refund_order + getCode(userId);
}
/**
* 未付款重新支付
*
* @param userId
*/
public static String getAgainCode(String again_order, String userId) {
return again_order + getCode(userId);
}
}

View File

@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -36,6 +37,8 @@ public class TaskExecutor {
private IAppPendingStorageService appPendingStorageService;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private IPlcService plcService;
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -352,4 +355,48 @@ public class TaskExecutor {
}
}
/**
* 定时任务更新plcid
*/
@Transactional(rollbackFor = Exception.class)
public void scheduleTask() {
// System.out.println("开始执行");
//查询入库表
List<Plc> plcs = plcService.selectPlcList();
Plc plc = plcs.get(0);
//查询入库任务表 到达9999999 则自动从0开始
if(plc.getPlcid() == 9999999){
plc.setPlcid(0L);
plcService.updatePlc(plc);
}
AppTask appTask = new AppTask();
appTask.setTaskStatus(0);
appTask.setPlcId(null);
List<AppTask> AppTasks = appTaskService.selectPlcList();
Long count = plc.getPlcid();
if(AppTasks.size() > 0){
List<String> list = AppTasks.stream().map(AppTask::getVehicleId).distinct().collect(Collectors.toList());
for(String ctl: list){
AppTask appTask1 = new AppTask();
appTask1.setTaskStatus(0);
appTask1.setVehicleId(ctl);
appTask1.setPlcId(++count);
appTaskService.updatePlcId(appTask1);
}
}
if(count.longValue() != plc.getPlcid().longValue()){
logger.info("定时任务更改plc{}",count);
plc.setPlcid(count);
plcService.updatePlc(plc);
}
plcs = plcService.selectPlcList();
plc = plcs.get(0);
//查询入库任务表 到达9999999 则自动从0开始
if(plc.getPlcid() == 9999999){
plc.setPlcid(0L);
plcService.updatePlc(plc);
}
}
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.app.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -13,118 +13,152 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-01-15
*/
public class AppGoods extends BaseEntity
{
public class AppGoods extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 物料编号 */
/**
* 主键id
*/
private Long id;
/**
* 物料编码
*/
@Excel(name = "物料编码")
private String goodsId;
/** 物料名称/描述 */
@Excel(name = "物料名称/描述")
/**
* 物料名称/描述
*/
@Excel(name = "物料描述")
private String goodsName;
/** 单位 */
@Excel(name = "单位")
/**
* 单位
*/
@Excel(name = "计量单位")
private String goodsUnit;
/** 物料类型 */
@Excel(name = "物料类型")
/**
* 物料类别
*/
@Excel(name = "物料类别")
private String goodsType;
/** 通用容器类型 */
/**
* 通用容器类型
*/
@Excel(name = "通用容器类型")
private String normalVehicleType;
/**
* 备注
*/
@Excel(name = "备注")
private String remark;
/** 物料状态 */
@Excel(name = "物料状态")
/**
* 物料状态 0 启用 1 禁用
*/
@Excel(name = "状态")
private Long goodsStatus;
/** 最近更新用户 */
@Excel(name = "最近更新用户")
/**
* 最近更新用户
*/
// @Excel(name = "最近更新用户")
private String lastUpdateUser;
/** 最近更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最近更新时间", width = 30, dateFormat = "yyyy-MM-dd")
/**
* 最近更新时间
*/
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "最近更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastUpdateTime;
public void setGoodsId(String goodsId)
{
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getGoodsId() {
return goodsId;
}
public void setGoodsId(String goodsId) {
this.goodsId = goodsId;
}
public String getGoodsId()
{
return goodsId;
}
public void setGoodsName(String goodsName)
{
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getGoodsName()
{
public String getGoodsName() {
return goodsName;
}
public void setGoodsUnit(String goodsUnit)
{
public void setGoodsUnit(String goodsUnit) {
this.goodsUnit = goodsUnit;
}
public String getGoodsUnit()
{
public String getGoodsUnit() {
return goodsUnit;
}
public void setGoodsType(String goodsType)
{
public void setGoodsType(String goodsType) {
this.goodsType = goodsType;
}
public String getGoodsType()
{
public String getGoodsType() {
return goodsType;
}
public void setNormalVehicleType(String normalVehicleType)
{
public void setNormalVehicleType(String normalVehicleType) {
this.normalVehicleType = normalVehicleType;
}
public String getNormalVehicleType()
{
public String getNormalVehicleType() {
return normalVehicleType;
}
public void setGoodsStatus(Long goodsStatus)
{
public void setGoodsStatus(Long goodsStatus) {
this.goodsStatus = goodsStatus;
}
public Long getGoodsStatus()
{
public Long getGoodsStatus() {
return goodsStatus;
}
public void setLastUpdateUser(String lastUpdateUser)
{
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
public String getLastUpdateUser()
{
public String getLastUpdateUser() {
return lastUpdateUser;
}
public void setLastUpdateTime(Date lastUpdateTime)
{
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public Date getLastUpdateTime()
{
public Date getLastUpdateTime() {
return lastUpdateTime;
}
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("goodsId", getGoodsId())
.append("goodsName", getGoodsName())
.append("goodsUnit", getGoodsUnit())

View File

@ -28,7 +28,9 @@ public class AppPmsOrderOut extends BaseEntity
/** 出库单号 */
private String listId;
/** wms订单号 */
@Excel(name = "wms订单号")
private String orderId;
/** 出库单类型 */
@Excel(name = "出库单类型")
private Long orderType;
@ -59,6 +61,70 @@ public class AppPmsOrderOut extends BaseEntity
@Excel(name = "订单状态")
private Integer orderStatus;
/** 总出库数量 */
@Excel(name = "总出库数量")
private BigDecimal pickNum;
/** 确认出库数量 */
@Excel(name = "确认出库数量")
private BigDecimal trNum;
/** 本次出库数量 */
@Excel(name = "本次出库数量")
private BigDecimal shelvesNum;
/** 库存数量 */
@Excel(name = "库存数量")
private BigDecimal stockNum;
/** 是否锁定 */
@Excel(name = "是否锁定")
private String isLock;
public String getIsLock() {
return isLock;
}
public void setIsLock(String isLock) {
this.isLock = isLock;
}
public BigDecimal getPickNum() {
return pickNum;
}
public void setPickNum(BigDecimal pickNum) {
this.pickNum = pickNum;
}
public BigDecimal getTrNum() {
return trNum;
}
public void setTrNum(BigDecimal trNum) {
this.trNum = trNum;
}
public BigDecimal getShelvesNum() {
return shelvesNum;
}
public void setShelvesNum(BigDecimal shelvesNum) {
this.shelvesNum = shelvesNum;
}
public BigDecimal getStockNum() {
return stockNum;
}
public void setStockNum(BigDecimal stockNum) {
this.stockNum = stockNum;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public void setListId(String listId)
{

View File

@ -54,7 +54,7 @@ public class AppStock extends BaseEntity
private BigDecimal remainNum;
/** 入库数量 */
@Excel(name = "库数量")
@Excel(name = "数量")
private BigDecimal originNum;
/** 批次号 */
@ -67,13 +67,13 @@ public class AppStock extends BaseEntity
/** 物料状态 */
@Excel(name = "物料状态")
private Long goodsStatus;
private Integer goodsStatus;
/** 库存状态 */
@Excel(name = "库存状态")
// 0: 未出库
// 1: 出库中
private Long stockStatus;
// 0: 正常
// 1: 冻结
private Integer stockStatus;
/** 入库用户 */
@Excel(name = "入库用户")
@ -87,6 +87,104 @@ public class AppStock extends BaseEntity
/** 最近更新用户 */
@Excel(name = "最近更新用户")
private String lastUpdateUser;
/** 上架时间 */
@Excel(name = "上架时间")
private String wareDate;
@Excel(name = "库龄")
private Integer goodsAge;
/** 入库类型(采购入库、退货入库、调货入库、盲收、其它) */
@Excel(name = "入库类型", readConverterExp = "采=购入库、退货入库、调货入库、盲收、其它")
private String storageMode;
//仓库编号
@Excel(name = "仓库编号")
private String storageId;
@Excel(name = "库区编号")
private String areaId;
//物料类别
@Excel(name = "物料类别")
private String goodsTypeId;
@Excel(name = "已占用数量")
private BigDecimal occupyNum;
// @Excel(name = "出库数量")
private BigDecimal packingNum;
@Excel(name = "生产日期")
private String productionDate;
public String getWareDate() {
return wareDate;
}
public void setWareDate(String wareDate) {
this.wareDate = wareDate;
}
public Integer getGoodsAge() {
return goodsAge;
}
public void setGoodsAge(Integer goodsAge) {
this.goodsAge = goodsAge;
}
public String getStorageMode() {
return storageMode;
}
public void setStorageMode(String storageMode) {
this.storageMode = storageMode;
}
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getGoodsTypeId() {
return goodsTypeId;
}
public void setGoodsTypeId(String goodsTypeId) {
this.goodsTypeId = goodsTypeId;
}
public BigDecimal getOccupyNum() {
return occupyNum;
}
public void setOccupyNum(BigDecimal occupyNum) {
this.occupyNum = occupyNum;
}
public BigDecimal getPackingNum() {
return packingNum;
}
public void setPackingNum(BigDecimal packingNum) {
this.packingNum = packingNum;
}
public String getProductionDate() {
return productionDate;
}
public void setProductionDate(String productionDate) {
this.productionDate = productionDate;
}
public void setStockId(String stockId)
{
@ -196,24 +294,23 @@ public class AppStock extends BaseEntity
{
return invAge;
}
public void setGoodsStatus(Long goodsStatus)
{
public Integer getGoodsStatus() {
return goodsStatus;
}
public void setGoodsStatus(Integer goodsStatus) {
this.goodsStatus = goodsStatus;
}
public Long getGoodsStatus()
{
return goodsStatus;
public Integer getStockStatus() {
return stockStatus;
}
public void setStockStatus(Long stockStatus)
{
public void setStockStatus(Integer stockStatus) {
this.stockStatus = stockStatus;
}
public Long getStockStatus()
{
return stockStatus;
}
public void setCreateUser(String createUser)
{
this.createUser = createUser;
@ -266,4 +363,13 @@ public class AppStock extends BaseEntity
.append("remark", getRemark())
.toString();
}
private Integer ckType;
public Integer getCkType() {
return ckType;
}
public void setCkType(Integer ckType) {
this.ckType = ckType;
}
}

View File

@ -83,6 +83,39 @@ public class AppTask extends BaseEntity
/** 前置任务 */
@Excel(name = "前置任务")
private String preTask;
/** PLC任务号 */
@Excel(name = "PLC任务号")
private Long plcId;
@Excel(name = "库位号")
private String locationId;
//1.零捡 2全量
private Integer ckType;
public Long getPlcId() {
return plcId;
}
public void setPlcId(Long plcId) {
this.plcId = plcId;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Integer getCkType() {
return ckType;
}
public void setCkType(Integer ckType) {
this.ckType = ckType;
}
public void setTaskId(String taskId)
{

View File

@ -73,6 +73,17 @@ public class AppTaskBak extends BaseEntity
/** 前置任务 */
@Excel(name = "前置任务")
private String preTask;
/** PLC任务号 */
@Excel(name = "PLC任务号")
private Long plcId;
public Long getPlcId() {
return plcId;
}
public void setPlcId(Long plcId) {
this.plcId = plcId;
}
public void setTaskId(String taskId)
{

View File

@ -0,0 +1,37 @@
package com.ruoyi.app.domain;
import com.ruoyi.common.annotation.Excel;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* plc管理对象 plc
*
* @author tony.wu
* @date 2023-12-07
*/
public class Plc implements Serializable
{
private static final long serialVersionUID = 1L;
/** 记录plc增长到9999999从1在开始 */
@Excel(name = "记录plc增长到9999999从1在开始")
private Long plcid;
public Long getPlcid() {
return plcid;
}
public void setPlcid(Long plcid) {
this.plcid = plcid;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("plcid", getPlcid())
.toString();
}
}

View File

@ -76,4 +76,6 @@ public interface AppLocationMapper
* @return
*/
List<AppLocation> selectAppLocationListByLocationIds(String[] locationIds);
List<AppLocation> selectFreeLoc();
}

View File

@ -59,4 +59,5 @@ public interface AppPmsOrderOutMapper
* @return 结果
*/
public int deleteAppPmsOrderOutByListIds(String[] recordIds);
public int deleteAppPmsOrderOutByOrderId(AppPmsOrderOut appPmsOrderOut);
}

View File

@ -61,4 +61,7 @@ public interface AppStockMapper
public int deleteAppStockByStockIds(String[] stockIds);
public int updateNewLocation(String oldLocation, String newLocation);
List<AppStock> selectStockByGoodsId(AppStock appStock);
int updateSts(AppStock appStock);
}

View File

@ -73,4 +73,8 @@ public interface AppTaskMapper
* @return 结果
*/
public int deleteAppTaskByTaskIds(String[] taskIds);
List<AppTask> selectPlcList();
int updatePlcId(AppTask appTask);
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.app.mapper;
import com.ruoyi.app.domain.Plc;
import java.util.List;
/**
* plc管理Mapper接口
*
* @author tony.wu
* @date 2023-12-07
*/
public interface PlcMapper
{
/**
* 查询plc管理列表
*
* @param plc plc管理
* @return plc管理集合
*/
public List<Plc> selectPlcList();
/**
* 新增plc管理
*
* @param plc plc管理
* @return 结果
*/
public int insertPlc(Plc plc);
/**
* 修改plc管理
*
* @param plc plc管理
* @return 结果
*/
public int updatePlc(Plc plc);
/**
* 删除plc管理
*
* @param plcid plc管理主键
* @return 结果
*/
public int deletePlcByPlcid(Integer plcid);
/**
* 批量删除plc管理
*
* @param plcids 需要删除的数据主键集合
* @return 结果
*/
public int deletePlcByPlcids(Integer[] plcids);
}

View File

@ -87,4 +87,6 @@ public interface IAppLocationService {
* @return
*/
void changeIsEnableStatus(String[] locationIds);
List<AppLocation> selectFreeLoc();
}

View File

@ -59,4 +59,6 @@ public interface IAppPmsOrderOutService
* @return 结果
*/
public int deleteAppPmsOrderOutByListId(String listId);
int updatePickNum(AppPmsOrderOut appPmsOrderOut);
}

View File

@ -62,4 +62,7 @@ public interface IAppStockService
public int updateNewLocation(String oldLocation, String newLocation);
List<AppStock> selectStockByGoodsId(AppStock tMiStock);
int updateSts(AppStock tMiStock3);
}

View File

@ -73,4 +73,8 @@ public interface IAppTaskService
* @return 结果
*/
public int deleteAppTaskByTaskId(String taskId);
List<AppTask> selectPlcList();
int updatePlcId(AppTask appTask1);
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.app.service;
import com.ruoyi.app.domain.Plc;
import java.util.List;
/**
* plc管理Service接口
*
* @author tony.wu
* @date 2023-12-07
*/
public interface IPlcService
{
/**
* 查询plc管理列表
*
* @param plc plc管理
* @return plc管理集合
*/
public List<Plc> selectPlcList();
/**
* 新增plc管理
*
* @param plc plc管理
* @return 结果
*/
public int insertPlc(Plc plc);
/**
* 修改plc管理
*
* @param plc plc管理
* @return 结果
*/
public int updatePlc(Plc plc);
/**
* 批量删除plc管理
*
* @param plcids 需要删除的plc管理主键集合
* @return 结果
*/
public int deletePlcByPlcids(Integer[] plcids);
/**
* 删除plc管理信息
*
* @param plcid plc管理主键
* @return 结果
*/
public int deletePlcByPlcid(Integer plcid);
}

View File

@ -231,13 +231,18 @@ public class AppLocationServiceImpl implements IAppLocationService {
if (CollectionUtil.isNotEmpty(appLocationList)) {
appLocationList.forEach(appLocation -> {
Integer oldIsEnabled = appLocation.getIsEnable();
if (AppConstants.APP_LOCATION_STATUS_ENABLE.equals(oldIsEnabled)) {
appLocation.setIsEnable(AppConstants.APP_LOCATION_STATUS_DISABLE);
}else if (AppConstants.APP_LOCATION_STATUS_DISABLE.equals(oldIsEnabled)) {
appLocation.setIsEnable(AppConstants.APP_LOCATION_STATUS_ENABLE);
if (AppConstants.LOCATION_STATUS_ENABLE.equals(oldIsEnabled)) {
appLocation.setIsEnable(AppConstants.LOCATION_STATUS_DISABLE);
}else if (AppConstants.LOCATION_STATUS_DISABLE.equals(oldIsEnabled)) {
appLocation.setIsEnable(AppConstants.LOCATION_STATUS_ENABLE);
}
appLocationMapper.updateAppLocation(appLocation);
});
}
}
@Override
public List<AppLocation> selectFreeLoc() {
return appLocationMapper.selectFreeLoc();
}
}

View File

@ -91,4 +91,9 @@ public class AppPmsOrderOutServiceImpl implements IAppPmsOrderOutService
{
return appPmsOrderOutMapper.deleteAppPmsOrderOutByListId(listId);
}
@Override
public int updatePickNum(AppPmsOrderOut appPmsOrderOut) {
return appPmsOrderOutMapper.updatePickNum(appPmsOrderOut);
}
}

View File

@ -98,4 +98,13 @@ public class AppStockServiceImpl implements IAppStockService
public int updateNewLocation(String oldLocation, String newLocation) {
return appStockMapper.updateNewLocation(oldLocation,newLocation);
}
@Override
public List<AppStock> selectStockByGoodsId(AppStock appStock) {
return appStockMapper.selectStockByGoodsId(appStock);
}
@Override
public int updateSts(AppStock appStock) {
return appStockMapper.updateSts(appStock);
}
}

View File

@ -103,4 +103,14 @@ public class AppTaskServiceImpl implements IAppTaskService
{
return appTaskMapper.deleteAppTaskByTaskId(taskId);
}
@Override
public List<AppTask> selectPlcList() {
return appTaskMapper.selectPlcList();
}
@Override
public int updatePlcId(AppTask appTask) {
return appTaskMapper.updatePlcId(appTask);
}
}

View File

@ -0,0 +1,84 @@
package com.ruoyi.app.service.impl;
import com.ruoyi.app.domain.Plc;
import com.ruoyi.app.mapper.PlcMapper;
import com.ruoyi.app.service.IPlcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* plc管理Service业务层处理
*
* @author tony.wu
* @date 2023-12-07
*/
@Service
public class PlcServiceImpl implements IPlcService
{
@Autowired
private PlcMapper plcMapper;
/**
* 查询plc管理列表
*
* @param plc plc管理
* @return plc管理
*/
@Override
public List<Plc> selectPlcList()
{
return plcMapper.selectPlcList();
}
/**
* 新增plc管理
*
* @param plc plc管理
* @return 结果
*/
@Override
public int insertPlc(Plc plc)
{
return plcMapper.insertPlc(plc);
}
/**
* 修改plc管理
*
* @param plc plc管理
* @return 结果
*/
@Override
public int updatePlc(Plc plc)
{
return plcMapper.updatePlc(plc);
}
/**
* 批量删除plc管理
*
* @param plcids 需要删除的plc管理主键
* @return 结果
*/
@Override
public int deletePlcByPlcids(Integer[] plcids)
{
return plcMapper.deletePlcByPlcids(plcids);
}
/**
* 删除plc管理信息
*
* @param plcid plc管理主键
* @return 结果
*/
@Override
public int deletePlcByPlcid(Integer plcid)
{
return plcMapper.deletePlcByPlcid(plcid);
}
}

View File

@ -5,6 +5,7 @@
<mapper namespace="com.ruoyi.app.mapper.AppGoodsMapper">
<resultMap type="AppGoods" id="AppGoodsResult">
<result property="id" column="id" />
<result property="goodsId" column="goods_id" />
<result property="goodsName" column="goods_name" />
<result property="goodsUnit" column="goods_unit" />
@ -17,12 +18,13 @@
</resultMap>
<sql id="selectAppGoodsVo">
select goods_id, goods_name, goods_unit, goods_type, normal_vehicle_type, goods_status, remark, last_update_user, last_update_time from app_goods
select id, goods_id, goods_name, goods_unit, goods_type, normal_vehicle_type, goods_status, remark, last_update_user, last_update_time from app_goods
</sql>
<select id="selectAppGoodsList" parameterType="AppGoods" resultMap="AppGoodsResult">
<include refid="selectAppGoodsVo"/>
<where>
<if test="goodsId != null and goodsId != ''"> and goodsId like concat('%', #{goodsId}, '%')</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
<if test="goodsType != null and goodsType != ''"> and goods_type = #{goodsType}</if>
@ -35,12 +37,13 @@
<select id="selectAppGoodsByGoodsId" parameterType="String" resultMap="AppGoodsResult">
<include refid="selectAppGoodsVo"/>
where goods_id = #{goodsId}
where id = #{id}
</select>
<insert id="insertAppGoods" parameterType="AppGoods">
insert into app_goods
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="goodsId != null">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="goodsUnit != null and goodsUnit != ''">goods_unit,</if>
@ -52,6 +55,7 @@
<if test="lastUpdateTime != null">last_update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="goodsUnit != null and goodsUnit != ''">#{goodsUnit},</if>
@ -67,6 +71,7 @@
<update id="updateAppGoods" parameterType="AppGoods">
update app_goods
<trim prefix="SET" suffixOverrides=",">
<if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="goodsUnit != null and goodsUnit != ''">goods_unit = #{goodsUnit},</if>
<if test="goodsType != null">goods_type = #{goodsType},</if>
@ -76,17 +81,25 @@
<if test="lastUpdateUser != null">last_update_user = #{lastUpdateUser},</if>
<if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
</trim>
where goods_id = #{goodsId}
where id = #{id}
</update>
<delete id="deleteAppGoodsByGoodsId" parameterType="String">
delete from app_goods where goods_id = #{goodsId}
delete from app_goods where id = #{id}
</delete>
<delete id="deleteAppGoodsByGoodsIds" parameterType="String">
delete from app_goods where goods_id in
<foreach item="goodsId" collection="array" open="(" separator="," close=")">
#{goodsId}
delete from app_goods where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectAppGoodsListByGoodsIds" parameterType="String" resultMap="AppGoodsResult">
<include refid="selectAppGoodsVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -67,7 +67,15 @@
<include refid="selectAppLocationVo"/>
where location_id = #{locationId}
</select>
<select id="selectFreeLoc" resultMap="AppLocationResult">
<include refid="selectAppLocationVo"/>
where location_status = 0 and is_working = 0 and is_enable = 0
and location_id NOT IN ( SELECT DISTINCT ( t.location_id ) FROM app_stock t UNION SELECT DISTINCT ( p.location_id ) FROM app_task p where p.location_id is not null)
ORDER BY
w_depth DESC,
w_col asc ,
w_layer ASC
</select>
<select id="countAvailableStock" resultType="java.util.Map">
SELECT
(SELECT COUNT(*) FROM app_location) AS total_count,

View File

@ -11,25 +11,33 @@
<result property="customerId" column="customer_id" />
<result property="goodsId" column="goods_id" />
<result property="goodsNum" column="goods_num" />
<result property="pickNum" column="pick_num" />
<result property="trNum" column="tr_num" />
<result property="shelvesNum" column="shelves_num" />
<result property="stockNum" column="stock_num" />
<result property="goodsDesc" column="goods_desc" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="orderStatus" column="order_status" />
<result property="isLock" column="is_lock" />
<result property="orderId" column="order_id" />
</resultMap>
<sql id="selectAppPmsOrderOutVo">
select record_id, list_id, order_type, customer_id, goods_id, goods_num, goods_desc, spare1, spare2 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 from app_pms_order_out
</sql>
<select id="selectAppPmsOrderOutList" parameterType="AppPmsOrderOut" resultMap="AppPmsOrderOutResult">
<include refid="selectAppPmsOrderOutVo"/>
<where>
<if test="listId != null "> and list_id = #{listId}</if>
<if test="orderType != null "> and order_type = #{orderType}</if>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="goodsNum != null "> and goods_num = #{goodsNum}</if>
<if test="goodsDesc != null and goodsDesc != ''"> and goods_desc = #{goodsDesc}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
<if test="isLock != null and isLock != ''"> and is_lock = #{isLock}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
</where>
</select>
@ -50,7 +58,13 @@
<if test="goodsDesc != null and goodsDesc != ''">goods_desc,</if>
<if test="spare1 != null and spare1 != ''">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="pickNum != null">pick_num,</if>
<if test="trNum != null">tr_num,</if>
<if test="shelvesNum != null">shelves_num,</if>
<if test="stockNum != null">stock_num,</if>
<if test="orderStatus != null">order_status,</if>
<if test="isLock != null">is_lock,</if>
<if test="orderId != null">order_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
@ -62,7 +76,13 @@
<if test="goodsDesc != null and goodsDesc != ''">#{goodsDesc},</if>
<if test="spare1 != null and spare1 != ''">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="pickNum != null">#{pickNum},</if>
<if test="trNum != null">#{trNum},</if>
<if test="shelvesNum != null">#{shelvesNum},</if>
<if test="stockNum != null">#{stockNum},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="isLock != null">#{isLock},</if>
<if test="orderId != null">#{orderId},</if>
</trim>
</insert>
@ -77,6 +97,20 @@
<if test="goodsDesc != null and goodsDesc != ''">goods_desc = #{goodsDesc},</if>
<if test="spare1 != null and spare1 != ''">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="pickNum != null">pick_num = #{pickNum},</if>
<if test="trNum != null">tr_num = #{trNum},</if>
<if test="shelvesNum != null">shelves_num = #{shelvesNum},</if>
<if test="stockNum != null">stock_num = #{stockNum},</if>
<if test="isLock != null">is_lock = #{isLock},</if>
</trim>
where record_id = #{recordId}
</update>
<update id="updatePickNum" parameterType="AppPmsOrderOut">
update app_pms_order_out
<trim prefix="SET" suffixOverrides=",">
<if test="pickNum != null">pick_num = #{pickNum},</if>
<if test="isLock != null">is_lock = #{isLock},</if>
</trim>
where record_id = #{recordId}
</update>
@ -84,7 +118,10 @@
<delete id="deleteAppPmsOrderOutByListId" parameterType="String">
delete from app_pms_order_out where record_id = #{recordId}
</delete>
<delete id="deleteAppPmsOrderOutByOrderId" parameterType="AppPmsOrderOut">
delete from app_pms_order_out where order_id = #{orderId}
</delete>
<delete id="deleteAppPmsOrderOutByListIds" parameterType="String">
delete from app_pms_order_out where record_id in
<foreach item="record_id" collection="array" open="(" separator="," close=")">

View File

@ -24,10 +24,19 @@
<result property="lastUpdateTime" column="last_update_time" />
<result property="lastUpdateUser" column="last_update_user" />
<result property="remark" column="remark" />
<result property="wareDate" column="ware_date" />
<result property="storageMode" column="storage_mode" />
<result property="storageId" column="storage_id" />
<result property="areaId" column="area_id" />
<result property="goodsTypeId" column="goods_type_id" />
<result property="occupyNum" column="occupy_num" />
<result property="packingNum" column="packing_num" />
<result property="productionDate" column="production_date" />
</resultMap>
<sql id="selectAppStockVo">
select stock_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 from app_stock
select stock_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
</sql>
<select id="selectAppStockList" parameterType="AppStock" resultMap="AppStockResult">
@ -37,26 +46,26 @@
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
<if test="providerId != null and providerId != ''"> and provider_id = #{providerId}</if>
<if test="providerName != null and providerName != ''"> and provider_name like concat('%', #{providerName}, '%')</if>
<if test="remainNum != null "> and remain_num = #{remainNum}</if>
<if test="originNum != null "> and origin_num = #{originNum}</if>
<if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
<if test="invAge != null "> and inv_age = #{invAge}</if>
<if test="goodsStatus != null "> and goods_status = #{goodsStatus}</if>
<if test="stockStatus != null "> and stock_status = #{stockStatus}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
<if test="lastUpdateTime != null "> and last_update_time = #{lastUpdateTime}</if>
<if test="lastUpdateUser != null and lastUpdateUser != ''"> and last_update_user = #{lastUpdateUser}</if>
<if test="storage_id != null"> and storage_id = #{storage_id}</if>
</where>
</select>
<select id="selectStockByGoodsId" parameterType="AppStock" resultMap="AppStockResult">
<include refid="selectAppStockVo"/>
where goods_id = #{goodsId} and stock_status = '0'
order by ware_date asc
</select>
<select id="selectAppStockByStockId" parameterType="String" resultMap="AppStockResult">
<include refid="selectAppStockVo"/>
where stock_id = #{stockId}
</select>
<update id="updateSts" parameterType="AppStock">
update app_stock set stock_status = #{stockStatus} where UPPER(vehicle_id) = UPPER(#{vehicleId})
</update>
<insert id="insertAppStock" parameterType="AppStock">
insert into app_stock
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -79,6 +88,14 @@
<if test="lastUpdateTime != null">last_update_time,</if>
<if test="lastUpdateUser != null">last_update_user,</if>
<if test="remark != null">remark,</if>
<if test="wareDate != null">ware_date,</if>
<if test="storageMode != null">storage_mode,</if>
<if test="storageId != null">storage_id,</if>
<if test="areaId != null">area_id,</if>
<if test="goodsTypeId != null">goods_type_id,</if>
<if test="occupyNum != null">occupy_num,</if>
<if test="packingNum != null">packing_num,</if>
<if test="productionDate != null">production_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockId != null">#{stockId},</if>
@ -100,6 +117,14 @@
<if test="lastUpdateTime != null">#{lastUpdateTime},</if>
<if test="lastUpdateUser != null">#{lastUpdateUser},</if>
<if test="remark != null">#{remark},</if>
<if test="wareDate != null">#{wareDate},</if>
<if test="storageMode != null">#{storageMode},</if>
<if test="storageId != null">#{storageId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="goodsTypeId != null">#{goodsTypeId},</if>
<if test="occupyNum != null">#{occupyNum},</if>
<if test="packingNum != null">#{packingNum},</if>
<if test="productionDate != null">#{productionDate},</if>
</trim>
</insert>
@ -124,6 +149,14 @@
<if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
<if test="lastUpdateUser != null">last_update_user = #{lastUpdateUser},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="wareDate != null">ware_date = #{wareDate},</if>
<if test="storageMode != null">storage_mode = #{storageMode},</if>
<if test="storageId != null">storage_id = #{storageId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="goodsTypeId != null">goods_type_id = #{goodsTypeId},</if>
<if test="occupyNum != null">occupy_num = #{occupyNum},</if>
<if test="packingNum != null">packing_num = #{packingNum},</if>
<if test="productionDate != null">production_date = #{productionDate},</if>
</trim>
where stock_id = #{stockId}
</update>

View File

@ -21,10 +21,12 @@
<result property="opUser" column="op_user" />
<result property="preTask" column="pre_task" />
<result property="remark" column="remark" />
<result property="locationId" column="location_id" />
<result property="ckType" column="ck_type" />
</resultMap>
<sql id="selectAppTaskBakVo">
select task_id, task_type, task_status, task_priority, vehicle_id, origin, destination, wcs_task_id, create_time, finish_time, goods_id, op_num, stock_num, op_user, pre_task, remark from app_task_bak
select task_id, task_type, task_status, task_priority, vehicle_id, origin, destination, wcs_task_id, create_time, finish_time, goods_id, op_num, stock_num, op_user, pre_task, remark,location_id,ck_type from app_task_bak
</sql>
<select id="selectAppTaskBakList" parameterType="AppTaskBak" resultMap="AppTaskBakResult">
@ -44,6 +46,7 @@
<if test="opUser != null and opUser != ''"> and op_user = #{opUser}</if>
<if test="preTask != null and preTask != ''"> and pre_task = #{preTask}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
</where>
</select>
@ -71,6 +74,8 @@
<if test="opUser != null">op_user,</if>
<if test="preTask != null">pre_task,</if>
<if test="remark != null">remark,</if>
<if test="locationId != null">location_id,</if>
<if test="ckType != null">ck_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
@ -89,6 +94,8 @@
<if test="opUser != null">#{opUser},</if>
<if test="preTask != null">#{preTask},</if>
<if test="remark != null">#{remark},</if>
<if test="locationId != null">#{locationId},</if>
<if test="ckType != null">#{ckType},</if>
</trim>
</insert>
@ -110,6 +117,8 @@
<if test="opUser != null">op_user = #{opUser},</if>
<if test="preTask != null">pre_task = #{preTask},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
</trim>
where task_id = #{taskId}
</update>

View File

@ -22,10 +22,13 @@
<result property="opUser" column="op_user" />
<result property="preTask" column="pre_task" />
<result property="remark" column="remark" />
<result property="plcId" column="plc_id" />
<result property="locationId" column="location_id" />
<result property="ckType" column="ck_type" />
</resultMap>
<sql id="selectAppTaskVo">
select task_id, task_type, task_status, task_priority, vehicle_id, origin, destination, wcs_task_id, create_time, finish_time, goods_id, op_num, stock_num, op_user, pre_task, remark from app_task
select task_id, task_type, task_status, task_priority, vehicle_id, origin, destination, wcs_task_id, create_time, finish_time, goods_id, op_num, stock_num, op_user, pre_task, remark,plc_id,location_id,ck_type from app_task
</sql>
<select id="selectAppTaskList" parameterType="AppTask" resultMap="AppTaskResult">
@ -35,16 +38,18 @@
<if test="taskStatus != null "> and task_status = #{taskStatus}</if>
<if test="taskPriority != null "> and task_priority = #{taskPriority}</if>
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
<if test="origin != null and origin != ''"> and origin = #{origin}</if>
<if test="destination != null and destination != ''"> and destination = #{destination}</if>
<if test="wcsTaskId != null and wcsTaskId != ''"> and wcs_task_id = #{wcsTaskId}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="opNum != null "> and op_num = #{opNum}</if>
<if test="stockNum != null "> and stock_num = #{stockNum}</if>
<if test="opUser != null and opUser != ''"> and op_user = #{opUser}</if>
<if test="preTask != null and preTask != ''"> and pre_task = #{preTask}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
<if test="plcId != null and plcId != ''"> and plc_id = #{plcId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="ckType != null and ckType != ''"> and ck_type = #{ckType}</if>
</where>
</select>
@ -72,6 +77,8 @@
<if test="opUser != null">op_user,</if>
<if test="preTask != null">pre_task,</if>
<if test="remark != null">remark,</if>
<if test="locationId != null">location_id,</if>
<if test="ckType != null">ck_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
@ -90,6 +97,8 @@
<if test="opUser != null">#{opUser},</if>
<if test="preTask != null">#{preTask},</if>
<if test="remark != null">#{remark},</if>
<if test="locationId != null">#{locationId},</if>
<if test="ckType != null">#{ckType},</if>
</trim>
</insert>
@ -114,6 +123,8 @@
<if test="appTask.opUser != null">op_user,</if>
<if test="appTask.preTask != null">pre_task,</if>
<if test="appTask.remark != null">remark,</if>
<if test="appTask.locationId != null">location_id,</if>
<if test="appTask.ckType != null">ck_type,</if>
</trim>
)
values
@ -135,6 +146,7 @@
<if test="appTask.opUser != null">#{appTask.opUser},</if>
<if test="appTask.preTask != null">#{appTask.preTask},</if>
<if test="appTask.remark != null">#{appTask.remark},</if>
<if test="appTask.ckType != null">#{appTask.ckType},</if>
</trim>
)
</foreach>
@ -159,6 +171,8 @@
<if test="opUser != null">op_user = #{opUser},</if>
<if test="preTask != null">pre_task = #{preTask},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
</trim>
where task_id = #{taskId}
</update>
@ -182,16 +196,34 @@
<if test="appTask.opUser != null">op_user = #{appTask.opUser},</if>
<if test="appTask.preTask != null">pre_task = #{appTask.preTask},</if>
<if test="appTask.remark != null">remark = #{appTask.remark},</if>
<if test="appTask.locationId != null">location_id = #{appTask.locationId},</if>
<if test="appTask.ckType != null">ck_type = #{appTask.ckType},</if>
</trim>
where task_id = #{appTask.taskId}
</foreach>
</update>
<update id="updatePlcId" parameterType="AppTask">
update app_task
<trim prefix="SET" suffixOverrides=",">
<if test="plcId != null">plc_id = #{plcId}</if>
</trim>
where task_status = #{taskStatus} AND vehicle_id = #{vehicleId}
</update>
<delete id="deleteAppTaskByTaskId" parameterType="String">
delete from app_task where task_id = #{taskId}
</delete>
<select id="selectPlcList" resultMap="AppTask">
<include refid="selectAppTaskVo"/>
where task_status = 0 AND plc_id is null
</select>
<update id="updatePlcId" parameterType="AppTask">
update app_task
<trim prefix="SET" suffixOverrides=",">
<if test="plcId != null">plc_id = #{plcId},</if>
</trim>
where task_status = #{taskStatus} AND vehicle_id = #{vehicleId}
</update>
<delete id="deleteAppTaskByTaskIds" parameterType="String">
delete from app_task where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.mapper.PlcMapper">
<resultMap type="Plc" id="PlcResult">
<result property="plcid" column="plcid" />
</resultMap>
<sql id="selectPlcVo">
select plcid from plc
</sql>
<select id="selectPlcList" resultMap="PlcResult">
<include refid="selectPlcVo"/>
</select>
<insert id="insertPlc" parameterType="Plc">
insert into plc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="plcid != null">plcid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="plcid != null">#{plcid},</if>
</trim>
</insert>
<update id="updatePlc" parameterType="Plc">
update plc
set plcid = #{plcid}
</update>
<delete id="deletePlcByPlcid" parameterType="Integer">
delete from plc where plcid = #{plcid}
</delete>
<delete id="deletePlcByPlcids" parameterType="String">
delete from plc where plcid in
<foreach item="plcid" collection="array" open="(" separator="," close=")">
#{plcid}
</foreach>
</delete>
</mapper>