You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

3835 lines
138 KiB

<template>
<div>
<el-form label-position="top" style="margin-top: -0px">
<el-row :gutter="20">
<el-col :span="20">
<el-button v-if="notifyNo===''" @click="addNotify()" type="primary" class="yzzButtonAn">新建申请单</el-button>
<!-- 只允许一条明细记录 不然后续推送给wcs 立库可能会有问题-->
<el-button v-if="notifyNo!=''" type="primary" :disabled="dataList.length>0" @click="chooseSOSModal()" class="yzzButtonAn">新增物料</el-button>
<el-button v-if="notifyNo!=''" type="primary" @click="xiadaNotify()" class="yzzButtonAn">下达申请单</el-button>
<el-button v-if="notifyNo!=''" type="primary" @click="deleteNotify()" class="yzzButtonAn">删除申请单</el-button>
</el-col>
</el-row>
<el-row :gutter="10" v-if="notifyNo!=''">
<el-col :span="3">
<el-form-item :label="'工厂编码'">
<el-input v-model="notifyData.site" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item :label="'申请单号'">
<el-input v-model="notifyData.notifyNo" disabled style="width: 100%;"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item :label="'申请账号'">
<el-input v-model="notifyData.username" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item :label="'申请时间'">
<el-input v-model="notifyData.notifyDate" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item :label="'状态'">
<el-select v-model="notifyData.status" style="width: 100%" disabled>
<el-option label="全部" value=""></el-option>
<el-option v-for="item in notifyStatusList" :key="item.listValue" :label="item.listDesc"
:value="item.listValue"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card"
v-if="notifyNo!=''" @tab-click="tabClick">
<el-tab-pane label="已申请工单" name="sos">
<el-table :height="height" :data="dataList" border style="width: 100%;" @row-click="changeData">
<el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable"
:prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px" /></span>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="enterSOSDetail(scope.row)">物料</a>
<a type="text" size="small" @click="deleteNotifySOS(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="材料明细" name="sub">
<el-table :data="materialDetailList" :height="height" border :row-class-name="materialDetailTableRowClassName"
v-loading="dataListLoading" style="width: 100%; ">
<!-- <el-table-column-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="80"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <a type="text" size="small" v-if="currentRow.status==='ISSUE'" @click="deleteNotifyMaterial(scope.row)">删除</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column v-for="(item,index) in materialDetailColumnList" :key="index" :sortable="item.columnSortable"
:prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px" /></span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-dialog title="新增工单物料" :close-on-click-modal="false" v-drag :visible.sync="seqNoModalFlag" width="980px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="10">
<el-form-item label="订单类型">
<el-radio-group v-model="orderType" :disabled="seqNoList.length>0" size="small">
<el-radio label="slittingorder">分切订单</el-radio>
<el-radio label="shipment">销售发货</el-radio>
<el-radio label="shoporder">成品订单</el-radio>
<el-radio label="baofei">报废单</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- <el-col :span="2">
<el-form-item label=" " v-if="orderType!=='baofei'">
<el-button type="primary" @click="openOrderManageDialog()" class="">从订单添加</el-button>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="'已添加订单(不保存)'" style="width: 100%" v-if="orderType!=='baofei'">
<el-input v-model="remark" style="width: 100%" readonly></el-input>
</el-form-item>
</el-col> -->
</el-row>
<el-row :gutter="20">
<el-col :span="4" v-if="orderType!=='baofei'">
<el-form-item label="工厂编号">
<el-select
v-model="materialDialogSite"
placeholder="请选择Site"
:loading="materialDialogSiteLoading"
:disabled="seqNoList.length > 0"
style="width: 100%">
<el-option
v-for="item in materialDialogSiteOptions"
:key="item.siteCode"
:label="item.siteName"
:value="item.siteCode">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="物料号" v-if="orderType!=='baofei'">
<el-input v-model="partNo" @keyup.enter.native="addRowFromQuery" :disabled="orderType=='baofei'"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label=" ">
<el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading" v-if="orderType!=='baofei'"
class="">添加物料行</el-button>
<el-button type="primary" @click="openSelectMaterialModal()" v-if="orderType!=='baofei'"
class="">选择物料</el-button>
<el-button type="primary" @click="importModel()" :disabled="seqNoList.length>0" v-if="orderType!=='baofei'"
class="">导入</el-button>
<el-button type="primary" @click="importModel2()" :disabled="seqNoList.length>0" v-if="orderType==='baofei'"
class="">报废导入</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :height="400" :data="seqNoList" border style="width: 100%;" class="choose-sos-table" :row-class-name="seqNoTableRowClassName">
<!-- rqrq - 使用displayColumnList2计算属性,报废类型时动态显示批次号列 -->
<el-table-column v-for="(item,index) in displayColumnList2" :key="index" :sortable="item.columnSortable"
:prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<div v-if="item.columnProp === 'applyQty'">
<el-input class="applyQtyClass" v-model="scope.row.applyQty" style="height: 11px; width: 98%;"></el-input>
</div>
<!-- rqrq - 可用库存特殊显示:加粗,小于需求数量时红色 -->
<span v-else-if="item.columnProp === 'availableQty'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
{{ scope.row.availableQty }}
</span>
<!-- rqrq - 导入数量特殊显示:大于可用库存时红色 -->
<span v-else-if="item.columnProp === 'remark'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
{{ scope.row.remark }}
</span>
<span v-else-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px" /></span>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
<template slot-scope="scope">
<el-button type="danger" size="mini" plain style="height:14px; line-height:14px; padding:0 8px;" @click="deleteSeqNoRow(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="saveNewSoIssueNotify" :loading="saveNewLoading">保存</el-button>
<el-button type="primary" @click="seqNoModalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 订单管理弹窗 - rqrq -->
<el-dialog :title="'订单添加(' + orderTypeText + ')'" :close-on-click-modal="false" v-drag :visible.sync="orderManageDialogVisible" width="1100px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="4">
<el-form-item label="工厂编号">
<el-input :value="materialDialogSite" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item :label="'Order No'">
<el-input v-model="orderManageData.orderNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入订单号"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item :label="'Release No'">
<el-input v-model="orderManageData.releaseNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入Release No"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item :label="'Sequence No'">
<el-input v-model="orderManageData.sequenceNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入Sequence No"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="' '">
<el-button type="primary" @click="addOrderToTempList()" :loading="addOrderTempLoading" class="">添加</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 订单明细列表 - rqrq -->
<el-table :height="400" :data="tempOrderList" border style="width: 100%;" v-loading="tempOrderListLoading">
<el-table-column prop="orderNo" header-align="center" align="center" min-width="120" label="订单号"></el-table-column>
<el-table-column prop="subSite" header-align="center" align="center" min-width="100" label="工厂编号"></el-table-column>
<el-table-column prop="releaseNo" header-align="center" align="center" min-width="100" label="Release No"></el-table-column>
<el-table-column prop="sequenceNo" header-align="center" align="center" min-width="100" label="Sequence No"></el-table-column>
<el-table-column prop="componentPartNo" header-align="center" align="center" min-width="150" label="物料编码"></el-table-column>
<el-table-column prop="componentPartDesc" header-align="center" align="center" min-width="150" label="物料描述" show-overflow-tooltip></el-table-column>
<el-table-column prop="applyQty" header-align="center" align="right" min-width="100" label="数量"></el-table-column>
<el-table-column prop="uom" header-align="center" align="center" min-width="80" label="单位"></el-table-column>
<el-table-column prop="isInWh" header-align="center" align="center" min-width="100" label="是否在立库"></el-table-column>
<!-- rqrq - 新增可用库存列 -->
<el-table-column prop="availableQty" header-align="center" align="right" min-width="100" label="可用库存">
<template slot-scope="scope">
<span :style="{fontWeight: 'bold', color: (scope.row.availableQty < scope.row.applyQty) ? '#F56C6C' : ''}">
{{ scope.row.availableQty }}
</span>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="80" label="操作">
<template slot-scope="scope">
<el-button type="danger" size="mini" plain style="height:14px; line-height:14px; padding:0 8px;" @click="deleteTempOrderRow(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="summaryOrderToMainList()" :loading="summaryLoading">汇总到主列表</el-button>
<el-button @click="closeOrderManageDialog()">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 销售发货:同一单号多CONTRACT时先选site再拉行 - rqrq -->
<el-dialog title="选择Shipment站点" :close-on-click-modal="false" v-drag :visible.sync="shipmentSiteSelectModalFlag" width="900px" append-to-body>
<div style="margin-bottom: 8px;color:#606266;">同一单号命中多个站点,请选择要添加的Shipment后再查询物料</div>
<el-table
:data="shipmentSiteSelectList"
border
highlight-current-row
height="320"
style="width: 100%;"
@current-change="handleShipmentSiteSelectChange">
<el-table-column type="index" width="50" label="#" align="center"></el-table-column>
<el-table-column prop="contract" label="Site/CONTRACT" min-width="120" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="shipmentId" label="ShipmentId" min-width="120" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="shipmentType" label="类型" min-width="100" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="receiverId" label="接收方" min-width="120" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="receiverDesc" label="接收方描述" min-width="160" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="state" label="状态" min-width="100" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="plannedShipDate" label="计划发货日期" min-width="130" align="center" show-overflow-tooltip></el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 12px;text-align:center">
<el-button type="primary" @click="confirmShipmentSiteSelect()" :loading="addOrderTempLoading">确认</el-button>
<el-button type="primary" @click="shipmentSiteSelectModalFlag=false">取消</el-button>
</el-footer>
</el-dialog>
<!-- 成品/分切订单:同一单号多site时先选contract再查物料 - rqrq -->
<el-dialog title="选择工单Site" :close-on-click-modal="false" v-drag :visible.sync="shopOrderSiteSelectFlag" width="900px" append-to-body>
<el-table :height="360" :data="shopOrderCandidateList" border style="width: 100%;" highlight-current-row>
<el-table-column prop="contract" label="Site" min-width="100" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="orderNo" label="OrderNo" min-width="120" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="releaseNo" label="ReleaseNo" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="sequenceNo" label="SequenceNo" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="partNo" label="产品编码" min-width="120" header-align="center" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" label="产品名称" min-width="160" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column prop="objstate" label="状态" min-width="90" header-align="center" align="center"></el-table-column>
<el-table-column prop="lotSize" label="工单数量" min-width="90" header-align="center" align="right"></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="90" label="操作">
<template slot-scope="scope">
<el-button type="primary" plain style="height:14px; line-height:14px; padding:0 8px;" :loading="addOrderTempLoading" @click="confirmShopOrderSite(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="shopOrderSiteSelectFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 选择物料弹框 -->
<el-dialog title="新增物料" :close-on-click-modal="false" v-drag :visible.sync="selectMaterialModalFlag" width="1080px">
<el-form :inline="true" label-position="top">
<el-form-item label="Site">
<el-input :value="selectMaterialDisplaySite" disabled style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="物料编号">
<el-input v-model="componentPartNo" style="width: 120px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="loadAvailableMaterialList()" class="">查询</el-button>
</el-form-item>
</el-form>
<el-container style="margin-top: 0px;">
<!-- 左侧:可选物料 -->
<el-main style="width: 470px;padding: 1px">
<span style="font-size: 12px">可选物料:</span>
<el-table height="350px" :data="availableMaterialList" border ref="itemTable1" @row-click="itemClickRow1"
@selection-change="handleAvailableSelectionChange" highlight-current-row style="width: 100%"
v-loading="selectMaterialLoading">
<el-table-column type="selection" header-align="center" align="center" :selectable="selectFlag" width="50">
</el-table-column>
<el-table-column prop="partNo" header-align="center" align="center" min-width="140" label="物料号">
</el-table-column>
<el-table-column header-align="center" align="center" min-width="80" label="Site">
<template slot-scope="scope">
{{ scope.row.subSite || scope.row.site || selectMaterialDisplaySite }}
</template>
</el-table-column>
<el-table-column prop="height" header-align="center" align="center" min-width="70" label="高度">
</el-table-column>
<el-table-column prop="isInWh" header-align="center" align="center" min-width="80" label="是否在立库">
</el-table-column>
<!-- rqrq - 新增可用库存列 -->
<el-table-column prop="availableQty" header-align="center" align="right" min-width="80" label="可用库存">
<template slot-scope="scope">
<span style="font-weight: bold;">{{ scope.row.availableQty }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleAvailableSizeChange" @current-change="handleAvailableCurrentChange"
:current-page="availableMaterialPage" :page-sizes="[50, 100]" :page-size="availableMaterialLimit"
small layout="total, prev, pager, next" :total="availableMaterialTotal"
style="margin-top: 10px; text-align: right;">
</el-pagination>
</el-main>
<!-- 中间:操作按钮 -->
<el-main style="width: 100px;padding: 1px">
<div style="margin-top: 180px;margin-left: 18px">
<el-button type="primary" @click="addToSelected">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="removeFromSelected">删除&lt;&lt; </el-button>
</div>
</el-main>
<!-- 右侧:已选物料 -->
<el-main style="width: 470px;padding: 1px">
<span style="font-size: 12px">已有物料:</span>
<el-table height="400px" :data="selectedMaterialList" border ref="itemTable2" @row-click="itemClickRow2"
@selection-change="handleSelectedSelectionChange" highlight-current-row style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" :selectable="selectFlag" width="50">
</el-table-column>
<el-table-column prop="partNo" header-align="center" align="center" min-width="140" label="物料号">
</el-table-column>
<el-table-column header-align="center" align="center" min-width="80" label="Site">
<template slot-scope="scope">
{{ scope.row.subSite || scope.row.site || selectMaterialDisplaySite }}
</template>
</el-table-column>
<el-table-column prop="height" header-align="center" align="center" min-width="70" label="高度">
</el-table-column>
<el-table-column prop="isInWh" header-align="center" align="center" min-width="80" label="是否在立库">
</el-table-column>
<!-- rqrq - 新增可用库存列 -->
<el-table-column prop="availableQty" header-align="center" align="right" min-width="80" label="可用库存">
<template slot-scope="scope">
<span style="font-weight: bold;">{{ scope.row.availableQty }}</span>
</template>
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="confirmSelectMaterial()">保存</el-button>
<el-button @click="selectMaterialModalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="申请明细" :close-on-click-modal="false" v-drag :visible.sync="materialModalFlag" width="900px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item :label="'生产订单号'">
<el-input v-model="sobomData.orderNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label=" ">
<el-button type="primary" @click="openSelectMaterialModalForDetail()"
class="">添加</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="yzzTable">
<el-table :height="400" :data="sobomList" border v-loading="bomLoadFlag" style="width: 100%;">
<el-table-column v-for="(item,index) in columnList3" :key="index" :sortable="item.columnSortable"
:prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<div v-if="item.columnProp === 'qtyToIssue'">
<el-input v-model="scope.row.qtyToIssue" type="number" style="height: 11px; width: 98%;" :step="0"
:min="0"></el-input>
</div>
<div v-else-if="item.columnProp === 'remark'">
<el-input v-model="scope.row.remark" style="padding: 0;width: 100%"></el-input>
</div>
<!-- rqrq - 可用库存特殊显示:加粗,小于申请数量时红色 -->
<div v-else-if="item.columnProp === 'availableQty'">
<span :style="{fontWeight: 'bold', color: (scope.row.availableQty < scope.row.qtyToIssue) ? '#F56C6C' : ''}">
{{ scope.row.availableQty }}
</span>
</div>
<div v-else>
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px" /></span>
</div>
</template>
</el-table-column>
<!-- <el-table-column prop="" header-align="center" align="center" min-width="50" label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="qtyAllForBom(scope.row)" style="width: 100%">全数领料</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="saveNoOrderMaterialDetail()">保存</el-button>
<el-button type="primary" @click="materialModalFlag=false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="保存物料" :close-on-click-modal="false" v-drag :visible.sync="saveOtherPartModalFlag" width="600px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item :label="'物料编码'">
<el-input v-model="otherPartData.componentPartNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item :label="'物料描述'">
<el-input v-model="otherPartData.partDesc" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item :label="'计量单位'">
<el-input v-model="otherPartData.umid" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'需求数量'">
<el-input-number v-model="otherPartData.qtyToIssue" style="padding: 0;width: 100%" :step="0" :min="0"
:controls="false"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item :label="'备注'">
<el-input v-model="otherPartData.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="saveOtherPart()">保存</el-button>
<el-button type="primary" @click="saveOtherPartModalFlag=false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="下达申请单" :close-on-click-modal="false" v-drag :visible.sync="showXiadaNotifyDialog" width="400px">
<el-form :inline="true" label-position="top" label-width="500px" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="要求发料时间">
<el-date-picker v-model="xiadaNotifyData.planIssueDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" class="issueNotify">
<el-input type="textarea" v-model="xiadaNotifyData.remark" :rows="3" placeholder="请输入内容"
style="width: 100%"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="height:30px;text-align:center;">
<el-button type="primary" @click="confirmXiadaNotify()">下达</el-button>
<el-button type="primary" @click="showXiadaNotifyDialog=false">取消</el-button>
</el-footer>
</el-dialog>
<el-dialog title="选择申请类型" :close-on-click-modal="false" v-drag :visible.sync="showAddNotifyTypeDialog"
width="400px">
<el-form :inline="true" label-position="top" label-width="500px" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="申请类型">
<el-radio-group v-model="selectedNotifyType">
<el-radio label="production">生产领料单</el-radio>
<el-radio label="outsourced">委外领料单</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" class="issueNotify">
<el-input type="textarea" v-model="selectedNotifyRemark" :rows="3" placeholder="请输入内容"
style="width: 100%"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="height:30px;text-align:center;">
<el-button type="primary" @click="confirmAddNotify()">确认</el-button>
<el-button type="primary" @click="showAddNotifyTypeDialog=false">取消</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<noorderUploadExcel ref="noorderUploadExcel" @refreshTable="searchTable" v-drag></noorderUploadExcel>
<baofeiUploadExcel ref="baofeiUploadExcel" @refreshTable="searchTable" v-drag></baofeiUploadExcel>
</div>
</template>
<script>
import {
getUserNoOrderNotifyNo,
createNoOrderNotify,
getNotifyNoOrderDetail,
getNoOrderMaterialList,
saveNoOrderMaterialDetail,
saveNoOrderNotify,
saveSOIssueNotifyOrderList,
searchNotifyMaterialListNew,
xiadaNotify,
deleteNotify,
deleteNotifySOS,
noOrderList,
getAllNotifyStatus,
queryPartAttributeData,
searchOtherPart,
} from '@/api/haianWarehouse/noOrderIssueNotify.js'
import { haiAnGetShipmentAndLineForIssure as getShipmentAndLineForIssure } from '@/api/haianWarehouse/shipmentIssue.js'
import {
haiAnGetShopOrderAndMaterialByShoporder as getShopOrderAndMaterialByShoporder,
haiAnGetShopOrderFromIFSWithOrderNo as getShopOrderFromIFSWithOrderNo,
} from '@/api/haianWarehouse/shopOrderIssueNotify.js'
import { getUserAuthorizedSubSiteCodes } from '@/api/factory/accessSite'
import { getAuthorizedSubSiteCodeList } from '@/utils/subSiteAuth'
import noorderUploadExcel from '@/views/modules/noOrderIssue/noorder_upload_excel.vue'
import baofeiUploadExcel from '@/views/modules/noOrderIssue/baofei_upload_excel.vue'
import Chooselist from '@/views/modules/common/Chooselist_eam'
import { getTableUserListLanguage } from '@/api/table.js'
export default {
name: 'newNoOrderIssueNotify54',
components: {
Chooselist,
noorderUploadExcel,
baofeiUploadExcel,
},
watch: {
// notifyOrderData: {
// deep: true,
// handler: function (newV, oldV) {
// this.notifyOrderData.locationNo = this.notifyOrderData.locationNo.toUpperCase()
// }
// },
},
data() {
return {
activeName: 'sos',
noControlPartModelFlag: false,
buList: [],
partList: [],
partList2: [],
notifyStatusList: [],
notifyNo: '',
notifyData: {
site: '',
bu: '',
notifyNo: '',
notifyDate: '',
enteredDate: '',
userName: '',
userDisplay: '',
remark: '',
planIssueDate: '',
},
dataList2: [],
dataList3: [],
materialDetailList: [],
currentRow: '',
dataListLoading: false,
// 是否收藏
favorite: false,
changeBuFlag: false,
partModelFlag: false,
newBu: '',
// 导出 start
exportData: [],
exportName: '设备分组' + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ['设备分组'],
exportFooter: [],
exportList: [],
// 导出 end
searchData: {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
groupID: '',
groupDesc: '',
buDesc: '',
active: 'Y',
page: 1,
limit: 10,
},
sobomData: {
orderNo: '',
seqno: '',
partNo: '',
},
//申请单序号
itemNo: '',
notifyOrderData: {
partNo: '',
orderNo: '',
itemNo: '',
releaseNo: '',
sequenceNo: '',
partDesc: '',
qtyrequired: '',
issureQty: '',
needDate: '',
},
seqNoData: {
site: this.$store.state.user.site,
seqno: '',
releaseNo: '',
sequenceNo: '',
sResourceID: '',
sWorkcenterno: '',
operatorId: '',
sShiftno: '',
startDate: '',
endDate: '',
},
seqNoList: [],
height: 200,
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataList: [],
sobomList: [],
dataListSelections: [],
seqNoModalFlag: false,
materialModalFlag: false,
modalDisableFlag: false,
saveSeqNoModalFlag: false,
bomLoadFlag: false,
xiadaList: [],
columnList4: [
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table4ComponentPartNo',
tableId: '555001Table4',
tableName: '非BOM材料明细',
columnProp: 'componentPartNo',
headerAlign: 'center',
align: 'center',
columnLabel: '材料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table4PartDesc',
tableId: '555001Table4',
tableName: '非BOM材料明细',
columnProp: 'partDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '材料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 130,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table4QtyToIssue',
tableId: '555001Table4',
tableName: '非BOM材料明细',
columnProp: 'qtyToIssue',
headerAlign: 'center',
align: 'right',
columnLabel: '申请数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table4Remark',
tableId: '555001Table4',
tableName: '非BOM材料明细',
columnProp: 'remark',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 200,
},
],
modalData: {
flag: '',
bu: '',
site: this.$store.state.user.site,
groupID: '',
groupDesc: '',
active: '',
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
},
// 展示列集
columnList: [
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1ItemNo',
tableId: '555001Table1',
tableName: '领料申请工单子表',
columnProp: 'itemNo',
headerAlign: 'center',
align: 'right',
columnLabel: '序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 50,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1SubSite',
tableId: '555001Table1',
tableName: '领料申请工单子表',
columnProp: 'subSite',
headerAlign: 'center',
align: 'center',
columnLabel: '工厂编号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 90,
},
/* {
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1SeqNo',
tableId: '555001Table1',
tableName: '领料申请派工单子表',
columnProp: 'seqNo',
headerAlign: 'center',
align: 'center',
columnLabel: '派工单号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 150,
}, */
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1SOOrderNo',
tableId: '555001Table1',
tableName: '领料申请工单子表',
columnProp: 'soorderNo',
headerAlign: 'center',
align: 'center',
columnLabel: '生产订单号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1ReleaseNo',
tableId: '555001Table1',
tableName: '领料申请工单子表',
columnProp: 'releaseNo',
headerAlign: 'center',
align: 'center',
columnLabel: 'ReleaseNo',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1SequenceNo',
tableId: '555001Table1',
tableName: '领料申请工单子表',
columnProp: 'sequenceNo',
headerAlign: 'center',
align: 'center',
columnLabel: 'SequenceNo',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table1NeedDate',
tableId: '555001Table1',
tableName: '领料申请派工单子表',
columnProp: 'needDate',
headerAlign: 'center',
align: 'left',
columnLabel: '要求发料时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
],
columnList2: [
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2ComponentPartNo',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'partNo',
headerAlign: 'center',
align: 'left',
columnLabel: '物料号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2ApplyQty',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'applyQty',
headerAlign: 'center',
align: 'right',
columnLabel: '本次申请数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
// {
// userId: this.$store.state.user.name,
// functionId: 555001,
// serialNumber: '555001Table2FinishDate',
// tableId: '555001Table2',
// tableName: '查询工单及物料',
// columnProp: 'height',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '高度',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: false,
// columnWidth: 110,
// },
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2FinishDate',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'isInWh',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在立库',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 110,
},
{
// rqrq - 新增可用库存列
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2AvailableQty',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'availableQty',
headerAlign: 'center',
align: 'right',
columnLabel: '可用库存',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
],
columnList3: [
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3ComponentPartNo',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'componentPartNo',
headerAlign: 'center',
align: 'left',
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: true,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
// rqrq - 新增批次号列
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3BatchNo',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'batchNo',
headerAlign: 'center',
align: 'center',
columnLabel: '批次号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3QtyRequired',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'isInWh',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在立库',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 50,
},
{
// rqrq - 新增可用库存列
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3AvailableQty',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'availableQty',
headerAlign: 'center',
align: 'right',
columnLabel: '可用库存',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3QtyToIssue',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'qtyToIssue',
headerAlign: 'center',
align: 'right',
columnLabel: '本次申请数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 60,
},
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3Remark',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'remark',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 150,
},
],
materialDetailColumnList: [
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3ItemNo',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'itemNo',
headerAlign: 'center',
align: 'right',
columnLabel: '申请单序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3SubSite',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'subSite',
headerAlign: 'center',
align: 'center',
columnLabel: '工厂编号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 90,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3ComponentPartNo',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'componentPartNo',
headerAlign: 'center',
align: 'center',
columnLabel: '材料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3NeedDate',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'needDate',
headerAlign: 'center',
align: 'center',
columnLabel: '需求时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 110,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3QtyToIssue',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'qtyToIssue',
headerAlign: 'center',
align: 'right',
columnLabel: '申请数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3QtyToIssueOriginal',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'qtyToIssueOriginal',
headerAlign: 'center',
align: 'right',
columnLabel: '已发数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3IssueType',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'issueType',
headerAlign: 'center',
align: 'right',
columnLabel: '类型',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3Remark',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'remark',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3SOOrderNo',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'soorderNo',
headerAlign: 'center',
align: 'left',
columnLabel: '生产订单',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3BOMItemNo',
tableId: '701002Table3',
tableName: '申请单材料明细表',
columnProp: 'bomitemNo',
headerAlign: 'center',
align: 'right',
columnLabel: 'BOM序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
},
],
rules: {
groupIdType: [
{
required: true,
message: ' ',
trigger: ['blur', 'change'],
},
],
groupDescType: [
{
required: true,
message: ' ',
trigger: ['blur', 'change'],
},
],
activeType: [
{
required: true,
message: ' ',
trigger: ['blur', 'change'],
},
],
bu: [
{
required: true,
message: ' ',
trigger: ['blur', 'change'],
},
],
},
userBuList: [],
authSearch: false,
authSave: false,
authUpdate: false,
authDelete: false,
menuId: this.$route.meta.menuId,
partSearch: {
site: '',
sourceBu: '',
partNo: '',
partDesc: '',
spec: '',
},
xiadaModelFlag: false,
saveOtherPartModalFlag: false,
otherPartData: {
site: '',
notifyNo: '',
itemNo: '',
bOMItemNo: '',
componentPartNo: '',
qtyToIssue: '',
issueType: '',
partDesc: '',
umid: '',
remark: '',
},
showAddNotifyTypeDialog: false,
selectedNotifyType: 'production',
selectedNotifyRemark: '',
showXiadaNotifyDialog: false,
xiadaNotifyData: {
planIssueDate: '',
remark: '',
},
chooseLoading: false,
seqNoModalLoading: false,
saveNewLoading: false,
// 选择物料弹框相关
selectMaterialModalFlag: false,
availableMaterialList: [], // 左侧可选物料列表
selectedMaterialList: [], // 右侧已选物料列表
availableMaterialSelections: [], // 左侧选中的行
selectedMaterialSelections: [], // 右侧选中的行
selectMaterialLoading: false,
modelCode: '', // 模板编号
modelName: '', // 模板名称
// 左侧表格分页相关
availableMaterialPage: 1, // 当前页码
availableMaterialLimit: 100, // 每页条数
availableMaterialTotal: 0, // 总条数
componentPartNo: '', // 物料编码搜索
orderType: 'slittingorder',
// 申请明细弹框相关
isMaterialDetailModal: false, // 标识是否从申请明细弹框打开选择物料弹框
clickrow:{},
partNo:'',
addLineLoading:false,
// 新增工单物料弹窗Site下拉:用于添加物料行/选择物料按工厂过滤 - rqrq
materialDialogSite: '',
materialDialogSiteOptions: [],
materialDialogSiteLoading: false,
addOrderLoading:false, // 订单添加按钮loading状态 - rqrq(已废弃)
remark:'', // 已添加订单号列表(分号分隔) - rqrq
addedOrderNoList: [], // 已添加订单号数组 - rqrq
// ==================== 订单管理弹窗相关 - rqrq ====================
orderManageDialogVisible: false, // 订单管理弹窗显示状态 - rqrq
orderManageData: { // 订单管理输入数据 - rqrq
orderNo: '',
releaseNo: '*',
sequenceNo: '*'
},
tempOrderList: [], // 临时订单明细列表(不汇总) - rqrq
tempOrderListLoading: false, // 临时订单列表加载状态 - rqrq
addOrderTempLoading: false, // 添加订单到临时列表按钮loading - rqrq
summaryLoading: false, // 汇总按钮loading状态 - rqrq
// 订单添加多site确认:shipment候选 - rqrq
shipmentSiteSelectModalFlag: false,
shipmentSiteSelectList: [],
shipmentSiteSelectedRow: null,
// 订单添加多site确认:shoporder/slittingorder候选 - rqrq
shopOrderSiteSelectFlag: false,
shopOrderCandidateList: [],
// 多site二次查询时锁定当前输入的订单号与工厂编号 - rqrq
pendingOrderManageData: {
orderNo: '',
releaseNo: '*',
sequenceNo: '*',
site: '',
},
}
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 220
})
},
created () {
// 按钮控制
// this.getButtonAuthData()
//this.getTableUserColumn(this.$route.meta.menuId+'Table2',2)
this.getUserNotifyNo()
},
computed: {
// 获取订单类型的中文名称 - rqrq
orderTypeText() {
const typeMap = {
'slittingorder': '分切订单',
'shipment': '销售发货',
'shoporder': '成品订单'
}
return typeMap[this.orderType] || '未知类型'
},
// 新增物料弹框置灰展示当前过滤Site - rqrq
selectMaterialDisplaySite() {
if (this.isMaterialDetailModal) {
return String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
}
return String(this.materialDialogSite || '').trim()
},
// 新增工单物料弹窗表格列配置(根据订单类型动态显示批次号列) - rqrq
displayColumnList2() {
// 基础列配置
let baseColumns = [...this.columnList2]
// 如果订单类型是报废,在物料号后面插入批次号列 - rqrq
if (this.orderType === 'baofei') {
const batchColumn = {
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2BatchNo',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'batchNo',
headerAlign: 'center',
align: 'center',
columnLabel: '批次号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
}
const remarkColumn = {
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2Remark',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'remark',
headerAlign: 'center',
align: 'center',
columnLabel: '导入数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
}
// 在第一个列(物料号)后面插入批次号列 - rqrq
baseColumns.splice(1, 0, batchColumn)
baseColumns.splice(2, 0, remarkColumn)
}
return baseColumns
}
},
methods: {
tabClick(tab, event) {
// 刷新当前标签页的表格数据
this.refreshCurrentTabTable()
},
refreshCurrentTabTable() {
if (this.notifyNo === '' || !this.notifyNo) {
return
}
if (this.activeName === 'sub') {
// 使用当前选中的行数据,如果没有则使用申请单基本信息
let queryData = {
site: this.notifyData.site || this.$store.state.user.site,
notifyNo: this.notifyNo,
orderType: 'shoporder',
}
// 如果当前行有数据,合并进去
if (
this.currentRow &&
this.currentRow !== '' &&
this.currentRow.notifyNo
) {
queryData = {
...this.currentRow,
orderType: 'shoporder',
}
}
this.dataListLoading = true
searchNotifyMaterialListNew(queryData)
.then(({ data }) => {
this.dataListLoading = false
if (data && data.code === 0) {
this.materialDetailList = data.rows
} else {
this.materialDetailList = []
}
})
.catch(() => {
this.dataListLoading = false
this.materialDetailList = []
})
}
},
materialDetailTableRowClassName({ row, rowIndex }) {
if (
row.qtyToIssueOriginal < row.qtyToIssue &&
new Date(row.needDate) <
new Date(this.dayjs().format('YYYY-MM-DD HH:mm'))
) {
return 'error-row'
}
return ''
},
changeData(row) {
this.currentRow = JSON.parse(JSON.stringify(row))
this.refreshCurrentTabTable()
},
getBaseList(val, type) {
this.tagNo = val
let conSql = ''
this.$nextTick(() => {
let strVal = ''
if (val === 515) {
strVal = this.seqNoData.sResourceid
conSql =
" and site = '" +
this.notifyData.site +
"'" +
" and bu_no = '" +
this.notifyData.bu +
"'"
this.$refs.baseList.init(val, strVal, conSql)
}
if (val === 216) {
strVal = this.seqNoData.sWorkcenterno
conSql =
" and site = '" +
this.notifyData.site +
"'" +
" and bu_no = '" +
this.notifyData.bu +
"'"
this.$refs.baseList.init(val, strVal, conSql)
}
if (val === 215) {
strVal = this.notifyOrderData.locationNo
this.$refs.baseList.init(val, strVal)
}
})
},
tableRowClassName({ row, rowIndex }) {
if (row.qtyToIssue > row.qtyAvailable) {
return 'error-row'
}
return ''
},
// 报废导入表格行样式:导入数量大于可用库存时行变红 - rqrq
seqNoTableRowClassName({ row, rowIndex }) {
// 只有报废类型且remark存在时才判断 - rqrq
if (this.orderType === 'baofei' && row.remark !== undefined) {
const remarkQty = Number(row.remark || 0)
const availableQty = Number(row.availableQty || 0)
// 导入数量大于可用库存时变红 - rqrq
if (remarkQty > availableQty) {
return 'baofei-error-row'
}
}
return ''
},
// 列表方法的回调
getBaseData(val) {
if (this.tagNo === 515) {
this.seqNoData.sResourceid = val.resource_id
}
if (this.tagNo === 215) {
this.notifyOrderData.locationNo = val.location_id
}
if (this.tagNo === 216) {
this.seqNoData.sWorkcenterno = val.work_center_no
}
},
getUserNotifyNo() {
let inData = {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
}
this.getAllNotifyStatus()
getUserNoOrderNotifyNo(inData).then(({ data }) => {
if (data.code === 0) {
if (data.row != null) {
this.notifyNo = data.row.notifyNo
this.notifyData = data.row
this.getNotifyNoOrderDetail()
/* this.searchOtherPart('非BOM物料')
this.searchOtherPart('不管控物料') */
} else {
this.notifyNo = ''
this.notifyData = {
site: '',
bu: '',
notifyNo: '',
notifyDate: '',
enteredDate: '',
userName: '',
userDisplay: '',
remark: '',
planIssueDate: '',
}
this.dataList = []
}
} else {
this.notifyNo = ''
this.notifyData = {
site: '',
bu: '',
notifyNo: '',
notifyDate: '',
enteredDate: '',
userName: '',
userDisplay: '',
remark: '',
planIssueDate: '',
}
this.dataList = []
}
})
},
getNotifyNoOrderDetail() {
let inData = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
}
getNotifyNoOrderDetail(inData).then(({ data }) => {
if (data.code === 0) {
this.dataList = data.rows
}
})
},
addNotify() {
//this.showAddNotifyTypeDialog = true
let inData = {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
orderType: 'otherOrder', // rqrq - 固定为shoporder类型
}
createNoOrderNotify(inData).then(({ data }) => {
if (data.code === 0) {
this.showAddNotifyTypeDialog = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {},
})
this.getUserNotifyNo()
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
confirmAddNotify() {
let outWorkOrderFlag = 'N'
if (this.selectedNotifyType === 'outsourced') {
outWorkOrderFlag = 'Y'
} else {
outWorkOrderFlag = 'N'
}
let inData = {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
outWorkOrderFlag: outWorkOrderFlag,
remark: this.selectedNotifyRemark,
orderType: 'otherOrder', // rqrq - 固定为shoporder类型
}
this.getAllNotifyStatus()
createNoOrderNotify(inData).then(({ data }) => {
if (data.code === 0) {
this.showAddNotifyTypeDialog = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {},
})
this.getUserNotifyNo()
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
chooseSOS(row) {
if (this.dataList.length > 0) {
//这边是有个判断的,判断派工单号不能重复
let stop = false
for (let i = 0; i < this.dataList.length; i++) {
if (
this.dataList[i].orderNo == row.orderNo &&
this.dataList[i].releaseNo == row.releaseNo &&
this.dataList[i].sequenceNo == row.sequenceNo
) {
stop = true
}
}
if (stop) {
this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
confirmButtonText: '确定',
})
return false
}
}
let inData = {
site: this.$store.state.user.site,
orderNo: row.orderNo,
releaseNo: row.releaseNo,
sequenceNo: row.sequenceNo,
}
this.chooseLoading = true
getShopOrderFromIFSWithOrderNo(inData)
.then(({ data }) => {
if (data.code === 0) {
console.log('data', data)
this.notifyOrderData.partNo = data.rows[0].partNo
this.notifyOrderData.orderNo = data.rows[0].orderNo
this.notifyOrderData.site = this.$store.state.user.site
this.notifyOrderData.partDesc = data.rows[0].partDesc
this.notifyOrderData.qtyRequired = data.rows[0].lotSize
this.notifyOrderData.releaseNo = data.rows[0].releaseNo
this.notifyOrderData.issureQty = ''
this.notifyOrderData.needDate =
this.dayjs().format('YYYY-MM-DD HH:mm')
this.notifyOrderData.sequenceNo = data.rows[0].sequenceNo
this.saveSeqNoModalFlag = true
} else {
this.$meassage.error(data.msg)
return
}
})
.finally(() => {
this.chooseLoading = false
})
},
saveSOS() {
if (
this.notifyOrderData.needDate == null ||
this.notifyOrderData.needDate == ''
) {
this.$message.warning('请选择时间!')
return false
}
// if (
// this.notifyOrderData.issureQty == null ||
// this.notifyOrderData.issureQty == '' ||
// this.notifyOrderData.issureQty < 0
// ) {
// this.$message.warning('请填写领取数量!')
// return false
// }
let row = this.notifyOrderData
console.log('row', row, this.dataList)
if (this.dataList.length > 0) {
let stop = false
for (let i = 0; i < this.dataList.length; i++) {
if (
this.dataList[i].soorderNo == row.orderNo &&
this.dataList[i].releaseNo == row.releaseNo &&
this.dataList[i].sequenceNo == row.sequenceNo
) {
stop = true
}
}
if (stop) {
this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
confirmButtonText: '确定',
})
return false
}
}
this.$confirm('确定选择工单' + row.orderNo + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
let inData = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
fgPartNo: row.partNo,
soorderNo: row.orderNo,
opsItemNo: row.itemNo,
sequenceNo: row.sequenceNo,
releaseNo: row.releaseNo,
needDate: row.needDate,
issureQty: row.issureQty,
}
saveSOIssueNotifyOrderList(inData).then(({ data }) => {
if (data.code === 0) {
this.saveSeqNoModalFlag = false
row.itemNo = data.itemNo
this.getNotifyNoOrderDetail()
this.enterSOS(row)
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
})
},
qtyAllForSeqNo() {
this.notifyOrderData.issureQty = this.notifyOrderData.qtyRequired
},
qtyAllForBom(row) {
row.qtyToIssue = row.qtyRequired
},
enterSOSDetail(row) {
let rows = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
orderNo: row.soorderNo,
seqNo: row.seqNo,
partNo: row.fgPartNo,
itemNo: row.itemNo,
releaseNo: row.releaseNo,
sequenceNo: row.sequenceNo,
}
this.clickrow = row
//this.searchNotifyMaterialList(rows)
this.enterSOS(rows)
},
enterSOS(row) {
console.log('row', row)
this.seqNoModalFlag = false
this.materialModalFlag = true
this.sobomList = []
this.sobomData = {
orderNo: row.orderNo,
seqNo: row.seqNo,
partNo: row.partNo,
}
this.bomLoadFlag = true
let inData = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
partNo: row.partNo,
itemNo: row.itemNo,
}
getNoOrderMaterialList(inData).then(({ data }) => {
this.bomLoadFlag = false
if (data.code === 0) {
this.sobomList = data.rows
for (let i = 0; i < this.sobomList.length; i++) {
this.sobomList[i].itemNo = inData.itemNo
/* if(!this.sobomList[i].qtyToIssue){
this.$set(this.sobomList[i], 'qtyToIssue', this.sobomList[i].qtyRequired)
} */
}
}
})
},
// 从申请明细弹框打开选择物料弹框
openSelectMaterialModalForDetail() {
this.isMaterialDetailModal = true
// 设置模板编号和名称(使用生产订单号)
this.modelCode = this.sobomData.orderNo || ''
this.modelName = this.sobomData.partNo || ''
// 将sobomList中的数据转换为选择物料弹框需要的格式,显示在右侧"已有物料"列表中
const detailSite = String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
this.selectedMaterialList = this.sobomList.map(item => {
const convertedItem = JSON.parse(JSON.stringify(item))
// 将qtyToIssue转换为applyQty
convertedItem.applyQty = convertedItem.qtyToIssue || 0
// 确保partNo存在(可能使用componentPartNo)
if (!convertedItem.partNo && convertedItem.componentPartNo) {
convertedItem.partNo = convertedItem.componentPartNo
}
// 列表展示补齐Site - rqrq
convertedItem.site = convertedItem.site || convertedItem.subSite || detailSite
convertedItem.subSite = convertedItem.subSite || convertedItem.site || detailSite
return convertedItem
})
// 重置分页
this.availableMaterialPage = 1
this.availableMaterialLimit = 100
this.$set(
this,
'componentPartNo',
''
) // 清空物料编码搜索条件
// 加载可选物料列表
this.loadAvailableMaterialList()
// 打开弹框
this.selectMaterialModalFlag = true
},
chooseSOSModal() {
this.seqNoData = {
site: this.$store.state.user.site,
orderNo: '',
releaseNo: '*',
sequenceNo: '*',
seqno: '',
sResourceid: '',
sWorkcenterno: '',
operatorId: '',
sShiftno: '',
startDate: this.dayjs().format('YYYY-MM-DD'),
endDate: this.dayjs().format('YYYY-MM-DD'),
}
this.seqNoList = []
// 清空已添加订单记录 - rqrq
this.addedOrderNoList = []
this.remark = ''
// 清空临时订单列表 - rqrq
this.tempOrderList = []
this.partNo = ''
// 打开弹窗时加载授权Site下拉,供添加物料行/选择物料使用 - rqrq
this.loadMaterialDialogSiteOptions()
this.seqNoModalFlag = true
},
// 应用授权Site到下拉选项,空授权时回退父site - rqrq
applyMaterialDialogSiteOptions(subSiteCodeList, parentSite) {
const normalizedList = Array.isArray(subSiteCodeList)
? Array.from(new Set(subSiteCodeList.map(code => String(code || '').trim()).filter(code => !!code)))
: []
const finalSiteCodeList = normalizedList.length > 0
? normalizedList
: (parentSite ? [parentSite] : [])
this.materialDialogSiteOptions = finalSiteCodeList.map(siteCode => ({
siteCode,
siteName: siteCode,
}))
if (!this.materialDialogSiteOptions.some(item => item.siteCode === this.materialDialogSite)) {
this.materialDialogSite = this.materialDialogSiteOptions.length > 0
? this.materialDialogSiteOptions[0].siteCode
: ''
}
},
// 加载新增工单物料弹窗Site下拉(优先缓存,再拉授权接口) - rqrq
loadMaterialDialogSiteOptions() {
const userName = String(localStorage.getItem('userName') || this.$store.state.user.name || '').trim()
const parentSite = String(localStorage.getItem('site') || this.$store.state.user.site || '').trim()
const cacheSubSiteCodeList = getAuthorizedSubSiteCodeList(this.$store.state.user.subSiteCodeList)
this.applyMaterialDialogSiteOptions(cacheSubSiteCodeList, parentSite)
if (!userName || !parentSite) {
return Promise.resolve()
}
this.materialDialogSiteLoading = true
return getUserAuthorizedSubSiteCodes({ userName, site: parentSite })
.then(({ data }) => {
if (data && data.code === 0) {
this.applyMaterialDialogSiteOptions(data.data || [], parentSite)
}
})
.catch((error) => {
console.error('获取用户授权Site失败:', error)
})
.finally(() => {
this.materialDialogSiteLoading = false
})
},
// 校验并返回当前弹窗选中的Site - rqrq
resolveMaterialDialogSite() {
const selectedSite = String(this.materialDialogSite || '').trim()
if (!selectedSite) {
this.$message.warning('请先选择Site!')
return ''
}
return selectedSite
},
searchSOSRouting() {
// 初始化seqNoList如果不存在
if (!this.seqNoList) {
this.seqNoList = []
}
// 判断this.seqNoList中是否已存在相同的orderNo、releaseNo、sequenceNo组合
const exists = this.seqNoList.some(
(row) =>
row.orderNo === this.seqNoData.orderNo &&
row.releaseNo === this.seqNoData.releaseNo &&
row.sequenceNo === this.seqNoData.sequenceNo
)
if (exists) {
this.$message.warning('该工单数据已存在,请先删除再添加!')
return false
}
const dataListExists = this.dataList.some(
(row) =>
row.soorderNo === this.seqNoData.orderNo &&
row.releaseNo === this.seqNoData.releaseNo &&
row.sequenceNo === this.seqNoData.sequenceNo
)
if (dataListExists) {
this.$message.warning('该工单的数据已添加过,请先删除再添加!')
return false
}
// 直接创建一行数据并添加到表格中,不调用接口
const newRow = {
orderNo: this.seqNoData.orderNo,
releaseNo: this.seqNoData.releaseNo,
sequenceNo: this.seqNoData.sequenceNo,
lineItemNo: '',
materialLineStatus: '',
componentPartNo: '',
componentPartDesc: '',
applyQty: 0,
qtyIssued: 0,
qtyRequired: 0,
qtyReserved: 0,
uom: '',
partNo: '',
partDesc: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
this.$message.success('添加成功')
// 清空输入框
this.seqNoData.orderNo = ''
this.seqNoData.releaseNo = ''
this.seqNoData.sequenceNo = ''
},
// ==================== 订单管理弹窗相关方法 - rqrq ====================
// 打开订单管理弹窗:必须先选中工厂编号,查询按精确site不带% - rqrq
openOrderManageDialog() {
if (!this.resolveMaterialDialogSite()) {
return
}
this.orderManageDialogVisible = true
// 不清空临时列表,保留上次输入的数据 - rqrq
// this.tempOrderList = []
},
// 关闭订单管理弹窗 - rqrq
closeOrderManageDialog() {
this.orderManageDialogVisible = false
// 清空输入框 - rqrq
this.orderManageData = {
orderNo: '',
releaseNo: '*',
sequenceNo: '*'
}
},
// 添加订单到临时列表(不汇总);按弹窗工厂编号精确查,不再用site% - rqrq
addOrderToTempList() {
// 1. 参数校验 - rqrq
if (!this.orderManageData.orderNo || this.orderManageData.orderNo.trim() === '') {
this.$message.warning('请输入Order No!')
return
}
const selectedSite = this.resolveMaterialDialogSite()
if (!selectedSite) {
return
}
if (this.addOrderTempLoading) {
return
}
// 锁定当前输入,供二次查询使用 - rqrq
this.pendingOrderManageData = {
orderNo: this.orderManageData.orderNo.trim(),
releaseNo: this.orderManageData.releaseNo || '*',
sequenceNo: this.orderManageData.sequenceNo || '*',
site: selectedSite,
}
if (this.orderType === 'shipment') {
this.addShipmentOrderToTempList()
return
}
// 分切/成品订单:按下拉工厂编号精确查工单 - rqrq
this.addShopOrderToTempList()
},
// 销售发货:按弹窗工厂编号精确查询,不再拼接% - rqrq
addShipmentOrderToTempList() {
this.addOrderTempLoading = true
const requestParams = {
site: this.pendingOrderManageData.site || this.materialDialogSite,
orderNo: this.pendingOrderManageData.orderNo,
}
getShipmentAndLineForIssure(requestParams)
.then(({ data }) => {
if (!(data && data.code === 0)) {
this.$message.error((data && data.msg) || '获取订单物料失败!')
return
}
if (data.needSelectSite) {
this.shipmentSiteSelectList = (data.shipments || []).map((item) => this.normalizeShipmentSiteRow(item))
this.shipmentSiteSelectedRow = null
if (this.shipmentSiteSelectList.length === 0) {
this.$message.warning('未查询到数据!')
return
}
this.shipmentSiteSelectModalFlag = true
return
}
this.appendOrderMaterialToTempList(
data.rows || [],
this.pendingOrderManageData.site || this.materialDialogSite
)
})
.catch((error) => {
this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
})
.finally(() => {
this.addOrderTempLoading = false
})
},
// 兼容Shipment头大写/驼峰字段 - rqrq
normalizeShipmentSiteRow(item) {
if (!item) {
return {}
}
return {
contract: item.contract || item.CONTRACT || '',
shipmentId: item.shipmentId || item.SHIPMENT_ID || '',
shipmentType: item.shipmentType || item.SHIPMENT_TYPE || '',
receiverId: item.receiverId || item.RECEIVER_ID || '',
receiverDesc: item.receiverDesc || item.RECEIVER_DESC || '',
state: item.state || item.STATE || '',
plannedShipDate: item.plannedShipDate || item.PLANNED_SHIP_DATE || '',
sourceRefTypeDb: item.sourceRefTypeDb || item.SOURCE_REF_TYPE_DB || '',
}
},
handleShipmentSiteSelectChange(row) {
this.shipmentSiteSelectedRow = row
},
// 多CONTRACT确认后:按选定CONTRACT二次查询ShipmentLine - rqrq
confirmShipmentSiteSelect() {
if (!this.shipmentSiteSelectedRow || !this.shipmentSiteSelectedRow.contract) {
this.$message.warning('请先选择一条Shipment!')
return
}
if (this.addOrderTempLoading) {
return
}
this.addOrderTempLoading = true
const requestParams = {
site: this.pendingOrderManageData.site || this.materialDialogSite,
orderNo: this.pendingOrderManageData.orderNo,
selectedSite: this.shipmentSiteSelectedRow.contract,
}
getShipmentAndLineForIssure(requestParams)
.then(({ data }) => {
if (data && data.code === 0) {
this.shipmentSiteSelectModalFlag = false
this.appendOrderMaterialToTempList(
data.rows || [],
this.shipmentSiteSelectedRow.contract || this.pendingOrderManageData.site || this.materialDialogSite
)
return
}
this.$message.error((data && data.msg) || '获取订单物料失败!')
})
.catch((error) => {
this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
})
.finally(() => {
this.addOrderTempLoading = false
})
},
// 成品/分切:按下拉工厂编号精确查ShopOrder,不再拼接% - rqrq
addShopOrderToTempList() {
this.addOrderTempLoading = true
let materialFetchStarted = false
const shopOrderQuery = {
site: this.pendingOrderManageData.site || this.materialDialogSite,
orderNo: this.pendingOrderManageData.orderNo,
releaseNo: this.pendingOrderManageData.releaseNo,
sequenceNo: this.pendingOrderManageData.sequenceNo,
}
getShopOrderFromIFSWithOrderNo(shopOrderQuery)
.then(({ data }) => {
if (!(data && data.code === 0 && data.rows && data.rows.length > 0)) {
this.$message.error((data && data.msg) || '未查询到工单')
return
}
const allowedStatuses = ['Released', 'Reserved', 'Started']
const validOrders = data.rows.filter((item) => allowedStatuses.includes(item.objstate))
if (data.rows.length > 0 && validOrders.length === 0) {
this.$message.error('生产订单' + this.pendingOrderManageData.orderNo + '状态不允许发料,请检查!')
return
}
if (validOrders.length === 1) {
materialFetchStarted = true
return this.fetchShopOrderMaterialToTempList(validOrders[0])
}
this.shopOrderCandidateList = validOrders
this.shopOrderSiteSelectFlag = true
})
.catch((error) => {
this.$message.error((error && error.msg) || '查询工单失败')
})
.finally(() => {
if (!materialFetchStarted) {
this.addOrderTempLoading = false
}
})
},
// 用户选定具体site(contract)后拉取物料 - rqrq
confirmShopOrderSite(row) {
if (!row) {
return
}
this.shopOrderSiteSelectFlag = false
this.fetchShopOrderMaterialToTempList(row)
},
// 使用精确site调用ShopOrderMaterial链路,优先弹窗工厂编号 - rqrq
fetchShopOrderMaterialToTempList(shopOrder) {
const selectedSite = this.pendingOrderManageData.site || this.materialDialogSite
const contract = selectedSite || (shopOrder && (shopOrder.contract || shopOrder.site)) || ''
if (!contract) {
this.addOrderTempLoading = false
this.$message.error('缺少工厂编号,无法查询物料')
return Promise.resolve()
}
this.addOrderTempLoading = true
const materialQuery = {
site: contract,
orderNo: (shopOrder && shopOrder.orderNo) || this.pendingOrderManageData.orderNo,
releaseNo: (shopOrder && shopOrder.releaseNo) || this.pendingOrderManageData.releaseNo,
sequenceNo: (shopOrder && shopOrder.sequenceNo) || this.pendingOrderManageData.sequenceNo,
}
return getShopOrderAndMaterialByShoporder(materialQuery)
.then(({ data }) => {
if (data && data.code === 0) {
this.appendOrderMaterialToTempList(data.rows || [], contract, shopOrder)
return
}
this.$message.error((data && data.msg) || '获取订单物料失败!')
})
.catch((error) => {
this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
})
.finally(() => {
this.addOrderTempLoading = false
})
},
// 字段映射后追加到临时列表,并回填subSite为弹窗工厂编号 - rqrq
appendOrderMaterialToTempList(materialList, selectedSite, shopOrder) {
if (!materialList || materialList.length === 0) {
this.$message.warning('该订单没有物料明细!')
return
}
const orderNo = (shopOrder && shopOrder.orderNo) || this.pendingOrderManageData.orderNo
const releaseNo = (shopOrder && shopOrder.releaseNo) || this.pendingOrderManageData.releaseNo || ''
const sequenceNo = (shopOrder && shopOrder.sequenceNo) || this.pendingOrderManageData.sequenceNo || ''
const subSite = selectedSite || this.pendingOrderManageData.site || this.materialDialogSite || ''
materialList.forEach((item) => {
if (this.orderType === 'shipment') {
if (item.inventoryPartNo) {
item.componentPartNo = item.inventoryPartNo
}
if (item.shipmentId) {
item.orderNo = item.shipmentId
}
if (item.inventoryQty !== undefined && !item.applyQty) {
item.applyQty = item.inventoryQty
}
if (item.inventoryUom && !item.uom) {
item.uom = item.inventoryUom
}
} else if (item.qtyRequired !== undefined && !item.applyQty) {
item.applyQty = item.qtyRequired
}
item.orderNo = orderNo
item.releaseNo = releaseNo
item.sequenceNo = sequenceNo
item.partNo = item.componentPartNo
item.lineItemNo = item.lineItemNo || ''
item.materialLineStatus = item.materialLineStatus || ''
item.startDate = item.startDate || ''
item.finishDate = item.finishDate || ''
item.needDate = item.needDate || ''
item.subSite = item.subSite || item.contract || subSite || item.site || this.$store.state.user.site
})
this.tempOrderList.push(...materialList)
if (!this.addedOrderNoList.includes(orderNo)) {
this.addedOrderNoList.push(orderNo)
this.remark = this.addedOrderNoList.join(';')
}
this.$message.success('订单 ' + orderNo + ' 添加成功,共 ' + materialList.length + ' 条物料!')
this.orderManageData.orderNo = ''
},
// 删除临时订单列表中的某一行 - rqrq
deleteTempOrderRow(index) {
this.tempOrderList.splice(index, 1)
this.$message.success('删除成功!')
},
// 汇总到主列表;同料号不同subSite分开保留 - rqrq
summaryOrderToMainList() {
if (!this.tempOrderList || this.tempOrderList.length === 0) {
this.$message.warning('临时列表为空,无法汇总!')
return
}
this.summaryLoading = true
try {
// 1. 创建物料映射表,用于汇总;同料号不同subSite分开保留 - rqrq
const materialMap = new Map()
// 2. 先将临时列表的数据按物料号+subSite汇总 - rqrq
this.tempOrderList.forEach(item => {
const partNo = item.componentPartNo
if (!partNo) return
const subSite = item.subSite || item.contract || item.site || this.$store.state.user.site
const mapKey = partNo + '||' + subSite
if (materialMap.has(mapKey)) {
// 已存在,累加数量 - rqrq
const existing = materialMap.get(mapKey)
existing.applyQty = (parseFloat(existing.applyQty) || 0) + (parseFloat(item.applyQty) || 0)
// 合并订单号到remark - rqrq
if (item.orderNo && !existing.remark.includes(item.orderNo)) {
existing.remark = existing.remark ? existing.remark + ';' + item.orderNo : item.orderNo
}
} else {
// 新增 - rqrq
materialMap.set(mapKey, {
partNo: partNo,
componentPartNo: partNo,
height: item.height || '',
isInWh: item.isInWh || '',
availableQty: item.availableQty || 0, // rqrq - 新增可用库存字段
applyQty: parseFloat(item.applyQty) || 0,
componentPartDesc: item.componentPartDesc || item.partDesc || '',
uom: item.uom || '',
orderNo: item.orderNo || '',
releaseNo: item.releaseNo || '',
sequenceNo: item.sequenceNo || '',
lineItemNo: '',
materialLineStatus: '',
startDate: '',
finishDate: '',
needDate: '',
subSite: subSite,
remark: item.orderNo || '', // 初始remark为订单号 - rqrq
})
}
})
// 3. 与主列表seqNoList中现有物料汇总 - rqrq
this.seqNoList.forEach(existingItem => {
const partNo = existingItem.componentPartNo
if (!partNo) return
const subSite = existingItem.subSite || existingItem.contract || existingItem.site || this.$store.state.user.site
const mapKey = partNo + '||' + subSite
if (materialMap.has(mapKey)) {
// 累加数量 - rqrq
const mapItem = materialMap.get(mapKey)
mapItem.applyQty = (parseFloat(mapItem.applyQty) || 0) + (parseFloat(existingItem.applyQty) || 0)
// 合并remark - rqrq
if (existingItem.remark) {
mapItem.remark = existingItem.remark + ';' + mapItem.remark
}
} else {
// 主列表中的物料在临时列表没有,直接保留 - rqrq
materialMap.set(mapKey, existingItem)
}
})
// 4. 更新主列表seqNoList为汇总后的结果 - rqrq
this.seqNoList = Array.from(materialMap.values())
this.$message.success('汇总成功!共 ' + this.seqNoList.length + ' 行物料!')
// 5. 清空临时列表 - rqrq
this.tempOrderList = []
// 6. 关闭弹窗 - rqrq
this.orderManageDialogVisible = false
} catch (error) {
this.$message.error('汇总失败:' + error.message)
} finally {
this.summaryLoading = false
}
},
// 根据订单号添加物料到列表 - rqrq(已废弃,保留用于兼容)
addOrderToList() {
// 1. 参数校验 - rqrq
if (!this.seqNoData.orderNo || this.seqNoData.orderNo.trim() === '') {
this.$message.warning('请输入Order No!')
return
}
// 2. 检查订单号是否已添加 - rqrq
if (this.addedOrderNoList.includes(this.seqNoData.orderNo)) {
this.$message.warning('该订单已添加过,请勿重复添加!')
return
}
// 3. 根据订单类型选择API - rqrq
let apiMethod = null
if (this.orderType === 'shipment') {
// 销售发货类型使用getShipmentAndLineForIssure - rqrq
apiMethod = getShipmentAndLineForIssure
} else {
// 分切订单和成品订单使用getShopOrderAndMaterialByShoporder - rqrq
apiMethod = getShopOrderAndMaterialByShoporder
}
// 4. 准备请求参数 - rqrq
const requestParams = {
site: this.$store.state.user.site,
orderNo: this.seqNoData.orderNo.trim(),
releaseNo: this.seqNoData.releaseNo || '*',
sequenceNo: this.seqNoData.sequenceNo || '*',
}
// 5. 调用API获取订单物料 - rqrq
this.addOrderLoading = true
apiMethod(requestParams)
.then(({ data }) => {
if (data && data.code === 0) {
// 获取返回的物料列表 - rqrq
let materialList = data.rows || []
if (!materialList || materialList.length === 0) {
this.$message.warning('该订单没有物料明细!')
return
}
// 5. 字段映射处理 - 不同API返回字段名不一致 - rqrq
console.log('原始返回数据:', materialList) // 调试用 - rqrq
materialList.forEach(item => {
if (this.orderType === 'shipment') {
// 销售发货API字段映射 - rqrq
// inventoryPartNo -> partNo - rqrq
if (item.inventoryPartNo ) {
item.componentPartNo = item.inventoryPartNo
}
if(item.shipmentId){
item.orderNo = item.shipmentId
}
// inventoryQty -> applyQty - rqrq
if (item.inventoryQty !== undefined && !item.applyQty) {
item.applyQty = item.inventoryQty
}
// inventoryUom -> uom - rqrq
if (item.inventoryUom && !item.uom) {
item.uom = item.inventoryUom
}
// partDesc保持不变 - rqrq
} else {
// 分切/成品订单API字段映射 - rqrq
// qtyRequired -> applyQty - rqrq
if (item.qtyRequired !== undefined && !item.applyQty) {
item.applyQty = item.qtyRequired
}
}
})
console.log('字段映射后数据:', materialList) // 调试用 - rqrq
// 6. 按物料号汇总后端返回的物料 - rqrq
const backendMaterialMap = new Map()
materialList.forEach(item => {
const partNo = item.componentPartNo
if (!partNo) return
if (backendMaterialMap.has(partNo)) {
// 已存在,累加数量 - rqrq
const existing = backendMaterialMap.get(partNo)
existing.applyQty = (parseFloat(existing.applyQty) || 0) + (parseFloat(item.applyQty) || 0)
} else {
// 新增 - rqrq
backendMaterialMap.set(partNo, {
partNo: partNo,
componentPartNo: partNo,
height: item.height || '',
isInWh: item.isInWh || '',
applyQty: parseFloat(item.applyQty) || 0,
componentPartDesc: item.componentPartDesc || item.partDesc || '',
uom: item.uom || '',
orderNo: this.seqNoData.orderNo,
releaseNo: this.seqNoData.releaseNo || '',
sequenceNo: this.seqNoData.sequenceNo || '',
lineItemNo: '',
materialLineStatus: '',
startDate: '',
finishDate: '',
needDate: '',
remark: this.seqNoData.orderNo, // 添加订单号到备注 - rqrq
})
}
})
// 7. 与seqNoList中现有物料汇总 - rqrq
this.seqNoList.forEach(existingItem => {
const partNo = existingItem.componentPartNo
if (!partNo) return
if (backendMaterialMap.has(partNo)) {
// 累加数量 - rqrq
const backendItem = backendMaterialMap.get(partNo)
backendItem.applyQty = (parseFloat(backendItem.applyQty) || 0) + (parseFloat(existingItem.applyQty) || 0)
// 合并备注(如果现有项有备注,追加订单号) - rqrq
if (existingItem.remark) {
backendItem.remark = existingItem.remark + ';' + this.seqNoData.orderNo
}
} else {
// seqNoList中的物料在后端没有,直接保留 - rqrq
backendMaterialMap.set(partNo, existingItem)
}
})
// 8. 更新seqNoList为汇总后的结果 - rqrq
this.seqNoList = Array.from(backendMaterialMap.values())
console.log('更新后的seqNoList:', this.seqNoList) // 调试用 - rqrq
// 9. 记录已添加的订单号 - rqrq
this.addedOrderNoList.push(this.seqNoData.orderNo)
// 更新已添加订单显示(分号分隔) - rqrq
this.remark = this.addedOrderNoList.join(';')
this.$message.success(`订单 ${this.seqNoData.orderNo} 添加成功,共 ${materialList.length} 条物料,汇总后 ${this.seqNoList.length} 行!`)
// 10. 清空输入框 - rqrq
this.seqNoData.orderNo = ''
} else {
this.$message.error(data.msg || '获取订单物料失败!')
}
})
.catch((error) => {
this.$message.error(error.msg || '获取订单物料失败,请稍后重试')
})
.finally(() => {
this.addOrderLoading = false
})
},
// 添加行:从接口查询数据并添加到列表
addRowFromQuery() {
if(!this.partNo){
this.$message.warning('请输入物料号!')
return
}
const selectedSite = this.resolveMaterialDialogSite()
if (!selectedSite) {
return
}
// 初始化seqNoList如果不存在
if (!this.seqNoList) {
this.seqNoList = []
}
// 准备查询参数:site取弹窗下拉选中值 - rqrq
const queryParams = {
site: selectedSite,
componentPartNo: this.partNo || '', // 使用物料号输入框的值
orderType: this.orderType, // 使用订单类型
}
this.addLineLoading = true
queryPartAttributeData(queryParams)
.then(({ data }) => {
if (data.code === 0 && data.rows ) {
// 过滤掉已存在的物料(根据partNo判断)
const existingPartNos = this.seqNoList.map((item) => item.partNo)
const newRows = existingPartNos.includes(data.rows.partNo)
if (newRows) {
this.$message.warning('查询到的物料已存在于列表中!')
return
}
// 确保数据结构完整;subSite回填弹窗选中Site - rqrq
const newRow = {
partNo: data.rows.partNo || '',
height: data.rows.height || '',
isInWh: data.rows.isInWh || '',
availableQty: data.rows.availableQty || 0, // rqrq - 新增可用库存字段
componentPartNo: data.rows.partNo || '',
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
subSite: selectedSite,
}
this.seqNoList.push(newRow)
console.log('添加的新行:', newRow) // 调试用;
this.$set(this, 'partNo', '') // 清空物料号输入框
} else {
this.$message.warning(data.msg || '查询无数据')
}
})
.catch((error) => {
this.$message.error(error.msg || '查询失败,请稍后重试')
}).finally(() => {
this.addLineLoading = false
})
},
deleteSeqNoByOrderNo() {
if (this.seqNoData.orderNo == null || this.seqNoData.orderNo == '') {
this.$message.warning('请输入OrderNo!')
return false
}
if (this.seqNoList.length === 0) {
this.$message.warning('没有可删除的数据!')
return false
}
// 统计要删除的行数
const deleteCount = this.seqNoList.filter(
(row) => row.orderNo === this.seqNoData.orderNo
).length
if (deleteCount === 0) {
this.$message.warning('未找到匹配的OrderNo数据!')
return false
}
this.$confirm(
`确定要删除OrderNo为 ${this.seqNoData.orderNo}${deleteCount} 条数据吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
// 删除所有匹配的orderNo行
this.seqNoList = this.seqNoList.filter(
(row) => row.orderNo !== this.seqNoData.orderNo
)
this.$message.success(`成功删除 ${deleteCount} 条数据`)
})
.catch(() => {
// 用户取消删除
})
},
deleteSeqNoRow(index) {
if (index < 0 || index >= this.seqNoList.length) {
this.$message.warning('删除失败,索引无效!')
return false
}
const row = this.seqNoList[index]
this.$confirm(`确定要删除这条数据吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.seqNoList.splice(index, 1)
this.$message.success('删除成功')
})
.catch(() => {
// 用户取消删除
})
},
// 打开选择物料弹框
openSelectMaterialModal() {
const selectedSite = this.resolveMaterialDialogSite()
if (!selectedSite) {
return
}
this.isMaterialDetailModal = false // 标识从新增工单物料弹框打开
// 设置模板编号和名称
this.modelCode = this.seqNoData.orderNo
this.modelName = this.seqNoData.releaseNo
// 初始化已选列表为当前seqNoList中的数据,并补齐Site展示字段 - rqrq
this.selectedMaterialList = JSON.parse(JSON.stringify(this.seqNoList)).map((item) => {
item.site = item.site || item.subSite || selectedSite
item.subSite = item.subSite || item.site || selectedSite
return item
})
// 重置分页
this.availableMaterialPage = 1
// 加载可选物料列表(按弹窗Site过滤) - rqrq
this.loadAvailableMaterialList()
// 打开弹框
this.selectMaterialModalFlag = true
},
// 加载可选物料列表
loadAvailableMaterialList() {
// 新增物料弹窗取下拉Site;申请明细弹窗取当前行subSite,缺省回退登录site - rqrq
const selectedSite = this.isMaterialDetailModal
? String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
: String(this.materialDialogSite || '').trim()
if (!selectedSite) {
this.$message.warning('请先选择Site!')
this.availableMaterialList = []
this.availableMaterialTotal = 0
return
}
this.selectMaterialLoading = true
const params = {
page: this.availableMaterialPage,
limit: this.availableMaterialLimit,
componentPartNo: this.componentPartNo,
site: selectedSite,
}
noOrderList(params)
.then(({ data }) => {
this.selectMaterialLoading = false
if (data && data.code === 0) {
if (data.page) {
// 过滤掉已选中的物料
const selectedPartNos = this.selectedMaterialList.map(
(item) => item.partNo || item.componentPartNo
)
// 如果是从申请明细弹框打开的,还需要过滤掉sobomList中已存在的物料
if (this.isMaterialDetailModal && this.sobomList && this.sobomList.length > 0) {
const sobomPartNos = this.sobomList.map(
(item) => item.partNo || item.componentPartNo
)
selectedPartNos.push(...sobomPartNos)
}
this.availableMaterialList = data.page.list
.filter((item) => !selectedPartNos.includes(item.partNo))
.map((item) => {
// 列表展示与后续落库:补齐site/subSite - rqrq
const row = Object.assign({}, item)
row.site = row.site || selectedSite
row.subSite = row.subSite || row.site || selectedSite
return row
})
} else {
this.availableMaterialList = []
}
this.availableMaterialPage = data.page.currPage
this.availableMaterialLimit = data.page.pageSize
this.availableMaterialTotal = data.page.totalCount
} else {
this.availableMaterialList = []
if (data && data.msg) {
this.$message.warning(data.msg)
}
}
})
.catch((e) => {
this.selectMaterialLoading = false
this.availableMaterialList = []
this.availableMaterialTotal = 0
this.$message.error(e.msg || '加载数据失败')
})
},
// 左侧表格分页 - 每页条数改变
handleAvailableSizeChange(val) {
this.availableMaterialLimit = val
this.availableMaterialPage = 1
this.loadAvailableMaterialList()
},
// 左侧表格分页 - 当前页改变
handleAvailableCurrentChange(val) {
this.availableMaterialPage = val
this.loadAvailableMaterialList()
},
// 处理左侧表格选择变化
handleAvailableSelectionChange(selection) {
this.availableMaterialSelections = selection
},
// 处理右侧表格选择变化
handleSelectedSelectionChange(selection) {
this.selectedMaterialSelections = selection
},
// 左侧表格行点击
itemClickRow1(row) {
// 可以在这里实现行点击逻辑
},
// 右侧表格行点击
itemClickRow2(row) {
// 可以在这里实现行点击逻辑
},
// 判断行是否可选
selectFlag(row, index) {
return true // 所有行都可选
},
// 添加到已选列表
addToSelected() {
if (this.availableMaterialSelections.length === 0) {
this.$message.warning('请先选择要添加的物料!')
return false
}
// 将选中的项添加到已选列表
this.availableMaterialSelections.forEach((item) => {
// 检查是否已存在(使用propertiesItemNo或componentPartNo作为唯一标识)
const itemNo = item.partNo
const exists = this.selectedMaterialList.some(
(row) => row.PartNo === itemNo
)
if (!exists) {
const newItem = JSON.parse(JSON.stringify(item))
const selectedSite = this.selectMaterialDisplaySite
newItem.site = newItem.site || selectedSite
newItem.subSite = newItem.subSite || newItem.site || selectedSite
this.selectedMaterialList.push(newItem)
}
})
const addCount = this.availableMaterialSelections.length
// 清空选择
this.availableMaterialSelections = []
// 重新加载左侧数据(因为分页,需要重新获取以过滤掉已选中的)
this.loadAvailableMaterialList()
this.$message.success(`成功添加 ${addCount} 条数据`)
},
// 从已选列表移除
removeFromSelected() {
if (this.selectedMaterialSelections.length === 0) {
this.$message.warning('请先选择要删除的物料!')
return false
}
// 从已选列表中移除
const selectedItemNos = this.selectedMaterialSelections.map(
(item) => item.partNo
)
const removeCount = this.selectedMaterialSelections.length
this.selectedMaterialList = this.selectedMaterialList.filter(
(item) =>
!selectedItemNos.includes(
item.partNo
)
)
// 清空选择
this.selectedMaterialSelections = []
// 重新加载左侧数据(因为分页,需要重新获取,移除的项可能会出现在当前页)
this.loadAvailableMaterialList()
this.$message.success(`成功移除 ${removeCount} 条数据`)
},
// 确认选择物料
confirmSelectMaterial() {
if (this.isMaterialDetailModal) {
// 从申请明细弹框打开的情况,将右侧"已有物料"列表的完整数据更新到sobomList
const selectedItems = JSON.parse(JSON.stringify(this.selectedMaterialList))
// 将选中的物料转换为sobomList需要的格式
selectedItems.forEach(item => {
// 将applyQty转换为qtyToIssue
item.qtyToIssue = item.applyQty || 0
// 设置itemNo(使用sobomData中的itemNo,如果没有则使用空字符串)
item.itemNo = this.clickrow.itemNo
item.notifyNo = this.clickrow.notifyNo
item.soorderNo = this.clickrow.soorderNo
item.orderType = this.clickrow.orderType
item.site = this.$store.state.user.site
item.subSite = item.subSite || (this.clickrow && this.clickrow.subSite) || ''
// 确保componentPartNo存在
if (!item.componentPartNo) {
item.componentPartNo = item.partNo
}
})
// 将右侧"已有物料"列表的完整数据替换sobomList(包括原有和新增的)
this.sobomList = selectedItems
console.log("this.sobomList", this.sobomList);
this.isMaterialDetailModal = false
} else {
// 从新增工单物料弹框打开的情况,将数据添加到seqNoList,并回填弹窗Site - rqrq
const selectedSite = String(this.materialDialogSite || '').trim()
const selectedItems = JSON.parse(JSON.stringify(this.selectedMaterialList))
selectedItems.forEach(item => {
item.subSite = item.subSite || selectedSite
if (!item.componentPartNo) {
item.componentPartNo = item.partNo
}
})
this.seqNoList = selectedItems
}
// 关闭弹框
this.selectMaterialModalFlag = false
// 清空数据
this.availableMaterialList = []
this.selectedMaterialList = []
this.availableMaterialSelections = []
this.selectedMaterialSelections = []
this.$message.success('操作成功')
},
saveNoOrderMaterialDetail() {
for (let i = 0; i < this.sobomList.length; i++) {
if (
this.sobomList[i].qtyToIssue === '' ||
this.sobomList[i].qtyToIssue == null
) {
this.$message.warning('第'+(i+1)+'行数量为空,请填写申请数量!')
return false
}
this.sobomList[i].notifyNo = this.notifyNo
this.sobomList[i].site = this.$store.state.user.site
}
let materialList = this.sobomList.filter((item) => item.qtyToIssue > 0)
if (materialList.length == 0) {
this.$alert('没有需要保存的内容!', '提示', {
confirmButtonText: '确定',
})
return false
}
console.log('this.sobomList', materialList)
saveNoOrderMaterialDetail(materialList).then(({ data }) => {
if (data.code === 0) {
this.materialModalFlag = false
this.$message.success('操作成功')
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
saveNewSoIssueNotify() {
for (let i = 0; i < this.seqNoList.length; i++) {
if (
this.seqNoList[i].applyQty === '' ||
this.seqNoList[i].applyQty == null
) {
this.$message.warning('第'+(i+1)+'行数量为空,请填写申请数量!')
return false
}
this.seqNoList[i].notifyNo = this.notifyNo
this.seqNoList[i].site = this.$store.state.user.site
this.seqNoList[i].componentPartNo = this.seqNoList[i].partNo
}
let materialList = this.seqNoList.filter((item) => item.applyQty > 0)
if (materialList.length == 0) {
this.$alert('没有需要保存的内容!', '提示', {
confirmButtonText: '确定',
})
return false
}
console.log('this.sobomList', materialList)
var savaNotify = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
userName: this.$store.state.user.name,
orderType:this.orderType,
materialList: materialList,
}
this.saveNewLoading = true
saveNoOrderNotify(savaNotify)
.then(({ data }) => {
if (data.code === 0) {
this.seqNoModalFlag = false
// 清空已添加订单记录 - rqrq
this.addedOrderNoList = []
this.remark = ''
this.getUserNotifyNo()
this.$message.success('操作成功')
} else {
this.$message.error(data.msg)
}
})
.finally(() => {
this.saveNewLoading = false
})
},
//导出excel
async createExportData() {
this.searchData.limit = -1
this.searchData.page = 1
await eamGroupSearch(this.searchData).then(({ data }) => {
this.exportList = data.page.list
})
return this.exportList
},
startDownload() {},
finishDownload() {},
fields() {
let json = '{'
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json +=
'"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
} else {
json +=
'"' +
item.columnLabel +
'"' +
':' +
'"' +
item.columnProp +
'"' +
','
}
})
json += '}'
let s = eval('(' + json + ')')
return s
},
xiadaNotifyModel() {
if (
this.dataList.length == 0 &&
this.dataList2.length == 0 &&
this.dataList3.length == 0
) {
this.$alert('没有明细记录无法下达!!', '提示', {
confirmButtonText: '确定',
})
return false
}
this.xiadaModelFlag = true
},
xiadaNotify() {
// 检查是否有明细记录
if (this.dataList.length == 0) {
this.$alert('没有明细记录无法下达!!', '提示', {
confirmButtonText: '确定',
})
return false
}
// 初始化弹框数据
this.xiadaNotifyData = {
planIssueDate:
this.notifyData.planIssueDate ||
this.dayjs().format('YYYY-MM-DD HH:mm:ss'),
remark: this.notifyData.remark || '',
}
// 打开弹框
this.showXiadaNotifyDialog = true
},
confirmXiadaNotify() {
if (this.dataList.length == 0) {
this.$alert('没有明细记录无法下达!!', '提示', {
confirmButtonText: '确定',
})
return false
}
// 验证要求发料时间
if (
!this.xiadaNotifyData.planIssueDate ||
this.xiadaNotifyData.planIssueDate === ''
) {
this.$message.warning('请选择要求发料时间!')
return false
}
// 准备下达数据
const notifyData = {
...this.notifyData,
planIssueDate: this.xiadaNotifyData.planIssueDate,
remark: this.xiadaNotifyData.remark,
}
// 执行下达操作
xiadaNotify(notifyData).then(({ data }) => {
if (data.code === 0) {
this.showXiadaNotifyDialog = false
this.xiadaModelFlag = false
this.getUserNotifyNo()
this.$message.success('操作成功')
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
saveOtherPart() {
// if (
// this.otherPartData.qtyToIssue == null ||
// this.otherPartData.qtyToIssue == '' ||
// this.otherPartData.qtyToIssue <= 0
// ) {
// this.$message.warning('请填写领取数量!')
// return false
// }
this.$confirm('确定保存' + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
saveOtherPart(this.otherPartData).then(({ data }) => {
if (data.code === 0) {
this.saveOtherPartModalFlag = false
if (this.otherPartData.issueType === '非BOM物料') {
this.partModelFlag = false
this.activeName = 'noBom'
this.searchOtherPart('非BOM物料')
}
if (this.otherPartData.issueType === '不管控物料') {
this.noControlPartModelFlag = false
this.activeName = 'noControl'
this.searchOtherPart('不管控物料')
}
this.$message.success('操作成功')
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
})
},
deleteNotify() {
if (this.dataList.length > 0) {
this.$alert('请先删除已经申请的明细记录!!', '提示', {
confirmButtonText: '确定',
})
return false
}
deleteNotify(this.notifyData).then(({ data }) => {
if (data.code === 0) {
this.getUserNotifyNo()
this.$message.success(data.msg)
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
searchOtherPart(type) {
let inData = {
site: this.notifyData.site,
notifyNo: this.notifyData.notifyNo,
issueType: type,
}
searchOtherPart(inData).then(({ data }) => {
if (data && data.code === 0) {
if (type === '非BOM物料') {
this.dataList2 = data.rows
}
if (type === '不管控物料') {
this.dataList3 = data.rows
}
}
})
},
// 删除
deleteNotifySOS(row) {
this.$confirm(`是否删除这个工单的申请信息?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteNotifySOS(row).then(({ data }) => {
if (data && data.code === 0) {
this.getNotifyNoOrderDetail()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {},
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
})
.catch(() => {})
},
//获取按钮的权限数据
getButtonAuthData() {
let searchFlag = this.isAuth(this.menuId + ':search')
let saveFlag = this.isAuth(this.menuId + ':save')
let updateFlag = this.isAuth(this.menuId + ':update')
let deleteFlag = this.isAuth(this.menuId + ':delete')
//处理页面的权限数据
this.authSearch = !searchFlag
this.authSave = !saveFlag
this.authUpdate = !updateFlag
this.authDelete = !deleteFlag
},
searchTable(rows) {
if( rows.length > 0){
for (let i = 0; i < rows.length; i++) {
// 判断是否为报废导入数据(有batchNo字段)- rqrq
if (rows[i].batchNo !== undefined || rows[i].remark !== undefined) {
// 报废导入数据结构 - rqrq
const newRow = {
partNo: rows[i].partNo || '', // 第一列:物料号
batchNo: rows[i].batchNo || '', // 第二列:批次号
remark: rows[i].remark || 0, // 第三列:导入数量(如果为空则为0)
applyQty: rows[i].applyQty || 0, // 第四列:申请数量(使用可用库存)
isInWh: rows[i].isInWh || 'N', // 是否在立库
availableQty: rows[i].availableQty || 0, // 可用库存
// 以下字段保持兼容性 - rqrq
height: '',
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
} else {
// 其他导入数据结构(原逻辑)- rqrq
const newRow = {
partNo: rows[i].componentPartNo || '',
height: rows[i].height || '',
isInWh: rows[i].isInWh || '',
applyQty: rows[i].qtyRequired || 0,
availableQty: rows[i].availableQty || 0,
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
}
}
}
},
getAllNotifyStatus() {
let inData = {
site: this.$store.state.user.site,
listName: 'ISSUENOTIFYHEADER_STATUS',
locale: this.$i18n.locale,
}
getAllNotifyStatus(inData).then(({ data }) => {
this.notifyStatusList = data
console.log('notifyStatusList', this.notifyStatusList)
})
},
async getTableUserColumn(tableId, columnId) {
let queryTableUser = {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: tableId,
status: true,
languageCode: this.$i18n.locale,
}
await getTableUserListLanguage(queryTableUser).then(({ data }) => {
if (data.rows.length > 0) {
//this.columnList1 = []
switch (columnId) {
case 1:
this.columnList1 = data.rows
break
case 2:
this.columnList2 = data.rows
break
case 3:
this.columnList3 = data.rows
break
case 4:
this.columnList4 = data.rows
break
}
}
})
},
importModel() {
let data = {
site: this.$store.state.user.site,
notifyNo: this.notifyData.notifyNo,
}
this.$nextTick(() => {
this.$refs.noorderUploadExcel.init(data)
})
},
importModel2() {
let data = {
site: this.$store.state.user.site,
notifyNo: this.notifyData.notifyNo,
}
this.$nextTick(() => {
this.$refs.baofeiUploadExcel.init(data)
})
},
// 获取 tableDefault 列
async getColumnList(tableId, columnId) {
let queryTable = {
functionId: this.$route.meta.menuId,
tableId: tableId,
languageCode: this.$i18n.locale,
}
await getTableDefaultListLanguage(queryTable).then(({ data }) => {
if (data.rows && data.rows.length > 0) {
switch (columnId) {
case 1:
this.columnList1 = data.rows
break
case 2:
this.columnList2 = data.rows
break
case 3:
this.columnList3 = data.rows
break
case 4:
this.columnList4 = data.rows
break
}
} else {
// this.showDefault = true.
}
})
},
/**
* 海安页签刷新改走海安明细接口,固定orderType=noorder防止误查shoporder链路 - rqrq
*/
refreshCurrentTabTable () {
if (this.notifyNo === '' || !this.notifyNo) {
return
}
if (this.activeName === 'sub') {
let queryData = {
site: this.notifyData.site || this.$store.state.user.site,
notifyNo: this.notifyNo,
orderType: 'noorder',
}
if (this.currentRow && this.currentRow !== '' && this.currentRow.notifyNo) {
queryData = {
...this.currentRow,
site: this.notifyData.site || this.$store.state.user.site,
orderType: 'noorder',
}
}
this.dataListLoading = true
// 调用海安材料明细接口,确保“无单领料-材料明细页签”只读写haian_表 - rqrq
searchNotifyMaterialListNew(queryData).then(({ data }) => {
this.dataListLoading = false
if (data && data.code === 0) {
this.materialDetailList = data.rows || []
} else {
this.materialDetailList = []
}
}).catch(() => {
this.dataListLoading = false
this.materialDetailList = []
})
}
},
/**
* 海安页面初始化:查询当前用户未下达无单申请单(header.order_type=noorder)- rqrq
*/
getUserNotifyNo () {
const inData = {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
}
this.getAllNotifyStatus()
getUserNoOrderNotifyNo(inData).then(({ data }) => {
if (data && data.code === 0 && data.row) {
this.notifyNo = data.row.notifyNo
this.notifyData = data.row
this.getNotifyNoOrderDetail()
} else {
this.notifyNo = ''
this.notifyData = {
site: '',
bu: '',
notifyNo: '',
notifyDate: '',
enteredDate: '',
userName: '',
userDisplay: '',
remark: '',
planIssueDate: '',
}
this.dataList = []
this.materialDetailList = []
}
})
},
/**
* 海安无单订单层查询:返回haian_SOIssueNotifyOrderList明细并保留subsite字段 - rqrq
*/
getNotifyNoOrderDetail () {
const inData = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
}
getNotifyNoOrderDetail(inData).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.rows || []
} else {
this.dataList = []
}
})
},
/**
* 海安新建无单主单:请求统一传site+username,后端强制写order_type=noorder - rqrq
*/
addNotify () {
const inData = {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
orderType: 'noorder',
}
createNoOrderNotify(inData).then(({ data }) => {
if (data && data.code === 0) {
this.showAddNotifyTypeDialog = false
this.$message.success('操作成功')
this.getUserNotifyNo()
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
/**
* 海安新建无单主单(带申请类型):保持老交互,但后端仍按noorder主类型落库 - rqrq
*/
confirmAddNotify () {
let outWorkOrderFlag = 'N'
if (this.selectedNotifyType === 'outsourced') {
outWorkOrderFlag = 'Y'
}
const inData = {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
outWorkOrderFlag,
remark: this.selectedNotifyRemark,
orderType: 'noorder',
}
this.getAllNotifyStatus()
createNoOrderNotify(inData).then(({ data }) => {
if (data && data.code === 0) {
this.showAddNotifyTypeDialog = false
this.$message.success('操作成功')
this.getUserNotifyNo()
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
/**
* 兼容老“选择工单”入口:保存父行改走海安接口并补齐subsite,避免写入旧表 - rqrq
*/
saveSOS () {
if (this.notifyOrderData.needDate == null || this.notifyOrderData.needDate === '') {
this.$message.warning('请选择时间!')
return false
}
const row = this.notifyOrderData
if (this.dataList.length > 0) {
let stop = false
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].soorderNo === row.orderNo &&
this.dataList[i].releaseNo === row.releaseNo &&
this.dataList[i].sequenceNo === row.sequenceNo) {
stop = true
break
}
}
if (stop) {
this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
confirmButtonText: '确定',
})
return false
}
}
this.$confirm('确定选择工单' + row.orderNo + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const inData = {
site: this.$store.state.user.site,
subSite: row.subSite || row.contract || row.site || this.$store.state.user.site,
notifyNo: this.notifyNo,
fgPartNo: row.partNo,
soorderNo: row.orderNo,
opsItemNo: row.itemNo,
sequenceNo: row.sequenceNo,
releaseNo: row.releaseNo,
needDate: row.needDate,
issureQty: row.issureQty,
}
// 调用海安父行保存接口,确保itemNo来自haian_SOIssueNotifyOrderList序列 - rqrq
saveSOIssueNotifyOrderList(inData).then(({ data }) => {
if (data && data.code === 0) {
this.saveSeqNoModalFlag = false
row.itemNo = data.itemNo
row.subSite = inData.subSite
this.getNotifyNoOrderDetail()
this.enterSOS(row)
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
})
},
/**
* 海安无单明细查询:物料弹窗改走海安getNoOrderMaterialList,避免读取旧表数据 - rqrq
*/
enterSOS (row) {
this.seqNoModalFlag = false
this.materialModalFlag = true
this.sobomList = []
this.sobomData = {
orderNo: row.orderNo,
seqNo: row.seqNo,
partNo: row.partNo,
subSite: row.subSite || '',
}
this.bomLoadFlag = true
const inData = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
itemNo: row.itemNo,
subSite: row.subSite || '',
}
getNoOrderMaterialList(inData).then(({ data }) => {
this.bomLoadFlag = false
if (data && data.code === 0) {
this.sobomList = data.rows || []
for (let i = 0; i < this.sobomList.length; i++) {
this.sobomList[i].itemNo = inData.itemNo
this.sobomList[i].subSite = this.sobomList[i].subSite || inData.subSite || this.$store.state.user.site
}
}
}).catch(() => {
this.bomLoadFlag = false
})
},
/**
* 海安无单明细保存:统一透传notifyNo/site/subsite并调用海安先删后存链路 - rqrq
*/
saveNoOrderMaterialDetail () {
for (let i = 0; i < this.sobomList.length; i++) {
if (this.sobomList[i].qtyToIssue === '' || this.sobomList[i].qtyToIssue == null) {
this.$message.warning('第' + (i + 1) + '行数量为空,请填写申请数量!')
return false
}
this.sobomList[i].notifyNo = this.notifyNo
this.sobomList[i].site = this.$store.state.user.site
this.sobomList[i].subSite = this.sobomList[i].subSite || (this.clickrow && this.clickrow.subSite) || this.$store.state.user.site
}
const materialList = this.sobomList.filter((item) => item.qtyToIssue > 0)
if (materialList.length === 0) {
this.$alert('没有需要保存的内容!', '提示', {
confirmButtonText: '确定',
})
return false
}
saveNoOrderMaterialDetail(materialList).then(({ data }) => {
if (data && data.code === 0) {
this.materialModalFlag = false
this.$message.success('操作成功')
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
/**
* 海安无单保存:父子写库统一改走saveNoOrderNotify,并为子行补齐subsite - rqrq
*/
saveNewSoIssueNotify () {
for (let i = 0; i < this.seqNoList.length; i++) {
if (this.seqNoList[i].applyQty === '' || this.seqNoList[i].applyQty == null) {
this.$message.warning('第' + (i + 1) + '行数量为空,请填写申请数量!')
return false
}
this.seqNoList[i].notifyNo = this.notifyNo
this.seqNoList[i].componentPartNo = this.seqNoList[i].componentPartNo || this.seqNoList[i].partNo
// 先落subSite再写大site,避免被父site覆盖 - rqrq
this.seqNoList[i].subSite = this.seqNoList[i].subSite || this.seqNoList[i].contract || this.materialDialogSite || this.$store.state.user.site
this.seqNoList[i].site = this.$store.state.user.site
}
const materialList = this.seqNoList.filter((item) => item.applyQty > 0)
if (materialList.length === 0) {
this.$alert('没有需要保存的内容!', '提示', {
confirmButtonText: '确定',
})
return false
}
const saveNotify = {
site: this.$store.state.user.site,
notifyNo: this.notifyNo,
userName: this.$store.state.user.name,
orderType: this.orderType,
materialList,
}
this.saveNewLoading = true
// 调用海安无单保存接口:后端负责按subsite拆父行并落haian_子表 - rqrq
saveNoOrderNotify(saveNotify).then(({ data }) => {
if (data && data.code === 0) {
this.seqNoModalFlag = false
this.addedOrderNoList = []
this.remark = ''
this.getUserNotifyNo()
this.$message.success('操作成功')
} else if (data) {
this.$message.error(data.msg)
}
}).finally(() => {
this.saveNewLoading = false
})
},
/**
* 海安无单下达:调用海安头表状态流转接口,避免误触发旧模块逻辑 - rqrq
*/
confirmXiadaNotify () {
if (this.dataList.length === 0) {
this.$alert('没有明细记录无法下达!!', '提示', {
confirmButtonText: '确定',
})
return false
}
if (!this.xiadaNotifyData.planIssueDate || this.xiadaNotifyData.planIssueDate === '') {
this.$message.warning('请选择要求发料时间!')
return false
}
const notifyData = {
...this.notifyData,
site: this.$store.state.user.site,
planIssueDate: this.xiadaNotifyData.planIssueDate,
remark: this.xiadaNotifyData.remark,
}
xiadaNotify(notifyData).then(({ data }) => {
if (data && data.code === 0) {
this.showXiadaNotifyDialog = false
this.xiadaModelFlag = false
this.getUserNotifyNo()
this.$message.success('操作成功')
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
/**
* 海安无单删单:走海安deleteNotify接口,清理haian父子数据 - rqrq
*/
deleteNotify () {
if (this.dataList.length > 0) {
this.$alert('请先删除已经申请的明细记录!!', '提示', {
confirmButtonText: '确定',
})
return false
}
deleteNotify(this.notifyData).then(({ data }) => {
if (data && data.code === 0) {
this.getUserNotifyNo()
this.$message.success(data.msg || '删除成功')
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
},
/**
* 海安无单删除父行:删除按钮调用海安deleteNotifySOS避免误删旧表数据 - rqrq
*/
deleteNotifySOS (row) {
this.$confirm('是否删除这个工单的申请信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const requestRow = {
...row,
site: row.site || this.$store.state.user.site,
notifyNo: row.notifyNo || this.notifyNo,
subSite: row.subSite || this.$store.state.user.site,
}
deleteNotifySOS(requestRow).then(({ data }) => {
if (data && data.code === 0) {
this.getNotifyNoOrderDetail()
this.$message.success('操作成功')
} else if (data) {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定',
})
}
})
}).catch(() => {})
}
},
}
</script>
<style scoped>
.board666 .el-table .error-row {
background: #f86868;
}
/deep/ .el-table .error-row {
background: #f86868 !important;
}
/* rqrq - 报废导入:导入数量大于可用库存时行变红 */
/deep/ .el-table .baofei-error-row {
background: #fef0f0 !important;
}
/deep/ .el-table .baofei-error-row td {
color: #F56C6C !important;
}
/* 在 <style scoped> 下,使用深度选择器作用到 ElementUI 内部结构 */
.issueNotify {
width: 100%;
height: auto;
}
.issueNotify /deep/ .el-form-item__content {
display: inline !important;
}
.site-content > .el-tabs > .el-tabs__content > .site-tabs__tools {
top: 35px;
height: 40px;
font-size: 16px;
line-height: 40px;
}
.text-right /deep/ .el-input__inner {
text-align: right !important;
}
.text-right /deep/ .el-input-number__input {
text-align: right !important;
}
.yzzTable /deep/.el-table .cell {
line-height: 20px;
font-size: 12px;
height: 20px;
}
.applyQtyClass /deep/.el-input__inner {
height: 14px !important;
}
/* 选择工单弹窗:紧凑表格与按钮样式 */
.choose-sos-btn {
height: 14px;
box-sizing: border-box;
padding: 0 6px;
line-height: 12px;
font-size: 12px;
display: inline-flex;
align-items: center;
justify-content: center;
}
</style>