1. 添加单机出库接口

2. 实现出库口查询功能
This commit is contained in:
李宇奇 2025-05-19 10:55:03 +08:00
parent 8ca9d65970
commit b90f03e1a6
7 changed files with 124 additions and 44 deletions

View File

@ -1,11 +1,9 @@
package com.wms_main.controller.ycwms;
import com.wms_main.model.dto.request.ycwms.OrderInReq;
import com.wms_main.model.dto.request.ycwms.OrderOutReq;
import com.wms_main.model.dto.request.ycwms.StockReq;
import com.wms_main.model.dto.request.ycwms.StockResp;
import com.wms_main.model.dto.request.ycwms.*;
import com.wms_main.model.dto.response.ycwms.YcwmsResponse;
import com.wms_main.repository.utils.StringUtils;
import com.wms_main.service.controller.IYcwmsControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@ -49,4 +47,19 @@ public class YcwmsController {
public YcwmsResponse<Object> getAvailPercent(@RequestParam(value = "equipmentId") String equipmentId) {
return ycwmsControllerService.getAvailPercent(equipmentId);
}
@PostMapping("/localOut")
public YcwmsResponse<Object> localOut(@RequestBody LocalOrderReq request) {
return ycwmsControllerService.localOrderOut(request);
}
@PostMapping("/getOutLocation")
public YcwmsResponse<Object> getOutLocation(@RequestBody OrderOutReq request) {
String outLoc = ycwmsControllerService.getLocByGoodsId(request.getGoodsId());
if (StringUtils.isEmpty(outLoc)) {
return YcwmsResponse.error("查询为空", null);
} else {
return YcwmsResponse.success(outLoc);
}
}
}

View File

@ -0,0 +1,21 @@
package com.wms_main.model.dto.request.ycwms;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class LocalOrderReq {
@JsonProperty("specification")
private String specification;
@JsonProperty("xsfbillno")
private String xsfbillno;
@JsonProperty("xsfseq")
private Integer xsfseq;
@JsonProperty("neibubianhao")
private String neibubianhao;
}

View File

@ -1,9 +1,6 @@
package com.wms_main.service.controller;
import com.wms_main.model.dto.request.ycwms.OrderInReq;
import com.wms_main.model.dto.request.ycwms.OrderOutReq;
import com.wms_main.model.dto.request.ycwms.StockReq;
import com.wms_main.model.dto.request.ycwms.StockResp;
import com.wms_main.model.dto.request.ycwms.*;
import com.wms_main.model.dto.response.ycwms.YcwmsResponse;
import java.util.List;
@ -14,4 +11,6 @@ public interface IYcwmsControllerService {
YcwmsResponse<Object> orderOut(OrderOutReq request);
YcwmsResponse<List<StockResp>> stock(StockReq request);
YcwmsResponse<Object> getAvailPercent(String equipmentId);
YcwmsResponse<Object> localOrderOut(LocalOrderReq request);
String getLocByGoodsId(String goodsId);
}

View File

@ -75,12 +75,13 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
orderIn.setGoodsName("空托盘");
orderIn.setBatch("0");
orderIn.setGoodsType("0");
orderIn.setSpecification("empty");
orderIn.setQuantity(4.0);
orderIn.setGoodsDesc("");
orderIn.setXsfbillno("");
orderIn.setSpecification("empty");
orderIn.setXsfbillno(goodsId567);
orderIn.setXsfseq(0);
orderIn.setNeibubianhao("");
orderIn.setNeibubianhao("0");
orderIn.setOrderStatus(OrderStatusEnum.RUNNING.getCode());
orderIn.setCreateTime(LocalDateTime.now());
orderIn.setUpdateTime(LocalDateTime.now());
@ -144,12 +145,13 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
orderIn.setGoodsName("空托盘");
orderIn.setBatch("0");
orderIn.setGoodsType("0");
orderIn.setSpecification("empty");
orderIn.setQuantity(1.0);
orderIn.setGoodsDesc("");
orderIn.setXsfbillno("");
orderIn.setSpecification("empty");
orderIn.setXsfbillno(goodsId34);
orderIn.setXsfseq(0);
orderIn.setNeibubianhao("");
orderIn.setNeibubianhao("0");
orderIn.setOrderStatus(OrderStatusEnum.RUNNING.getCode());
orderIn.setCreateTime(LocalDateTime.now());
orderIn.setUpdateTime(LocalDateTime.now());

