健腾mes前端
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.

726 lines
23 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  4. <el-form-item :label="'工厂编码'">
  5. <el-input v-model="searchData.site" style="width: 130px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'生产订单号'">
  8. <el-input v-model="searchData.orderNo" style="width: 130px"></el-input>
  9. </el-form-item>
  10. <el-form-item >
  11. <span slot="label" style="" @click="getBaseList(24)"><a herf="#">加工中心编码</a></span>
  12. <el-input v-model="searchData.sWorkCenterNo" style="width: 130px"></el-input>
  13. </el-form-item>
  14. <el-form-item >
  15. <span slot="label" style="" @click="getBaseList(5)"><a herf="#">物料编码</a></span>
  16. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item :label="'派工单号'">
  19. <el-input v-model="searchData.seqNo" type="number" style="width: 120px"></el-input>
  20. </el-form-item>
  21. <el-form-item :label="'是否报工完成'">
  22. <el-select v-model="searchData.reportFlag" style="width: 120px">
  23. <el-option label="全部" value=""></el-option>
  24. <el-option label="是" value="QtyReported>=QtyRequired"></el-option>
  25. <el-option label="否" value="QtyRequired>QtyReported"></el-option>
  26. </el-select>
  27. </el-form-item>
  28. </el-form>
  29. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  30. <el-form-item :label="'工序号'">
  31. <el-input v-model="searchData.itemNo" type="number" style="width: 130px"></el-input>
  32. </el-form-item>
  33. <el-form-item :label="'派工日期:'">
  34. <el-date-picker
  35. style="width: 130px"
  36. v-model="searchData.startDate"
  37. value-format="yyyy-MM-dd"
  38. placeholder="选择日期">
  39. </el-date-picker>
  40. </el-form-item>
  41. <el-form-item :label="'至: '">
  42. <el-date-picker
  43. style="width: 130px"
  44. v-model="searchData.endDate"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="选择日期">
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item >
  51. <span slot="label" style="" @click="getBaseList(26)"><a herf="#">操作员姓名</a></span>
  52. <el-input v-model="searchData.operatorName" style="width: 120px"></el-input>
  53. </el-form-item>
  54. <el-form-item >
  55. <span slot="label" style="" @click="getBaseList(88)"><a herf="#">机台ID</a></span>
  56. <el-input v-model="searchData.sResourceID" style="width: 120px"></el-input>
  57. </el-form-item>
  58. <el-form-item :label="'班次'">
  59. <el-select v-model="searchData.sShiftNo" style="width: 120px">
  60. <el-option label="全部" value=""></el-option>
  61. <el-option label="白班" value="白班"></el-option>
  62. <el-option label="晚班" value="晚班"></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item :label="'是否关闭'">
  66. <el-select v-model="searchData.closedFlag" style="width: 120px">
  67. <el-option label="全部" value=""></el-option>
  68. <el-option label="是" value="Y"></el-option>
  69. <el-option label="否" value="N"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item :label="' '">
  73. <el-button @click="search()" style="margin-left: 0px;margin-top:0px" type="primary">查询</el-button>
  74. <download-excel
  75. :fields="exportDataStandard"
  76. :data="tableData"
  77. type="xlsx"
  78. :name="exportName"
  79. :header="exportHeader"
  80. :footer="exportFooter"
  81. :defaultValue="exportDefaultValue"
  82. :fetch="createExportData"
  83. :before-generate="startDownload"
  84. :before-finish="finishDownload"
  85. worksheet="导出信息"
  86. class="el-button el-button--primary el-button--medium">
  87. {{'导出'}}
  88. </download-excel>
  89. </el-form-item>
  90. </el-form>
  91. <el-table
  92. :height="height"
  93. :data="tableData"
  94. border
  95. style="width: 100%">
  96. <el-table-column
  97. prop=""
  98. header-align="center"
  99. align="center"
  100. min-width="160"
  101. label="操作">
  102. <template slot-scope="scope" class="foo_container">
  103. <a v-if="scope.row.circulationSeqNo===null&&scope.row.closedFlag=='N'" type="text" size="small" @click="closeSchedule(scope.row)">关闭派工单</a>
  104. <a v-if="scope.row.circulationSeqNo===null&&scope.row.closedFlag=='Y'" type="text" size="small" @click="openSchedule(scope.row)">打开派工单</a>
  105. <span v-if="scope.row.circulationSeqNo!=null" size="small" >派工单已流转</span>
  106. <a v-if="scope.row.circulationSeqNo==null" type="text" size="small" @click="cancelJob(scope.row)">取消派工单</a>
  107. <a v-if="scope.row.circulationSeqNo==null" type="text" size="small" @click="circulation(scope.row)">流转</a>
  108. </template>
  109. </el-table-column>
  110. <!-- <el-table-column-->
  111. <!-- prop="site"-->
  112. <!-- header-align="center"-->
  113. <!-- align="left"-->
  114. <!-- min-width="60"-->
  115. <!-- label="工厂编码">-->
  116. <!-- </el-table-column>-->
  117. <el-table-column
  118. prop="seqNo"
  119. header-align="center"
  120. sortable
  121. align="left"
  122. min-width="70"
  123. label="派工单号">
  124. </el-table-column>
  125. <el-table-column
  126. prop="sScheduledDate"
  127. header-align="center"
  128. sortable
  129. align="left"
  130. min-width="80"
  131. label="派工日期">
  132. </el-table-column>
  133. <el-table-column
  134. prop="orderNo"
  135. header-align="center"
  136. sortable
  137. align="left"
  138. min-width="100"
  139. label="生产订单号">
  140. </el-table-column>
  141. <el-table-column
  142. prop="itemNo"
  143. header-align="center"
  144. sortable
  145. align="left"
  146. min-width="70"
  147. label="工序号">
  148. </el-table-column>
  149. <el-table-column
  150. prop="itemDesc"
  151. header-align="center"
  152. sortable
  153. align="left"
  154. min-width="160"
  155. label="工序名称">
  156. </el-table-column>
  157. <el-table-column
  158. prop="partNo"
  159. header-align="center"
  160. sortable
  161. align="left"
  162. min-width="80"
  163. label="物料编码">
  164. </el-table-column>
  165. <el-table-column
  166. prop="partDesc"
  167. header-align="center"
  168. sortable
  169. align="left"
  170. min-width="200"
  171. label="物料名称">
  172. </el-table-column>
  173. <el-table-column
  174. prop="firstWorkDate"
  175. header-align="center"
  176. sortable
  177. align="left"
  178. min-width="120"
  179. label="首次开工时间">
  180. </el-table-column>
  181. <el-table-column
  182. prop="closedDate"
  183. header-align="center"
  184. sortable
  185. align="left"
  186. min-width="120"
  187. label="结束时间">
  188. </el-table-column>
  189. <el-table-column
  190. prop="qtyRequired"
  191. header-align="center"
  192. sortable
  193. align="right"
  194. min-width="80"
  195. label="派工数量">
  196. </el-table-column>
  197. <el-table-column
  198. prop="qtyReported"
  199. header-align="center"
  200. sortable
  201. align="right"
  202. min-width="80"
  203. label="报工数量">
  204. </el-table-column>
  205. <el-table-column
  206. prop="qtyApprove"
  207. header-align="center"
  208. sortable
  209. align="right"
  210. min-width="80"
  211. label="合格数量">
  212. </el-table-column>
  213. <el-table-column
  214. prop="closedFlag"
  215. header-align="center"
  216. sortable
  217. align="left"
  218. min-width="80"
  219. label="是否关闭">
  220. </el-table-column>
  221. <el-table-column
  222. prop="operatorName"
  223. header-align="center"
  224. sortable
  225. align="left"
  226. min-width="80"
  227. label="操作员姓名">
  228. </el-table-column>
  229. <el-table-column
  230. prop="timeRequired"
  231. header-align="center"
  232. sortable
  233. align="right"
  234. min-width="80"
  235. label="需求时间">
  236. </el-table-column>
  237. <el-table-column
  238. prop="sResourceID"
  239. header-align="center"
  240. sortable
  241. align="left"
  242. min-width="70"
  243. label="机台ID">
  244. </el-table-column>
  245. <el-table-column
  246. prop="sShiftNo"
  247. header-align="center"
  248. sortable
  249. align="left"
  250. min-width="70"
  251. label="班次">
  252. </el-table-column>
  253. <el-table-column
  254. prop="sWorkCenterNo"
  255. header-align="center"
  256. sortable
  257. align="left"
  258. min-width="100"
  259. label="加工中心编码">
  260. </el-table-column>
  261. <el-table-column
  262. prop="circulationSeqNo"
  263. header-align="center"
  264. sortable
  265. align="right"
  266. min-width="90"
  267. label="流转派工单号">
  268. </el-table-column>
  269. <el-table-column
  270. prop="circulationQty"
  271. header-align="center"
  272. sortable
  273. align="right"
  274. min-width="80"
  275. label="流转数量">
  276. </el-table-column>
  277. </el-table>
  278. <el-dialog title="流转派工单" :close-on-click-modal="false" v-drag :visible.sync="circulationFlag" width="600px">
  279. <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
  280. <el-form-item :label="'派工单号:'">
  281. <el-input v-model="circulationData.seqNo" ref="start" type="number" style="width: 130px;" readonly></el-input>
  282. </el-form-item>
  283. <el-form-item :label="'派工日期:'">
  284. <!-- <el-input v-model="circulationData.sScheduledDate" ref="start" type="number" style="width: 130px;" readonly></el-input>-->
  285. <el-date-picker
  286. style="width: 130px"
  287. v-model="circulationData.sScheduledDate"
  288. type="date"
  289. value-format="yyyy-MM-dd"
  290. readonly
  291. placeholder="选择日期">
  292. </el-date-picker>
  293. </el-form-item>
  294. <el-form-item :label="'未完成数量:'">
  295. <el-input v-model="circulationData.circulationQty" ref="start" type="number" style="width: 130px;" readonly></el-input>
  296. </el-form-item>
  297. </el-form>
  298. <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: 5px;">
  299. <el-form-item :label="'流转日期:'">
  300. <el-date-picker
  301. style="width: 130px"
  302. v-model="circulationData.circulationDate"
  303. type="date"
  304. value-format="yyyy-MM-dd"
  305. placeholder="选择日期">
  306. </el-date-picker>
  307. </el-form-item>
  308. <el-form-item label="派工机台:">
  309. <el-select v-model="circulationData.sResourceID" style="width: 130px"
  310. placeholder="请选择">
  311. <el-option
  312. v-for="(item,index) in availableResourceList"
  313. :key="index"
  314. :label="item.ResouceDesc"
  315. :value="item.ResourceID"
  316. >
  317. </el-option>
  318. </el-select>
  319. </el-form-item>
  320. <el-form-item label="派工班次:">
  321. <el-select v-model="circulationData.sShiftNo" style="width: 130px"
  322. placeholder="请选择">
  323. <el-option label="白班" value="白班"></el-option>
  324. <el-option label="晚班" value="晚班"></el-option>
  325. </el-select>
  326. </el-form-item>
  327. <el-form-item label="派工人员:">
  328. <el-select v-model="circulationData.operatorId" style="width: 130px"
  329. placeholder="请选择">
  330. <el-option v-for="item in operatorIdList " :key="index" :label="item.operatorName"
  331. :value="item.operatorID">
  332. </el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-form>
  336. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  337. <el-button type="primary" @click="doCirculation()">流转</el-button>
  338. <el-button type="primary" @click="circulationFlag = false">关闭</el-button>
  339. </el-footer>
  340. </el-dialog>
  341. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  342. </div>
  343. </template>
  344. <script>
  345. import {
  346. getWorkCenterOperatorList,
  347. getAvailableResourceList,
  348. cancelJob,
  349. getSOScheduleRoutingData,
  350. circulationSchedule,
  351. closeSchedule,
  352. openSchedule
  353. } from "@/api/production/schedule.js"
  354. import Chooselist from '@/views/modules/common/Chooselist'
  355. export default {
  356. name: 'closeSchedule',
  357. components: {
  358. Chooselist
  359. },
  360. data () {
  361. return {
  362. setUp: {
  363. reviewFlag: false,
  364. saveButton: false,
  365. readonlyFlag: false,
  366. disabled: false
  367. },
  368. circulationData:{
  369. site:'',
  370. seqNo:'',
  371. sScheduledDate:'',
  372. circulationQty:'',
  373. circulationDate:'',
  374. sResourceID:'',
  375. sShiftNo:'',
  376. operatorId:'',
  377. },
  378. availableResourceList:[],
  379. operatorIdList:[],
  380. saveHeaderData: {
  381. site: '',
  382. seqNo: '',
  383. itemNo: '',
  384. partNo: '',
  385. partDescription: '',
  386. operationDesc: '',
  387. workCenterNo: '',
  388. workCenterDesc: '',
  389. operatorId: '',
  390. operatorName: '',
  391. planStartTime: '',
  392. planFinishTime: '',
  393. qtyReported: 0,
  394. qtyApprove: 0,
  395. qtyRework: 0,
  396. operatorId2: '',
  397. operatorIdName2: '',
  398. scrapReason: '',
  399. preparationTime: 0,
  400. manufacturingTime: 0,
  401. cleaningTime: 0,
  402. shutdownReason: '',
  403. remark: '',
  404. orderRef1:'',
  405. scheduleType:'',
  406. userId:'',
  407. },
  408. sopFlag:false,
  409. site: this.$store.state.user.site,
  410. operatorType: 0,
  411. // 导出 start
  412. exportData: [],
  413. exportDataStandard: {
  414. '派工单号': 'seqNo',
  415. '关联单号': 'orderNo',
  416. '关联单号类型': 'scheduleType',
  417. '工序号': 'itemNo',
  418. '工序名称': 'itemDesc',
  419. '派工数量': 'qtyRequired',
  420. '报工数量': 'qtyReported',
  421. '合格数量': 'qtyApprove',
  422. '需求时间': 'timeRequired',
  423. '派工日期': 'sScheduledDate',
  424. '操作员姓名': 'operatorName',
  425. '物料编码': 'partNo',
  426. '物料名称': 'partDesc',
  427. '机台ID': 'sResourceID',
  428. '班次': 'sShiftNo',
  429. '加工中心': 'sWorkCenterNo',
  430. '首次开工时间': 'firstWorkDate',
  431. '结束时间': 'closedDate',
  432. },
  433. exportName: '派工单列表' + this.getStrDate(),
  434. exportHeader: ['派工单列表'],
  435. exportFooter: [],
  436. exportDefaultValue: '这一行这一列没有数据',
  437. // 导出 end
  438. height: 200,
  439. tableData: [],
  440. date1: '',
  441. searchData: {
  442. orderNo: '',
  443. sWorkCenterNo: '',
  444. partNo: '',
  445. site: '',
  446. itemNo:'',
  447. seqNo:'',
  448. itemDesc:'',
  449. scheduleType:'',
  450. reportFlag:'QtyRequired>QtyReported',
  451. startDate:'',
  452. endDate:'',
  453. operatorName:'',
  454. sResourceID:'',
  455. sShiftNo:'',
  456. closedFlag:'',
  457. userId:this.$store.state.user.name
  458. },
  459. photoUrl:'',
  460. sopData:{
  461. site:'',
  462. partNo:'',
  463. },
  464. partDescription:'',
  465. fileTitle:'',
  466. fileName:'',
  467. num:1,
  468. currentData:'',
  469. photoDatas:[],
  470. uploadImg:[],
  471. showviewer: false,
  472. url: '',
  473. height2:600,
  474. circulationFlag:false,
  475. }
  476. },
  477. mounted () {
  478. this.$nextTick(() => {
  479. this.height = window.innerHeight - 210
  480. this.height2 = window.innerHeight -100
  481. })
  482. },
  483. methods: {
  484. // 获取基础数据列表S
  485. getBaseList (val, type) {
  486. this.tagNo = val
  487. this.$nextTick(() => {
  488. let strVal = ''
  489. if (val === 24) {
  490. strVal = this.searchData.sWorkCenterNo
  491. }
  492. if (val === 5) {
  493. strVal = this.searchData.partNo
  494. }
  495. if (val === 26) {
  496. strVal = this.searchData.operatorName
  497. }
  498. if (val === 88) {
  499. strVal = this.searchData.sResourceID
  500. }
  501. this.$refs.baseList.init(val, strVal)
  502. })
  503. },
  504. /* 列表方法的回调 */
  505. getBaseData (val) {
  506. if (this.tagNo === 24) {
  507. this.searchData.sWorkCenterNo = val.WorkCenterNo
  508. } else if (this.tagNo === 5) {
  509. this.searchData.partNo = val.PartNo
  510. }
  511. if (this.tagNo === 26) {
  512. this.searchData.operatorName = val.OperatorName
  513. }
  514. if (this.tagNo === 88) {
  515. this.searchData.sResourceID = val.ResourceID
  516. }
  517. },
  518. search () {
  519. getSOScheduleRoutingData(this.searchData).then(({data}) => {
  520. this.tableData = data.rows
  521. })
  522. },
  523. createExportData () {
  524. return this.tableData
  525. },
  526. startDownload () {
  527. // this.exportData = this.dataList
  528. },
  529. finishDownload () {
  530. },
  531. getStrDate () {
  532. let dd = new Date()
  533. let Y = dd.getFullYear()
  534. let M = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)// 获取当前月份的日期,不足10补0
  535. let D = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()// 获取当前几号,不足10补0
  536. let H = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  537. let MM = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  538. let S = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  539. return Y + M + D + H + MM + S
  540. },
  541. circulation(row){
  542. this.getWorkCenterOperatorList(row);
  543. this.getAvailableResourceList(row);
  544. this.circulationData.seqNo=row.seqNo;
  545. this.circulationData.sScheduledDate=row.sScheduledDate;
  546. this.circulationData.circulationQty=row.qtyRequired-row.qtyApprove;
  547. this.circulationData.site=row.site;
  548. this.circulationData.circulationDate='';
  549. this.circulationData.sResourceID='';
  550. this.circulationData.sShiftNo='';
  551. this.circulationData.operatorId='';
  552. this.circulationFlag=true;
  553. },
  554. doCirculation(){
  555. if(this.circulationData.circulationDate==''||this.circulationData.circulationDate==null){
  556. this.$alert('请选择流转日期!', '错误', {
  557. confirmButtonText: '确定'
  558. })
  559. return false;
  560. }
  561. if(this.circulationData.sResourceID==''||this.circulationData.sResourceID==null){
  562. this.$alert('请选择机台!', '错误', {
  563. confirmButtonText: '确定'
  564. })
  565. return false;
  566. }
  567. if(this.circulationData.sShiftNo==''||this.circulationData.sShiftNo==null){
  568. this.$alert('请选择班次!', '错误', {
  569. confirmButtonText: '确定'
  570. })
  571. return false;
  572. }
  573. if(this.circulationData.operatorId==''||this.circulationData.operatorId==null){
  574. this.$alert('请选择操作员!', '错误', {
  575. confirmButtonText: '确定'
  576. })
  577. return false;
  578. }
  579. this.$confirm(`是否流转?流转后需要重新打印新派工单!`, '提示', {
  580. confirmButtonText: '确定',
  581. cancelButtonText: '取消',
  582. type: 'warning'
  583. }).then(() => {
  584. circulationSchedule(this.circulationData).then(({data}) => {
  585. if (data && data.code === 0) {
  586. this.circulationFlag=false;
  587. this.search ();
  588. this.$message({
  589. message: '操作成功',
  590. type: 'success',
  591. duration: 1500,
  592. onClose: () => {
  593. }
  594. })
  595. } else {
  596. this.$alert(data.msg, '错误', {
  597. confirmButtonText: '确定'
  598. })
  599. }
  600. })
  601. })
  602. },
  603. closeSchedule(row){
  604. this.$confirm(`确定关闭此派工单`, '提示', {
  605. confirmButtonText: '确定',
  606. cancelButtonText: '取消',
  607. type: 'warning'
  608. }).then(() => {
  609. closeSchedule(row).then(({data}) => {
  610. if (data && data.code === 0) {
  611. this.search();
  612. this.$message({
  613. message: '操作成功',
  614. type: 'success',
  615. duration: 1500,
  616. onClose: () => {
  617. }
  618. })
  619. } else {
  620. this.$alert(data.msg, '错误', {
  621. confirmButtonText: '确定'
  622. })
  623. }
  624. })
  625. })
  626. },
  627. openSchedule(row){
  628. this.$confirm(`确定打开此派工单`, '提示', {
  629. confirmButtonText: '确定',
  630. cancelButtonText: '取消',
  631. type: 'warning'
  632. }).then(() => {
  633. openSchedule(row).then(({data}) => {
  634. if (data && data.code === 0) {
  635. this.search();
  636. this.$message({
  637. message: '操作成功',
  638. type: 'success',
  639. duration: 1500,
  640. onClose: () => {
  641. }
  642. })
  643. } else {
  644. this.$alert(data.msg, '错误', {
  645. confirmButtonText: '确定'
  646. })
  647. }
  648. })
  649. })
  650. },
  651. getWorkCenterOperatorList(row){
  652. let inData={
  653. site:row.site,
  654. workCenterNo:row.sWorkCenterNo,
  655. }
  656. getWorkCenterOperatorList(inData).then(({data}) => {
  657. this.operatorIdList = data.rows;
  658. })
  659. },
  660. getAvailableResourceList(row){
  661. let inData={
  662. site:row.site,
  663. orderNo:row.orderNo,
  664. itemNo:row.itemNo,
  665. }
  666. getAvailableResourceList(inData).then(({data}) => {
  667. this.availableResourceList = data.rows;
  668. })
  669. },
  670. cancelJob(row){
  671. if(row.qtyReported>0){
  672. this.$alert('该派工单已经有报工无法取消!', '错误', {
  673. confirmButtonText: '确定'
  674. })
  675. return false
  676. }
  677. this.$confirm(`确定取消此派工单`, '提示', {
  678. confirmButtonText: '确定',
  679. cancelButtonText: '取消',
  680. type: 'warning'
  681. }).then(() => {
  682. cancelJob(row).then(({data}) => {
  683. if (data && data.code === 0) {
  684. this.search ();
  685. this.$message({
  686. message: '操作成功',
  687. type: 'success',
  688. duration: 1500,
  689. onClose: () => {
  690. }
  691. })
  692. }else {
  693. this.$alert(data.msg, '错误', {
  694. confirmButtonText: '确定'
  695. })
  696. }
  697. })
  698. })
  699. },
  700. },
  701. created () {
  702. }
  703. }
  704. </script>
  705. <style scoped>
  706. .input_left{
  707. text-align: left;
  708. }
  709. .input_reight{
  710. text-align: right;
  711. }
  712. /deep/ input::-webkit-inner-spin-button {
  713. -webkit-appearance: none !important;
  714. }
  715. input[type='number'] {
  716. -moz-appearance: textfield !important;
  717. }
  718. </style>