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

  1. <template>
  2. <div>
  3. <el-form label-position="top" style="margin-top: -0px">
  4. <el-row :gutter="20">
  5. <el-col :span="20">
  6. <el-button v-if="notifyNo===''" @click="addNotify()" type="primary" class="yzzButtonAn">新建申请单</el-button>
  7. <!-- 只允许一条明细记录 不然后续推送给wcs 立库可能会有问题-->
  8. <el-button v-if="notifyNo!=''" type="primary" :disabled="dataList.length>0" @click="chooseSOSModal()" class="yzzButtonAn">新增物料</el-button>
  9. <el-button v-if="notifyNo!=''" type="primary" @click="xiadaNotify()" class="yzzButtonAn">下达申请单</el-button>
  10. <el-button v-if="notifyNo!=''" type="primary" @click="deleteNotify()" class="yzzButtonAn">删除申请单</el-button>
  11. </el-col>
  12. </el-row>
  13. <el-row :gutter="10" v-if="notifyNo!=''">
  14. <el-col :span="3">
  15. <el-form-item :label="'工厂编码'">
  16. <el-input v-model="notifyData.site" disabled></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="3">
  20. <el-form-item :label="'申请单号'">
  21. <el-input v-model="notifyData.notifyNo" disabled style="width: 100%;"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="3">
  25. <el-form-item :label="'申请账号'">
  26. <el-input v-model="notifyData.username" disabled></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="3">
  30. <el-form-item :label="'申请时间'">
  31. <el-input v-model="notifyData.notifyDate" disabled></el-input>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="3">
  35. <el-form-item :label="'状态'">
  36. <el-select v-model="notifyData.status" style="width: 100%" disabled>
  37. <el-option label="全部" value=""></el-option>
  38. <el-option v-for="item in notifyStatusList" :key="item.listValue" :label="item.listDesc"
  39. :value="item.listValue"></el-option>
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. </el-row>
  44. </el-form>
  45. <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card"
  46. v-if="notifyNo!=''" @tab-click="tabClick">
  47. <el-tab-pane label="已申请工单" name="sos">
  48. <el-table :height="height" :data="dataList" border style="width: 100%;" @row-click="changeData">
  49. <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable"
  50. :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
  51. :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
  52. :label="item.columnLabel">
  53. <template slot-scope="scope">
  54. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  55. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  56. style="width: 100px; height: 80px" /></span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
  60. <template slot-scope="scope">
  61. <a type="text" size="small" @click="enterSOSDetail(scope.row)">物料</a>
  62. <a type="text" size="small" @click="deleteNotifySOS(scope.row)">删除</a>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. </el-tab-pane>
  67. <el-tab-pane label="材料明细" name="sub">
  68. <el-table :data="materialDetailList" :height="height" border :row-class-name="materialDetailTableRowClassName"
  69. v-loading="dataListLoading" style="width: 100%; ">
  70. <!-- <el-table-column-->
  71. <!-- header-align="center"-->
  72. <!-- align="center"-->
  73. <!-- width="80"-->
  74. <!-- label="操作">-->
  75. <!-- <template slot-scope="scope">-->
  76. <!-- <a type="text" size="small" v-if="currentRow.status==='ISSUE'" @click="deleteNotifyMaterial(scope.row)">删除</a>-->
  77. <!-- </template>-->
  78. <!-- </el-table-column>-->
  79. <el-table-column v-for="(item,index) in materialDetailColumnList" :key="index" :sortable="item.columnSortable"
  80. :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
  81. :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
  82. :label="item.columnLabel">
  83. <template slot-scope="scope">
  84. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  85. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  86. style="width: 100px; height: 80px" /></span>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. </el-tab-pane>
  91. </el-tabs>
  92. <el-dialog title="新增工单物料" :close-on-click-modal="false" v-drag :visible.sync="seqNoModalFlag" width="980px">
  93. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  94. <el-row :gutter="20">
  95. <el-col :span="10">
  96. <el-form-item label="订单类型">
  97. <el-radio-group v-model="orderType" :disabled="seqNoList.length>0" size="small">
  98. <el-radio label="slittingorder">分切订单</el-radio>
  99. <el-radio label="shipment">销售发货</el-radio>
  100. <el-radio label="shoporder">成品订单</el-radio>
  101. <el-radio label="baofei">报废单</el-radio>
  102. </el-radio-group>
  103. </el-form-item>
  104. </el-col>
  105. <!-- <el-col :span="2">
  106. <el-form-item label=" " v-if="orderType!=='baofei'">
  107. <el-button type="primary" @click="openOrderManageDialog()" class="">从订单添加</el-button>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="12">
  111. <el-form-item :label="'已添加订单(不保存)'" style="width: 100%" v-if="orderType!=='baofei'">
  112. <el-input v-model="remark" style="width: 100%" readonly></el-input>
  113. </el-form-item>
  114. </el-col> -->
  115. </el-row>
  116. <el-row :gutter="20">
  117. <el-col :span="4" v-if="orderType!=='baofei'">
  118. <el-form-item label="工厂编号">
  119. <el-select
  120. v-model="materialDialogSite"
  121. placeholder="请选择Site"
  122. :loading="materialDialogSiteLoading"
  123. :disabled="seqNoList.length > 0"
  124. style="width: 100%">
  125. <el-option
  126. v-for="item in materialDialogSiteOptions"
  127. :key="item.siteCode"
  128. :label="item.siteName"
  129. :value="item.siteCode">
  130. </el-option>
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="5">
  135. <el-form-item label="物料号" v-if="orderType!=='baofei'">
  136. <el-input v-model="partNo" @keyup.enter.native="addRowFromQuery" :disabled="orderType=='baofei'"></el-input>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="10">
  140. <el-form-item label=" ">
  141. <el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading" v-if="orderType!=='baofei'"
  142. class="">添加物料行</el-button>
  143. <el-button type="primary" @click="openSelectMaterialModal()" v-if="orderType!=='baofei'"
  144. class="">选择物料</el-button>
  145. <el-button type="primary" @click="importModel()" :disabled="seqNoList.length>0" v-if="orderType!=='baofei'"
  146. class="">导入</el-button>
  147. <el-button type="primary" @click="importModel2()" :disabled="seqNoList.length>0" v-if="orderType==='baofei'"
  148. class="">报废导入</el-button>
  149. </el-form-item>
  150. </el-col>
  151. </el-row>
  152. </el-form>
  153. <el-table :height="400" :data="seqNoList" border style="width: 100%;" class="choose-sos-table" :row-class-name="seqNoTableRowClassName">
  154. <!-- rqrq - 使用displayColumnList2计算属性报废类型时动态显示批次号列 -->
  155. <el-table-column v-for="(item,index) in displayColumnList2" :key="index" :sortable="item.columnSortable"
  156. :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
  157. :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
  158. :label="item.columnLabel">
  159. <template slot-scope="scope">
  160. <div v-if="item.columnProp === 'applyQty'">
  161. <el-input class="applyQtyClass" v-model="scope.row.applyQty" style="height: 11px; width: 98%;"></el-input>
  162. </div>
  163. <!-- rqrq - 可用库存特殊显示加粗小于需求数量时红色 -->
  164. <span v-else-if="item.columnProp === 'availableQty'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
  165. {{ scope.row.availableQty }}
  166. </span>
  167. <!-- rqrq - 导入数量特殊显示大于可用库存时红色 -->
  168. <span v-else-if="item.columnProp === 'remark'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
  169. {{ scope.row.remark }}
  170. </span>
  171. <span v-else-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  172. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  173. style="width: 100px; height: 80px" /></span>
  174. </template>
  175. </el-table-column>
  176. <el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
  177. <template slot-scope="scope">
  178. <el-button type="danger" size="mini" plain style="height:14px; line-height:14px; padding:0 8px;" @click="deleteSeqNoRow(scope.$index)">删除</el-button>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  183. <el-button type="primary" @click="saveNewSoIssueNotify" :loading="saveNewLoading">保存</el-button>
  184. <el-button type="primary" @click="seqNoModalFlag = false">关闭</el-button>
  185. </el-footer>
  186. </el-dialog>
  187. <!-- 订单管理弹窗 - rqrq -->
  188. <el-dialog :title="'订单添加(' + orderTypeText + ')'" :close-on-click-modal="false" v-drag :visible.sync="orderManageDialogVisible" width="1100px">
  189. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  190. <el-row :gutter="20">
  191. <el-col :span="4">
  192. <el-form-item label="工厂编号">
  193. <el-input :value="materialDialogSite" disabled style="width: 100%"></el-input>
  194. </el-form-item>
  195. </el-col>
  196. <el-col :span="5">
  197. <el-form-item :label="'Order No'">
  198. <el-input v-model="orderManageData.orderNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入订单号"></el-input>
  199. </el-form-item>
  200. </el-col>
  201. <el-col :span="5">
  202. <el-form-item :label="'Release No'">
  203. <el-input v-model="orderManageData.releaseNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入Release No"></el-input>
  204. </el-form-item>
  205. </el-col>
  206. <el-col :span="5">
  207. <el-form-item :label="'Sequence No'">
  208. <el-input v-model="orderManageData.sequenceNo" @keyup.enter.native="addOrderToTempList()" placeholder="请输入Sequence No"></el-input>
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="4">
  212. <el-form-item :label="' '">
  213. <el-button type="primary" @click="addOrderToTempList()" :loading="addOrderTempLoading" class="">添加</el-button>
  214. </el-form-item>
  215. </el-col>
  216. </el-row>
  217. </el-form>
  218. <!-- 订单明细列表 - rqrq -->
  219. <el-table :height="400" :data="tempOrderList" border style="width: 100%;" v-loading="tempOrderListLoading">
  220. <el-table-column prop="orderNo" header-align="center" align="center" min-width="120" label="订单号"></el-table-column>
  221. <el-table-column prop="subSite" header-align="center" align="center" min-width="100" label="工厂编号"></el-table-column>
  222. <el-table-column prop="releaseNo" header-align="center" align="center" min-width="100" label="Release No"></el-table-column>
  223. <el-table-column prop="sequenceNo" header-align="center" align="center" min-width="100" label="Sequence No"></el-table-column>
  224. <el-table-column prop="componentPartNo" header-align="center" align="center" min-width="150" label="物料编码"></el-table-column>
  225. <el-table-column prop="componentPartDesc" header-align="center" align="center" min-width="150" label="物料描述" show-overflow-tooltip></el-table-column>
  226. <el-table-column prop="applyQty" header-align="center" align="right" min-width="100" label="数量"></el-table-column>
  227. <el-table-column prop="uom" header-align="center" align="center" min-width="80" label="单位"></el-table-column>
  228. <el-table-column prop="isInWh" header-align="center" align="center" min-width="100" label="是否在立库"></el-table-column>
  229. <!-- rqrq - 新增可用库存列 -->
  230. <el-table-column prop="availableQty" header-align="center" align="right" min-width="100" label="可用库存">
  231. <template slot-scope="scope">
  232. <span :style="{fontWeight: 'bold', color: (scope.row.availableQty < scope.row.applyQty) ? '#F56C6C' : ''}">
  233. {{ scope.row.availableQty }}
  234. </span>
  235. </template>
  236. </el-table-column>
  237. <el-table-column fixed="right" header-align="center" align="center" width="80" label="操作">
  238. <template slot-scope="scope">
  239. <el-button type="danger" size="mini" plain style="height:14px; line-height:14px; padding:0 8px;" @click="deleteTempOrderRow(scope.$index)">删除</el-button>
  240. </template>
  241. </el-table-column>
  242. </el-table>
  243. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  244. <el-button type="primary" @click="summaryOrderToMainList()" :loading="summaryLoading">汇总到主列表</el-button>
  245. <el-button @click="closeOrderManageDialog()">关闭</el-button>
  246. </el-footer>
  247. </el-dialog>
  248. <!-- 销售发货同一单号多CONTRACT时先选site再拉行 - rqrq -->
  249. <el-dialog title="选择Shipment站点" :close-on-click-modal="false" v-drag :visible.sync="shipmentSiteSelectModalFlag" width="900px" append-to-body>
  250. <div style="margin-bottom: 8px;color:#606266;">同一单号命中多个站点请选择要添加的Shipment后再查询物料</div>
  251. <el-table
  252. :data="shipmentSiteSelectList"
  253. border
  254. highlight-current-row
  255. height="320"
  256. style="width: 100%;"
  257. @current-change="handleShipmentSiteSelectChange">
  258. <el-table-column type="index" width="50" label="#" align="center"></el-table-column>
  259. <el-table-column prop="contract" label="Site/CONTRACT" min-width="120" align="center" show-overflow-tooltip></el-table-column>
  260. <el-table-column prop="shipmentId" label="ShipmentId" min-width="120" align="center" show-overflow-tooltip></el-table-column>
  261. <el-table-column prop="shipmentType" label="类型" min-width="100" align="center" show-overflow-tooltip></el-table-column>
  262. <el-table-column prop="receiverId" label="接收方" min-width="120" align="center" show-overflow-tooltip></el-table-column>
  263. <el-table-column prop="receiverDesc" label="接收方描述" min-width="160" align="left" show-overflow-tooltip></el-table-column>
  264. <el-table-column prop="state" label="状态" min-width="100" align="center" show-overflow-tooltip></el-table-column>
  265. <el-table-column prop="plannedShipDate" label="计划发货日期" min-width="130" align="center" show-overflow-tooltip></el-table-column>
  266. </el-table>
  267. <el-footer style="height:40px;margin-top: 12px;text-align:center">
  268. <el-button type="primary" @click="confirmShipmentSiteSelect()" :loading="addOrderTempLoading">确认</el-button>
  269. <el-button type="primary" @click="shipmentSiteSelectModalFlag=false">取消</el-button>
  270. </el-footer>
  271. </el-dialog>
  272. <!-- 成品/分切订单同一单号多site时先选contract再查物料 - rqrq -->
  273. <el-dialog title="选择工单Site" :close-on-click-modal="false" v-drag :visible.sync="shopOrderSiteSelectFlag" width="900px" append-to-body>
  274. <el-table :height="360" :data="shopOrderCandidateList" border style="width: 100%;" highlight-current-row>
  275. <el-table-column prop="contract" label="Site" min-width="100" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  276. <el-table-column prop="orderNo" label="OrderNo" min-width="120" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  277. <el-table-column prop="releaseNo" label="ReleaseNo" min-width="90" header-align="center" align="center"></el-table-column>
  278. <el-table-column prop="sequenceNo" label="SequenceNo" min-width="90" header-align="center" align="center"></el-table-column>
  279. <el-table-column prop="partNo" label="产品编码" min-width="120" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  280. <el-table-column prop="partDesc" label="产品名称" min-width="160" header-align="center" align="left" show-overflow-tooltip></el-table-column>
  281. <el-table-column prop="objstate" label="状态" min-width="90" header-align="center" align="center"></el-table-column>
  282. <el-table-column prop="lotSize" label="工单数量" min-width="90" header-align="center" align="right"></el-table-column>
  283. <el-table-column fixed="right" header-align="center" align="center" width="90" label="操作">
  284. <template slot-scope="scope">
  285. <el-button type="primary" plain style="height:14px; line-height:14px; padding:0 8px;" :loading="addOrderTempLoading" @click="confirmShopOrderSite(scope.row)">选择</el-button>
  286. </template>
  287. </el-table-column>
  288. </el-table>
  289. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  290. <el-button type="primary" @click="shopOrderSiteSelectFlag = false">关闭</el-button>
  291. </el-footer>
  292. </el-dialog>
  293. <!-- 选择物料弹框 -->
  294. <el-dialog title="新增物料" :close-on-click-modal="false" v-drag :visible.sync="selectMaterialModalFlag" width="1080px">
  295. <el-form :inline="true" label-position="top">
  296. <el-form-item label="Site">
  297. <el-input :value="selectMaterialDisplaySite" disabled style="width: 120px"></el-input>
  298. </el-form-item>
  299. <el-form-item label="物料编号">
  300. <el-input v-model="componentPartNo" style="width: 120px"></el-input>
  301. </el-form-item>
  302. <el-form-item label=" ">
  303. <el-button type="primary" @click="loadAvailableMaterialList()" class="">查询</el-button>
  304. </el-form-item>
  305. </el-form>
  306. <el-container style="margin-top: 0px;">
  307. <!-- 左侧可选物料 -->
  308. <el-main style="width: 470px;padding: 1px">
  309. <span style="font-size: 12px">可选物料</span>
  310. <el-table height="350px" :data="availableMaterialList" border ref="itemTable1" @row-click="itemClickRow1"
  311. @selection-change="handleAvailableSelectionChange" highlight-current-row style="width: 100%"
  312. v-loading="selectMaterialLoading">
  313. <el-table-column type="selection" header-align="center" align="center" :selectable="selectFlag" width="50">
  314. </el-table-column>
  315. <el-table-column prop="partNo" header-align="center" align="center" min-width="140" label="物料号">
  316. </el-table-column>
  317. <el-table-column header-align="center" align="center" min-width="80" label="Site">
  318. <template slot-scope="scope">
  319. {{ scope.row.subSite || scope.row.site || selectMaterialDisplaySite }}
  320. </template>
  321. </el-table-column>
  322. <el-table-column prop="height" header-align="center" align="center" min-width="70" label="高度">
  323. </el-table-column>
  324. <el-table-column prop="isInWh" header-align="center" align="center" min-width="80" label="是否在立库">
  325. </el-table-column>
  326. <!-- rqrq - 新增可用库存列 -->
  327. <el-table-column prop="availableQty" header-align="center" align="right" min-width="80" label="可用库存">
  328. <template slot-scope="scope">
  329. <span style="font-weight: bold;">{{ scope.row.availableQty }}</span>
  330. </template>
  331. </el-table-column>
  332. </el-table>
  333. <el-pagination @size-change="handleAvailableSizeChange" @current-change="handleAvailableCurrentChange"
  334. :current-page="availableMaterialPage" :page-sizes="[50, 100]" :page-size="availableMaterialLimit"
  335. small layout="total, prev, pager, next" :total="availableMaterialTotal"
  336. style="margin-top: 10px; text-align: right;">
  337. </el-pagination>
  338. </el-main>
  339. <!-- 中间操作按钮 -->
  340. <el-main style="width: 100px;padding: 1px">
  341. <div style="margin-top: 180px;margin-left: 18px">
  342. <el-button type="primary" @click="addToSelected">添加>></el-button>
  343. </div>
  344. <div style="margin-top: 15px;margin-left: 18px">
  345. <el-button type="primary" @click="removeFromSelected">删除&lt;&lt; </el-button>
  346. </div>
  347. </el-main>
  348. <!-- 右侧已选物料 -->
  349. <el-main style="width: 470px;padding: 1px">
  350. <span style="font-size: 12px">已有物料</span>
  351. <el-table height="400px" :data="selectedMaterialList" border ref="itemTable2" @row-click="itemClickRow2"
  352. @selection-change="handleSelectedSelectionChange" highlight-current-row style="width: 100%">
  353. <el-table-column type="selection" header-align="center" align="center" :selectable="selectFlag" width="50">
  354. </el-table-column>
  355. <el-table-column prop="partNo" header-align="center" align="center" min-width="140" label="物料号">
  356. </el-table-column>
  357. <el-table-column header-align="center" align="center" min-width="80" label="Site">
  358. <template slot-scope="scope">
  359. {{ scope.row.subSite || scope.row.site || selectMaterialDisplaySite }}
  360. </template>
  361. </el-table-column>
  362. <el-table-column prop="height" header-align="center" align="center" min-width="70" label="高度">
  363. </el-table-column>
  364. <el-table-column prop="isInWh" header-align="center" align="center" min-width="80" label="是否在立库">
  365. </el-table-column>
  366. <!-- rqrq - 新增可用库存列 -->
  367. <el-table-column prop="availableQty" header-align="center" align="right" min-width="80" label="可用库存">
  368. <template slot-scope="scope">
  369. <span style="font-weight: bold;">{{ scope.row.availableQty }}</span>
  370. </template>
  371. </el-table-column>
  372. </el-table>
  373. </el-main>
  374. </el-container>
  375. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  376. <el-button type="primary" @click="confirmSelectMaterial()">保存</el-button>
  377. <el-button @click="selectMaterialModalFlag = false">关闭</el-button>
  378. </el-footer>
  379. </el-dialog>
  380. <el-dialog title="申请明细" :close-on-click-modal="false" v-drag :visible.sync="materialModalFlag" width="900px">
  381. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  382. <el-row :gutter="20">
  383. <el-col :span="6">
  384. <el-form-item :label="'生产订单号'">
  385. <el-input v-model="sobomData.orderNo" disabled></el-input>
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="6">
  389. <el-form-item label=" ">
  390. <el-button type="primary" @click="openSelectMaterialModalForDetail()"
  391. class="">添加</el-button>
  392. </el-form-item>
  393. </el-col>
  394. </el-row>
  395. </el-form>
  396. <div class="yzzTable">
  397. <el-table :height="400" :data="sobomList" border v-loading="bomLoadFlag" style="width: 100%;">
  398. <el-table-column v-for="(item,index) in columnList3" :key="index" :sortable="item.columnSortable"
  399. :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
  400. :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
  401. :label="item.columnLabel">
  402. <template slot-scope="scope">
  403. <div v-if="item.columnProp === 'qtyToIssue'">
  404. <el-input v-model="scope.row.qtyToIssue" type="number" style="height: 11px; width: 98%;" :step="0"
  405. :min="0"></el-input>
  406. </div>
  407. <div v-else-if="item.columnProp === 'remark'">
  408. <el-input v-model="scope.row.remark" style="padding: 0;width: 100%"></el-input>
  409. </div>
  410. <!-- rqrq - 可用库存特殊显示加粗小于申请数量时红色 -->
  411. <div v-else-if="item.columnProp === 'availableQty'">
  412. <span :style="{fontWeight: 'bold', color: (scope.row.availableQty < scope.row.qtyToIssue) ? '#F56C6C' : ''}">
  413. {{ scope.row.availableQty }}
  414. </span>
  415. </div>
  416. <div v-else>
  417. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  418. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  419. style="width: 100px; height: 80px" /></span>
  420. </div>
  421. </template>
  422. </el-table-column>
  423. <!-- <el-table-column prop="" header-align="center" align="center" min-width="50" label="操作">
  424. <template slot-scope="scope">
  425. <el-button type="primary" @click="qtyAllForBom(scope.row)" style="width: 100%">全数领料</el-button>
  426. </template>
  427. </el-table-column> -->
  428. </el-table>
  429. </div>
  430. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  431. <el-button type="primary" @click="saveNoOrderMaterialDetail()">保存</el-button>
  432. <el-button type="primary" @click="materialModalFlag=false">关闭</el-button>
  433. </el-footer>
  434. </el-dialog>
  435. <el-dialog title="保存物料" :close-on-click-modal="false" v-drag :visible.sync="saveOtherPartModalFlag" width="600px">
  436. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  437. <el-row :gutter="20">
  438. <el-col :span="6">
  439. <el-form-item :label="'物料编码'">
  440. <el-input v-model="otherPartData.componentPartNo" disabled></el-input>
  441. </el-form-item>
  442. </el-col>
  443. <el-col :span="18">
  444. <el-form-item :label="'物料描述'">
  445. <el-input v-model="otherPartData.partDesc" disabled></el-input>
  446. </el-form-item>
  447. </el-col>
  448. </el-row>
  449. <el-row :gutter="20">
  450. <el-col :span="6">
  451. <el-form-item :label="'计量单位'">
  452. <el-input v-model="otherPartData.umid" disabled></el-input>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :span="6">
  456. <el-form-item :label="'需求数量'">
  457. <el-input-number v-model="otherPartData.qtyToIssue" style="padding: 0;width: 100%" :step="0" :min="0"
  458. :controls="false"></el-input-number>
  459. </el-form-item>
  460. </el-col>
  461. </el-row>
  462. <el-row :gutter="20">
  463. <el-col :span="24">
  464. <el-form-item :label="'备注'">
  465. <el-input v-model="otherPartData.remark"></el-input>
  466. </el-form-item>
  467. </el-col>
  468. </el-row>
  469. </el-form>
  470. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  471. <el-button type="primary" @click="saveOtherPart()">保存</el-button>
  472. <el-button type="primary" @click="saveOtherPartModalFlag=false">关闭</el-button>
  473. </el-footer>
  474. </el-dialog>
  475. <el-dialog title="下达申请单" :close-on-click-modal="false" v-drag :visible.sync="showXiadaNotifyDialog" width="400px">
  476. <el-form :inline="true" label-position="top" label-width="500px" style="margin-left: 7px;margin-top: -5px;">
  477. <el-row :gutter="20">
  478. <el-col :span="24">
  479. <el-form-item label="要求发料时间">
  480. <el-date-picker v-model="xiadaNotifyData.planIssueDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
  481. format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" style="width: 100%">
  482. </el-date-picker>
  483. </el-form-item>
  484. </el-col>
  485. <el-col :span="24">
  486. <el-form-item label="备注" class="issueNotify">
  487. <el-input type="textarea" v-model="xiadaNotifyData.remark" :rows="3" placeholder="请输入内容"
  488. style="width: 100%"></el-input>
  489. </el-form-item>
  490. </el-col>
  491. </el-row>
  492. </el-form>
  493. <el-footer style="height:30px;text-align:center;">
  494. <el-button type="primary" @click="confirmXiadaNotify()">下达</el-button>
  495. <el-button type="primary" @click="showXiadaNotifyDialog=false">取消</el-button>
  496. </el-footer>
  497. </el-dialog>
  498. <el-dialog title="选择申请类型" :close-on-click-modal="false" v-drag :visible.sync="showAddNotifyTypeDialog"
  499. width="400px">
  500. <el-form :inline="true" label-position="top" label-width="500px" style="margin-left: 7px;margin-top: -5px;">
  501. <el-row :gutter="20">
  502. <el-col :span="24">
  503. <el-form-item label="申请类型">
  504. <el-radio-group v-model="selectedNotifyType">
  505. <el-radio label="production">生产领料单</el-radio>
  506. <el-radio label="outsourced">委外领料单</el-radio>
  507. </el-radio-group>
  508. </el-form-item>
  509. </el-col>
  510. <el-col :span="24">
  511. <el-form-item label="备注" class="issueNotify">
  512. <el-input type="textarea" v-model="selectedNotifyRemark" :rows="3" placeholder="请输入内容"
  513. style="width: 100%"></el-input>
  514. </el-form-item>
  515. </el-col>
  516. </el-row>
  517. </el-form>
  518. <el-footer style="height:30px;text-align:center;">
  519. <el-button type="primary" @click="confirmAddNotify()">确认</el-button>
  520. <el-button type="primary" @click="showAddNotifyTypeDialog=false">取消</el-button>
  521. </el-footer>
  522. </el-dialog>
  523. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  524. <noorderUploadExcel ref="noorderUploadExcel" @refreshTable="searchTable" v-drag></noorderUploadExcel>
  525. <baofeiUploadExcel ref="baofeiUploadExcel" @refreshTable="searchTable" v-drag></baofeiUploadExcel>
  526. </div>
  527. </template>
  528. <script>
  529. import {
  530. getUserNoOrderNotifyNo,
  531. createNoOrderNotify,
  532. getNotifyNoOrderDetail,
  533. getNoOrderMaterialList,
  534. saveNoOrderMaterialDetail,
  535. saveNoOrderNotify,
  536. saveSOIssueNotifyOrderList,
  537. searchNotifyMaterialListNew,
  538. xiadaNotify,
  539. deleteNotify,
  540. deleteNotifySOS,
  541. noOrderList,
  542. getAllNotifyStatus,
  543. queryPartAttributeData,
  544. searchOtherPart,
  545. } from '@/api/haianWarehouse/noOrderIssueNotify.js'
  546. import { haiAnGetShipmentAndLineForIssure as getShipmentAndLineForIssure } from '@/api/haianWarehouse/shipmentIssue.js'
  547. import {
  548. haiAnGetShopOrderAndMaterialByShoporder as getShopOrderAndMaterialByShoporder,
  549. haiAnGetShopOrderFromIFSWithOrderNo as getShopOrderFromIFSWithOrderNo,
  550. } from '@/api/haianWarehouse/shopOrderIssueNotify.js'
  551. import { getUserAuthorizedSubSiteCodes } from '@/api/factory/accessSite'
  552. import { getAuthorizedSubSiteCodeList } from '@/utils/subSiteAuth'
  553. import noorderUploadExcel from '@/views/modules/noOrderIssue/noorder_upload_excel.vue'
  554. import baofeiUploadExcel from '@/views/modules/noOrderIssue/baofei_upload_excel.vue'
  555. import Chooselist from '@/views/modules/common/Chooselist_eam'
  556. import { getTableUserListLanguage } from '@/api/table.js'
  557. export default {
  558. name: 'newNoOrderIssueNotify54',
  559. components: {
  560. Chooselist,
  561. noorderUploadExcel,
  562. baofeiUploadExcel,
  563. },
  564. watch: {
  565. // notifyOrderData: {
  566. // deep: true,
  567. // handler: function (newV, oldV) {
  568. // this.notifyOrderData.locationNo = this.notifyOrderData.locationNo.toUpperCase()
  569. // }
  570. // },
  571. },
  572. data() {
  573. return {
  574. activeName: 'sos',
  575. noControlPartModelFlag: false,
  576. buList: [],
  577. partList: [],
  578. partList2: [],
  579. notifyStatusList: [],
  580. notifyNo: '',
  581. notifyData: {
  582. site: '',
  583. bu: '',
  584. notifyNo: '',
  585. notifyDate: '',
  586. enteredDate: '',
  587. userName: '',
  588. userDisplay: '',
  589. remark: '',
  590. planIssueDate: '',
  591. },
  592. dataList2: [],
  593. dataList3: [],
  594. materialDetailList: [],
  595. currentRow: '',
  596. dataListLoading: false,
  597. // 是否收藏
  598. favorite: false,
  599. changeBuFlag: false,
  600. partModelFlag: false,
  601. newBu: '',
  602. // 导出 start
  603. exportData: [],
  604. exportName: '设备分组' + this.dayjs().format('YYYYMMDDHHmmss'),
  605. exportHeader: ['设备分组'],
  606. exportFooter: [],
  607. exportList: [],
  608. // 导出 end
  609. searchData: {
  610. site: this.$store.state.user.site,
  611. userName: this.$store.state.user.name,
  612. groupID: '',
  613. groupDesc: '',
  614. buDesc: '',
  615. active: 'Y',
  616. page: 1,
  617. limit: 10,
  618. },
  619. sobomData: {
  620. orderNo: '',
  621. seqno: '',
  622. partNo: '',
  623. },
  624. //申请单序号
  625. itemNo: '',
  626. notifyOrderData: {
  627. partNo: '',
  628. orderNo: '',
  629. itemNo: '',
  630. releaseNo: '',
  631. sequenceNo: '',
  632. partDesc: '',
  633. qtyrequired: '',
  634. issureQty: '',
  635. needDate: '',
  636. },
  637. seqNoData: {
  638. site: this.$store.state.user.site,
  639. seqno: '',
  640. releaseNo: '',
  641. sequenceNo: '',
  642. sResourceID: '',
  643. sWorkcenterno: '',
  644. operatorId: '',
  645. sShiftno: '',
  646. startDate: '',
  647. endDate: '',
  648. },
  649. seqNoList: [],
  650. height: 200,
  651. pageIndex: 1,
  652. pageSize: 20,
  653. totalPage: 0,
  654. dataList: [],
  655. sobomList: [],
  656. dataListSelections: [],
  657. seqNoModalFlag: false,
  658. materialModalFlag: false,
  659. modalDisableFlag: false,
  660. saveSeqNoModalFlag: false,
  661. bomLoadFlag: false,
  662. xiadaList: [],
  663. columnList4: [
  664. {
  665. userId: this.$store.state.user.name,
  666. functionId: 555001,
  667. serialNumber: '555001Table4ComponentPartNo',
  668. tableId: '555001Table4',
  669. tableName: '非BOM材料明细',
  670. columnProp: 'componentPartNo',
  671. headerAlign: 'center',
  672. align: 'center',
  673. columnLabel: '材料编码',
  674. columnHidden: false,
  675. columnImage: false,
  676. columnSortable: false,
  677. sortLv: 0,
  678. status: true,
  679. fixed: false,
  680. columnWidth: 100,
  681. },
  682. {
  683. userId: this.$store.state.user.name,
  684. functionId: 555001,
  685. serialNumber: '555001Table4PartDesc',
  686. tableId: '555001Table4',
  687. tableName: '非BOM材料明细',
  688. columnProp: 'partDesc',
  689. headerAlign: 'center',
  690. align: 'left',
  691. columnLabel: '材料名称',
  692. columnHidden: false,
  693. columnImage: false,
  694. columnSortable: false,
  695. sortLv: 0,
  696. status: true,
  697. fixed: false,
  698. columnWidth: 130,
  699. },
  700. {
  701. userId: this.$store.state.user.name,
  702. functionId: 555001,
  703. serialNumber: '555001Table4QtyToIssue',
  704. tableId: '555001Table4',
  705. tableName: '非BOM材料明细',
  706. columnProp: 'qtyToIssue',
  707. headerAlign: 'center',
  708. align: 'right',
  709. columnLabel: '申请数量',
  710. columnHidden: false,
  711. columnImage: false,
  712. columnSortable: false,
  713. sortLv: 0,
  714. status: true,
  715. fixed: false,
  716. columnWidth: 80,
  717. },
  718. {
  719. userId: this.$store.state.user.name,
  720. functionId: 555001,
  721. serialNumber: '555001Table4Remark',
  722. tableId: '555001Table4',
  723. tableName: '非BOM材料明细',
  724. columnProp: 'remark',
  725. headerAlign: 'center',
  726. align: 'left',
  727. columnLabel: '备注',
  728. columnHidden: false,
  729. columnImage: false,
  730. columnSortable: false,
  731. sortLv: 0,
  732. status: true,
  733. fixed: false,
  734. columnWidth: 200,
  735. },
  736. ],
  737. modalData: {
  738. flag: '',
  739. bu: '',
  740. site: this.$store.state.user.site,
  741. groupID: '',
  742. groupDesc: '',
  743. active: '',
  744. createBy: this.$store.state.user.name,
  745. updateBy: this.$store.state.user.name,
  746. },
  747. // 展示列集
  748. columnList: [
  749. {
  750. userId: this.$store.state.user.name,
  751. functionId: 555001,
  752. serialNumber: '555001Table1ItemNo',
  753. tableId: '555001Table1',
  754. tableName: '领料申请工单子表',
  755. columnProp: 'itemNo',
  756. headerAlign: 'center',
  757. align: 'right',
  758. columnLabel: '序号',
  759. columnHidden: false,
  760. columnImage: false,
  761. columnSortable: false,
  762. sortLv: 0,
  763. status: true,
  764. fixed: false,
  765. columnWidth: 50,
  766. },
  767. {
  768. userId: this.$store.state.user.name,
  769. functionId: 555001,
  770. serialNumber: '555001Table1SubSite',
  771. tableId: '555001Table1',
  772. tableName: '领料申请工单子表',
  773. columnProp: 'subSite',
  774. headerAlign: 'center',
  775. align: 'center',
  776. columnLabel: '工厂编号',
  777. columnHidden: false,
  778. columnImage: false,
  779. columnSortable: false,
  780. sortLv: 0,
  781. status: true,
  782. fixed: false,
  783. columnWidth: 90,
  784. },
  785. /* {
  786. userId: this.$store.state.user.name,
  787. functionId: 555001,
  788. serialNumber: '555001Table1SeqNo',
  789. tableId: '555001Table1',
  790. tableName: '领料申请派工单子表',
  791. columnProp: 'seqNo',
  792. headerAlign: 'center',
  793. align: 'center',
  794. columnLabel: '派工单号',
  795. columnHidden: false,
  796. columnImage: false,
  797. columnSortable: false,
  798. sortLv: 0,
  799. status: true,
  800. fixed: false,
  801. columnWidth: 150,
  802. }, */
  803. {
  804. userId: this.$store.state.user.name,
  805. functionId: 555001,
  806. serialNumber: '555001Table1SOOrderNo',
  807. tableId: '555001Table1',
  808. tableName: '领料申请工单子表',
  809. columnProp: 'soorderNo',
  810. headerAlign: 'center',
  811. align: 'center',
  812. columnLabel: '生产订单号',
  813. columnHidden: false,
  814. columnImage: false,
  815. columnSortable: false,
  816. sortLv: 0,
  817. status: true,
  818. fixed: false,
  819. columnWidth: 120,
  820. },
  821. {
  822. userId: this.$store.state.user.name,
  823. functionId: 555001,
  824. serialNumber: '555001Table1ReleaseNo',
  825. tableId: '555001Table1',
  826. tableName: '领料申请工单子表',
  827. columnProp: 'releaseNo',
  828. headerAlign: 'center',
  829. align: 'center',
  830. columnLabel: 'ReleaseNo',
  831. columnHidden: false,
  832. columnImage: false,
  833. columnSortable: false,
  834. sortLv: 0,
  835. status: true,
  836. fixed: false,
  837. columnWidth: 80,
  838. },
  839. {
  840. userId: this.$store.state.user.name,
  841. functionId: 555001,
  842. serialNumber: '555001Table1SequenceNo',
  843. tableId: '555001Table1',
  844. tableName: '领料申请工单子表',
  845. columnProp: 'sequenceNo',
  846. headerAlign: 'center',
  847. align: 'center',
  848. columnLabel: 'SequenceNo',
  849. columnHidden: false,
  850. columnImage: false,
  851. columnSortable: false,
  852. sortLv: 0,
  853. status: true,
  854. fixed: false,
  855. columnWidth: 80,
  856. },
  857. {
  858. userId: this.$store.state.user.name,
  859. functionId: 555001,
  860. serialNumber: '555001Table1NeedDate',
  861. tableId: '555001Table1',
  862. tableName: '领料申请派工单子表',
  863. columnProp: 'needDate',
  864. headerAlign: 'center',
  865. align: 'left',
  866. columnLabel: '要求发料时间',
  867. columnHidden: false,
  868. columnImage: false,
  869. columnSortable: false,
  870. sortLv: 0,
  871. status: true,
  872. fixed: false,
  873. columnWidth: 80,
  874. },
  875. ],
  876. columnList2: [
  877. {
  878. userId: this.$store.state.user.name,
  879. functionId: 555001,
  880. serialNumber: '555001Table2ComponentPartNo',
  881. tableId: '555001Table2',
  882. tableName: '查询工单及物料',
  883. columnProp: 'partNo',
  884. headerAlign: 'center',
  885. align: 'left',
  886. columnLabel: '物料号',
  887. columnHidden: false,
  888. columnImage: false,
  889. columnSortable: false,
  890. sortLv: 0,
  891. status: true,
  892. fixed: false,
  893. columnWidth: 120,
  894. },
  895. {
  896. userId: this.$store.state.user.name,
  897. functionId: 555001,
  898. serialNumber: '555001Table2ApplyQty',
  899. tableId: '555001Table2',
  900. tableName: '查询工单及物料',
  901. columnProp: 'applyQty',
  902. headerAlign: 'center',
  903. align: 'right',
  904. columnLabel: '本次申请数量',
  905. columnHidden: false,
  906. columnImage: false,
  907. columnSortable: false,
  908. sortLv: 0,
  909. status: true,
  910. fixed: false,
  911. columnWidth: 80,
  912. },
  913. // {
  914. // userId: this.$store.state.user.name,
  915. // functionId: 555001,
  916. // serialNumber: '555001Table2FinishDate',
  917. // tableId: '555001Table2',
  918. // tableName: '查询工单及物料',
  919. // columnProp: 'height',
  920. // headerAlign: 'center',
  921. // align: 'center',
  922. // columnLabel: '高度',
  923. // columnHidden: false,
  924. // columnImage: false,
  925. // columnSortable: false,
  926. // sortLv: 0,
  927. // status: true,
  928. // fixed: false,
  929. // columnWidth: 110,
  930. // },
  931. {
  932. userId: this.$store.state.user.name,
  933. functionId: 555001,
  934. serialNumber: '555001Table2FinishDate',
  935. tableId: '555001Table2',
  936. tableName: '查询工单及物料',
  937. columnProp: 'isInWh',
  938. headerAlign: 'center',
  939. align: 'center',
  940. columnLabel: '是否在立库',
  941. columnHidden: false,
  942. columnImage: false,
  943. columnSortable: false,
  944. sortLv: 0,
  945. status: true,
  946. fixed: false,
  947. columnWidth: 110,
  948. },
  949. {
  950. // rqrq - 新增可用库存列
  951. userId: this.$store.state.user.name,
  952. functionId: 555001,
  953. serialNumber: '555001Table2AvailableQty',
  954. tableId: '555001Table2',
  955. tableName: '查询工单及物料',
  956. columnProp: 'availableQty',
  957. headerAlign: 'center',
  958. align: 'right',
  959. columnLabel: '可用库存',
  960. columnHidden: false,
  961. columnImage: false,
  962. columnSortable: false,
  963. sortLv: 0,
  964. status: true,
  965. fixed: false,
  966. columnWidth: 80,
  967. },
  968. ],
  969. columnList3: [
  970. {
  971. userId: this.$store.state.user.name,
  972. functionId: 555001,
  973. serialNumber: '555001Table3ComponentPartNo',
  974. tableId: '555001Table3',
  975. tableName: '领料申请BOM子表',
  976. columnProp: 'componentPartNo',
  977. headerAlign: 'center',
  978. align: 'left',
  979. columnLabel: '物料编码',
  980. columnHidden: false,
  981. columnImage: false,
  982. columnSortable: true,
  983. sortLv: 0,
  984. status: true,
  985. fixed: false,
  986. columnWidth: 80,
  987. },
  988. {
  989. // rqrq - 新增批次号列
  990. userId: this.$store.state.user.name,
  991. functionId: 555001,
  992. serialNumber: '555001Table3BatchNo',
  993. tableId: '555001Table3',
  994. tableName: '领料申请BOM子表',
  995. columnProp: 'batchNo',
  996. headerAlign: 'center',
  997. align: 'center',
  998. columnLabel: '批次号',
  999. columnHidden: false,
  1000. columnImage: false,
  1001. columnSortable: false,
  1002. sortLv: 0,
  1003. status: true,
  1004. fixed: false,
  1005. columnWidth: 80,
  1006. },
  1007. {
  1008. userId: this.$store.state.user.name,
  1009. functionId: 555001,
  1010. serialNumber: '555001Table3QtyRequired',
  1011. tableId: '555001Table3',
  1012. tableName: '领料申请BOM子表',
  1013. columnProp: 'isInWh',
  1014. headerAlign: 'center',
  1015. align: 'center',
  1016. columnLabel: '是否在立库',
  1017. columnHidden: false,
  1018. columnImage: false,
  1019. columnSortable: false,
  1020. sortLv: 0,
  1021. status: true,
  1022. fixed: false,
  1023. columnWidth: 50,
  1024. },
  1025. {
  1026. // rqrq - 新增可用库存列
  1027. userId: this.$store.state.user.name,
  1028. functionId: 555001,
  1029. serialNumber: '555001Table3AvailableQty',
  1030. tableId: '555001Table3',
  1031. tableName: '领料申请BOM子表',
  1032. columnProp: 'availableQty',
  1033. headerAlign: 'center',
  1034. align: 'right',
  1035. columnLabel: '可用库存',
  1036. columnHidden: false,
  1037. columnImage: false,
  1038. columnSortable: false,
  1039. sortLv: 0,
  1040. status: true,
  1041. fixed: false,
  1042. columnWidth: 80,
  1043. },
  1044. {
  1045. userId: this.$store.state.user.name,
  1046. functionId: 555001,
  1047. serialNumber: '555001Table3QtyToIssue',
  1048. tableId: '555001Table3',
  1049. tableName: '领料申请BOM子表',
  1050. columnProp: 'qtyToIssue',
  1051. headerAlign: 'center',
  1052. align: 'right',
  1053. columnLabel: '本次申请数量',
  1054. columnHidden: false,
  1055. columnImage: false,
  1056. columnSortable: false,
  1057. sortLv: 0,
  1058. status: true,
  1059. fixed: false,
  1060. columnWidth: 60,
  1061. },
  1062. {
  1063. userId: this.$store.state.user.name,
  1064. functionId: 555001,
  1065. serialNumber: '555001Table3Remark',
  1066. tableId: '555001Table3',
  1067. tableName: '领料申请BOM子表',
  1068. columnProp: 'remark',
  1069. headerAlign: 'center',
  1070. align: 'left',
  1071. columnLabel: '备注',
  1072. columnHidden: false,
  1073. columnImage: false,
  1074. columnSortable: false,
  1075. sortLv: 0,
  1076. status: true,
  1077. fixed: false,
  1078. columnWidth: 150,
  1079. },
  1080. ],
  1081. materialDetailColumnList: [
  1082. {
  1083. userId: this.$store.state.user.name,
  1084. functionId: 701002,
  1085. serialNumber: '701002Table3ItemNo',
  1086. tableId: '701002Table3',
  1087. tableName: '申请单材料明细表',
  1088. columnProp: 'itemNo',
  1089. headerAlign: 'center',
  1090. align: 'right',
  1091. columnLabel: '申请单序号',
  1092. columnHidden: false,
  1093. columnImage: false,
  1094. columnSortable: false,
  1095. sortLv: 0,
  1096. status: true,
  1097. fixed: '',
  1098. columnWidth: 80,
  1099. },
  1100. {
  1101. userId: this.$store.state.user.name,
  1102. functionId: 701002,
  1103. serialNumber: '701002Table3SubSite',
  1104. tableId: '701002Table3',
  1105. tableName: '申请单材料明细表',
  1106. columnProp: 'subSite',
  1107. headerAlign: 'center',
  1108. align: 'center',
  1109. columnLabel: '工厂编号',
  1110. columnHidden: false,
  1111. columnImage: false,
  1112. columnSortable: false,
  1113. sortLv: 0,
  1114. status: true,
  1115. fixed: '',
  1116. columnWidth: 90,
  1117. },
  1118. {
  1119. userId: this.$store.state.user.name,
  1120. functionId: 701002,
  1121. serialNumber: '701002Table3ComponentPartNo',
  1122. tableId: '701002Table3',
  1123. tableName: '申请单材料明细表',
  1124. columnProp: 'componentPartNo',
  1125. headerAlign: 'center',
  1126. align: 'center',
  1127. columnLabel: '材料编码',
  1128. columnHidden: false,
  1129. columnImage: false,
  1130. columnSortable: false,
  1131. sortLv: 0,
  1132. status: true,
  1133. fixed: '',
  1134. columnWidth: 100,
  1135. },
  1136. {
  1137. userId: this.$store.state.user.name,
  1138. functionId: 701002,
  1139. serialNumber: '701002Table3NeedDate',
  1140. tableId: '701002Table3',
  1141. tableName: '申请单材料明细表',
  1142. columnProp: 'needDate',
  1143. headerAlign: 'center',
  1144. align: 'center',
  1145. columnLabel: '需求时间',
  1146. columnHidden: false,
  1147. columnImage: false,
  1148. columnSortable: false,
  1149. sortLv: 0,
  1150. status: true,
  1151. fixed: '',
  1152. columnWidth: 110,
  1153. },
  1154. {
  1155. userId: this.$store.state.user.name,
  1156. functionId: 701002,
  1157. serialNumber: '701002Table3QtyToIssue',
  1158. tableId: '701002Table3',
  1159. tableName: '申请单材料明细表',
  1160. columnProp: 'qtyToIssue',
  1161. headerAlign: 'center',
  1162. align: 'right',
  1163. columnLabel: '申请数量',
  1164. columnHidden: false,
  1165. columnImage: false,
  1166. columnSortable: false,
  1167. sortLv: 0,
  1168. status: true,
  1169. fixed: '',
  1170. columnWidth: 80,
  1171. },
  1172. {
  1173. userId: this.$store.state.user.name,
  1174. functionId: 701002,
  1175. serialNumber: '701002Table3QtyToIssueOriginal',
  1176. tableId: '701002Table3',
  1177. tableName: '申请单材料明细表',
  1178. columnProp: 'qtyToIssueOriginal',
  1179. headerAlign: 'center',
  1180. align: 'right',
  1181. columnLabel: '已发数量',
  1182. columnHidden: false,
  1183. columnImage: false,
  1184. columnSortable: false,
  1185. sortLv: 0,
  1186. status: true,
  1187. fixed: '',
  1188. columnWidth: 80,
  1189. },
  1190. {
  1191. userId: this.$store.state.user.name,
  1192. functionId: 701002,
  1193. serialNumber: '701002Table3IssueType',
  1194. tableId: '701002Table3',
  1195. tableName: '申请单材料明细表',
  1196. columnProp: 'issueType',
  1197. headerAlign: 'center',
  1198. align: 'right',
  1199. columnLabel: '类型',
  1200. columnHidden: false,
  1201. columnImage: false,
  1202. columnSortable: false,
  1203. sortLv: 0,
  1204. status: true,
  1205. fixed: '',
  1206. columnWidth: 80,
  1207. },
  1208. {
  1209. userId: this.$store.state.user.name,
  1210. functionId: 701002,
  1211. serialNumber: '701002Table3Remark',
  1212. tableId: '701002Table3',
  1213. tableName: '申请单材料明细表',
  1214. columnProp: 'remark',
  1215. headerAlign: 'center',
  1216. align: 'left',
  1217. columnLabel: '备注',
  1218. columnHidden: false,
  1219. columnImage: false,
  1220. columnSortable: false,
  1221. sortLv: 0,
  1222. status: true,
  1223. fixed: '',
  1224. columnWidth: 160,
  1225. },
  1226. {
  1227. userId: this.$store.state.user.name,
  1228. functionId: 701002,
  1229. serialNumber: '701002Table3SOOrderNo',
  1230. tableId: '701002Table3',
  1231. tableName: '申请单材料明细表',
  1232. columnProp: 'soorderNo',
  1233. headerAlign: 'center',
  1234. align: 'left',
  1235. columnLabel: '生产订单',
  1236. columnHidden: false,
  1237. columnImage: false,
  1238. columnSortable: false,
  1239. sortLv: 0,
  1240. status: true,
  1241. fixed: '',
  1242. columnWidth: 120,
  1243. },
  1244. {
  1245. userId: this.$store.state.user.name,
  1246. functionId: 701002,
  1247. serialNumber: '701002Table3BOMItemNo',
  1248. tableId: '701002Table3',
  1249. tableName: '申请单材料明细表',
  1250. columnProp: 'bomitemNo',
  1251. headerAlign: 'center',
  1252. align: 'right',
  1253. columnLabel: 'BOM序号',
  1254. columnHidden: false,
  1255. columnImage: false,
  1256. columnSortable: false,
  1257. sortLv: 0,
  1258. status: true,
  1259. fixed: '',
  1260. columnWidth: 80,
  1261. },
  1262. ],
  1263. rules: {
  1264. groupIdType: [
  1265. {
  1266. required: true,
  1267. message: ' ',
  1268. trigger: ['blur', 'change'],
  1269. },
  1270. ],
  1271. groupDescType: [
  1272. {
  1273. required: true,
  1274. message: ' ',
  1275. trigger: ['blur', 'change'],
  1276. },
  1277. ],
  1278. activeType: [
  1279. {
  1280. required: true,
  1281. message: ' ',
  1282. trigger: ['blur', 'change'],
  1283. },
  1284. ],
  1285. bu: [
  1286. {
  1287. required: true,
  1288. message: ' ',
  1289. trigger: ['blur', 'change'],
  1290. },
  1291. ],
  1292. },
  1293. userBuList: [],
  1294. authSearch: false,
  1295. authSave: false,
  1296. authUpdate: false,
  1297. authDelete: false,
  1298. menuId: this.$route.meta.menuId,
  1299. partSearch: {
  1300. site: '',
  1301. sourceBu: '',
  1302. partNo: '',
  1303. partDesc: '',
  1304. spec: '',
  1305. },
  1306. xiadaModelFlag: false,
  1307. saveOtherPartModalFlag: false,
  1308. otherPartData: {
  1309. site: '',
  1310. notifyNo: '',
  1311. itemNo: '',
  1312. bOMItemNo: '',
  1313. componentPartNo: '',
  1314. qtyToIssue: '',
  1315. issueType: '',
  1316. partDesc: '',
  1317. umid: '',
  1318. remark: '',
  1319. },
  1320. showAddNotifyTypeDialog: false,
  1321. selectedNotifyType: 'production',
  1322. selectedNotifyRemark: '',
  1323. showXiadaNotifyDialog: false,
  1324. xiadaNotifyData: {
  1325. planIssueDate: '',
  1326. remark: '',
  1327. },
  1328. chooseLoading: false,
  1329. seqNoModalLoading: false,
  1330. saveNewLoading: false,
  1331. // 选择物料弹框相关
  1332. selectMaterialModalFlag: false,
  1333. availableMaterialList: [], // 左侧可选物料列表
  1334. selectedMaterialList: [], // 右侧已选物料列表
  1335. availableMaterialSelections: [], // 左侧选中的行
  1336. selectedMaterialSelections: [], // 右侧选中的行
  1337. selectMaterialLoading: false,
  1338. modelCode: '', // 模板编号
  1339. modelName: '', // 模板名称
  1340. // 左侧表格分页相关
  1341. availableMaterialPage: 1, // 当前页码
  1342. availableMaterialLimit: 100, // 每页条数
  1343. availableMaterialTotal: 0, // 总条数
  1344. componentPartNo: '', // 物料编码搜索
  1345. orderType: 'slittingorder',
  1346. // 申请明细弹框相关
  1347. isMaterialDetailModal: false, // 标识是否从申请明细弹框打开选择物料弹框
  1348. clickrow:{},
  1349. partNo:'',
  1350. addLineLoading:false,
  1351. // 新增工单物料弹窗Site下拉:用于添加物料行/选择物料按工厂过滤 - rqrq
  1352. materialDialogSite: '',
  1353. materialDialogSiteOptions: [],
  1354. materialDialogSiteLoading: false,
  1355. addOrderLoading:false, // 订单添加按钮loading状态 - rqrq(已废弃)
  1356. remark:'', // 已添加订单号列表(分号分隔) - rqrq
  1357. addedOrderNoList: [], // 已添加订单号数组 - rqrq
  1358. // ==================== 订单管理弹窗相关 - rqrq ====================
  1359. orderManageDialogVisible: false, // 订单管理弹窗显示状态 - rqrq
  1360. orderManageData: { // 订单管理输入数据 - rqrq
  1361. orderNo: '',
  1362. releaseNo: '*',
  1363. sequenceNo: '*'
  1364. },
  1365. tempOrderList: [], // 临时订单明细列表(不汇总) - rqrq
  1366. tempOrderListLoading: false, // 临时订单列表加载状态 - rqrq
  1367. addOrderTempLoading: false, // 添加订单到临时列表按钮loading - rqrq
  1368. summaryLoading: false, // 汇总按钮loading状态 - rqrq
  1369. // 订单添加多site确认:shipment候选 - rqrq
  1370. shipmentSiteSelectModalFlag: false,
  1371. shipmentSiteSelectList: [],
  1372. shipmentSiteSelectedRow: null,
  1373. // 订单添加多site确认:shoporder/slittingorder候选 - rqrq
  1374. shopOrderSiteSelectFlag: false,
  1375. shopOrderCandidateList: [],
  1376. // 多site二次查询时锁定当前输入的订单号与工厂编号 - rqrq
  1377. pendingOrderManageData: {
  1378. orderNo: '',
  1379. releaseNo: '*',
  1380. sequenceNo: '*',
  1381. site: '',
  1382. },
  1383. }
  1384. },
  1385. mounted() {
  1386. this.$nextTick(() => {
  1387. this.height = window.innerHeight - 220
  1388. })
  1389. },
  1390. created () {
  1391. // 按钮控制
  1392. // this.getButtonAuthData()
  1393. //this.getTableUserColumn(this.$route.meta.menuId+'Table2',2)
  1394. this.getUserNotifyNo()
  1395. },
  1396. computed: {
  1397. // 获取订单类型的中文名称 - rqrq
  1398. orderTypeText() {
  1399. const typeMap = {
  1400. 'slittingorder': '分切订单',
  1401. 'shipment': '销售发货',
  1402. 'shoporder': '成品订单'
  1403. }
  1404. return typeMap[this.orderType] || '未知类型'
  1405. },
  1406. // 新增物料弹框置灰展示当前过滤Site - rqrq
  1407. selectMaterialDisplaySite() {
  1408. if (this.isMaterialDetailModal) {
  1409. return String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
  1410. }
  1411. return String(this.materialDialogSite || '').trim()
  1412. },
  1413. // 新增工单物料弹窗表格列配置(根据订单类型动态显示批次号列) - rqrq
  1414. displayColumnList2() {
  1415. // 基础列配置
  1416. let baseColumns = [...this.columnList2]
  1417. // 如果订单类型是报废,在物料号后面插入批次号列 - rqrq
  1418. if (this.orderType === 'baofei') {
  1419. const batchColumn = {
  1420. userId: this.$store.state.user.name,
  1421. functionId: 555001,
  1422. serialNumber: '555001Table2BatchNo',
  1423. tableId: '555001Table2',
  1424. tableName: '查询工单及物料',
  1425. columnProp: 'batchNo',
  1426. headerAlign: 'center',
  1427. align: 'center',
  1428. columnLabel: '批次号',
  1429. columnHidden: false,
  1430. columnImage: false,
  1431. columnSortable: false,
  1432. sortLv: 0,
  1433. status: true,
  1434. fixed: false,
  1435. columnWidth: 120,
  1436. }
  1437. const remarkColumn = {
  1438. userId: this.$store.state.user.name,
  1439. functionId: 555001,
  1440. serialNumber: '555001Table2Remark',
  1441. tableId: '555001Table2',
  1442. tableName: '查询工单及物料',
  1443. columnProp: 'remark',
  1444. headerAlign: 'center',
  1445. align: 'center',
  1446. columnLabel: '导入数量',
  1447. columnHidden: false,
  1448. columnImage: false,
  1449. columnSortable: false,
  1450. sortLv: 0,
  1451. status: true,
  1452. fixed: false,
  1453. columnWidth: 120,
  1454. }
  1455. // 在第一个列(物料号)后面插入批次号列 - rqrq
  1456. baseColumns.splice(1, 0, batchColumn)
  1457. baseColumns.splice(2, 0, remarkColumn)
  1458. }
  1459. return baseColumns
  1460. }
  1461. },
  1462. methods: {
  1463. tabClick(tab, event) {
  1464. // 刷新当前标签页的表格数据
  1465. this.refreshCurrentTabTable()
  1466. },
  1467. refreshCurrentTabTable() {
  1468. if (this.notifyNo === '' || !this.notifyNo) {
  1469. return
  1470. }
  1471. if (this.activeName === 'sub') {
  1472. // 使用当前选中的行数据,如果没有则使用申请单基本信息
  1473. let queryData = {
  1474. site: this.notifyData.site || this.$store.state.user.site,
  1475. notifyNo: this.notifyNo,
  1476. orderType: 'shoporder',
  1477. }
  1478. // 如果当前行有数据,合并进去
  1479. if (
  1480. this.currentRow &&
  1481. this.currentRow !== '' &&
  1482. this.currentRow.notifyNo
  1483. ) {
  1484. queryData = {
  1485. ...this.currentRow,
  1486. orderType: 'shoporder',
  1487. }
  1488. }
  1489. this.dataListLoading = true
  1490. searchNotifyMaterialListNew(queryData)
  1491. .then(({ data }) => {
  1492. this.dataListLoading = false
  1493. if (data && data.code === 0) {
  1494. this.materialDetailList = data.rows
  1495. } else {
  1496. this.materialDetailList = []
  1497. }
  1498. })
  1499. .catch(() => {
  1500. this.dataListLoading = false
  1501. this.materialDetailList = []
  1502. })
  1503. }
  1504. },
  1505. materialDetailTableRowClassName({ row, rowIndex }) {
  1506. if (
  1507. row.qtyToIssueOriginal < row.qtyToIssue &&
  1508. new Date(row.needDate) <
  1509. new Date(this.dayjs().format('YYYY-MM-DD HH:mm'))
  1510. ) {
  1511. return 'error-row'
  1512. }
  1513. return ''
  1514. },
  1515. changeData(row) {
  1516. this.currentRow = JSON.parse(JSON.stringify(row))
  1517. this.refreshCurrentTabTable()
  1518. },
  1519. getBaseList(val, type) {
  1520. this.tagNo = val
  1521. let conSql = ''
  1522. this.$nextTick(() => {
  1523. let strVal = ''
  1524. if (val === 515) {
  1525. strVal = this.seqNoData.sResourceid
  1526. conSql =
  1527. " and site = '" +
  1528. this.notifyData.site +
  1529. "'" +
  1530. " and bu_no = '" +
  1531. this.notifyData.bu +
  1532. "'"
  1533. this.$refs.baseList.init(val, strVal, conSql)
  1534. }
  1535. if (val === 216) {
  1536. strVal = this.seqNoData.sWorkcenterno
  1537. conSql =
  1538. " and site = '" +
  1539. this.notifyData.site +
  1540. "'" +
  1541. " and bu_no = '" +
  1542. this.notifyData.bu +
  1543. "'"
  1544. this.$refs.baseList.init(val, strVal, conSql)
  1545. }
  1546. if (val === 215) {
  1547. strVal = this.notifyOrderData.locationNo
  1548. this.$refs.baseList.init(val, strVal)
  1549. }
  1550. })
  1551. },
  1552. tableRowClassName({ row, rowIndex }) {
  1553. if (row.qtyToIssue > row.qtyAvailable) {
  1554. return 'error-row'
  1555. }
  1556. return ''
  1557. },
  1558. // 报废导入表格行样式:导入数量大于可用库存时行变红 - rqrq
  1559. seqNoTableRowClassName({ row, rowIndex }) {
  1560. // 只有报废类型且remark存在时才判断 - rqrq
  1561. if (this.orderType === 'baofei' && row.remark !== undefined) {
  1562. const remarkQty = Number(row.remark || 0)
  1563. const availableQty = Number(row.availableQty || 0)
  1564. // 导入数量大于可用库存时变红 - rqrq
  1565. if (remarkQty > availableQty) {
  1566. return 'baofei-error-row'
  1567. }
  1568. }
  1569. return ''
  1570. },
  1571. // 列表方法的回调
  1572. getBaseData(val) {
  1573. if (this.tagNo === 515) {
  1574. this.seqNoData.sResourceid = val.resource_id
  1575. }
  1576. if (this.tagNo === 215) {
  1577. this.notifyOrderData.locationNo = val.location_id
  1578. }
  1579. if (this.tagNo === 216) {
  1580. this.seqNoData.sWorkcenterno = val.work_center_no
  1581. }
  1582. },
  1583. getUserNotifyNo() {
  1584. let inData = {
  1585. site: this.$store.state.user.site,
  1586. username: this.$store.state.user.name,
  1587. }
  1588. this.getAllNotifyStatus()
  1589. getUserNoOrderNotifyNo(inData).then(({ data }) => {
  1590. if (data.code === 0) {
  1591. if (data.row != null) {
  1592. this.notifyNo = data.row.notifyNo
  1593. this.notifyData = data.row
  1594. this.getNotifyNoOrderDetail()
  1595. /* this.searchOtherPart('BOM')
  1596. this.searchOtherPart('不管控物料') */
  1597. } else {
  1598. this.notifyNo = ''
  1599. this.notifyData = {
  1600. site: '',
  1601. bu: '',
  1602. notifyNo: '',
  1603. notifyDate: '',
  1604. enteredDate: '',
  1605. userName: '',
  1606. userDisplay: '',
  1607. remark: '',
  1608. planIssueDate: '',
  1609. }
  1610. this.dataList = []
  1611. }
  1612. } else {
  1613. this.notifyNo = ''
  1614. this.notifyData = {
  1615. site: '',
  1616. bu: '',
  1617. notifyNo: '',
  1618. notifyDate: '',
  1619. enteredDate: '',
  1620. userName: '',
  1621. userDisplay: '',
  1622. remark: '',
  1623. planIssueDate: '',
  1624. }
  1625. this.dataList = []
  1626. }
  1627. })
  1628. },
  1629. getNotifyNoOrderDetail() {
  1630. let inData = {
  1631. site: this.$store.state.user.site,
  1632. notifyNo: this.notifyNo,
  1633. }
  1634. getNotifyNoOrderDetail(inData).then(({ data }) => {
  1635. if (data.code === 0) {
  1636. this.dataList = data.rows
  1637. }
  1638. })
  1639. },
  1640. addNotify() {
  1641. //this.showAddNotifyTypeDialog = true
  1642. let inData = {
  1643. site: this.$store.state.user.site,
  1644. userName: this.$store.state.user.name,
  1645. orderType: 'otherOrder', // rqrq - 固定为shoporder类型
  1646. }
  1647. createNoOrderNotify(inData).then(({ data }) => {
  1648. if (data.code === 0) {
  1649. this.showAddNotifyTypeDialog = false
  1650. this.$message({
  1651. message: '操作成功',
  1652. type: 'success',
  1653. duration: 1500,
  1654. onClose: () => {},
  1655. })
  1656. this.getUserNotifyNo()
  1657. } else {
  1658. this.$alert(data.msg, '错误', {
  1659. confirmButtonText: '确定',
  1660. })
  1661. }
  1662. })
  1663. },
  1664. confirmAddNotify() {
  1665. let outWorkOrderFlag = 'N'
  1666. if (this.selectedNotifyType === 'outsourced') {
  1667. outWorkOrderFlag = 'Y'
  1668. } else {
  1669. outWorkOrderFlag = 'N'
  1670. }
  1671. let inData = {
  1672. site: this.$store.state.user.site,
  1673. userName: this.$store.state.user.name,
  1674. outWorkOrderFlag: outWorkOrderFlag,
  1675. remark: this.selectedNotifyRemark,
  1676. orderType: 'otherOrder', // rqrq - 固定为shoporder类型
  1677. }
  1678. this.getAllNotifyStatus()
  1679. createNoOrderNotify(inData).then(({ data }) => {
  1680. if (data.code === 0) {
  1681. this.showAddNotifyTypeDialog = false
  1682. this.$message({
  1683. message: '操作成功',
  1684. type: 'success',
  1685. duration: 1500,
  1686. onClose: () => {},
  1687. })
  1688. this.getUserNotifyNo()
  1689. } else {
  1690. this.$alert(data.msg, '错误', {
  1691. confirmButtonText: '确定',
  1692. })
  1693. }
  1694. })
  1695. },
  1696. chooseSOS(row) {
  1697. if (this.dataList.length > 0) {
  1698. //这边是有个判断的,判断派工单号不能重复
  1699. let stop = false
  1700. for (let i = 0; i < this.dataList.length; i++) {
  1701. if (
  1702. this.dataList[i].orderNo == row.orderNo &&
  1703. this.dataList[i].releaseNo == row.releaseNo &&
  1704. this.dataList[i].sequenceNo == row.sequenceNo
  1705. ) {
  1706. stop = true
  1707. }
  1708. }
  1709. if (stop) {
  1710. this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
  1711. confirmButtonText: '确定',
  1712. })
  1713. return false
  1714. }
  1715. }
  1716. let inData = {
  1717. site: this.$store.state.user.site,
  1718. orderNo: row.orderNo,
  1719. releaseNo: row.releaseNo,
  1720. sequenceNo: row.sequenceNo,
  1721. }
  1722. this.chooseLoading = true
  1723. getShopOrderFromIFSWithOrderNo(inData)
  1724. .then(({ data }) => {
  1725. if (data.code === 0) {
  1726. console.log('data', data)
  1727. this.notifyOrderData.partNo = data.rows[0].partNo
  1728. this.notifyOrderData.orderNo = data.rows[0].orderNo
  1729. this.notifyOrderData.site = this.$store.state.user.site
  1730. this.notifyOrderData.partDesc = data.rows[0].partDesc
  1731. this.notifyOrderData.qtyRequired = data.rows[0].lotSize
  1732. this.notifyOrderData.releaseNo = data.rows[0].releaseNo
  1733. this.notifyOrderData.issureQty = ''
  1734. this.notifyOrderData.needDate =
  1735. this.dayjs().format('YYYY-MM-DD HH:mm')
  1736. this.notifyOrderData.sequenceNo = data.rows[0].sequenceNo
  1737. this.saveSeqNoModalFlag = true
  1738. } else {
  1739. this.$meassage.error(data.msg)
  1740. return
  1741. }
  1742. })
  1743. .finally(() => {
  1744. this.chooseLoading = false
  1745. })
  1746. },
  1747. saveSOS() {
  1748. if (
  1749. this.notifyOrderData.needDate == null ||
  1750. this.notifyOrderData.needDate == ''
  1751. ) {
  1752. this.$message.warning('请选择时间!')
  1753. return false
  1754. }
  1755. // if (
  1756. // this.notifyOrderData.issureQty == null ||
  1757. // this.notifyOrderData.issureQty == '' ||
  1758. // this.notifyOrderData.issureQty < 0
  1759. // ) {
  1760. // this.$message.warning('请填写领取数量!')
  1761. // return false
  1762. // }
  1763. let row = this.notifyOrderData
  1764. console.log('row', row, this.dataList)
  1765. if (this.dataList.length > 0) {
  1766. let stop = false
  1767. for (let i = 0; i < this.dataList.length; i++) {
  1768. if (
  1769. this.dataList[i].soorderNo == row.orderNo &&
  1770. this.dataList[i].releaseNo == row.releaseNo &&
  1771. this.dataList[i].sequenceNo == row.sequenceNo
  1772. ) {
  1773. stop = true
  1774. }
  1775. }
  1776. if (stop) {
  1777. this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
  1778. confirmButtonText: '确定',
  1779. })
  1780. return false
  1781. }
  1782. }
  1783. this.$confirm('确定选择工单' + row.orderNo + '?', '提示', {
  1784. confirmButtonText: '确定',
  1785. cancelButtonText: '取消',
  1786. type: 'warning',
  1787. }).then(() => {
  1788. let inData = {
  1789. site: this.$store.state.user.site,
  1790. notifyNo: this.notifyNo,
  1791. fgPartNo: row.partNo,
  1792. soorderNo: row.orderNo,
  1793. opsItemNo: row.itemNo,
  1794. sequenceNo: row.sequenceNo,
  1795. releaseNo: row.releaseNo,
  1796. needDate: row.needDate,
  1797. issureQty: row.issureQty,
  1798. }
  1799. saveSOIssueNotifyOrderList(inData).then(({ data }) => {
  1800. if (data.code === 0) {
  1801. this.saveSeqNoModalFlag = false
  1802. row.itemNo = data.itemNo
  1803. this.getNotifyNoOrderDetail()
  1804. this.enterSOS(row)
  1805. } else {
  1806. this.$alert(data.msg, '错误', {
  1807. confirmButtonText: '确定',
  1808. })
  1809. }
  1810. })
  1811. })
  1812. },
  1813. qtyAllForSeqNo() {
  1814. this.notifyOrderData.issureQty = this.notifyOrderData.qtyRequired
  1815. },
  1816. qtyAllForBom(row) {
  1817. row.qtyToIssue = row.qtyRequired
  1818. },
  1819. enterSOSDetail(row) {
  1820. let rows = {
  1821. site: this.$store.state.user.site,
  1822. notifyNo: this.notifyNo,
  1823. orderNo: row.soorderNo,
  1824. seqNo: row.seqNo,
  1825. partNo: row.fgPartNo,
  1826. itemNo: row.itemNo,
  1827. releaseNo: row.releaseNo,
  1828. sequenceNo: row.sequenceNo,
  1829. }
  1830. this.clickrow = row
  1831. //this.searchNotifyMaterialList(rows)
  1832. this.enterSOS(rows)
  1833. },
  1834. enterSOS(row) {
  1835. console.log('row', row)
  1836. this.seqNoModalFlag = false
  1837. this.materialModalFlag = true
  1838. this.sobomList = []
  1839. this.sobomData = {
  1840. orderNo: row.orderNo,
  1841. seqNo: row.seqNo,
  1842. partNo: row.partNo,
  1843. }
  1844. this.bomLoadFlag = true
  1845. let inData = {
  1846. site: this.$store.state.user.site,
  1847. notifyNo: this.notifyNo,
  1848. partNo: row.partNo,
  1849. itemNo: row.itemNo,
  1850. }
  1851. getNoOrderMaterialList(inData).then(({ data }) => {
  1852. this.bomLoadFlag = false
  1853. if (data.code === 0) {
  1854. this.sobomList = data.rows
  1855. for (let i = 0; i < this.sobomList.length; i++) {
  1856. this.sobomList[i].itemNo = inData.itemNo
  1857. /* if(!this.sobomList[i].qtyToIssue){
  1858. this.$set(this.sobomList[i], 'qtyToIssue', this.sobomList[i].qtyRequired)
  1859. } */
  1860. }
  1861. }
  1862. })
  1863. },
  1864. // 从申请明细弹框打开选择物料弹框
  1865. openSelectMaterialModalForDetail() {
  1866. this.isMaterialDetailModal = true
  1867. // 设置模板编号和名称(使用生产订单号)
  1868. this.modelCode = this.sobomData.orderNo || ''
  1869. this.modelName = this.sobomData.partNo || ''
  1870. // 将sobomList中的数据转换为选择物料弹框需要的格式,显示在右侧"已有物料"列表中
  1871. const detailSite = String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
  1872. this.selectedMaterialList = this.sobomList.map(item => {
  1873. const convertedItem = JSON.parse(JSON.stringify(item))
  1874. // 将qtyToIssue转换为applyQty
  1875. convertedItem.applyQty = convertedItem.qtyToIssue || 0
  1876. // 确保partNo存在(可能使用componentPartNo)
  1877. if (!convertedItem.partNo && convertedItem.componentPartNo) {
  1878. convertedItem.partNo = convertedItem.componentPartNo
  1879. }
  1880. // 列表展示补齐Site - rqrq
  1881. convertedItem.site = convertedItem.site || convertedItem.subSite || detailSite
  1882. convertedItem.subSite = convertedItem.subSite || convertedItem.site || detailSite
  1883. return convertedItem
  1884. })
  1885. // 重置分页
  1886. this.availableMaterialPage = 1
  1887. this.availableMaterialLimit = 100
  1888. this.$set(
  1889. this,
  1890. 'componentPartNo',
  1891. ''
  1892. ) // 清空物料编码搜索条件
  1893. // 加载可选物料列表
  1894. this.loadAvailableMaterialList()
  1895. // 打开弹框
  1896. this.selectMaterialModalFlag = true
  1897. },
  1898. chooseSOSModal() {
  1899. this.seqNoData = {
  1900. site: this.$store.state.user.site,
  1901. orderNo: '',
  1902. releaseNo: '*',
  1903. sequenceNo: '*',
  1904. seqno: '',
  1905. sResourceid: '',
  1906. sWorkcenterno: '',
  1907. operatorId: '',
  1908. sShiftno: '',
  1909. startDate: this.dayjs().format('YYYY-MM-DD'),
  1910. endDate: this.dayjs().format('YYYY-MM-DD'),
  1911. }
  1912. this.seqNoList = []
  1913. // 清空已添加订单记录 - rqrq
  1914. this.addedOrderNoList = []
  1915. this.remark = ''
  1916. // 清空临时订单列表 - rqrq
  1917. this.tempOrderList = []
  1918. this.partNo = ''
  1919. // 打开弹窗时加载授权Site下拉,供添加物料行/选择物料使用 - rqrq
  1920. this.loadMaterialDialogSiteOptions()
  1921. this.seqNoModalFlag = true
  1922. },
  1923. // 应用授权Site到下拉选项,空授权时回退父site - rqrq
  1924. applyMaterialDialogSiteOptions(subSiteCodeList, parentSite) {
  1925. const normalizedList = Array.isArray(subSiteCodeList)
  1926. ? Array.from(new Set(subSiteCodeList.map(code => String(code || '').trim()).filter(code => !!code)))
  1927. : []
  1928. const finalSiteCodeList = normalizedList.length > 0
  1929. ? normalizedList
  1930. : (parentSite ? [parentSite] : [])
  1931. this.materialDialogSiteOptions = finalSiteCodeList.map(siteCode => ({
  1932. siteCode,
  1933. siteName: siteCode,
  1934. }))
  1935. if (!this.materialDialogSiteOptions.some(item => item.siteCode === this.materialDialogSite)) {
  1936. this.materialDialogSite = this.materialDialogSiteOptions.length > 0
  1937. ? this.materialDialogSiteOptions[0].siteCode
  1938. : ''
  1939. }
  1940. },
  1941. // 加载新增工单物料弹窗Site下拉(优先缓存,再拉授权接口) - rqrq
  1942. loadMaterialDialogSiteOptions() {
  1943. const userName = String(localStorage.getItem('userName') || this.$store.state.user.name || '').trim()
  1944. const parentSite = String(localStorage.getItem('site') || this.$store.state.user.site || '').trim()
  1945. const cacheSubSiteCodeList = getAuthorizedSubSiteCodeList(this.$store.state.user.subSiteCodeList)
  1946. this.applyMaterialDialogSiteOptions(cacheSubSiteCodeList, parentSite)
  1947. if (!userName || !parentSite) {
  1948. return Promise.resolve()
  1949. }
  1950. this.materialDialogSiteLoading = true
  1951. return getUserAuthorizedSubSiteCodes({ userName, site: parentSite })
  1952. .then(({ data }) => {
  1953. if (data && data.code === 0) {
  1954. this.applyMaterialDialogSiteOptions(data.data || [], parentSite)
  1955. }
  1956. })
  1957. .catch((error) => {
  1958. console.error('获取用户授权Site失败:', error)
  1959. })
  1960. .finally(() => {
  1961. this.materialDialogSiteLoading = false
  1962. })
  1963. },
  1964. // 校验并返回当前弹窗选中的Site - rqrq
  1965. resolveMaterialDialogSite() {
  1966. const selectedSite = String(this.materialDialogSite || '').trim()
  1967. if (!selectedSite) {
  1968. this.$message.warning('请先选择Site!')
  1969. return ''
  1970. }
  1971. return selectedSite
  1972. },
  1973. searchSOSRouting() {
  1974. // 初始化seqNoList如果不存在
  1975. if (!this.seqNoList) {
  1976. this.seqNoList = []
  1977. }
  1978. // 判断this.seqNoList中是否已存在相同的orderNo、releaseNo、sequenceNo组合
  1979. const exists = this.seqNoList.some(
  1980. (row) =>
  1981. row.orderNo === this.seqNoData.orderNo &&
  1982. row.releaseNo === this.seqNoData.releaseNo &&
  1983. row.sequenceNo === this.seqNoData.sequenceNo
  1984. )
  1985. if (exists) {
  1986. this.$message.warning('该工单数据已存在,请先删除再添加!')
  1987. return false
  1988. }
  1989. const dataListExists = this.dataList.some(
  1990. (row) =>
  1991. row.soorderNo === this.seqNoData.orderNo &&
  1992. row.releaseNo === this.seqNoData.releaseNo &&
  1993. row.sequenceNo === this.seqNoData.sequenceNo
  1994. )
  1995. if (dataListExists) {
  1996. this.$message.warning('该工单的数据已添加过,请先删除再添加!')
  1997. return false
  1998. }
  1999. // 直接创建一行数据并添加到表格中,不调用接口
  2000. const newRow = {
  2001. orderNo: this.seqNoData.orderNo,
  2002. releaseNo: this.seqNoData.releaseNo,
  2003. sequenceNo: this.seqNoData.sequenceNo,
  2004. lineItemNo: '',
  2005. materialLineStatus: '',
  2006. componentPartNo: '',
  2007. componentPartDesc: '',
  2008. applyQty: 0,
  2009. qtyIssued: 0,
  2010. qtyRequired: 0,
  2011. qtyReserved: 0,
  2012. uom: '',
  2013. partNo: '',
  2014. partDesc: '',
  2015. startDate: '',
  2016. finishDate: '',
  2017. needDate: '',
  2018. }
  2019. this.seqNoList.push(newRow)
  2020. this.$message.success('添加成功')
  2021. // 清空输入框
  2022. this.seqNoData.orderNo = ''
  2023. this.seqNoData.releaseNo = ''
  2024. this.seqNoData.sequenceNo = ''
  2025. },
  2026. // ==================== 订单管理弹窗相关方法 - rqrq ====================
  2027. // 打开订单管理弹窗:必须先选中工厂编号,查询按精确site不带% - rqrq
  2028. openOrderManageDialog() {
  2029. if (!this.resolveMaterialDialogSite()) {
  2030. return
  2031. }
  2032. this.orderManageDialogVisible = true
  2033. // 不清空临时列表,保留上次输入的数据 - rqrq
  2034. // this.tempOrderList = []
  2035. },
  2036. // 关闭订单管理弹窗 - rqrq
  2037. closeOrderManageDialog() {
  2038. this.orderManageDialogVisible = false
  2039. // 清空输入框 - rqrq
  2040. this.orderManageData = {
  2041. orderNo: '',
  2042. releaseNo: '*',
  2043. sequenceNo: '*'
  2044. }
  2045. },
  2046. // 添加订单到临时列表(不汇总);按弹窗工厂编号精确查,不再用site% - rqrq
  2047. addOrderToTempList() {
  2048. // 1. 参数校验 - rqrq
  2049. if (!this.orderManageData.orderNo || this.orderManageData.orderNo.trim() === '') {
  2050. this.$message.warning('请输入Order No!')
  2051. return
  2052. }
  2053. const selectedSite = this.resolveMaterialDialogSite()
  2054. if (!selectedSite) {
  2055. return
  2056. }
  2057. if (this.addOrderTempLoading) {
  2058. return
  2059. }
  2060. // 锁定当前输入,供二次查询使用 - rqrq
  2061. this.pendingOrderManageData = {
  2062. orderNo: this.orderManageData.orderNo.trim(),
  2063. releaseNo: this.orderManageData.releaseNo || '*',
  2064. sequenceNo: this.orderManageData.sequenceNo || '*',
  2065. site: selectedSite,
  2066. }
  2067. if (this.orderType === 'shipment') {
  2068. this.addShipmentOrderToTempList()
  2069. return
  2070. }
  2071. // 分切/成品订单:按下拉工厂编号精确查工单 - rqrq
  2072. this.addShopOrderToTempList()
  2073. },
  2074. // 销售发货:按弹窗工厂编号精确查询,不再拼接% - rqrq
  2075. addShipmentOrderToTempList() {
  2076. this.addOrderTempLoading = true
  2077. const requestParams = {
  2078. site: this.pendingOrderManageData.site || this.materialDialogSite,
  2079. orderNo: this.pendingOrderManageData.orderNo,
  2080. }
  2081. getShipmentAndLineForIssure(requestParams)
  2082. .then(({ data }) => {
  2083. if (!(data && data.code === 0)) {
  2084. this.$message.error((data && data.msg) || '获取订单物料失败!')
  2085. return
  2086. }
  2087. if (data.needSelectSite) {
  2088. this.shipmentSiteSelectList = (data.shipments || []).map((item) => this.normalizeShipmentSiteRow(item))
  2089. this.shipmentSiteSelectedRow = null
  2090. if (this.shipmentSiteSelectList.length === 0) {
  2091. this.$message.warning('未查询到数据!')
  2092. return
  2093. }
  2094. this.shipmentSiteSelectModalFlag = true
  2095. return
  2096. }
  2097. this.appendOrderMaterialToTempList(
  2098. data.rows || [],
  2099. this.pendingOrderManageData.site || this.materialDialogSite
  2100. )
  2101. })
  2102. .catch((error) => {
  2103. this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
  2104. })
  2105. .finally(() => {
  2106. this.addOrderTempLoading = false
  2107. })
  2108. },
  2109. // 兼容Shipment头大写/驼峰字段 - rqrq
  2110. normalizeShipmentSiteRow(item) {
  2111. if (!item) {
  2112. return {}
  2113. }
  2114. return {
  2115. contract: item.contract || item.CONTRACT || '',
  2116. shipmentId: item.shipmentId || item.SHIPMENT_ID || '',
  2117. shipmentType: item.shipmentType || item.SHIPMENT_TYPE || '',
  2118. receiverId: item.receiverId || item.RECEIVER_ID || '',
  2119. receiverDesc: item.receiverDesc || item.RECEIVER_DESC || '',
  2120. state: item.state || item.STATE || '',
  2121. plannedShipDate: item.plannedShipDate || item.PLANNED_SHIP_DATE || '',
  2122. sourceRefTypeDb: item.sourceRefTypeDb || item.SOURCE_REF_TYPE_DB || '',
  2123. }
  2124. },
  2125. handleShipmentSiteSelectChange(row) {
  2126. this.shipmentSiteSelectedRow = row
  2127. },
  2128. // 多CONTRACT确认后:按选定CONTRACT二次查询ShipmentLine - rqrq
  2129. confirmShipmentSiteSelect() {
  2130. if (!this.shipmentSiteSelectedRow || !this.shipmentSiteSelectedRow.contract) {
  2131. this.$message.warning('请先选择一条Shipment!')
  2132. return
  2133. }
  2134. if (this.addOrderTempLoading) {
  2135. return
  2136. }
  2137. this.addOrderTempLoading = true
  2138. const requestParams = {
  2139. site: this.pendingOrderManageData.site || this.materialDialogSite,
  2140. orderNo: this.pendingOrderManageData.orderNo,
  2141. selectedSite: this.shipmentSiteSelectedRow.contract,
  2142. }
  2143. getShipmentAndLineForIssure(requestParams)
  2144. .then(({ data }) => {
  2145. if (data && data.code === 0) {
  2146. this.shipmentSiteSelectModalFlag = false
  2147. this.appendOrderMaterialToTempList(
  2148. data.rows || [],
  2149. this.shipmentSiteSelectedRow.contract || this.pendingOrderManageData.site || this.materialDialogSite
  2150. )
  2151. return
  2152. }
  2153. this.$message.error((data && data.msg) || '获取订单物料失败!')
  2154. })
  2155. .catch((error) => {
  2156. this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
  2157. })
  2158. .finally(() => {
  2159. this.addOrderTempLoading = false
  2160. })
  2161. },
  2162. // 成品/分切:按下拉工厂编号精确查ShopOrder,不再拼接% - rqrq
  2163. addShopOrderToTempList() {
  2164. this.addOrderTempLoading = true
  2165. let materialFetchStarted = false
  2166. const shopOrderQuery = {
  2167. site: this.pendingOrderManageData.site || this.materialDialogSite,
  2168. orderNo: this.pendingOrderManageData.orderNo,
  2169. releaseNo: this.pendingOrderManageData.releaseNo,
  2170. sequenceNo: this.pendingOrderManageData.sequenceNo,
  2171. }
  2172. getShopOrderFromIFSWithOrderNo(shopOrderQuery)
  2173. .then(({ data }) => {
  2174. if (!(data && data.code === 0 && data.rows && data.rows.length > 0)) {
  2175. this.$message.error((data && data.msg) || '未查询到工单')
  2176. return
  2177. }
  2178. const allowedStatuses = ['Released', 'Reserved', 'Started']
  2179. const validOrders = data.rows.filter((item) => allowedStatuses.includes(item.objstate))
  2180. if (data.rows.length > 0 && validOrders.length === 0) {
  2181. this.$message.error('生产订单' + this.pendingOrderManageData.orderNo + '状态不允许发料,请检查!')
  2182. return
  2183. }
  2184. if (validOrders.length === 1) {
  2185. materialFetchStarted = true
  2186. return this.fetchShopOrderMaterialToTempList(validOrders[0])
  2187. }
  2188. this.shopOrderCandidateList = validOrders
  2189. this.shopOrderSiteSelectFlag = true
  2190. })
  2191. .catch((error) => {
  2192. this.$message.error((error && error.msg) || '查询工单失败')
  2193. })
  2194. .finally(() => {
  2195. if (!materialFetchStarted) {
  2196. this.addOrderTempLoading = false
  2197. }
  2198. })
  2199. },
  2200. // 用户选定具体site(contract)后拉取物料 - rqrq
  2201. confirmShopOrderSite(row) {
  2202. if (!row) {
  2203. return
  2204. }
  2205. this.shopOrderSiteSelectFlag = false
  2206. this.fetchShopOrderMaterialToTempList(row)
  2207. },
  2208. // 使用精确site调用ShopOrderMaterial链路,优先弹窗工厂编号 - rqrq
  2209. fetchShopOrderMaterialToTempList(shopOrder) {
  2210. const selectedSite = this.pendingOrderManageData.site || this.materialDialogSite
  2211. const contract = selectedSite || (shopOrder && (shopOrder.contract || shopOrder.site)) || ''
  2212. if (!contract) {
  2213. this.addOrderTempLoading = false
  2214. this.$message.error('缺少工厂编号,无法查询物料')
  2215. return Promise.resolve()
  2216. }
  2217. this.addOrderTempLoading = true
  2218. const materialQuery = {
  2219. site: contract,
  2220. orderNo: (shopOrder && shopOrder.orderNo) || this.pendingOrderManageData.orderNo,
  2221. releaseNo: (shopOrder && shopOrder.releaseNo) || this.pendingOrderManageData.releaseNo,
  2222. sequenceNo: (shopOrder && shopOrder.sequenceNo) || this.pendingOrderManageData.sequenceNo,
  2223. }
  2224. return getShopOrderAndMaterialByShoporder(materialQuery)
  2225. .then(({ data }) => {
  2226. if (data && data.code === 0) {
  2227. this.appendOrderMaterialToTempList(data.rows || [], contract, shopOrder)
  2228. return
  2229. }
  2230. this.$message.error((data && data.msg) || '获取订单物料失败!')
  2231. })
  2232. .catch((error) => {
  2233. this.$message.error((error && error.msg) || '获取订单物料失败,请稍后重试')
  2234. })
  2235. .finally(() => {
  2236. this.addOrderTempLoading = false
  2237. })
  2238. },
  2239. // 字段映射后追加到临时列表,并回填subSite为弹窗工厂编号 - rqrq
  2240. appendOrderMaterialToTempList(materialList, selectedSite, shopOrder) {
  2241. if (!materialList || materialList.length === 0) {
  2242. this.$message.warning('该订单没有物料明细!')
  2243. return
  2244. }
  2245. const orderNo = (shopOrder && shopOrder.orderNo) || this.pendingOrderManageData.orderNo
  2246. const releaseNo = (shopOrder && shopOrder.releaseNo) || this.pendingOrderManageData.releaseNo || ''
  2247. const sequenceNo = (shopOrder && shopOrder.sequenceNo) || this.pendingOrderManageData.sequenceNo || ''
  2248. const subSite = selectedSite || this.pendingOrderManageData.site || this.materialDialogSite || ''
  2249. materialList.forEach((item) => {
  2250. if (this.orderType === 'shipment') {
  2251. if (item.inventoryPartNo) {
  2252. item.componentPartNo = item.inventoryPartNo
  2253. }
  2254. if (item.shipmentId) {
  2255. item.orderNo = item.shipmentId
  2256. }
  2257. if (item.inventoryQty !== undefined && !item.applyQty) {
  2258. item.applyQty = item.inventoryQty
  2259. }
  2260. if (item.inventoryUom && !item.uom) {
  2261. item.uom = item.inventoryUom
  2262. }
  2263. } else if (item.qtyRequired !== undefined && !item.applyQty) {
  2264. item.applyQty = item.qtyRequired
  2265. }
  2266. item.orderNo = orderNo
  2267. item.releaseNo = releaseNo
  2268. item.sequenceNo = sequenceNo
  2269. item.partNo = item.componentPartNo
  2270. item.lineItemNo = item.lineItemNo || ''
  2271. item.materialLineStatus = item.materialLineStatus || ''
  2272. item.startDate = item.startDate || ''
  2273. item.finishDate = item.finishDate || ''
  2274. item.needDate = item.needDate || ''
  2275. item.subSite = item.subSite || item.contract || subSite || item.site || this.$store.state.user.site
  2276. })
  2277. this.tempOrderList.push(...materialList)
  2278. if (!this.addedOrderNoList.includes(orderNo)) {
  2279. this.addedOrderNoList.push(orderNo)
  2280. this.remark = this.addedOrderNoList.join(';')
  2281. }
  2282. this.$message.success('订单 ' + orderNo + ' 添加成功,共 ' + materialList.length + ' 条物料!')
  2283. this.orderManageData.orderNo = ''
  2284. },
  2285. // 删除临时订单列表中的某一行 - rqrq
  2286. deleteTempOrderRow(index) {
  2287. this.tempOrderList.splice(index, 1)
  2288. this.$message.success('删除成功!')
  2289. },
  2290. // 汇总到主列表;同料号不同subSite分开保留 - rqrq
  2291. summaryOrderToMainList() {
  2292. if (!this.tempOrderList || this.tempOrderList.length === 0) {
  2293. this.$message.warning('临时列表为空,无法汇总!')
  2294. return
  2295. }
  2296. this.summaryLoading = true
  2297. try {
  2298. // 1. 创建物料映射表,用于汇总;同料号不同subSite分开保留 - rqrq
  2299. const materialMap = new Map()
  2300. // 2. 先将临时列表的数据按物料号+subSite汇总 - rqrq
  2301. this.tempOrderList.forEach(item => {
  2302. const partNo = item.componentPartNo
  2303. if (!partNo) return
  2304. const subSite = item.subSite || item.contract || item.site || this.$store.state.user.site
  2305. const mapKey = partNo + '||' + subSite
  2306. if (materialMap.has(mapKey)) {
  2307. // 已存在,累加数量 - rqrq
  2308. const existing = materialMap.get(mapKey)
  2309. existing.applyQty = (parseFloat(existing.applyQty) || 0) + (parseFloat(item.applyQty) || 0)
  2310. // 合并订单号到remark - rqrq
  2311. if (item.orderNo && !existing.remark.includes(item.orderNo)) {
  2312. existing.remark = existing.remark ? existing.remark + ';' + item.orderNo : item.orderNo
  2313. }
  2314. } else {
  2315. // 新增 - rqrq
  2316. materialMap.set(mapKey, {
  2317. partNo: partNo,
  2318. componentPartNo: partNo,
  2319. height: item.height || '',
  2320. isInWh: item.isInWh || '',
  2321. availableQty: item.availableQty || 0, // rqrq - 新增可用库存字段
  2322. applyQty: parseFloat(item.applyQty) || 0,
  2323. componentPartDesc: item.componentPartDesc || item.partDesc || '',
  2324. uom: item.uom || '',
  2325. orderNo: item.orderNo || '',
  2326. releaseNo: item.releaseNo || '',
  2327. sequenceNo: item.sequenceNo || '',
  2328. lineItemNo: '',
  2329. materialLineStatus: '',
  2330. startDate: '',
  2331. finishDate: '',
  2332. needDate: '',
  2333. subSite: subSite,
  2334. remark: item.orderNo || '', // 初始remark为订单号 - rqrq
  2335. })
  2336. }
  2337. })
  2338. // 3. 与主列表seqNoList中现有物料汇总 - rqrq
  2339. this.seqNoList.forEach(existingItem => {
  2340. const partNo = existingItem.componentPartNo
  2341. if (!partNo) return
  2342. const subSite = existingItem.subSite || existingItem.contract || existingItem.site || this.$store.state.user.site
  2343. const mapKey = partNo + '||' + subSite
  2344. if (materialMap.has(mapKey)) {
  2345. // 累加数量 - rqrq
  2346. const mapItem = materialMap.get(mapKey)
  2347. mapItem.applyQty = (parseFloat(mapItem.applyQty) || 0) + (parseFloat(existingItem.applyQty) || 0)
  2348. // 合并remark - rqrq
  2349. if (existingItem.remark) {
  2350. mapItem.remark = existingItem.remark + ';' + mapItem.remark
  2351. }
  2352. } else {
  2353. // 主列表中的物料在临时列表没有,直接保留 - rqrq
  2354. materialMap.set(mapKey, existingItem)
  2355. }
  2356. })
  2357. // 4. 更新主列表seqNoList为汇总后的结果 - rqrq
  2358. this.seqNoList = Array.from(materialMap.values())
  2359. this.$message.success('汇总成功!共 ' + this.seqNoList.length + ' 行物料!')
  2360. // 5. 清空临时列表 - rqrq
  2361. this.tempOrderList = []
  2362. // 6. 关闭弹窗 - rqrq
  2363. this.orderManageDialogVisible = false
  2364. } catch (error) {
  2365. this.$message.error('汇总失败:' + error.message)
  2366. } finally {
  2367. this.summaryLoading = false
  2368. }
  2369. },
  2370. // 根据订单号添加物料到列表 - rqrq(已废弃,保留用于兼容)
  2371. addOrderToList() {
  2372. // 1. 参数校验 - rqrq
  2373. if (!this.seqNoData.orderNo || this.seqNoData.orderNo.trim() === '') {
  2374. this.$message.warning('请输入Order No!')
  2375. return
  2376. }
  2377. // 2. 检查订单号是否已添加 - rqrq
  2378. if (this.addedOrderNoList.includes(this.seqNoData.orderNo)) {
  2379. this.$message.warning('该订单已添加过,请勿重复添加!')
  2380. return
  2381. }
  2382. // 3. 根据订单类型选择API - rqrq
  2383. let apiMethod = null
  2384. if (this.orderType === 'shipment') {
  2385. // 销售发货类型使用getShipmentAndLineForIssure - rqrq
  2386. apiMethod = getShipmentAndLineForIssure
  2387. } else {
  2388. // 分切订单和成品订单使用getShopOrderAndMaterialByShoporder - rqrq
  2389. apiMethod = getShopOrderAndMaterialByShoporder
  2390. }
  2391. // 4. 准备请求参数 - rqrq
  2392. const requestParams = {
  2393. site: this.$store.state.user.site,
  2394. orderNo: this.seqNoData.orderNo.trim(),
  2395. releaseNo: this.seqNoData.releaseNo || '*',
  2396. sequenceNo: this.seqNoData.sequenceNo || '*',
  2397. }
  2398. // 5. 调用API获取订单物料 - rqrq
  2399. this.addOrderLoading = true
  2400. apiMethod(requestParams)
  2401. .then(({ data }) => {
  2402. if (data && data.code === 0) {
  2403. // 获取返回的物料列表 - rqrq
  2404. let materialList = data.rows || []
  2405. if (!materialList || materialList.length === 0) {
  2406. this.$message.warning('该订单没有物料明细!')
  2407. return
  2408. }
  2409. // 5. 字段映射处理 - 不同API返回字段名不一致 - rqrq
  2410. console.log('原始返回数据:', materialList) // 调试用 - rqrq
  2411. materialList.forEach(item => {
  2412. if (this.orderType === 'shipment') {
  2413. // 销售发货API字段映射 - rqrq
  2414. // inventoryPartNo -> partNo - rqrq
  2415. if (item.inventoryPartNo ) {
  2416. item.componentPartNo = item.inventoryPartNo
  2417. }
  2418. if(item.shipmentId){
  2419. item.orderNo = item.shipmentId
  2420. }
  2421. // inventoryQty -> applyQty - rqrq
  2422. if (item.inventoryQty !== undefined && !item.applyQty) {
  2423. item.applyQty = item.inventoryQty
  2424. }
  2425. // inventoryUom -> uom - rqrq
  2426. if (item.inventoryUom && !item.uom) {
  2427. item.uom = item.inventoryUom
  2428. }
  2429. // partDesc保持不变 - rqrq
  2430. } else {
  2431. // 分切/成品订单API字段映射 - rqrq
  2432. // qtyRequired -> applyQty - rqrq
  2433. if (item.qtyRequired !== undefined && !item.applyQty) {
  2434. item.applyQty = item.qtyRequired
  2435. }
  2436. }
  2437. })
  2438. console.log('字段映射后数据:', materialList) // 调试用 - rqrq
  2439. // 6. 按物料号汇总后端返回的物料 - rqrq
  2440. const backendMaterialMap = new Map()
  2441. materialList.forEach(item => {
  2442. const partNo = item.componentPartNo
  2443. if (!partNo) return
  2444. if (backendMaterialMap.has(partNo)) {
  2445. // 已存在,累加数量 - rqrq
  2446. const existing = backendMaterialMap.get(partNo)
  2447. existing.applyQty = (parseFloat(existing.applyQty) || 0) + (parseFloat(item.applyQty) || 0)
  2448. } else {
  2449. // 新增 - rqrq
  2450. backendMaterialMap.set(partNo, {
  2451. partNo: partNo,
  2452. componentPartNo: partNo,
  2453. height: item.height || '',
  2454. isInWh: item.isInWh || '',
  2455. applyQty: parseFloat(item.applyQty) || 0,
  2456. componentPartDesc: item.componentPartDesc || item.partDesc || '',
  2457. uom: item.uom || '',
  2458. orderNo: this.seqNoData.orderNo,
  2459. releaseNo: this.seqNoData.releaseNo || '',
  2460. sequenceNo: this.seqNoData.sequenceNo || '',
  2461. lineItemNo: '',
  2462. materialLineStatus: '',
  2463. startDate: '',
  2464. finishDate: '',
  2465. needDate: '',
  2466. remark: this.seqNoData.orderNo, // 添加订单号到备注 - rqrq
  2467. })
  2468. }
  2469. })
  2470. // 7. 与seqNoList中现有物料汇总 - rqrq
  2471. this.seqNoList.forEach(existingItem => {
  2472. const partNo = existingItem.componentPartNo
  2473. if (!partNo) return
  2474. if (backendMaterialMap.has(partNo)) {
  2475. // 累加数量 - rqrq
  2476. const backendItem = backendMaterialMap.get(partNo)
  2477. backendItem.applyQty = (parseFloat(backendItem.applyQty) || 0) + (parseFloat(existingItem.applyQty) || 0)
  2478. // 合并备注(如果现有项有备注,追加订单号) - rqrq
  2479. if (existingItem.remark) {
  2480. backendItem.remark = existingItem.remark + ';' + this.seqNoData.orderNo
  2481. }
  2482. } else {
  2483. // seqNoList中的物料在后端没有,直接保留 - rqrq
  2484. backendMaterialMap.set(partNo, existingItem)
  2485. }
  2486. })
  2487. // 8. 更新seqNoList为汇总后的结果 - rqrq
  2488. this.seqNoList = Array.from(backendMaterialMap.values())
  2489. console.log('更新后的seqNoList:', this.seqNoList) // 调试用 - rqrq
  2490. // 9. 记录已添加的订单号 - rqrq
  2491. this.addedOrderNoList.push(this.seqNoData.orderNo)
  2492. // 更新已添加订单显示(分号分隔) - rqrq
  2493. this.remark = this.addedOrderNoList.join(';')
  2494. this.$message.success(`订单 ${this.seqNoData.orderNo} 添加成功,共 ${materialList.length} 条物料,汇总后 ${this.seqNoList.length} 行!`)
  2495. // 10. 清空输入框 - rqrq
  2496. this.seqNoData.orderNo = ''
  2497. } else {
  2498. this.$message.error(data.msg || '获取订单物料失败!')
  2499. }
  2500. })
  2501. .catch((error) => {
  2502. this.$message.error(error.msg || '获取订单物料失败,请稍后重试')
  2503. })
  2504. .finally(() => {
  2505. this.addOrderLoading = false
  2506. })
  2507. },
  2508. // 添加行:从接口查询数据并添加到列表
  2509. addRowFromQuery() {
  2510. if(!this.partNo){
  2511. this.$message.warning('请输入物料号!')
  2512. return
  2513. }
  2514. const selectedSite = this.resolveMaterialDialogSite()
  2515. if (!selectedSite) {
  2516. return
  2517. }
  2518. // 初始化seqNoList如果不存在
  2519. if (!this.seqNoList) {
  2520. this.seqNoList = []
  2521. }
  2522. // 准备查询参数:site取弹窗下拉选中值 - rqrq
  2523. const queryParams = {
  2524. site: selectedSite,
  2525. componentPartNo: this.partNo || '', // 使用物料号输入框的值
  2526. orderType: this.orderType, // 使用订单类型
  2527. }
  2528. this.addLineLoading = true
  2529. queryPartAttributeData(queryParams)
  2530. .then(({ data }) => {
  2531. if (data.code === 0 && data.rows ) {
  2532. // 过滤掉已存在的物料(根据partNo判断)
  2533. const existingPartNos = this.seqNoList.map((item) => item.partNo)
  2534. const newRows = existingPartNos.includes(data.rows.partNo)
  2535. if (newRows) {
  2536. this.$message.warning('查询到的物料已存在于列表中!')
  2537. return
  2538. }
  2539. // 确保数据结构完整;subSite回填弹窗选中Site - rqrq
  2540. const newRow = {
  2541. partNo: data.rows.partNo || '',
  2542. height: data.rows.height || '',
  2543. isInWh: data.rows.isInWh || '',
  2544. availableQty: data.rows.availableQty || 0, // rqrq - 新增可用库存字段
  2545. componentPartNo: data.rows.partNo || '',
  2546. orderNo: '',
  2547. releaseNo: '',
  2548. sequenceNo: '',
  2549. lineItemNo: '',
  2550. materialLineStatus: '',
  2551. componentPartDesc: '',
  2552. uom: '',
  2553. startDate: '',
  2554. finishDate: '',
  2555. needDate: '',
  2556. subSite: selectedSite,
  2557. }
  2558. this.seqNoList.push(newRow)
  2559. console.log('添加的新行:', newRow) // 调试用;
  2560. this.$set(this, 'partNo', '') // 清空物料号输入框
  2561. } else {
  2562. this.$message.warning(data.msg || '查询无数据')
  2563. }
  2564. })
  2565. .catch((error) => {
  2566. this.$message.error(error.msg || '查询失败,请稍后重试')
  2567. }).finally(() => {
  2568. this.addLineLoading = false
  2569. })
  2570. },
  2571. deleteSeqNoByOrderNo() {
  2572. if (this.seqNoData.orderNo == null || this.seqNoData.orderNo == '') {
  2573. this.$message.warning('请输入OrderNo!')
  2574. return false
  2575. }
  2576. if (this.seqNoList.length === 0) {
  2577. this.$message.warning('没有可删除的数据!')
  2578. return false
  2579. }
  2580. // 统计要删除的行数
  2581. const deleteCount = this.seqNoList.filter(
  2582. (row) => row.orderNo === this.seqNoData.orderNo
  2583. ).length
  2584. if (deleteCount === 0) {
  2585. this.$message.warning('未找到匹配的OrderNo数据!')
  2586. return false
  2587. }
  2588. this.$confirm(
  2589. `确定要删除OrderNo为 ${this.seqNoData.orderNo}${deleteCount} 条数据吗?`,
  2590. '提示',
  2591. {
  2592. confirmButtonText: '确定',
  2593. cancelButtonText: '取消',
  2594. type: 'warning',
  2595. }
  2596. )
  2597. .then(() => {
  2598. // 删除所有匹配的orderNo行
  2599. this.seqNoList = this.seqNoList.filter(
  2600. (row) => row.orderNo !== this.seqNoData.orderNo
  2601. )
  2602. this.$message.success(`成功删除 ${deleteCount} 条数据`)
  2603. })
  2604. .catch(() => {
  2605. // 用户取消删除
  2606. })
  2607. },
  2608. deleteSeqNoRow(index) {
  2609. if (index < 0 || index >= this.seqNoList.length) {
  2610. this.$message.warning('删除失败,索引无效!')
  2611. return false
  2612. }
  2613. const row = this.seqNoList[index]
  2614. this.$confirm(`确定要删除这条数据吗?`, '提示', {
  2615. confirmButtonText: '确定',
  2616. cancelButtonText: '取消',
  2617. type: 'warning',
  2618. })
  2619. .then(() => {
  2620. this.seqNoList.splice(index, 1)
  2621. this.$message.success('删除成功')
  2622. })
  2623. .catch(() => {
  2624. // 用户取消删除
  2625. })
  2626. },
  2627. // 打开选择物料弹框
  2628. openSelectMaterialModal() {
  2629. const selectedSite = this.resolveMaterialDialogSite()
  2630. if (!selectedSite) {
  2631. return
  2632. }
  2633. this.isMaterialDetailModal = false // 标识从新增工单物料弹框打开
  2634. // 设置模板编号和名称
  2635. this.modelCode = this.seqNoData.orderNo
  2636. this.modelName = this.seqNoData.releaseNo
  2637. // 初始化已选列表为当前seqNoList中的数据,并补齐Site展示字段 - rqrq
  2638. this.selectedMaterialList = JSON.parse(JSON.stringify(this.seqNoList)).map((item) => {
  2639. item.site = item.site || item.subSite || selectedSite
  2640. item.subSite = item.subSite || item.site || selectedSite
  2641. return item
  2642. })
  2643. // 重置分页
  2644. this.availableMaterialPage = 1
  2645. // 加载可选物料列表(按弹窗Site过滤) - rqrq
  2646. this.loadAvailableMaterialList()
  2647. // 打开弹框
  2648. this.selectMaterialModalFlag = true
  2649. },
  2650. // 加载可选物料列表
  2651. loadAvailableMaterialList() {
  2652. // 新增物料弹窗取下拉Site;申请明细弹窗取当前行subSite,缺省回退登录site - rqrq
  2653. const selectedSite = this.isMaterialDetailModal
  2654. ? String((this.clickrow && this.clickrow.subSite) || this.$store.state.user.site || '').trim()
  2655. : String(this.materialDialogSite || '').trim()
  2656. if (!selectedSite) {
  2657. this.$message.warning('请先选择Site!')
  2658. this.availableMaterialList = []
  2659. this.availableMaterialTotal = 0
  2660. return
  2661. }
  2662. this.selectMaterialLoading = true
  2663. const params = {
  2664. page: this.availableMaterialPage,
  2665. limit: this.availableMaterialLimit,
  2666. componentPartNo: this.componentPartNo,
  2667. site: selectedSite,
  2668. }
  2669. noOrderList(params)
  2670. .then(({ data }) => {
  2671. this.selectMaterialLoading = false
  2672. if (data && data.code === 0) {
  2673. if (data.page) {
  2674. // 过滤掉已选中的物料
  2675. const selectedPartNos = this.selectedMaterialList.map(
  2676. (item) => item.partNo || item.componentPartNo
  2677. )
  2678. // 如果是从申请明细弹框打开的,还需要过滤掉sobomList中已存在的物料
  2679. if (this.isMaterialDetailModal && this.sobomList && this.sobomList.length > 0) {
  2680. const sobomPartNos = this.sobomList.map(
  2681. (item) => item.partNo || item.componentPartNo
  2682. )
  2683. selectedPartNos.push(...sobomPartNos)
  2684. }
  2685. this.availableMaterialList = data.page.list
  2686. .filter((item) => !selectedPartNos.includes(item.partNo))
  2687. .map((item) => {
  2688. // 列表展示与后续落库:补齐site/subSite - rqrq
  2689. const row = Object.assign({}, item)
  2690. row.site = row.site || selectedSite
  2691. row.subSite = row.subSite || row.site || selectedSite
  2692. return row
  2693. })
  2694. } else {
  2695. this.availableMaterialList = []
  2696. }
  2697. this.availableMaterialPage = data.page.currPage
  2698. this.availableMaterialLimit = data.page.pageSize
  2699. this.availableMaterialTotal = data.page.totalCount
  2700. } else {
  2701. this.availableMaterialList = []
  2702. if (data && data.msg) {
  2703. this.$message.warning(data.msg)
  2704. }
  2705. }
  2706. })
  2707. .catch((e) => {
  2708. this.selectMaterialLoading = false
  2709. this.availableMaterialList = []
  2710. this.availableMaterialTotal = 0
  2711. this.$message.error(e.msg || '加载数据失败')
  2712. })
  2713. },
  2714. // 左侧表格分页 - 每页条数改变
  2715. handleAvailableSizeChange(val) {
  2716. this.availableMaterialLimit = val
  2717. this.availableMaterialPage = 1
  2718. this.loadAvailableMaterialList()
  2719. },
  2720. // 左侧表格分页 - 当前页改变
  2721. handleAvailableCurrentChange(val) {
  2722. this.availableMaterialPage = val
  2723. this.loadAvailableMaterialList()
  2724. },
  2725. // 处理左侧表格选择变化
  2726. handleAvailableSelectionChange(selection) {
  2727. this.availableMaterialSelections = selection
  2728. },
  2729. // 处理右侧表格选择变化
  2730. handleSelectedSelectionChange(selection) {
  2731. this.selectedMaterialSelections = selection
  2732. },
  2733. // 左侧表格行点击
  2734. itemClickRow1(row) {
  2735. // 可以在这里实现行点击逻辑
  2736. },
  2737. // 右侧表格行点击
  2738. itemClickRow2(row) {
  2739. // 可以在这里实现行点击逻辑
  2740. },
  2741. // 判断行是否可选
  2742. selectFlag(row, index) {
  2743. return true // 所有行都可选
  2744. },
  2745. // 添加到已选列表
  2746. addToSelected() {
  2747. if (this.availableMaterialSelections.length === 0) {
  2748. this.$message.warning('请先选择要添加的物料!')
  2749. return false
  2750. }
  2751. // 将选中的项添加到已选列表
  2752. this.availableMaterialSelections.forEach((item) => {
  2753. // 检查是否已存在(使用propertiesItemNo或componentPartNo作为唯一标识)
  2754. const itemNo = item.partNo
  2755. const exists = this.selectedMaterialList.some(
  2756. (row) => row.PartNo === itemNo
  2757. )
  2758. if (!exists) {
  2759. const newItem = JSON.parse(JSON.stringify(item))
  2760. const selectedSite = this.selectMaterialDisplaySite
  2761. newItem.site = newItem.site || selectedSite
  2762. newItem.subSite = newItem.subSite || newItem.site || selectedSite
  2763. this.selectedMaterialList.push(newItem)
  2764. }
  2765. })
  2766. const addCount = this.availableMaterialSelections.length
  2767. // 清空选择
  2768. this.availableMaterialSelections = []
  2769. // 重新加载左侧数据(因为分页,需要重新获取以过滤掉已选中的)
  2770. this.loadAvailableMaterialList()
  2771. this.$message.success(`成功添加 ${addCount} 条数据`)
  2772. },
  2773. // 从已选列表移除
  2774. removeFromSelected() {
  2775. if (this.selectedMaterialSelections.length === 0) {
  2776. this.$message.warning('请先选择要删除的物料!')
  2777. return false
  2778. }
  2779. // 从已选列表中移除
  2780. const selectedItemNos = this.selectedMaterialSelections.map(
  2781. (item) => item.partNo
  2782. )
  2783. const removeCount = this.selectedMaterialSelections.length
  2784. this.selectedMaterialList = this.selectedMaterialList.filter(
  2785. (item) =>
  2786. !selectedItemNos.includes(
  2787. item.partNo
  2788. )
  2789. )
  2790. // 清空选择
  2791. this.selectedMaterialSelections = []
  2792. // 重新加载左侧数据(因为分页,需要重新获取,移除的项可能会出现在当前页)
  2793. this.loadAvailableMaterialList()
  2794. this.$message.success(`成功移除 ${removeCount} 条数据`)
  2795. },
  2796. // 确认选择物料
  2797. confirmSelectMaterial() {
  2798. if (this.isMaterialDetailModal) {
  2799. // 从申请明细弹框打开的情况,将右侧"已有物料"列表的完整数据更新到sobomList
  2800. const selectedItems = JSON.parse(JSON.stringify(this.selectedMaterialList))
  2801. // 将选中的物料转换为sobomList需要的格式
  2802. selectedItems.forEach(item => {
  2803. // 将applyQty转换为qtyToIssue
  2804. item.qtyToIssue = item.applyQty || 0
  2805. // 设置itemNo(使用sobomData中的itemNo,如果没有则使用空字符串)
  2806. item.itemNo = this.clickrow.itemNo
  2807. item.notifyNo = this.clickrow.notifyNo
  2808. item.soorderNo = this.clickrow.soorderNo
  2809. item.orderType = this.clickrow.orderType
  2810. item.site = this.$store.state.user.site
  2811. item.subSite = item.subSite || (this.clickrow && this.clickrow.subSite) || ''
  2812. // 确保componentPartNo存在
  2813. if (!item.componentPartNo) {
  2814. item.componentPartNo = item.partNo
  2815. }
  2816. })
  2817. // 将右侧"已有物料"列表的完整数据替换sobomList(包括原有和新增的)
  2818. this.sobomList = selectedItems
  2819. console.log("this.sobomList", this.sobomList);
  2820. this.isMaterialDetailModal = false
  2821. } else {
  2822. // 从新增工单物料弹框打开的情况,将数据添加到seqNoList,并回填弹窗Site - rqrq
  2823. const selectedSite = String(this.materialDialogSite || '').trim()
  2824. const selectedItems = JSON.parse(JSON.stringify(this.selectedMaterialList))
  2825. selectedItems.forEach(item => {
  2826. item.subSite = item.subSite || selectedSite
  2827. if (!item.componentPartNo) {
  2828. item.componentPartNo = item.partNo
  2829. }
  2830. })
  2831. this.seqNoList = selectedItems
  2832. }
  2833. // 关闭弹框
  2834. this.selectMaterialModalFlag = false
  2835. // 清空数据
  2836. this.availableMaterialList = []
  2837. this.selectedMaterialList = []
  2838. this.availableMaterialSelections = []
  2839. this.selectedMaterialSelections = []
  2840. this.$message.success('操作成功')
  2841. },
  2842. saveNoOrderMaterialDetail() {
  2843. for (let i = 0; i < this.sobomList.length; i++) {
  2844. if (
  2845. this.sobomList[i].qtyToIssue === '' ||
  2846. this.sobomList[i].qtyToIssue == null
  2847. ) {
  2848. this.$message.warning('第'+(i+1)+'行数量为空,请填写申请数量!')
  2849. return false
  2850. }
  2851. this.sobomList[i].notifyNo = this.notifyNo
  2852. this.sobomList[i].site = this.$store.state.user.site
  2853. }
  2854. let materialList = this.sobomList.filter((item) => item.qtyToIssue > 0)
  2855. if (materialList.length == 0) {
  2856. this.$alert('没有需要保存的内容!', '提示', {
  2857. confirmButtonText: '确定',
  2858. })
  2859. return false
  2860. }
  2861. console.log('this.sobomList', materialList)
  2862. saveNoOrderMaterialDetail(materialList).then(({ data }) => {
  2863. if (data.code === 0) {
  2864. this.materialModalFlag = false
  2865. this.$message.success('操作成功')
  2866. } else {
  2867. this.$alert(data.msg, '错误', {
  2868. confirmButtonText: '确定',
  2869. })
  2870. }
  2871. })
  2872. },
  2873. saveNewSoIssueNotify() {
  2874. for (let i = 0; i < this.seqNoList.length; i++) {
  2875. if (
  2876. this.seqNoList[i].applyQty === '' ||
  2877. this.seqNoList[i].applyQty == null
  2878. ) {
  2879. this.$message.warning('第'+(i+1)+'行数量为空,请填写申请数量!')
  2880. return false
  2881. }
  2882. this.seqNoList[i].notifyNo = this.notifyNo
  2883. this.seqNoList[i].site = this.$store.state.user.site
  2884. this.seqNoList[i].componentPartNo = this.seqNoList[i].partNo
  2885. }
  2886. let materialList = this.seqNoList.filter((item) => item.applyQty > 0)
  2887. if (materialList.length == 0) {
  2888. this.$alert('没有需要保存的内容!', '提示', {
  2889. confirmButtonText: '确定',
  2890. })
  2891. return false
  2892. }
  2893. console.log('this.sobomList', materialList)
  2894. var savaNotify = {
  2895. site: this.$store.state.user.site,
  2896. notifyNo: this.notifyNo,
  2897. userName: this.$store.state.user.name,
  2898. orderType:this.orderType,
  2899. materialList: materialList,
  2900. }
  2901. this.saveNewLoading = true
  2902. saveNoOrderNotify(savaNotify)
  2903. .then(({ data }) => {
  2904. if (data.code === 0) {
  2905. this.seqNoModalFlag = false
  2906. // 清空已添加订单记录 - rqrq
  2907. this.addedOrderNoList = []
  2908. this.remark = ''
  2909. this.getUserNotifyNo()
  2910. this.$message.success('操作成功')
  2911. } else {
  2912. this.$message.error(data.msg)
  2913. }
  2914. })
  2915. .finally(() => {
  2916. this.saveNewLoading = false
  2917. })
  2918. },
  2919. //导出excel
  2920. async createExportData() {
  2921. this.searchData.limit = -1
  2922. this.searchData.page = 1
  2923. await eamGroupSearch(this.searchData).then(({ data }) => {
  2924. this.exportList = data.page.list
  2925. })
  2926. return this.exportList
  2927. },
  2928. startDownload() {},
  2929. finishDownload() {},
  2930. fields() {
  2931. let json = '{'
  2932. this.columnList.forEach((item, index) => {
  2933. if (index == this.columnList.length - 1) {
  2934. json +=
  2935. '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  2936. } else {
  2937. json +=
  2938. '"' +
  2939. item.columnLabel +
  2940. '"' +
  2941. ':' +
  2942. '"' +
  2943. item.columnProp +
  2944. '"' +
  2945. ','
  2946. }
  2947. })
  2948. json += '}'
  2949. let s = eval('(' + json + ')')
  2950. return s
  2951. },
  2952. xiadaNotifyModel() {
  2953. if (
  2954. this.dataList.length == 0 &&
  2955. this.dataList2.length == 0 &&
  2956. this.dataList3.length == 0
  2957. ) {
  2958. this.$alert('没有明细记录无法下达!!', '提示', {
  2959. confirmButtonText: '确定',
  2960. })
  2961. return false
  2962. }
  2963. this.xiadaModelFlag = true
  2964. },
  2965. xiadaNotify() {
  2966. // 检查是否有明细记录
  2967. if (this.dataList.length == 0) {
  2968. this.$alert('没有明细记录无法下达!!', '提示', {
  2969. confirmButtonText: '确定',
  2970. })
  2971. return false
  2972. }
  2973. // 初始化弹框数据
  2974. this.xiadaNotifyData = {
  2975. planIssueDate:
  2976. this.notifyData.planIssueDate ||
  2977. this.dayjs().format('YYYY-MM-DD HH:mm:ss'),
  2978. remark: this.notifyData.remark || '',
  2979. }
  2980. // 打开弹框
  2981. this.showXiadaNotifyDialog = true
  2982. },
  2983. confirmXiadaNotify() {
  2984. if (this.dataList.length == 0) {
  2985. this.$alert('没有明细记录无法下达!!', '提示', {
  2986. confirmButtonText: '确定',
  2987. })
  2988. return false
  2989. }
  2990. // 验证要求发料时间
  2991. if (
  2992. !this.xiadaNotifyData.planIssueDate ||
  2993. this.xiadaNotifyData.planIssueDate === ''
  2994. ) {
  2995. this.$message.warning('请选择要求发料时间!')
  2996. return false
  2997. }
  2998. // 准备下达数据
  2999. const notifyData = {
  3000. ...this.notifyData,
  3001. planIssueDate: this.xiadaNotifyData.planIssueDate,
  3002. remark: this.xiadaNotifyData.remark,
  3003. }
  3004. // 执行下达操作
  3005. xiadaNotify(notifyData).then(({ data }) => {
  3006. if (data.code === 0) {
  3007. this.showXiadaNotifyDialog = false
  3008. this.xiadaModelFlag = false
  3009. this.getUserNotifyNo()
  3010. this.$message.success('操作成功')
  3011. } else {
  3012. this.$alert(data.msg, '错误', {
  3013. confirmButtonText: '确定',
  3014. })
  3015. }
  3016. })
  3017. },
  3018. saveOtherPart() {
  3019. // if (
  3020. // this.otherPartData.qtyToIssue == null ||
  3021. // this.otherPartData.qtyToIssue == '' ||
  3022. // this.otherPartData.qtyToIssue <= 0
  3023. // ) {
  3024. // this.$message.warning('请填写领取数量!')
  3025. // return false
  3026. // }
  3027. this.$confirm('确定保存' + '?', '提示', {
  3028. confirmButtonText: '确定',
  3029. cancelButtonText: '取消',
  3030. type: 'warning',
  3031. }).then(() => {
  3032. saveOtherPart(this.otherPartData).then(({ data }) => {
  3033. if (data.code === 0) {
  3034. this.saveOtherPartModalFlag = false
  3035. if (this.otherPartData.issueType === '非BOM物料') {
  3036. this.partModelFlag = false
  3037. this.activeName = 'noBom'
  3038. this.searchOtherPart('非BOM物料')
  3039. }
  3040. if (this.otherPartData.issueType === '不管控物料') {
  3041. this.noControlPartModelFlag = false
  3042. this.activeName = 'noControl'
  3043. this.searchOtherPart('不管控物料')
  3044. }
  3045. this.$message.success('操作成功')
  3046. } else {
  3047. this.$alert(data.msg, '错误', {
  3048. confirmButtonText: '确定',
  3049. })
  3050. }
  3051. })
  3052. })
  3053. },
  3054. deleteNotify() {
  3055. if (this.dataList.length > 0) {
  3056. this.$alert('请先删除已经申请的明细记录!!', '提示', {
  3057. confirmButtonText: '确定',
  3058. })
  3059. return false
  3060. }
  3061. deleteNotify(this.notifyData).then(({ data }) => {
  3062. if (data.code === 0) {
  3063. this.getUserNotifyNo()
  3064. this.$message.success(data.msg)
  3065. } else {
  3066. this.$alert(data.msg, '错误', {
  3067. confirmButtonText: '确定',
  3068. })
  3069. }
  3070. })
  3071. },
  3072. searchOtherPart(type) {
  3073. let inData = {
  3074. site: this.notifyData.site,
  3075. notifyNo: this.notifyData.notifyNo,
  3076. issueType: type,
  3077. }
  3078. searchOtherPart(inData).then(({ data }) => {
  3079. if (data && data.code === 0) {
  3080. if (type === '非BOM物料') {
  3081. this.dataList2 = data.rows
  3082. }
  3083. if (type === '不管控物料') {
  3084. this.dataList3 = data.rows
  3085. }
  3086. }
  3087. })
  3088. },
  3089. // 删除
  3090. deleteNotifySOS(row) {
  3091. this.$confirm(`是否删除这个工单的申请信息?`, '提示', {
  3092. confirmButtonText: '确定',
  3093. cancelButtonText: '取消',
  3094. type: 'warning',
  3095. })
  3096. .then(() => {
  3097. deleteNotifySOS(row).then(({ data }) => {
  3098. if (data && data.code === 0) {
  3099. this.getNotifyNoOrderDetail()
  3100. this.$message({
  3101. message: '操作成功',
  3102. type: 'success',
  3103. duration: 1500,
  3104. onClose: () => {},
  3105. })
  3106. } else {
  3107. this.$alert(data.msg, '错误', {
  3108. confirmButtonText: '确定',
  3109. })
  3110. }
  3111. })
  3112. })
  3113. .catch(() => {})
  3114. },
  3115. //获取按钮的权限数据
  3116. getButtonAuthData() {
  3117. let searchFlag = this.isAuth(this.menuId + ':search')
  3118. let saveFlag = this.isAuth(this.menuId + ':save')
  3119. let updateFlag = this.isAuth(this.menuId + ':update')
  3120. let deleteFlag = this.isAuth(this.menuId + ':delete')
  3121. //处理页面的权限数据
  3122. this.authSearch = !searchFlag
  3123. this.authSave = !saveFlag
  3124. this.authUpdate = !updateFlag
  3125. this.authDelete = !deleteFlag
  3126. },
  3127. searchTable(rows) {
  3128. if( rows.length > 0){
  3129. for (let i = 0; i < rows.length; i++) {
  3130. // 判断是否为报废导入数据(有batchNo字段)- rqrq
  3131. if (rows[i].batchNo !== undefined || rows[i].remark !== undefined) {
  3132. // 报废导入数据结构 - rqrq
  3133. const newRow = {
  3134. partNo: rows[i].partNo || '', // 第一列:物料号
  3135. batchNo: rows[i].batchNo || '', // 第二列:批次号
  3136. remark: rows[i].remark || 0, // 第三列:导入数量(如果为空则为0)
  3137. applyQty: rows[i].applyQty || 0, // 第四列:申请数量(使用可用库存)
  3138. isInWh: rows[i].isInWh || 'N', // 是否在立库
  3139. availableQty: rows[i].availableQty || 0, // 可用库存
  3140. // 以下字段保持兼容性 - rqrq
  3141. height: '',
  3142. orderNo: '',
  3143. releaseNo: '',
  3144. sequenceNo: '',
  3145. lineItemNo: '',
  3146. materialLineStatus: '',
  3147. componentPartDesc: '',
  3148. uom: '',
  3149. startDate: '',
  3150. finishDate: '',
  3151. needDate: '',
  3152. }
  3153. this.seqNoList.push(newRow)
  3154. } else {
  3155. // 其他导入数据结构(原逻辑)- rqrq
  3156. const newRow = {
  3157. partNo: rows[i].componentPartNo || '',
  3158. height: rows[i].height || '',
  3159. isInWh: rows[i].isInWh || '',
  3160. applyQty: rows[i].qtyRequired || 0,
  3161. availableQty: rows[i].availableQty || 0,
  3162. orderNo: '',
  3163. releaseNo: '',
  3164. sequenceNo: '',
  3165. lineItemNo: '',
  3166. materialLineStatus: '',
  3167. componentPartDesc: '',
  3168. uom: '',
  3169. startDate: '',
  3170. finishDate: '',
  3171. needDate: '',
  3172. }
  3173. this.seqNoList.push(newRow)
  3174. }
  3175. }
  3176. }
  3177. },
  3178. getAllNotifyStatus() {
  3179. let inData = {
  3180. site: this.$store.state.user.site,
  3181. listName: 'ISSUENOTIFYHEADER_STATUS',
  3182. locale: this.$i18n.locale,
  3183. }
  3184. getAllNotifyStatus(inData).then(({ data }) => {
  3185. this.notifyStatusList = data
  3186. console.log('notifyStatusList', this.notifyStatusList)
  3187. })
  3188. },
  3189. async getTableUserColumn(tableId, columnId) {
  3190. let queryTableUser = {
  3191. userId: this.$store.state.user.name,
  3192. functionId: this.$route.meta.menuId,
  3193. tableId: tableId,
  3194. status: true,
  3195. languageCode: this.$i18n.locale,
  3196. }
  3197. await getTableUserListLanguage(queryTableUser).then(({ data }) => {
  3198. if (data.rows.length > 0) {
  3199. //this.columnList1 = []
  3200. switch (columnId) {
  3201. case 1:
  3202. this.columnList1 = data.rows
  3203. break
  3204. case 2:
  3205. this.columnList2 = data.rows
  3206. break
  3207. case 3:
  3208. this.columnList3 = data.rows
  3209. break
  3210. case 4:
  3211. this.columnList4 = data.rows
  3212. break
  3213. }
  3214. }
  3215. })
  3216. },
  3217. importModel() {
  3218. let data = {
  3219. site: this.$store.state.user.site,
  3220. notifyNo: this.notifyData.notifyNo,
  3221. }
  3222. this.$nextTick(() => {
  3223. this.$refs.noorderUploadExcel.init(data)
  3224. })
  3225. },
  3226. importModel2() {
  3227. let data = {
  3228. site: this.$store.state.user.site,
  3229. notifyNo: this.notifyData.notifyNo,
  3230. }
  3231. this.$nextTick(() => {
  3232. this.$refs.baofeiUploadExcel.init(data)
  3233. })
  3234. },
  3235. // 获取 tableDefault 列
  3236. async getColumnList(tableId, columnId) {
  3237. let queryTable = {
  3238. functionId: this.$route.meta.menuId,
  3239. tableId: tableId,
  3240. languageCode: this.$i18n.locale,
  3241. }
  3242. await getTableDefaultListLanguage(queryTable).then(({ data }) => {
  3243. if (data.rows && data.rows.length > 0) {
  3244. switch (columnId) {
  3245. case 1:
  3246. this.columnList1 = data.rows
  3247. break
  3248. case 2:
  3249. this.columnList2 = data.rows
  3250. break
  3251. case 3:
  3252. this.columnList3 = data.rows
  3253. break
  3254. case 4:
  3255. this.columnList4 = data.rows
  3256. break
  3257. }
  3258. } else {
  3259. // this.showDefault = true.
  3260. }
  3261. })
  3262. },
  3263. /**
  3264. * 海安页签刷新改走海安明细接口固定orderType=noorder防止误查shoporder链路 - rqrq
  3265. */
  3266. refreshCurrentTabTable () {
  3267. if (this.notifyNo === '' || !this.notifyNo) {
  3268. return
  3269. }
  3270. if (this.activeName === 'sub') {
  3271. let queryData = {
  3272. site: this.notifyData.site || this.$store.state.user.site,
  3273. notifyNo: this.notifyNo,
  3274. orderType: 'noorder',
  3275. }
  3276. if (this.currentRow && this.currentRow !== '' && this.currentRow.notifyNo) {
  3277. queryData = {
  3278. ...this.currentRow,
  3279. site: this.notifyData.site || this.$store.state.user.site,
  3280. orderType: 'noorder',
  3281. }
  3282. }
  3283. this.dataListLoading = true
  3284. // 调用海安材料明细接口,确保“无单领料-材料明细页签”只读写haian_表 - rqrq
  3285. searchNotifyMaterialListNew(queryData).then(({ data }) => {
  3286. this.dataListLoading = false
  3287. if (data && data.code === 0) {
  3288. this.materialDetailList = data.rows || []
  3289. } else {
  3290. this.materialDetailList = []
  3291. }
  3292. }).catch(() => {
  3293. this.dataListLoading = false
  3294. this.materialDetailList = []
  3295. })
  3296. }
  3297. },
  3298. /**
  3299. * 海安页面初始化查询当前用户未下达无单申请单header.order_type=noorder- rqrq
  3300. */
  3301. getUserNotifyNo () {
  3302. const inData = {
  3303. site: this.$store.state.user.site,
  3304. username: this.$store.state.user.name,
  3305. }
  3306. this.getAllNotifyStatus()
  3307. getUserNoOrderNotifyNo(inData).then(({ data }) => {
  3308. if (data && data.code === 0 && data.row) {
  3309. this.notifyNo = data.row.notifyNo
  3310. this.notifyData = data.row
  3311. this.getNotifyNoOrderDetail()
  3312. } else {
  3313. this.notifyNo = ''
  3314. this.notifyData = {
  3315. site: '',
  3316. bu: '',
  3317. notifyNo: '',
  3318. notifyDate: '',
  3319. enteredDate: '',
  3320. userName: '',
  3321. userDisplay: '',
  3322. remark: '',
  3323. planIssueDate: '',
  3324. }
  3325. this.dataList = []
  3326. this.materialDetailList = []
  3327. }
  3328. })
  3329. },
  3330. /**
  3331. * 海安无单订单层查询返回haian_SOIssueNotifyOrderList明细并保留subsite字段 - rqrq
  3332. */
  3333. getNotifyNoOrderDetail () {
  3334. const inData = {
  3335. site: this.$store.state.user.site,
  3336. notifyNo: this.notifyNo,
  3337. }
  3338. getNotifyNoOrderDetail(inData).then(({ data }) => {
  3339. if (data && data.code === 0) {
  3340. this.dataList = data.rows || []
  3341. } else {
  3342. this.dataList = []
  3343. }
  3344. })
  3345. },
  3346. /**
  3347. * 海安新建无单主单请求统一传site+username后端强制写order_type=noorder - rqrq
  3348. */
  3349. addNotify () {
  3350. const inData = {
  3351. site: this.$store.state.user.site,
  3352. userName: this.$store.state.user.name,
  3353. orderType: 'noorder',
  3354. }
  3355. createNoOrderNotify(inData).then(({ data }) => {
  3356. if (data && data.code === 0) {
  3357. this.showAddNotifyTypeDialog = false
  3358. this.$message.success('操作成功')
  3359. this.getUserNotifyNo()
  3360. } else if (data) {
  3361. this.$alert(data.msg, '错误', {
  3362. confirmButtonText: '确定',
  3363. })
  3364. }
  3365. })
  3366. },
  3367. /**
  3368. * 海安新建无单主单带申请类型保持老交互但后端仍按noorder主类型落库 - rqrq
  3369. */
  3370. confirmAddNotify () {
  3371. let outWorkOrderFlag = 'N'
  3372. if (this.selectedNotifyType === 'outsourced') {
  3373. outWorkOrderFlag = 'Y'
  3374. }
  3375. const inData = {
  3376. site: this.$store.state.user.site,
  3377. userName: this.$store.state.user.name,
  3378. outWorkOrderFlag,
  3379. remark: this.selectedNotifyRemark,
  3380. orderType: 'noorder',
  3381. }
  3382. this.getAllNotifyStatus()
  3383. createNoOrderNotify(inData).then(({ data }) => {
  3384. if (data && data.code === 0) {
  3385. this.showAddNotifyTypeDialog = false
  3386. this.$message.success('操作成功')
  3387. this.getUserNotifyNo()
  3388. } else if (data) {
  3389. this.$alert(data.msg, '错误', {
  3390. confirmButtonText: '确定',
  3391. })
  3392. }
  3393. })
  3394. },
  3395. /**
  3396. * 兼容老选择工单入口保存父行改走海安接口并补齐subsite避免写入旧表 - rqrq
  3397. */
  3398. saveSOS () {
  3399. if (this.notifyOrderData.needDate == null || this.notifyOrderData.needDate === '') {
  3400. this.$message.warning('请选择时间!')
  3401. return false
  3402. }
  3403. const row = this.notifyOrderData
  3404. if (this.dataList.length > 0) {
  3405. let stop = false
  3406. for (let i = 0; i < this.dataList.length; i++) {
  3407. if (this.dataList[i].soorderNo === row.orderNo &&
  3408. this.dataList[i].releaseNo === row.releaseNo &&
  3409. this.dataList[i].sequenceNo === row.sequenceNo) {
  3410. stop = true
  3411. break
  3412. }
  3413. }
  3414. if (stop) {
  3415. this.$alert('已经选择过此工单,请返回点击明细直接操作!!', '提示', {
  3416. confirmButtonText: '确定',
  3417. })
  3418. return false
  3419. }
  3420. }
  3421. this.$confirm('确定选择工单' + row.orderNo + '?', '提示', {
  3422. confirmButtonText: '确定',
  3423. cancelButtonText: '取消',
  3424. type: 'warning',
  3425. }).then(() => {
  3426. const inData = {
  3427. site: this.$store.state.user.site,
  3428. subSite: row.subSite || row.contract || row.site || this.$store.state.user.site,
  3429. notifyNo: this.notifyNo,
  3430. fgPartNo: row.partNo,
  3431. soorderNo: row.orderNo,
  3432. opsItemNo: row.itemNo,
  3433. sequenceNo: row.sequenceNo,
  3434. releaseNo: row.releaseNo,
  3435. needDate: row.needDate,
  3436. issureQty: row.issureQty,
  3437. }
  3438. // 调用海安父行保存接口,确保itemNo来自haian_SOIssueNotifyOrderList序列 - rqrq
  3439. saveSOIssueNotifyOrderList(inData).then(({ data }) => {
  3440. if (data && data.code === 0) {
  3441. this.saveSeqNoModalFlag = false
  3442. row.itemNo = data.itemNo
  3443. row.subSite = inData.subSite
  3444. this.getNotifyNoOrderDetail()
  3445. this.enterSOS(row)
  3446. } else if (data) {
  3447. this.$alert(data.msg, '错误', {
  3448. confirmButtonText: '确定',
  3449. })
  3450. }
  3451. })
  3452. })
  3453. },
  3454. /**
  3455. * 海安无单明细查询物料弹窗改走海安getNoOrderMaterialList避免读取旧表数据 - rqrq
  3456. */
  3457. enterSOS (row) {
  3458. this.seqNoModalFlag = false
  3459. this.materialModalFlag = true
  3460. this.sobomList = []
  3461. this.sobomData = {
  3462. orderNo: row.orderNo,
  3463. seqNo: row.seqNo,
  3464. partNo: row.partNo,
  3465. subSite: row.subSite || '',
  3466. }
  3467. this.bomLoadFlag = true
  3468. const inData = {
  3469. site: this.$store.state.user.site,
  3470. notifyNo: this.notifyNo,
  3471. itemNo: row.itemNo,
  3472. subSite: row.subSite || '',
  3473. }
  3474. getNoOrderMaterialList(inData).then(({ data }) => {
  3475. this.bomLoadFlag = false
  3476. if (data && data.code === 0) {
  3477. this.sobomList = data.rows || []
  3478. for (let i = 0; i < this.sobomList.length; i++) {
  3479. this.sobomList[i].itemNo = inData.itemNo
  3480. this.sobomList[i].subSite = this.sobomList[i].subSite || inData.subSite || this.$store.state.user.site
  3481. }
  3482. }
  3483. }).catch(() => {
  3484. this.bomLoadFlag = false
  3485. })
  3486. },
  3487. /**
  3488. * 海安无单明细保存统一透传notifyNo/site/subsite并调用海安先删后存链路 - rqrq
  3489. */
  3490. saveNoOrderMaterialDetail () {
  3491. for (let i = 0; i < this.sobomList.length; i++) {
  3492. if (this.sobomList[i].qtyToIssue === '' || this.sobomList[i].qtyToIssue == null) {
  3493. this.$message.warning('第' + (i + 1) + '行数量为空,请填写申请数量!')
  3494. return false
  3495. }
  3496. this.sobomList[i].notifyNo = this.notifyNo
  3497. this.sobomList[i].site = this.$store.state.user.site
  3498. this.sobomList[i].subSite = this.sobomList[i].subSite || (this.clickrow && this.clickrow.subSite) || this.$store.state.user.site
  3499. }
  3500. const materialList = this.sobomList.filter((item) => item.qtyToIssue > 0)
  3501. if (materialList.length === 0) {
  3502. this.$alert('没有需要保存的内容!', '提示', {
  3503. confirmButtonText: '确定',
  3504. })
  3505. return false
  3506. }
  3507. saveNoOrderMaterialDetail(materialList).then(({ data }) => {
  3508. if (data && data.code === 0) {
  3509. this.materialModalFlag = false
  3510. this.$message.success('操作成功')
  3511. } else if (data) {
  3512. this.$alert(data.msg, '错误', {
  3513. confirmButtonText: '确定',
  3514. })
  3515. }
  3516. })
  3517. },
  3518. /**
  3519. * 海安无单保存父子写库统一改走saveNoOrderNotify并为子行补齐subsite - rqrq
  3520. */
  3521. saveNewSoIssueNotify () {
  3522. for (let i = 0; i < this.seqNoList.length; i++) {
  3523. if (this.seqNoList[i].applyQty === '' || this.seqNoList[i].applyQty == null) {
  3524. this.$message.warning('第' + (i + 1) + '行数量为空,请填写申请数量!')
  3525. return false
  3526. }
  3527. this.seqNoList[i].notifyNo = this.notifyNo
  3528. this.seqNoList[i].componentPartNo = this.seqNoList[i].componentPartNo || this.seqNoList[i].partNo
  3529. // 先落subSite再写大site,避免被父site覆盖 - rqrq
  3530. this.seqNoList[i].subSite = this.seqNoList[i].subSite || this.seqNoList[i].contract || this.materialDialogSite || this.$store.state.user.site
  3531. this.seqNoList[i].site = this.$store.state.user.site
  3532. }
  3533. const materialList = this.seqNoList.filter((item) => item.applyQty > 0)
  3534. if (materialList.length === 0) {
  3535. this.$alert('没有需要保存的内容!', '提示', {
  3536. confirmButtonText: '确定',
  3537. })
  3538. return false
  3539. }
  3540. const saveNotify = {
  3541. site: this.$store.state.user.site,
  3542. notifyNo: this.notifyNo,
  3543. userName: this.$store.state.user.name,
  3544. orderType: this.orderType,
  3545. materialList,
  3546. }
  3547. this.saveNewLoading = true
  3548. // 调用海安无单保存接口:后端负责按subsite拆父行并落haian_子表 - rqrq
  3549. saveNoOrderNotify(saveNotify).then(({ data }) => {
  3550. if (data && data.code === 0) {
  3551. this.seqNoModalFlag = false
  3552. this.addedOrderNoList = []
  3553. this.remark = ''
  3554. this.getUserNotifyNo()
  3555. this.$message.success('操作成功')
  3556. } else if (data) {
  3557. this.$message.error(data.msg)
  3558. }
  3559. }).finally(() => {
  3560. this.saveNewLoading = false
  3561. })
  3562. },
  3563. /**
  3564. * 海安无单下达调用海安头表状态流转接口避免误触发旧模块逻辑 - rqrq
  3565. */
  3566. confirmXiadaNotify () {
  3567. if (this.dataList.length === 0) {
  3568. this.$alert('没有明细记录无法下达!!', '提示', {
  3569. confirmButtonText: '确定',
  3570. })
  3571. return false
  3572. }
  3573. if (!this.xiadaNotifyData.planIssueDate || this.xiadaNotifyData.planIssueDate === '') {
  3574. this.$message.warning('请选择要求发料时间!')
  3575. return false
  3576. }
  3577. const notifyData = {
  3578. ...this.notifyData,
  3579. site: this.$store.state.user.site,
  3580. planIssueDate: this.xiadaNotifyData.planIssueDate,
  3581. remark: this.xiadaNotifyData.remark,
  3582. }
  3583. xiadaNotify(notifyData).then(({ data }) => {
  3584. if (data && data.code === 0) {
  3585. this.showXiadaNotifyDialog = false
  3586. this.xiadaModelFlag = false
  3587. this.getUserNotifyNo()
  3588. this.$message.success('操作成功')
  3589. } else if (data) {
  3590. this.$alert(data.msg, '错误', {
  3591. confirmButtonText: '确定',
  3592. })
  3593. }
  3594. })
  3595. },
  3596. /**
  3597. * 海安无单删单走海安deleteNotify接口清理haian父子数据 - rqrq
  3598. */
  3599. deleteNotify () {
  3600. if (this.dataList.length > 0) {
  3601. this.$alert('请先删除已经申请的明细记录!!', '提示', {
  3602. confirmButtonText: '确定',
  3603. })
  3604. return false
  3605. }
  3606. deleteNotify(this.notifyData).then(({ data }) => {
  3607. if (data && data.code === 0) {
  3608. this.getUserNotifyNo()
  3609. this.$message.success(data.msg || '删除成功')
  3610. } else if (data) {
  3611. this.$alert(data.msg, '错误', {
  3612. confirmButtonText: '确定',
  3613. })
  3614. }
  3615. })
  3616. },
  3617. /**
  3618. * 海安无单删除父行删除按钮调用海安deleteNotifySOS避免误删旧表数据 - rqrq
  3619. */
  3620. deleteNotifySOS (row) {
  3621. this.$confirm('是否删除这个工单的申请信息?', '提示', {
  3622. confirmButtonText: '确定',
  3623. cancelButtonText: '取消',
  3624. type: 'warning',
  3625. }).then(() => {
  3626. const requestRow = {
  3627. ...row,
  3628. site: row.site || this.$store.state.user.site,
  3629. notifyNo: row.notifyNo || this.notifyNo,
  3630. subSite: row.subSite || this.$store.state.user.site,
  3631. }
  3632. deleteNotifySOS(requestRow).then(({ data }) => {
  3633. if (data && data.code === 0) {
  3634. this.getNotifyNoOrderDetail()
  3635. this.$message.success('操作成功')
  3636. } else if (data) {
  3637. this.$alert(data.msg, '错误', {
  3638. confirmButtonText: '确定',
  3639. })
  3640. }
  3641. })
  3642. }).catch(() => {})
  3643. }
  3644. },
  3645. }
  3646. </script>
  3647. <style scoped>
  3648. .board666 .el-table .error-row {
  3649. background: #f86868;
  3650. }
  3651. /deep/ .el-table .error-row {
  3652. background: #f86868 !important;
  3653. }
  3654. /* rqrq - 报废导入:导入数量大于可用库存时行变红 */
  3655. /deep/ .el-table .baofei-error-row {
  3656. background: #fef0f0 !important;
  3657. }
  3658. /deep/ .el-table .baofei-error-row td {
  3659. color: #F56C6C !important;
  3660. }
  3661. /* 在 <style scoped> 下,使用深度选择器作用到 ElementUI 内部结构 */
  3662. .issueNotify {
  3663. width: 100%;
  3664. height: auto;
  3665. }
  3666. .issueNotify /deep/ .el-form-item__content {
  3667. display: inline !important;
  3668. }
  3669. .site-content > .el-tabs > .el-tabs__content > .site-tabs__tools {
  3670. top: 35px;
  3671. height: 40px;
  3672. font-size: 16px;
  3673. line-height: 40px;
  3674. }
  3675. .text-right /deep/ .el-input__inner {
  3676. text-align: right !important;
  3677. }
  3678. .text-right /deep/ .el-input-number__input {
  3679. text-align: right !important;
  3680. }
  3681. .yzzTable /deep/.el-table .cell {
  3682. line-height: 20px;
  3683. font-size: 12px;
  3684. height: 20px;
  3685. }
  3686. .applyQtyClass /deep/.el-input__inner {
  3687. height: 14px !important;
  3688. }
  3689. /* 选择工单弹窗:紧凑表格与按钮样式 */
  3690. .choose-sos-btn {
  3691. height: 14px;
  3692. box-sizing: border-box;
  3693. padding: 0 6px;
  3694. line-height: 12px;
  3695. font-size: 12px;
  3696. display: inline-flex;
  3697. align-items: center;
  3698. justify-content: center;
  3699. }
  3700. </style>