Browse Source

更改车辆配载逻辑

dev-xx
qb 8 months ago
parent
commit
46f531097a
  1. 227
      src/views/distribution/artery/AddVehicleStowage.vue

227
src/views/distribution/artery/AddVehicleStowage.vue

@ -584,8 +584,8 @@
</el-button>
<!-- 处理未挂载在目的仓的数据 -->
<el-button icon="Refresh" type="primary" @click="handleShowProblemData">
挂载目的仓
<el-button icon="Refresh" class="errBtn" type="primary" @click="handleShowProblemData">
处理待挂载数据
</el-button>
</div>
</div>
@ -601,17 +601,38 @@
<div class="title">
<span class="mr20">目的仓: </span>
<el-select></el-select>
<el-select
clearable
placeholder="请选择目的仓"
filterable
v-model="details.problemInfo.nodeId"
>
<el-option
v-for="val in details.nodeList"
:key="val.nodeId"
:label="val.nodeName"
:value="val.nodeId"
/>
</el-select>
</div>
<!-- <el-form-item label="目的仓:"></el-form-item> -->
<el-tabs v-model="details.problemInfo.activeName">
<el-tab-pane :label="'已装车数据 -- ' + details.problemDataByReal.length" name="real">
</el-tab-pane>
<el-tab-pane :label="'未装车数据 -- ' + details.problemDataByPlan.length" name="plan">
</el-tab-pane>
</el-tabs>
<tablecmt
class="columnList mt20"
ref="newColumnListNode"
class="columnList"
:columnList="details.newColumnList"
:tableData="details.problemData"
:tableData="
details.problemInfo.activeName === 'real'
? details.problemDataByReal
: details.problemDataByPlan
"
@inputTxt="(value, row) => inputsc(value, row)"
@selection="list => selectionChange(list)"
@selection="list => (details.problemInfo.selectionList = list)"
>
<template #default="slotProps">
<!-- <template v-if="slotProps.scope.column.label === '计划数'">
@ -624,14 +645,7 @@
<div class="flex-c-c">
<el-button @click="details.popUpShow.problemDataVisited = false">取消</el-button>
<el-button
type="primary"
:loading="btnLoadingObj.editPlanNumBtn"
icon="Promotion"
@click="handleSubmitEdit"
>
提交
</el-button>
<el-button type="primary" icon="Promotion" @click="handleSubmitProblemData"> 提交 </el-button>
</div>
</el-dialog>
@ -911,10 +925,19 @@ const details = reactive<any>({
/** 拷贝的编辑信息, 提交时根据数据对比设置为新增、删除、编辑 */
nodeCloneInfoData: [],
/** 挂载在配载任务中, 但未挂载目的仓的数据 */
problemData: [],
problemForm: {},
problemDataByReal: [], //
problemDataByPlan: [], // ,
problemInfo: {
/** 挂载的目的仓 */
nodeId: '',
selectionList: [],
query: {},
activeName: 'real',
},
/** 节点 */
nodeList: [],
/** 当前所在仓库 */
warehouseId: '',
});
const btnLoadingObj = reactive({
@ -923,21 +946,7 @@ const btnLoadingObj = reactive({
/** 修改计划数量 */
editPlanNumBtn: false,
});
const {
search,
query,
shortcuts,
stockupDate,
data,
loadingObj,
selectionList,
drawerShow,
page,
trickleLoadingPage,
zeroAdditionalRecordingInfo,
popUpShow,
form,
} = toRefs(details);
const { search, query, shortcuts, loadingObj, page, form } = toRefs(details);
// --
const nodeInfoRef = ref(null);
@ -1106,6 +1115,9 @@ const onLoad = async () => {
const { code, data } = res.data;
if (code !== 200) return;
details.warehouseId = data.warehouseId;
console.log('details.warehouseId :>> ', details.warehouseId);
details.allCarsLineList = data.allWarehouseIds;
const promiseArr = [];
@ -1261,17 +1273,52 @@ remoteMethod('');
/** 目的仓选择时给目的仓名称赋值 */
const destinationWarehouseNameChange = (val, index) => {
const _value = details.options.find(value => value.warehouseId === val);
details.nodeInfoData[index].nodeName = _value.warehouseName;
details.nodeInfoData[index].nodeId = _value.warehouseId;
details.nodeInfoData[index].linkMan = _value.linkMan;
details.nodeInfoData[index].linkPhone = _value.linkPhone;
details.nodeInfoData[index].linkAddress = _value.linkAddress;
const _node = details.nodeInfoData[index];
_node.nodeName = _value.warehouseName;
_node.nodeId = _value.warehouseId;
_node.linkMan = _value.linkMan;
_node.linkPhone = _value.linkPhone;
_node.linkAddress = _value.linkAddress;
for (let i = 0; i < nodeInfokeys.length; i++) {
const value = nodeInfokeys[i];
// 0
details.nodeInfoData[index][value] = 0;
_node[value] = 0;
}
if (Number(details.pageType) !== 2) return;
const _lineCarsOrderList = _node.lineCarsOrderList;
// ,
for (let i = _lineCarsOrderList.length - 1; i >= 0; i--) {
const value = _lineCarsOrderList[i];
//
if (!value.carsOrderId || value.nodeId === details.warehouseId) continue;
_lineCarsOrderList.splice(i, 1);
details.problemDataByReal.push(value);
}
//
for (let i = details.problemDataByReal.length - 1; i >= 0; i--) {
const value = details.problemDataByReal[i];
if (value.finalNodeId !== _value.warehouseId) continue;
_lineCarsOrderList.push(value);
details.problemDataByReal.splice(i, 1);
}
for (let i = details.problemDataByPlan.length - 1; i >= 0; i--) {
const value = details.problemDataByPlan[i];
if (value.finalNodeId !== _value.warehouseId) continue;
_lineCarsOrderList.push(value);
details.problemDataByPlan.splice(i, 1);
}
_node.itemFilterData();
};
/** 搜索 */
@ -1580,6 +1627,10 @@ const handleDelNode = (index: number, row) => {
for (const iterator of row.lineCarsOrderList) {
const _code = iterator.orderCode + ',' + iterator.waybillNo;
const _index = details.orderCodeList.indexOf(_code);
iterator.carsOrderId && iterator.realNum > 0 && details.problemDataByReal.push(iterator);
iterator.carsOrderId && !iterator.realNum && details.problemDataByPlan.push(iterator);
// +
details.orderCodeList.splice(_index, 1);
}
@ -1607,19 +1658,20 @@ const handleAddWaybill = async (index: number) => {
//
if (Number(details.pageType) === 3) return;
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要添加的订单');
for (let item of details.selectionList) {
const _orderMap = [];
for (let i = 0; i < details.selectionList.length; i++) {
const item = details.selectionList[i];
item.totalNum = item.totalNum || 20;
item.planNum = item.stockNum;
item.loadingNum = 0;
_orderMap.push(item.orderCode + ',' + item.waybillNo);
_node.lineCarsOrderList.push(item);
}
details.orderCodeList = [
...new Set([
...details.orderCodeList,
...details.selectionList.map(val => val.orderCode + ',' + val.waybillNo),
]),
];
details.orderCodeList = [...new Set([...details.orderCodeList, ..._orderMap])];
_node.itemFilterData();
// _node.renderData = _node.lineCarsOrderList;
@ -1649,7 +1701,21 @@ const handleRemoveWaybill = async (index: number) => {
//
_node.lineCarsOrderList = _node.lineCarsOrderList.filter((val, index) => {
const _flag = !_selectList.includes(val);
let _flag = true;
for (let i = 0; i < _selectList.length; i++) {
const value = _selectList[i];
if (value !== val) continue;
console.log('value :>> ', value);
_flag = false;
//
value.carsOrderId && value.realNum > 0 && details.problemDataByReal.push(value);
value.carsOrderId && !value.realNum && details.problemDataByPlan.push(value);
break;
}
if (!_flag) {
const _code = val.orderCode + ',' + val.waybillNo;
const _index = details.orderCodeList.indexOf(_code);
@ -1660,8 +1726,7 @@ const handleRemoveWaybill = async (index: number) => {
});
_node.renderData = _node.renderData.filter((val, index) => {
const _flag = !_selectList.includes(val);
return _flag;
return !_selectList.includes(val);
});
//
@ -1730,8 +1795,6 @@ const handleSubmitEdit = async () => {
/** 显示未挂载目的仓的数据 */
const handleShowProblemData = () => {
console.log('details.nodeInfoData :>> ', details.nodeInfoData);
console.log('details.active :>> ', details.active);
details.nodeList = [];
for (let i = 0; i < details.nodeInfoData.length; i++) {
const item = details.nodeInfoData[i];
@ -1744,7 +1807,63 @@ const handleShowProblemData = () => {
});
}
details.popUpShow;
if (details.nodeList.length === 1) details.problemInfo.nodeId = details.nodeList[0].nodeId;
if (details.nodeList.length === 0) return ElMessage.warning('没有后续节点,请添加节点');
details.popUpShow.problemDataVisited = true;
};
/** 提交挂载 */
const handleSubmitProblemData = () => {
if (!details.problemInfo.nodeId) return ElMessage.warning('请选择挂载的目的仓');
if (details.problemInfo.selectionList.length === 0)
return ElMessage.warning('请选择需要挂载数据');
const _data =
details.problemInfo.activeName === 'real'
? details.problemDataByReal
: details.problemDataByPlan;
for (let i = 0; i < details.nodeInfoData.length; i++) {
const _node = details.nodeInfoData[i];
if (_node.nodeId !== details.problemInfo.nodeId) continue;
//
const _orderMap = [];
for (let i = 0; i < details.problemInfo.selectionList.length; i++) {
const item = details.problemInfo.selectionList[i];
item.totalNum = item.totalNum || 20;
item.planNum = item.stockNum;
item.loadingNum = 0;
_orderMap.push(item.orderCode + ',' + item.waybillNo);
_node.lineCarsOrderList.push(item);
for (let index = 0; index < _data.length; index++) {
const value = _data[index];
if (value !== item) continue;
_data.splice(index, 1);
break;
}
}
details.orderCodeList = [...new Set([...details.orderCodeList, ..._orderMap])];
_node.itemFilterData();
clearSelectionList();
details.page.pageNum = 1;
initOriginWarehouseOrder();
break;
}
};
/** 关闭页面 */
@ -2329,4 +2448,8 @@ const handleSubmit = (formEl: FormInstance | undefined) => {
display: flex;
}
}
:deep(.el-tabs__item.is-active) {
font-weight: bold;
}
</style>

Loading…
Cancel
Save