View File

@ -266,7 +266,52 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
return YcwmsResponse.error("equipmentId无效", null);
}
private String getLocByGoodsId(String goodsId) {
public YcwmsResponse<Object> localOrderOut(LocalOrderReq request) {
log.info("亚驰单机出库单请求参数{}", JSON.toJSON(request));
if(request == null) return YcwmsResponse.error("参数错误", null);
if (StringUtils.isEmpty(request.getNeibubianhao())
|| StringUtils.isEmpty(request.getXsfbillno())
|| StringUtils.isEmpty(String.valueOf(request.getXsfseq()))
|| StringUtils.isEmpty(request.getSpecification())) {
return YcwmsResponse.error("参数错误", null);
}
List<TAppStock> stocks = appStockService.list(
new LambdaQueryWrapper<TAppStock>()
.eq(TAppStock::getNeibubianhao, request.getNeibubianhao())
.eq(TAppStock::getXsfbillno, request.getXsfbillno())
.eq(TAppStock::getXsfseq, request.getXsfseq())
.eq(TAppStock::getSled, request.getSpecification())
);
if (stocks == null || stocks.isEmpty()) {
return YcwmsResponse.error("库存不足, 出库失败", null);
}
TAppOrderOut orderOut = new TAppOrderOut();
orderOut.setRecordId(UUIDUtils.getNewUUID());
orderOut.setOrderId(UUIDUtils.getNewUUID("baokai"));
orderOut.setBatch(stocks.getFirst().getBatch());
orderOut.setSpecification(request.getSpecification());
orderOut.setOrderStatus(OrderStatusEnum.CREATE.getCode());
orderOut.setCreateTime(LocalDateTime.now());
orderOut.setUpdateTime(LocalDateTime.now());
orderOut.setRemark("Local");
String tmpGoodsId = stocks.getFirst().getGoodsId();
if (tmpGoodsId.length() < 3) {
orderOut.setGoodsId(tmpGoodsId);
int tmpGoodsNum = Integer.parseInt(tmpGoodsId);
orderOut.setQuantity((tmpGoodsNum <= 1) ? 1.0 : 4.0);
} else {
orderOut.setGoodsId(stocks.getFirst().getVehicleId());
orderOut.setQuantity(0.0);
tmpGoodsId = stocks.getFirst().getVehicleId();
}
if(!appOrderOutService.save(orderOut)) {
return YcwmsResponse.error("出库单保存失败,请稍后再试", null);
}
return YcwmsResponse.success(getLocByGoodsId(tmpGoodsId));
}
public String getLocByGoodsId(String goodsId) {
if (goodsId.length() < 3) {
return switch (goodsId) {
case "0" -> "LK-3";

View File

@ -6,14 +6,14 @@ import axios from "axios";
*/
const _request = axios.create({
// baseURL: 'http://localhost:12315',
baseURL: 'http://10.18.58.21:12315',
baseURL: 'http://localhost:12315',
// baseURL: 'http://10.18.58.21:12315',
timeout: 5000
})
const submitOrderOutForm = (params) => {
return _request({
url: '/ycwms/orderOut',
url: '/ycwms/localOut',
method: 'post',
data: params
})

View File

@ -7,23 +7,23 @@
<el-form ref="orderOutFormRef" :model="orderOutForm" :rules="rules" label-width="70px" :label-position="labelPosition" status-icon>
<el-row :gutter="5" class="form-row">
<el-col :xs="24" :sm="4" :md="4" :lg="4">
<el-form-item label="物料编号" prop="goodsId">
<el-input v-model="orderOutForm.goodsId" clearable @keyup.enter="handleEnter('batch')" ref="goodsIdRef" class="custom-input" />
<el-form-item label="内部编号" prop="neibubianhao">
<el-input v-model="orderOutForm.neibubianhao" clearable @keyup.enter="handleEnter('xsfbillno')" ref="neibubianhaoRef" class="custom-input" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="4" :md="4" :lg="4">
<el-form-item label="批次" prop="batch">
<el-input v-model="orderOutForm.batch" clearable @keyup.enter="handleEnter('specification')" ref="batchRef" class="custom-input" />
<el-form-item label="销售单号" prop="xsfbillno">
<el-input v-model="orderOutForm.xsfbillno" clearable @keyup.enter="handleEnter('xsfseq')" ref="xsfbillnoRef" class="custom-input" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="4" :md="4" :lg="4">
<el-form-item label="行号" prop="xsfseq">
<el-input-number v-model="orderOutForm.xsfseq" :min="0" controls-position="right" clearable @keyup.enter="handleEnter('specification')" ref="xsfseqRef" class="custom-input" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="4" :md="4" :lg="4">
<el-form-item label="规格" prop="specification">
<el-input v-model="orderOutForm.specification" placeholder="请输入规格" clearable @keyup.enter="handleEnter('quantity')" ref="specificationRef" class="custom-input" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="4" :md="4" :lg="4">
<el-form-item label="数量" prop="quantity">
<el-input-number v-model="orderOutForm.quantity" :min="1" controls-position="right" clearable ref="quantityRef" class="custom-input" />
<el-input v-model="orderOutForm.specification" placeholder="请输入规格" clearable ref="specificationRef" class="custom-input" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="4" :md="4" :lg="4" class="btn-col">
@ -73,26 +73,26 @@ const generateOrderId = () => {
const orderOutFormRef = ref()
const orderOutForm = reactive({
orderId: generateOrderId(),
goodsId: '',
batch: '',
neibubianhao: '',
xsfbillno: '',
xsfseq: null,
specification: '',
quantity: null,
clientId: "WMS"
})
//
const rules = reactive({
goodsId: [{ required: true, message: '请输入物料编号', trigger: 'blur' }],
batch: [{ required: true, message: '请输入批次', trigger: 'blur' }],
specification: [{ required: true, message: '请输入规格', trigger: 'blur' }],
quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }]
neibubianhao: [{ required: true, message: '请输入内部编号', trigger: 'blur' }],
xsfbillno: [{ required: true, message: '请输入销售单号', trigger: 'blur' }],
xsfseq: [{ required: true, message: '请输入行号', trigger: 'blur' }],
specification: [{ required: true, message: '请输入规格', trigger: 'blur' }]
})
// DOM
const goodsIdRef = ref()
const batchRef = ref()
const neibubianhaoRef = ref()
const xsfbillnoRef = ref()
const xsfseqRef = ref()
const specificationRef = ref()
const quantityRef = ref()
//
const responseDialogVisible = ref(false)
@ -101,7 +101,7 @@ const responseResult = ref({})
//
onMounted(() => {
nextTick(() => {
goodsIdRef.value.focus()
neibubianhaoRef.value.focus()
window.addEventListener('resize', resizeHeight)
})
})
@ -118,10 +118,10 @@ const resizeHeight = () => {
//
const handleEnter = (nextField) => {
const refMap = {
'goodsId': goodsIdRef,
'batch': batchRef,
'specification': specificationRef,
'quantity': quantityRef
'neibubianhao': neibubianhaoRef,
'xsfbillno': xsfbillnoRef,
'xsfseq': xsfseqRef,
'specification': specificationRef
}
if (refMap[nextField]) {
@ -135,7 +135,7 @@ const resetForm = () => {
//
orderOutForm.orderId = generateOrderId()
nextTick(() => {
goodsIdRef.value.focus()
neibubianhaoRef.value.focus()
})
}