forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1. 修复请求日志功能中的bug
2. 增加紧急出库缺料输入料号工单后自动补全需求数量的功能 3. 增加缺料自动关闭的功能。
This commit is contained in:
parent
b0e85f49c0
commit
1cef5ede55
|
|
@ -63,3 +63,14 @@ export const confirmInventory = (params) => {
|
|||
data: params
|
||||
})
|
||||
}
|
||||
// 获取缺料数量
|
||||
export const getGoodsLackQty = (params) => {
|
||||
return request({
|
||||
url: '/task/getGoodsLackQty',
|
||||
method: 'get',
|
||||
params: {
|
||||
goodsId: params.goodsId,
|
||||
workOrder: params.workOrder
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
:options="outTypeOptions"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="料号" prop="goodsId">
|
||||
<el-input v-model="outTaskEntity.goodsId" clearable/>
|
||||
<el-input v-model="outTaskEntity.goodsId" @blur="getLackQty()" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId" v-if="outTaskEntity.outType !== 9">
|
||||
<el-input v-model="outTaskEntity.vehicleId" clearable/>
|
||||
|
|
@ -25,9 +25,9 @@
|
|||
<el-select-v2 style="width: 196px" v-model="outTaskEntity.reason" placeholder="请选择紧急出库原因"
|
||||
:options="reasonOptions"></el-select-v2>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="工单" prop="workOrder" v-if="outTaskEntity.reason === '缺料'">-->
|
||||
<!-- <el-input v-model="outTaskEntity.workOrder" clearable/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="工单" prop="workOrder" v-if="outTaskEntity.reason === '缺料'">
|
||||
<el-input v-model="outTaskEntity.workOrder" @blur="getLackQty()" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="primary"
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import {requireStockOut, getCurrentTask, confirmCurrentTask} from '@/api/task.js'
|
||||
import {requireStockOut, getCurrentTask, confirmCurrentTask, getGoodsLackQty} from '@/api/task.js'
|
||||
import {errorBox, warningBox} from '@/utils/myMessageBox.js'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {nextTick, onBeforeUnmount, onMounted, reactive, ref, watch} from 'vue'
|
||||
|
|
@ -116,6 +116,7 @@ let outTaskEntity = reactive({
|
|||
goodsId: '',
|
||||
vehicleId: '',
|
||||
reason: '',
|
||||
workOrder: '',
|
||||
needNum: null
|
||||
})
|
||||
const requestRules = reactive({
|
||||
|
|
@ -269,6 +270,10 @@ const confirmOut = () => {
|
|||
errorBox('紧急出库请选择原因。')
|
||||
return
|
||||
}
|
||||
if (outTaskEntity.reason === '缺料' && outTaskEntity.workOrder === '') {
|
||||
errorBox('缺料时必须输入工单号。')
|
||||
return
|
||||
}
|
||||
}
|
||||
const request = {
|
||||
outType: outTaskEntity.outType,
|
||||
|
|
@ -276,6 +281,7 @@ const confirmOut = () => {
|
|||
vehicleId: outTaskEntity.vehicleId.toUpperCase().trim(),
|
||||
needNum: outTaskEntity.needNum,
|
||||
reason: outTaskEntity.reason,
|
||||
workOrder: outTaskEntity.workOrder.trim(),
|
||||
destination: STAND_ID,
|
||||
userName: USER_NAME,
|
||||
standId: STAND_ID
|
||||
|
|
@ -365,6 +371,32 @@ const clearConfirmEntity = () => {
|
|||
confirmEntity.putArea = ''
|
||||
confirmEntity.warningQty = null
|
||||
}
|
||||
// 获取对应工单对应物料号的缺料数量
|
||||
const getLackQty = () => {
|
||||
if (outTaskEntity.outType !== 9 || outTaskEntity.reason !== '缺料') {
|
||||
// 非紧急出库且非缺料,则不处理
|
||||
return;
|
||||
}
|
||||
if (outTaskEntity.workOrder === '' || outTaskEntity.goodsId === '') {
|
||||
// 缺少工单号或者料号
|
||||
return
|
||||
}
|
||||
// 设置请求参数
|
||||
const request = {
|
||||
workOrder: outTaskEntity.workOrder.trim(),
|
||||
goodsId: outTaskEntity.goodsId.toUpperCase().trim()
|
||||
}
|
||||
loading.open('查询缺料缺料数量中...')
|
||||
getGoodsLackQty(request).then(res => {
|
||||
outTaskEntity.needNum = res.data
|
||||
}).catch(err => {
|
||||
// 异常,清空数量
|
||||
outTaskEntity.needNum = null
|
||||
console.log('获取缺料数量异常:' + err)
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms_main.constant.enums.others;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EmergencyOutReasonEnums {
|
||||
FEEDING("补料"),
|
||||
K_LACK("少K"),
|
||||
GOODS_LACK("缺料"),
|
||||
RETURN_ORDER("返工工单");
|
||||
private final String reason;
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ public class TaskController {
|
|||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/getInventoryConfirm")
|
||||
WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
public WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.getInventoryConfirm(inventoryConfirmRequest);
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +142,18 @@ public class TaskController {
|
|||
* @return 处理结果
|
||||
*/
|
||||
@PostMapping("/confirmInventory")
|
||||
BaseWmsApiResponse confirmInventory(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
public BaseWmsApiResponse confirmInventory(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.confirmInventory(inventoryConfirmRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缺料数量,当存在库存时,返回库存与需求的较小值
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
@GetMapping("/getGoodsLackQty")
|
||||
public int getLackQty(@RequestParam("goodsId") String goodsId, @RequestParam("workOrder") String workOrder) {
|
||||
return taskControllerService.getLackQty(goodsId, workOrder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ public class TSysApiServiceImpl extends ServiceImpl<SysApiMapper, TSysApi> imple
|
|||
if (request != null) {
|
||||
apiLog.setUrl(request.getUrl());
|
||||
apiLog.setTimeout(request.getTimeout());
|
||||
if (request.getMethod() != null) {
|
||||
apiLog.setMethod(request.getMethod().name());
|
||||
}
|
||||
apiLog.setContentType(request.getContentType());
|
||||
apiLog.setData(StringUtils.formatStringWithMaxLength(request.getData(), 2048));
|
||||
apiLog.setToken(StringUtils.formatStringWithMaxLength(request.getToken(), 2048));
|
||||
|
|
@ -52,8 +54,10 @@ public class TSysApiServiceImpl extends ServiceImpl<SysApiMapper, TSysApi> imple
|
|||
apiLog.setResponseTime(response.getResponseTime());
|
||||
apiLog.setRequestUrl(response.getRequestUrl());
|
||||
apiLog.setUseTime(response.getUseTime());
|
||||
if (response.getException() != null) {
|
||||
apiLog.setExceptionMessage(StringUtils.formatStringWithMaxLength(response.getException().getMessage(), 2048));
|
||||
}
|
||||
}
|
||||
// 保存api日志
|
||||
save(apiLog);
|
||||
// 记录文本日志
|
||||
|
|
|
|||
|
|
@ -44,4 +44,9 @@ public class StockOutRequest extends BaseWmsRequest {
|
|||
*/
|
||||
@JsonProperty("reason")
|
||||
private String reason;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@JsonProperty("workOrder")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,9 @@ public class TAppOuts {
|
|||
*/
|
||||
@TableField(value = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@TableField(value = "work_order")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,9 @@ public class TAppOutsRecord {
|
|||
*/
|
||||
@TableField(value = "request_time")
|
||||
private LocalDateTime requestTime;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
@TableField(value = "work_order")
|
||||
private String workOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package com.wms_main.repository.http;
|
||||
|
||||
import com.wms_main.dao.ITSysApiService;
|
||||
import com.wms_main.model.po.TSysLog;
|
||||
import com.wms_main.repository.http.entity.HttpRequest;
|
||||
import com.wms_main.repository.http.entity.HttpResponse;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.repository.utils.UUIDUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
|
|
|
|||
|
|
@ -99,4 +99,13 @@ public interface ITaskControllerService {
|
|||
* @return 处理结果
|
||||
*/
|
||||
BaseWmsApiResponse confirmInventory(InventoryConfirmRequest inventoryConfirmRequest);
|
||||
|
||||
/**
|
||||
* 获取对应工单的缺料数量
|
||||
* 最小值为0,最大值为库存数量
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
int getLackQty(String goodsId, String workOrder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.wms_main.app.AppCommon;
|
||||
import com.wms_main.constant.AppConstant;
|
||||
import com.wms_main.constant.enums.others.EmergencyOutReasonEnums;
|
||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskStatusEnums;
|
||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
|
||||
import com.wms_main.constant.enums.wms.*;
|
||||
|
|
@ -64,6 +65,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
private final ITAppPickPlanService appPickPlanService;// 拣选计划服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点任务服务
|
||||
private final ITAppInventoryRecordService appInventoryRecordService;// 盘点记录服务
|
||||
private final ITAppWorkService appWorkService;// 工作详情服务
|
||||
private final AppCommon appCommon;
|
||||
|
||||
/**
|
||||
|
|
@ -286,6 +288,10 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
if (stockOutRequest.getNeedNum() == null || stockOutRequest.getNeedNum() <= 0) {
|
||||
return BaseWmsApiResponse.error("请求错误:紧急出库必须输入有效数量。");
|
||||
}
|
||||
// 判断原因是缺料的时候,需判断工单号是否输入
|
||||
if (stockOutRequest.getReason().contains("缺料") && StringUtils.isEmpty(stockOutRequest.getWorkOrder())) {
|
||||
return BaseWmsApiResponse.error("请求错误:缺料时必须输入工单号。");
|
||||
}
|
||||
// 判断请求的料号是不是库外料
|
||||
TAppGoods thisGoods = appCommon.getInstantGoodsByGoodsId(stockOutRequest.getGoodsId());
|
||||
if (thisGoods == null || !thisGoods.getPutArea().contains("ASRS")) {
|
||||
|
|
@ -325,7 +331,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
stockOutRequest.getDestination(),
|
||||
stockOutRequest.getUserName(),
|
||||
stockOutRequest.getReason(),
|
||||
LocalDateTime.now()
|
||||
LocalDateTime.now(),
|
||||
stockOutRequest.getWorkOrder()
|
||||
);
|
||||
appOutsService.save(task);
|
||||
return BaseWmsApiResponse.success("添加出库请求成功。");
|
||||
|
|
@ -333,6 +340,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 入库用出库---实现
|
||||
*
|
||||
* @param voiRequest 请求信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
|
|
@ -391,7 +399,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
"R1",
|
||||
voiRequest.getUserName(),
|
||||
"",
|
||||
LocalDateTime.now()
|
||||
LocalDateTime.now(),
|
||||
""
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -761,6 +770,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 请求盘点---实现
|
||||
*
|
||||
* @param inventoryRequest 盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
|
|
@ -829,6 +839,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
|
||||
/**
|
||||
* 查询盘点确认信息
|
||||
*
|
||||
* @param inventoryConfirmRequest 请求
|
||||
* @return 查询结果
|
||||
*/
|
||||
|
|
@ -858,11 +869,12 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
// 返回结果
|
||||
return WmsApiResponse.success("查询盘点确认信息成功。", inventoryConfirmVo);
|
||||
}
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(),"当前箱子没有要盘点的任务,请放行。", null);
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(), "当前箱子没有要盘点的任务,请放行。", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认盘点信息
|
||||
*
|
||||
* @param inventoryConfirmRequest 确认请求
|
||||
* @return 处理结果
|
||||
*/
|
||||
|
|
@ -980,8 +992,50 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应工单对应物料的缺料数量---实现
|
||||
* @param goodsId 料号
|
||||
* @param workOrder 工单号
|
||||
* @return 缺料数量
|
||||
*/
|
||||
@Override
|
||||
public int getLackQty(String goodsId, String workOrder) {
|
||||
// 判断是否缺少料号和工单
|
||||
if (StringUtils.isEmpty(goodsId) || StringUtils.isEmpty(workOrder)) {
|
||||
return 0;
|
||||
}
|
||||
// 查询这个工单里面关于这个工单的缺料
|
||||
List<TAppWork> lackWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, workOrder)
|
||||
.eq(TAppWork::getGoodsId, goodsId)
|
||||
.eq(TAppWork::getLackStatus, 1)
|
||||
.eq(TAppWork::getWorkStatus, 2));
|
||||
if (lackWorks == null || lackWorks.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
// 计算数量的总数
|
||||
int sumLack = lackWorks.stream().mapToInt(work -> {
|
||||
if (work.getFinishNum() < work.getNeedNum()) {
|
||||
// 只有确实缺少数量时,才可以计算缺料数量
|
||||
return work.getNeedNum() - work.getFinishNum();
|
||||
}
|
||||
return 0;
|
||||
}).sum();
|
||||
// 查询这个物料的库存
|
||||
List<TAppStock> thisGoodsStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getGoodsId, goodsId));
|
||||
if (thisGoodsStocks != null && !thisGoodsStocks.isEmpty()) {
|
||||
// 如果库存存在,则取库存数量与需求数量的最小值
|
||||
int goodsStockNum = thisGoodsStocks.stream().mapToInt(TAppStock::getRemainNum).sum();
|
||||
return Math.min(goodsStockNum, sumLack);
|
||||
}
|
||||
// 没有库存的情况下,直接返回需求数量
|
||||
return sumLack;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新出库单信息
|
||||
*
|
||||
* @param confirmTaskRequest 确认信息
|
||||
*/
|
||||
private String updateTaskInfo(ConfirmTaskRequest confirmTaskRequest) {
|
||||
|
|
@ -1013,7 +1067,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
outs.getDestination(),
|
||||
outs.getUserName(),
|
||||
outs.getReason(),
|
||||
outs.getRequestTime()
|
||||
outs.getRequestTime(),
|
||||
outs.getWorkOrder()
|
||||
);
|
||||
// 删除出库单
|
||||
appOutsService.removeById(outs.getTaskId());
|
||||
|
|
@ -1023,6 +1078,38 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
// 更新出库单
|
||||
appOutsService.updateById(outs);
|
||||
}
|
||||
// 判断是否是紧急出库且是缺料
|
||||
if (Objects.equals(outs.getOutType(), WmsOutTypeEnums.EMERGE.getCode())
|
||||
&& outs.getReason().contains(EmergencyOutReasonEnums.GOODS_LACK.getReason()) && StringUtils.isNotEmpty(outs.getWorkOrder())) {
|
||||
// 查询此工单下缺料的工作
|
||||
List<TAppWork> lackGoodsWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
||||
.eq(TAppWork::getWorkOrder, outs.getWorkOrder())
|
||||
.eq(TAppWork::getWorkStatus, 2)
|
||||
.eq(TAppWork::getLackStatus, 1));
|
||||
int canDistributeNum = taskConfirm.getRealPickQty();
|
||||
List<TAppWork> needUpdateWorks = new ArrayList<>();
|
||||
for (TAppWork lackGoodsWork : lackGoodsWorks) {
|
||||
if (canDistributeNum == 0) {
|
||||
// 本次拣选数量不够分了
|
||||
break;
|
||||
}
|
||||
if (lackGoodsWork.getFinishNum() >= lackGoodsWork.getNeedNum()) {
|
||||
continue;
|
||||
}
|
||||
int remainNeedNum = lackGoodsWork.getNeedNum() - lackGoodsWork.getFinishNum();
|
||||
// 这里需要重新设置完成数量。
|
||||
if (remainNeedNum >= canDistributeNum) {
|
||||
canDistributeNum = 0;
|
||||
lackGoodsWork.setFinishNum(lackGoodsWork.getFinishNum() + canDistributeNum);
|
||||
} else {
|
||||
canDistributeNum -= remainNeedNum;
|
||||
lackGoodsWork.setFinishNum(lackGoodsWork.getNeedNum());
|
||||
lackGoodsWork.setLackStatus(0);
|
||||
}
|
||||
needUpdateWorks.add(lackGoodsWork);
|
||||
}
|
||||
appWorkService.updateBatchById(needUpdateWorks);
|
||||
}
|
||||
// 清除拣选计划
|
||||
LambdaQueryWrapper<TAppPickPlan> pickPlanQueryWrapper = new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.eq(TAppPickPlan::getWorkIndex, confirmTaskRequest.getTaskConfirm().getTaskId());
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@ public class TaskOperationControllerServiceImpl implements ITaskOperationControl
|
|||
targetOuts.getDestination(),
|
||||
targetOuts.getUserName(),
|
||||
targetOuts.getReason(),
|
||||
targetOuts.getRequestTime()
|
||||
targetOuts.getRequestTime(),
|
||||
targetOuts.getWorkOrder()
|
||||
));
|
||||
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
||||
.eq(TAppPickPlan::getWorkIndex, targetOuts.getTaskId()));
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,8 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
thisOuts.getDestination(),
|
||||
thisOuts.getUserName(),
|
||||
thisOuts.getReason(),
|
||||
thisOuts.getRequestTime()
|
||||
thisOuts.getRequestTime(),
|
||||
thisOuts.getWorkOrder()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user