fix:订单配备货相关链路功能调整

dev_1.0.2
jiangpeng 2026-06-01 14:40:36 +08:00
parent 8acc68141d
commit 671bbd5692
7 changed files with 98 additions and 33 deletions

View File

@ -602,8 +602,9 @@ export default {
if (item.allBindList) {
item.allBindList.forEach(bindItem => {
const originalPhNum = bindItem.originalPhNum === '' || bindItem.originalPhNum === null || bindItem.originalPhNum === undefined ? 0 : Number(bindItem.originalPhNum);
const currentPhNum = this.stockingBindDraftMap[bindItem.purchaseId] !== undefined
? Number(this.stockingBindDraftMap[bindItem.purchaseId])
const key = this.getBindDraftKey(item.productCode, bindItem.purchaseId);
const currentPhNum = this.stockingBindDraftMap[key] !== undefined
? Number(this.stockingBindDraftMap[key])
: (bindItem.phNum === '' || bindItem.phNum === null || bindItem.phNum === undefined ? 0 : Number(bindItem.phNum));
const price = Number(bindItem.price) || 0;
const diff = currentPhNum - originalPhNum;
@ -770,9 +771,13 @@ export default {
this.stockingDetailLoading = false;
});
},
getDraftBindNum(purchaseId, defaultValue) {
if (this.stockingBindDraftMap[purchaseId] !== undefined) {
return this.stockingBindDraftMap[purchaseId];
getBindDraftKey(productCode, purchaseId) {
return `${productCode}_${purchaseId}`;
},
getDraftBindNum(productCode, purchaseId, defaultValue) {
const key = this.getBindDraftKey(productCode, purchaseId);
if (this.stockingBindDraftMap[key] !== undefined) {
return this.stockingBindDraftMap[key];
}
return defaultValue;
},
@ -784,7 +789,8 @@ export default {
const validValue = Math.max(minValue, Math.min(rawValue, maxValue));
row.phNum = validValue;
this.$set(this.stockingBindDraftMap, row.purchaseId, validValue);
const key = this.getBindDraftKey(item.productCode, row.purchaseId);
this.$set(this.stockingBindDraftMap, key, validValue);
this.updateItemTotalPhNum(item);
},
calculateMaxPhNum(row, item) {
@ -795,8 +801,9 @@ export default {
const maxPhysical = originalPhNum + originalKyNum;
const currentTotalPhNum = this.calculateCurrentTotalPhNum(item);
const currentRowPhNum = this.stockingBindDraftMap[row.purchaseId] !== undefined
? Number(this.stockingBindDraftMap[row.purchaseId])
const key = this.getBindDraftKey(item.productCode, row.purchaseId);
const currentRowPhNum = this.stockingBindDraftMap[key] !== undefined
? Number(this.stockingBindDraftMap[key])
: (row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum));
const maxAllowedByOrder = orderNum - currentTotalPhNum + currentRowPhNum;
@ -812,7 +819,7 @@ export default {
}).then(bindResponse => {
return (bindResponse.rows || []).map(bindItem => ({
...bindItem,
phNum: this.getDraftBindNum(bindItem.purchaseId, bindItem.phNum),
phNum: this.getDraftBindNum(item.productCode, bindItem.purchaseId, bindItem.phNum),
originalPhNum: bindItem.originalPhNum !== undefined ? bindItem.originalPhNum : bindItem.phNum,
originalKyNum: bindItem.originalKyNum !== undefined ? bindItem.originalKyNum : bindItem.kyNum
}));
@ -849,7 +856,8 @@ export default {
const diff = nextValue - originalPhNum;
row.kyNum = originalKyNum - diff;
this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue);
const key = this.getBindDraftKey(item.productCode, row.purchaseId);
this.$set(this.stockingBindDraftMap, key, nextValue);
this.updateItemTotalPhNum(item);
},
@ -858,9 +866,9 @@ export default {
let total = 0;
item.allBindList.forEach(bindItem => {
const purchaseId = bindItem.purchaseId;
if (this.stockingBindDraftMap && this.stockingBindDraftMap[purchaseId] !== undefined) {
total += Number(this.stockingBindDraftMap[purchaseId]);
const key = this.getBindDraftKey(item.productCode, bindItem.purchaseId);
if (this.stockingBindDraftMap && this.stockingBindDraftMap[key] !== undefined) {
total += Number(this.stockingBindDraftMap[key]);
} else {
const phNum = bindItem.phNum === '' || bindItem.phNum === null || bindItem.phNum === undefined ? 0 : Number(bindItem.phNum);
total += phNum;
@ -885,8 +893,9 @@ export default {
this.stockingDetailList.forEach(item => {
if (item.allBindList) {
item.allBindList.forEach(bindItem => {
const currentPhNum = this.stockingBindDraftMap[bindItem.purchaseId] !== undefined
? Number(this.stockingBindDraftMap[bindItem.purchaseId])
const key = this.getBindDraftKey(item.productCode, bindItem.purchaseId);
const currentPhNum = this.stockingBindDraftMap[key] !== undefined
? Number(this.stockingBindDraftMap[key])
: (bindItem.phNum === '' || bindItem.phNum === null || bindItem.phNum === undefined ? 0 : Number(bindItem.phNum));
const originalPhNum = bindItem.originalPhNum === '' || bindItem.originalPhNum === null || bindItem.originalPhNum === undefined ? 0 : Number(bindItem.originalPhNum);
if (currentPhNum !== originalPhNum) {
@ -922,8 +931,9 @@ export default {
item.originalTotalPhNum = this.calculateCurrentTotalPhNum(item);
if (item.allBindList) {
item.allBindList.forEach(bindItem => {
if (this.stockingBindDraftMap[bindItem.purchaseId] !== undefined) {
bindItem.phNum = this.stockingBindDraftMap[bindItem.purchaseId];
const key = this.getBindDraftKey(item.productCode, bindItem.purchaseId);
if (this.stockingBindDraftMap[key] !== undefined) {
bindItem.phNum = this.stockingBindDraftMap[key];
bindItem.originalPhNum = bindItem.phNum;
const originalKyNum = bindItem.originalKyNum === '' || bindItem.originalKyNum === null || bindItem.originalKyNum === undefined ? 0 : Number(bindItem.originalKyNum);
const diff = bindItem.phNum - (bindItem.originalPhNum || 0);
@ -934,8 +944,9 @@ export default {
}
if (item.bindList) {
item.bindList.forEach(bindItem => {
if (this.stockingBindDraftMap[bindItem.purchaseId] !== undefined) {
bindItem.phNum = this.stockingBindDraftMap[bindItem.purchaseId];
const key = this.getBindDraftKey(item.productCode, bindItem.purchaseId);
if (this.stockingBindDraftMap[key] !== undefined) {
bindItem.phNum = this.stockingBindDraftMap[key];
bindItem.originalPhNum = bindItem.phNum;
const originalKyNum = bindItem.originalKyNum === '' || bindItem.originalKyNum === null || bindItem.originalKyNum === undefined ? 0 : Number(bindItem.originalKyNum);
const diff = bindItem.phNum - (bindItem.originalPhNum || 0);

View File

@ -61,6 +61,11 @@
</el-row>
</el-form>
<el-tabs v-model="activePurchaseNo" @tab-click="handleTabClick" v-if="filteredPurchaseOrderList.length > 0">
<el-tab-pane v-for="purchase in filteredPurchaseOrderList" :key="purchase.purchaseNo" :label="`${purchase.purchaseNo} (${purchase.phNum}台)`" :name="purchase.purchaseNo">
</el-tab-pane>
</el-tabs>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleDownloadTemplate"></el-button>
@ -100,6 +105,7 @@ import { addDelivery, listProductSn } from '@/api/inventory/delivery';
import {importSnData,exportDownloadTemplate} from '@/api/inventory/outer'
import PurchaseOrderSelectDialog from '../../../purchaseorder/components/PurchaseOrderSelectDialog.vue';
import {handleTree} from "@/utils/ruoyi";
import { productMatchBindList } from '@/api/project/order';
export default {
name: "GenerateDeliveryForm",
@ -137,7 +143,7 @@ export default {
warehouseId: undefined,
orderCode: undefined,
},
isImported: false, // Flag to track if data is from import
isImported: false,
isInitialLoad: false,
purchaseOrderSelectVisible: false,
queryProductType: ['1', '2', '99'],
@ -145,8 +151,19 @@ export default {
warehouseId: null,
taxRate: 0.13,
warehouseName: '',
purchaseOrderList: [],
activePurchaseNo: '',
};
},
computed: {
filteredPurchaseOrderList() {
return this.purchaseOrderList.filter(purchase => {
const phNum = purchase.phNum || 0;
const bhNum = purchase.bhNum || 0;
return phNum > 0 && phNum > bhNum;
});
}
},
watch: {
'form.deliveryTimeType'(val) {
if (val === '0') {
@ -191,11 +208,32 @@ export default {
this.isInitialLoad = true;
this.visible = true;
this.$nextTick(() => {
// resetForm/
this.form.notifierAddress = notifierAddress;
this.getSnList();
this.loadPurchaseOrderList();
})
},
loadPurchaseOrderList() {
const orderCode = this.queryParams.orderCode;
const productCode = this.queryParams.productCode;
if (!orderCode || !productCode) {
this.getSnList();
return;
}
productMatchBindList(orderCode, productCode).then(response => {
this.purchaseOrderList = response.rows || [];
const filtered = this.filteredPurchaseOrderList;
if (filtered.length > 0) {
this.activePurchaseNo = filtered[0].purchaseNo;
this.queryParams.purchaseNo = this.activePurchaseNo;
} else {
this.activePurchaseNo = '';
this.queryParams.purchaseNo = undefined;
}
this.getSnList();
}).catch(() => {
this.getSnList();
});
},
getSnList() {
listProductSn(this.queryParams).then(response => {
this.snList = response.rows;
@ -211,6 +249,13 @@ export default {
}
});
},
handleTabClick(tab) {
this.activePurchaseNo = tab.name;
this.queryParams.purchaseNo = tab.name;
this.queryParams.pageNum = 1;
this.isInitialLoad = true;
this.getSnList();
},
handleSelectionChange(selection) {
if (this.isImported && selection.length!=(this.productData.quantity - this.productData.deliveryGenerateQuantity - this.productData.deliveryConfirmQuantity)) {
this.$message.error("导入数据不允许取消勾选");
@ -337,6 +382,7 @@ export default {
productCode: undefined,
warehouseId: undefined,
orderCode: undefined,
purchaseNo: undefined,
};
this.isImported = false;
this.price = null;
@ -344,6 +390,8 @@ export default {
this.warehouseId = null;
this.purchaseNo = '';
this.warehouseName = '';
this.purchaseOrderList = [];
this.activePurchaseNo = '';
}
}
};

View File

@ -51,6 +51,7 @@ public class InventoryInfo extends BaseEntity
@Excel(name = "出库单号")
private String outerCode;
private String orderCode;
private String purchaseNo;
/** 所属仓库 */
@Excel(name = "所属仓库")

View File

@ -107,7 +107,8 @@ public interface ProjectOrderInfoMapper
int selectProductMatchSnCountlList(@Param("purchaseNo") String purchaseNo);
int selectPurchaseOrderMapBindNum(@Param("purchaseNo") String purchaseNo,
@Param("orderCode") String orderCode);
@Param("orderCode") String orderCode,
@Param("productCode") String productCode);
List<OrderProductMatchSnDetailDto> selectProductMatchSnDetailList(@Param("purchaseNo") String purchaseNo,
@Param("productCode") String productCode);

View File

@ -2913,7 +2913,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
OrderProductMatchSnDto result = new OrderProductMatchSnDto();
List<OrderProductMatchSnDetailDto> snList = projectOrderInfoMapper.selectProductMatchSnDetailList(purchaseNo, productCode);
result.setTotalQuantity(snList.size());
Integer quotaQuantity = projectOrderInfoMapper.selectPurchaseOrderMapBindNum(purchaseNo, orderCode);
Integer quotaQuantity = projectOrderInfoMapper.selectPurchaseOrderMapBindNum(purchaseNo, orderCode, productCode);
result.setQuotaQuantity(quotaQuantity);
result.setSnList(snList);
List<OrderProductMatchWarehouseDto> warehouseList = snList.stream()

View File

@ -38,10 +38,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from oms_inventory_info t1
left join oms_warehouse_info t2 on t1.warehouse_id = t2.id
left join product_info t3 on t1.product_code = t3.product_code
<if test="orderCode != null and orderCode != ''">
<if test="(orderCode != null and orderCode != '') or (purchaseNo != null and purchaseNo != '')">
left join oms_inventory_inner t4 on t1.inner_code = t4.inner_code
</if>
<if test="orderCode != null and orderCode != ''">
left join oms_purchase_order t5 on t4.purchase_no = t5.purchase_no
left join oms_purchase_order_map t6 on t5.id = t6.purchase_id
left join oms_purchase_order_map t6 on t5.id = t6.purchase_id and t6.product_code = t1.product_code
left join project_order_info t7 on t6.order_id = t7.id and t7.order_code = #{orderCode}
</if>
<where>
@ -65,10 +67,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderCode != null and orderCode != ''">
and t6.bind_num > 0
</if>
<if test="purchaseNo != null and purchaseNo != ''">
and t4.purchase_no = #{purchaseNo}
</if>
<if test="warehouseId != null ">and t1.warehouse_id = #{warehouseId}</if>
<if test="innerPrice != null ">and t1.inner_price = #{innerPrice}</if>
<if test="outerPrice != null ">and t1.outer_price = #{outerPrice}</if>
</where>
</select>

View File

@ -942,7 +942,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join project_order_info as t2 on t1.project_id = t2.project_id
inner join product_info as t3 on t1.product_bom_code = t3.product_code
left join oms_purchase_order_item as t4 on t3.product_code = t4.product_code
left join oms_purchase_order_map as t5 on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id
left join oms_purchase_order_map as t5 on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id and t5.product_code = t4.product_code
left join (
select count(1) bh_num, product_code
from oms_inventory_info
@ -966,7 +966,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
max(t4.price) as price,
t4.quantity as cg_num,
t4.quantity - ifnull((select sum(bind_num) from oms_purchase_order_map as tt
where tt.purchase_id = t4.purchase_id and tt.product_code = t4.product_code), 0) as ky_num,
where tt.order_id = t2.id and tt.purchase_id = t4.purchase_id and tt.product_code = t4.product_code), 0) as ky_num,
t5.bind_num as ph_num,
t6.status,
(
@ -985,7 +985,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join oms_purchase_order_item as t4
on t3.product_code = t4.product_code
left join oms_purchase_order_map as t5
on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id
on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id and t4.product_code = t5.product_code
inner join oms_purchase_order as t6
on t6.id = t4.purchase_id
where t2.order_code = #{orderCode}
@ -1004,7 +1004,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on t1.inner_code = t2.inner_code
left join oms_warehouse_info as t3
on t2.warehouse_id = t3.id
where t2.purchase_no = #{purchaseNo} and t1.inventory_status=0
where t2.purchase_no = #{purchaseNo}
</select>
<select id="selectPurchaseOrderMapBindNum" resultType="java.lang.Integer">
@ -1014,7 +1014,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join project_order_info as t2
on t2.order_code = #{orderCode}
left join oms_purchase_order_map as t3
on t2.id = t3.order_id and t1.id = t3.purchase_id
on t2.id = t3.order_id and t1.id = t3.purchase_id and t3.product_code = #{productCode}
where t1.purchase_no = #{purchaseNo}
limit 1
</select>