| | |
| | | <el-button type="success" plain icon="el-icon-arrow-down" @click="handleMoveRowDown(zbSelForm)" |
| | | size="mini">下移</el-button> |
| | | <el-button type="success" plain icon="el-icon-printer" @click="get_ICInventoryMould(zbSelForm)">容器库存</el-button> |
| | | |
| | | <el-button type="success" plain icon="el-icon-printer" @click="get_ContainerInstantStock(zbSelForm)">容器即时库存</el-button> |
| | | </div> |
| | | <el-table :data="editData" style="width: 100%" height="300" width="100%" ref="zbTable" |
| | | @selection-change="handleTableZbEdit" :row-class-name="rowSysZbIndex" show-summary border> |
| | |
| | | <span>{{ scope.row.HUnitName }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="库存数量" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.KuHQty || 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="数量" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-input-number v-model="scope.row.HQty" :min="1" style="width: 90px;" |
| | |
| | | this.$emit('editClose', false) |
| | | } |
| | | }, |
| | | |
| | | //#region 查看容器即时库存 |
| | | async get_ContainerInstantStock(zbSelForm) { |
| | | if (!this.zbIndex) { |
| | | this.$modal.msgError("请选择一行数据"); |
| | | return; |
| | | } |
| | | |
| | | var index = zbSelForm.index - 1; |
| | | const rowData = this.editData[index]; |
| | | |
| | | if (rowData.HMaterID==0) { |
| | | this.$modal.msgError("请先选择容器"); |
| | | return; |
| | | } |
| | | |
| | | const whId = rowData.HWHID || this.form.HWHID; |
| | | if (!whId || whId == 0) { |
| | | this.$modal.msgError("请先选择有效的仓库"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | this.$modal.loading("正在查询库存..."); |
| | | |
| | | // 获取仓库名称 |
| | | const whResponse = await axios.get(this.$baseUrl + "/CommonModel/searchMethod", { |
| | | params: { |
| | | "sql": `select HName from Gy_Warehouse where HItemID = ${whId}`, |
| | | "user": sessionStorage["HUserName"], |
| | | "ModRightNameCheck": "" |
| | | } |
| | | }); |
| | | |
| | | const whName = whResponse.data.data[0]?.HName; |
| | | if (!whName) { |
| | | this.$modal.closeLoading(); |
| | | this.$modal.msgError("未找到仓库信息"); |
| | | return; |
| | | } |
| | | |
| | | // 获取所有库存数据 |
| | | var sql = "exec h_p_Kf_ICInventory_Mould ''"; |
| | | const response = await axios.get(this.$baseUrl + "/CommonModel/searchMethod", { |
| | | params: { |
| | | "sql": sql, |
| | | "user": sessionStorage["HUserName"], |
| | | "ModRightNameCheck": "" |
| | | } |
| | | }); |
| | | |
| | | let totalQty = 0; |
| | | |
| | | if (response.data.count == 1 && response.data.data) { |
| | | // 基础过滤:容器ID + 仓库名称 |
| | | let filteredData = response.data.data.filter(item => |
| | | item['HMaterID'] == rowData.HMaterID && item['仓库'] === whName |
| | | ); |
| | | |
| | | // 如果有库位,按库位过滤 |
| | | if (rowData.HSPName) { |
| | | filteredData = filteredData.filter(item => item['仓位'] === rowData.HSPName); |
| | | } |
| | | |
| | | // 计算总库存 |
| | | filteredData.forEach(item => { |
| | | totalQty += Number(item['库存数量'] || 0); |
| | | }); |
| | | } |
| | | |
| | | // 更新当前行的库存数量 |
| | | this.$set(this.editData, index, { |
| | | ...rowData, |
| | | KuHQty: totalQty |
| | | }); |
| | | |
| | | this.$modal.closeLoading(); |
| | | this.$modal.msgSuccess(`库存查询成功,当前库存:${totalQty}`); |
| | | |
| | | } catch (error) { |
| | | this.$modal.closeLoading(); |
| | | this.$modal.msgError("查询库存失败"); |
| | | } |
| | | }, |
| | | //#endregion |
| | | //根据用户获取对应职员、部门、销售主管 |
| | | getCzyglByUser() { |
| | | axios.get(this.$baseUrl + '/Xs_SeOrderBill/getCzyglByUser', { |
| | |
| | | this.editData.push(copyRow); |
| | | } |
| | | }, |
| | | |
| | | |
| | | handleMoveRowUp(zbSelForm) { |
| | | if (!this.zbIndex) { |
| | | this.$modal.msgError("请选择一行数据") |
| | |
| | | this.$refs.zbTable.toggleRowSelection(del_row, false) //设置这一行取消选中 |
| | | } |
| | | }, |
| | | |
| | | //#region 查看容器库存 |
| | | get_ICInventoryMould(zbSelForm) { |
| | | if (!this.zbIndex) { |
| | | this.$modal.msgError("请选择一行数据") |
| | | } else { |
| | | var index = zbSelForm.index-1; |
| | | this.ICInventoryMouldShow = true |
| | | this.$nextTick(() => { |
| | | this.$refs.ICInventoryMould.open(this.editData[index]); |
| | | }) |
| | | } |
| | | }, |
| | | //#endregion |
| | | |
| | | |
| | | // 编辑提交保存 |
| | | submitForm() { |