健腾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.

808 lines
28 KiB

  1. <template>
  2. <div class="mod-config">
  3. <el-form inline="true" v-model="searchData">
  4. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;" >
  5. <el-form-item :label="'工厂编号:'">
  6. <el-input v-model="searchData.site" style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'日计划号:'">
  9. <el-input v-model="searchData.orderNo" style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'生产订单号:'">
  12. <el-input v-model="searchData.orderRef1" style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'规格型号:'">
  15. <el-input v-model="searchData.partDescription" style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'计划日期:'">
  18. <el-date-picker
  19. style="width: 130px"
  20. v-model="searchData.startDate1"
  21. type="date"
  22. value-format="yyyy-MM-dd"
  23. placeholder="选择日期">
  24. </el-date-picker>
  25. </el-form-item>
  26. <el-form-item style="margin-top: 23px;">
  27. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  28. </el-form-item>
  29. <el-form-item :label="' '">
  30. <el-date-picker
  31. style="width: 130px"
  32. v-model="searchData.endDate1"
  33. type="date"
  34. value-format="yyyy-MM-dd"
  35. placeholder="选择日期">
  36. </el-date-picker>
  37. </el-form-item>
  38. </el-form>
  39. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;">
  40. <el-form-item :label="'状态:'">
  41. <el-select filterable v-model="searchData.status" style="width: 120px">
  42. <el-option label="全部" value=""></el-option>
  43. <el-option label="已计划" value="('已计划')"></el-option>
  44. <el-option label="已取消" value="('已取消')"></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item >
  48. <span slot="label" style="" @click="getBaseList(5)"><a herf="#">物料编码</a></span>
  49. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  50. </el-form-item>
  51. <el-form-item :label="'派工情况:'">
  52. <el-select filterable v-model="searchData.planStatus" style="width: 120px">
  53. <el-option label="全部" value=""></el-option>
  54. <el-option label="未派工完" value="a.OrderQty>isnull(SL.scheduledQty,0)"></el-option>
  55. <el-option label="已派工完" value="isnull(SL.scheduledQty,0)>= a.OrderQty"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item >
  59. <span slot="label" style="" @click="getBaseList(24)"><a herf="#">加工中心</a></span>
  60. <el-input v-model="searchData.workCenterNo" style="width: 120px"></el-input>
  61. </el-form-item>
  62. <el-form-item :label="'工序名称'">
  63. <el-input v-model="searchData.operationDesc" style="width: 120px"></el-input>
  64. </el-form-item>
  65. <el-form-item :label="' '">
  66. <el-button @click="search()" style="margin-left: 24px" type="primary">查询</el-button>
  67. <download-excel
  68. :fields="exportDataStandard"
  69. :data="tableData"
  70. type="xlsx"
  71. :name="exportName"
  72. :header="exportHeader"
  73. :footer="exportFooter"
  74. :defaultValue="exportDefaultValue"
  75. :fetch="createExportData"
  76. :before-generate="startDownload"
  77. :before-finish="finishDownload"
  78. worksheet="导出信息"
  79. class="el-button el-button--primary el-button--medium">
  80. {{'导出'}}
  81. </download-excel>
  82. </el-form-item>
  83. </el-form>
  84. </el-form>
  85. <el-table
  86. :height="height"
  87. :data="tableData"
  88. :row-class-name="tableRowClassName"
  89. border
  90. style="width: 100%">
  91. <el-table-column
  92. prop=""
  93. fixed="left"
  94. header-align="center"
  95. align="center"
  96. min-width="60"
  97. label="操作">
  98. <template slot-scope="scope">
  99. <a type="text" size="small" @click="openScheduleModel(scope.row)">派工</a>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. prop="site"
  104. header-align="center"
  105. align="left"
  106. min-width="120"
  107. label="工厂编号">
  108. </el-table-column>
  109. <el-table-column
  110. prop="orderNo"
  111. header-align="center"
  112. align="left"
  113. min-width="120"
  114. label="日计划号">
  115. </el-table-column>
  116. <el-table-column
  117. prop="itemNo"
  118. header-align="center"
  119. align="left"
  120. min-width="60"
  121. label="工序号">
  122. </el-table-column>
  123. <el-table-column
  124. prop="operationDesc"
  125. header-align="center"
  126. align="left"
  127. min-width="160"
  128. label="工序名称">
  129. </el-table-column>
  130. <el-table-column
  131. prop="partNo"
  132. header-align="center"
  133. align="left"
  134. min-width="120"
  135. label="物料编码">
  136. </el-table-column>
  137. <el-table-column
  138. prop="partDescription"
  139. header-align="center"
  140. align="left"
  141. min-width="200"
  142. label="物料名称">
  143. </el-table-column>
  144. <el-table-column
  145. prop="workCenterNo"
  146. header-align="center"
  147. align="left"
  148. min-width="100"
  149. label="加工中心">
  150. </el-table-column>
  151. <el-table-column
  152. prop="workCenterDesc"
  153. header-align="center"
  154. align="left"
  155. min-width="100"
  156. label="加工中心名称">
  157. </el-table-column>
  158. <!-- <el-table-column-->
  159. <!-- prop="equipment"-->
  160. <!-- header-align="center"-->
  161. <!-- align="left"-->
  162. <!-- min-width="80"-->
  163. <!-- label="设备类型">-->
  164. <!-- </el-table-column>-->
  165. <el-table-column
  166. prop="status"
  167. header-align="center"
  168. align="left"
  169. min-width="60"
  170. label="状态">
  171. </el-table-column>
  172. <el-table-column
  173. prop="orderDate"
  174. header-align="center"
  175. align="left"
  176. min-width="130"
  177. label="计划日期">
  178. </el-table-column>
  179. <el-table-column
  180. prop="needDate"
  181. header-align="center"
  182. align="left"
  183. sortable
  184. width="130"
  185. label="ERP要求完工日期">
  186. </el-table-column>
  187. <el-table-column
  188. prop="orderRef1"
  189. header-align="center"
  190. align="left"
  191. min-width="130"
  192. label="生产订单号">
  193. </el-table-column>
  194. <el-table-column
  195. prop="lotSize"
  196. header-align="center"
  197. align="right"
  198. min-width="80"
  199. label="订单数量">
  200. </el-table-column>
  201. <el-table-column
  202. prop="scheduledQty"
  203. header-align="center"
  204. align="right"
  205. min-width="80"
  206. label="已派工数量">
  207. </el-table-column>
  208. <!-- <el-table-column-->
  209. <!-- prop="qtyReported"-->
  210. <!-- header-align="center"-->
  211. <!-- align="right"-->
  212. <!-- width="80"-->
  213. <!-- label="已报工数量">-->
  214. <!-- </el-table-column>-->
  215. <!-- <el-table-column-->
  216. <!-- prop="qtyApprove"-->
  217. <!-- header-align="center"-->
  218. <!-- align="right"-->
  219. <!-- width="80"-->
  220. <!-- label="合格数量">-->
  221. <!-- </el-table-column>-->
  222. <el-table-column
  223. prop="machSetupTime"
  224. header-align="center"
  225. align="right"
  226. min-width="80"
  227. label="调机时间">
  228. </el-table-column>
  229. <el-table-column
  230. prop="machRunFactor"
  231. header-align="center"
  232. align="right"
  233. min-width="80"
  234. label="单位产出量">
  235. </el-table-column>
  236. <el-table-column
  237. prop="factorUnit"
  238. header-align="center"
  239. align="left"
  240. min-width="80"
  241. label="产出单位">
  242. </el-table-column>
  243. </el-table>
  244. <el-dialog title="派工" :close-on-click-modal="false" v-drag :visible.sync="scheduledModalFlag" width="730px">
  245. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  246. <el-form-item label="日计划号:">
  247. <el-input v-model="schedulingModalData.orderNo" disabled style="width: 120px"></el-input>
  248. </el-form-item>
  249. <el-form-item label="工厂编号:">
  250. <el-input v-model="schedulingModalData.site" disabled style="width: 120px"></el-input>
  251. </el-form-item>
  252. <el-form-item label="计划日期:">
  253. <el-input v-model="schedulingModalData.orderDate" disabled style="width: 120px"></el-input>
  254. </el-form-item>
  255. <el-form-item label="订单数量:">
  256. <el-input v-model="schedulingModalData.lotSize" disabled style="width: 120px"></el-input>
  257. </el-form-item>
  258. <el-form-item label="待派工数:">
  259. <el-input v-model="schedulingModalData.qtyToSchedule" disabled style="width: 120px"></el-input>
  260. </el-form-item>
  261. </el-form>
  262. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  263. <el-form-item label="产品编码:">
  264. <el-input v-model="schedulingModalData.partNo" disabled style="width: 120px"></el-input>
  265. </el-form-item>
  266. <el-form-item label="产品名称:">
  267. <el-input v-model="schedulingModalData.partDescription" disabled style="width: 120px"></el-input>
  268. </el-form-item>
  269. <el-form-item label="工序号:">
  270. <el-input v-model="schedulingModalData.itemNo" disabled style="width: 120px"></el-input>
  271. </el-form-item>
  272. <el-form-item label="工序名称:">
  273. <el-input v-model="schedulingModalData.operationDesc" disabled style="width: 120px"></el-input>
  274. </el-form-item>
  275. <el-form-item label="加工中心:">
  276. <el-input v-model="schedulingModalData.workCenterNo" disabled style="width: 120px"></el-input>
  277. </el-form-item>
  278. </el-form>
  279. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  280. <el-form-item label="派工机台:">
  281. <el-select v-model="schedulingModalData.resourceId" style="width: 120px"
  282. placeholder="请选择">
  283. <el-option v-for="item in availableResourceList " :key="index" :label="item.ResourceID+'-'+item.ResouceDesc"
  284. :value="item.ResourceID">
  285. </el-option>
  286. </el-select>
  287. </el-form-item>
  288. <el-form-item label="派工班次:">
  289. <el-select v-model="schedulingModalData.shiftNo" style="width: 120px"
  290. placeholder="请选择">
  291. <el-option label="白班" value="白班"></el-option>
  292. <el-option label="晚班" value="晚班"></el-option>
  293. <el-option label="加班" value="加班"></el-option>
  294. </el-select>
  295. </el-form-item>
  296. <el-form-item label="派工人员:">
  297. <el-select v-model="schedulingModalData.operatorId" style="width: 120px"
  298. placeholder="请选择">
  299. <el-option v-for="item in operatorIdList " :key="index" :label="item.operatorName"
  300. :value="item.operatorID">
  301. </el-option>
  302. </el-select>
  303. </el-form-item>
  304. <el-form-item label="本次累计派工数量:">
  305. <el-input v-model="schedulingModalData.sumQty" type="number" disabled style="width: 120px"></el-input>
  306. </el-form-item>
  307. </el-form>
  308. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  309. <el-form-item label="派工备注:">
  310. <el-input v-model="schedulingModalData.remark" style="width: 656px"></el-input>
  311. </el-form-item>
  312. </el-form>
  313. <el-button type="primary" @click="addPlans()" style="margin-left: 10px;">添加</el-button>
  314. <el-button type="primary" @click="saveSchedule()">保存</el-button>
  315. <div class="rq ">
  316. <el-table
  317. height="200"
  318. :data="schedulingModalTableData"
  319. border
  320. style="width: 100%">
  321. <el-table-column
  322. prop="scheduleDate"
  323. header-align="center"
  324. align="left"
  325. min-width="100"
  326. label="派工日期">
  327. <template slot-scope="scope">
  328. <el-date-picker
  329. style="width: 95%"
  330. class="sl-input"
  331. v-model="scope.row.scheduleDate"
  332. type="date"
  333. value-format="yyyy-MM-dd"
  334. placeholder="选择日期">
  335. </el-date-picker>
  336. </template>
  337. </el-table-column>
  338. <el-table-column
  339. prop="scheduleQty"
  340. header-align="center"
  341. align="right"
  342. min-width="80"
  343. label="派工数量">
  344. <template slot-scope="scope">
  345. <el-input v-model="scope.row.scheduleQty" type="number" @change="changeSum" @blur="scheduleQtyBlur(scope.row)" placeholder="请输入数量"
  346. style="width:98%"></el-input>
  347. </template>
  348. </el-table-column>
  349. <el-table-column
  350. prop="resourceId"
  351. header-align="center"
  352. align="left"
  353. min-width="80"
  354. label="派工机台">
  355. <template slot-scope="scope">
  356. <el-select v-model="scope.row.resourceId" placeholder="请选择" style="height: 12px;padding: 0px " filterable
  357. allow-create>
  358. <el-option v-for="item in availableResourceList " :key="index" :label="item.ResourceID+'-'+item.ResouceDesc"
  359. :value="item.ResourceID">
  360. </el-option>
  361. </el-select>
  362. </template>
  363. </el-table-column>
  364. <el-table-column
  365. prop="shiftNo"
  366. header-align="center"
  367. align="left"
  368. min-width="80"
  369. label="派工班次">
  370. <template slot-scope="scope">
  371. <el-select v-model="scope.row.shiftNo" placeholder="请选择" style="height: 12px;padding: 0px " filterable
  372. allow-create>
  373. <el-option label="白班" value="白班"></el-option>
  374. <el-option label="晚班" value="晚班"></el-option>
  375. <el-option label="加班" value="加班"></el-option>
  376. </el-select>
  377. </template>
  378. </el-table-column>
  379. <!-- <el-table-column-->
  380. <!-- prop="shiftNo"-->
  381. <!-- header-align="center"-->
  382. <!-- align="left"-->
  383. <!-- min-width="80"-->
  384. <!-- label="派工类型">-->
  385. <!-- <template slot-scope="scope">-->
  386. <!-- <el-select v-model="scope.row.jobType" placeholder="请选择" style="height: 12px;padding: 0px " filterable-->
  387. <!-- allow-create>-->
  388. <!-- <el-option label="计件" value="计件"></el-option>-->
  389. <!-- <el-option label="计时" value="计时"></el-option>-->
  390. <!-- <el-option label="外协" value="外协"></el-option>-->
  391. <!-- </el-select>-->
  392. <!-- </template>-->
  393. <!-- </el-table-column>-->
  394. <el-table-column
  395. prop="operatorId"
  396. header-align="center"
  397. align="right"
  398. min-width="80"
  399. label="派工人员">
  400. <template slot-scope="scope">
  401. <el-select v-model="scope.row.operatorId" placeholder="请选择" style="height: 12px;padding: 0px " filterable
  402. allow-create>
  403. <el-option v-for="item in operatorIdList " :key="index" :label="item.operatorName"
  404. :value="item.operatorID">
  405. </el-option>
  406. </el-select>
  407. </template>
  408. </el-table-column>
  409. <el-table-column
  410. prop=""
  411. header-align="center"
  412. align="center"
  413. width="60"
  414. label="操作">
  415. <template slot-scope="scope" class="foo_container">
  416. <a type="text" size="small" @click="splitScheduleTable(scope.$index)">删除</a>
  417. </template>
  418. </el-table-column>
  419. </el-table>
  420. </div>
  421. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  422. <el-button type="primary" @click="scheduledModalFlag = false">取消</el-button>
  423. <!-- <el-button type="primary" :disabled="bannersBut" @click="saveBanners()">确定</el-button>-->
  424. </el-footer>
  425. </el-dialog>
  426. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  427. </div>
  428. </template>
  429. <script>
  430. import {
  431. getSOTastRoutingData,
  432. getWorkCenterOperatorList,
  433. getAvailableResourceList,
  434. scheduleForSOTask,
  435. } from "@/api/production.js"
  436. import Chooselist from '@/views/modules/common/Chooselist'
  437. export default {
  438. name: 'scheduleForSOTask',
  439. components: {
  440. Chooselist
  441. },
  442. data () {
  443. return {
  444. // 导出 start
  445. exportData: [],
  446. exportDataStandard: {
  447. "日计划号": "orderNo",
  448. "工序号": "itemNo",
  449. "工序名称": "operationDesc",
  450. "物料编码": "partNo",
  451. "物料名称": "partDescription",
  452. "加工中心": "workCenterNo",
  453. "状态": "status",
  454. "计划日期": "orderDate",
  455. "日计划数量": "lotSize",
  456. "已派工数量": "scheduledQty",
  457. "生产订单号": "orderRef1",
  458. "调机时间": "machSetupTime",
  459. "单位产出量": "machRunFactor",
  460. "产出单位": "factorUnit",
  461. },
  462. exportName: "日计划工序列表"+this.getStrDate(),
  463. exportHeader: ["日计划工序列表"],
  464. exportFooter: [],
  465. exportDefaultValue: "这一行这一列没有数据",
  466. // 导出 end
  467. height:200,
  468. tableData:[],
  469. date1:'',
  470. searchData: {
  471. orderNo: '',
  472. workCenterNo:'',
  473. operationDesc:'',
  474. startDate1: new Date(),
  475. endDate1: '',
  476. startDate3: '',
  477. endDate3: '',
  478. startDate4: '',
  479. endDate4: '',
  480. status: '(\'已计划\')',
  481. partNo: '',
  482. orderRef1:'',
  483. site: '',
  484. planStatus: 'a.OrderQty>isnull(SL.scheduledQty,0)',
  485. partDescription:'',
  486. finishFlag:'',
  487. userId:this.$store.state.user.name,
  488. },
  489. schedulingModalData: {
  490. remark:'',
  491. orderNo: '',
  492. site: '',
  493. orderRef1: '',
  494. lotSize: '',
  495. qtyToSchedule: '',
  496. partNo: '',
  497. partDescription: '',
  498. itemNo: '',
  499. operationDesc: '',
  500. workCenterNo: '',
  501. scheduleDate: '',
  502. scheduleQty: '',
  503. resourceId: '',
  504. shiftNo: '',
  505. sumQty: '',
  506. orderDate:'',
  507. operatorId:'',
  508. efficiency:'',
  509. partPlanQty:'',
  510. },
  511. scheduledModalFlag: false,
  512. availableResourceList: [],
  513. schedulingModalTableData: [],
  514. operatorIdList:[],
  515. tagNo:'',
  516. }
  517. },
  518. mounted() {
  519. this.$nextTick(()=>{
  520. this.height = window.innerHeight - 220;
  521. })
  522. },
  523. methods: {
  524. // 获取基础数据列表S
  525. getBaseList (val,type) {
  526. this.tagNo = val
  527. this.$nextTick(() => {
  528. let strVal = ''
  529. if (val === 5) {
  530. strVal = this.searchData.partNo
  531. }
  532. if (val === 24) {
  533. strVal = this.searchData.workCenterNo
  534. }
  535. this.$refs.baseList.init(val, strVal)
  536. })
  537. },
  538. /* 列表方法的回调 */
  539. getBaseData (val) {
  540. if (this.tagNo === 5) {
  541. this.searchData.partNo = val.PartNo
  542. }
  543. if (this.tagNo === 24) {
  544. this.searchData.workCenterNo = val.WorkCenterNo
  545. }
  546. },
  547. search(){
  548. getSOTastRoutingData(this.searchData).then(({data}) => {
  549. this.tableData = data.rows;
  550. })
  551. },
  552. createExportData() {
  553. return this.tableData;
  554. },
  555. startDownload() {
  556. // this.exportData = this.dataList
  557. },
  558. finishDownload() {
  559. },
  560. getStrDate() {
  561. let dd = new Date();
  562. let Y = dd.getFullYear();
  563. let M = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);//获取当前月份的日期,不足10补0
  564. let D = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();//获取当前几号,不足10补0
  565. let H = dd.getHours() < 10 ? "0" + dd.getHours() : dd.getHours();
  566. let MM = dd.getMinutes() < 10 ? "0" + dd.getMinutes() : dd.getMinutes();
  567. let S = dd.getSeconds() < 10 ? "0" + dd.getSeconds() : dd.getSeconds();
  568. return Y + M + D + H + MM + S;
  569. },
  570. openScheduleModel(row){
  571. // if (row.lotSize-row.scheduledQty == 0) {
  572. // this.$alert('该订单已派工完毕!', '错误', {
  573. // confirmButtonText: '确定'
  574. // })
  575. // return false
  576. // }
  577. this.schedulingModalData = {
  578. remark:'',
  579. partPlanQty: row.partPlanQty,
  580. orderNo: row.orderNo,
  581. site: row.site,
  582. orderRef1: row.orderRef1,
  583. lotSize: row.lotSize,
  584. qtyToSchedule: row.lotSize-row.scheduledQty,
  585. partNo: row.partNo,
  586. partDescription: row.partDescription,
  587. itemNo: row.itemNo,
  588. operationDesc: row.operationDesc,
  589. workCenterNo: row.workCenterNo,
  590. efficiency:row.efficiency,
  591. orderDate: row.orderDate,
  592. scheduleDate: '',
  593. scheduleQty: '',
  594. resourceId: '',
  595. shiftNo: '',
  596. sumQty: 0,
  597. operatorId: '',
  598. }
  599. this.schedulingModalTableData = []
  600. this.getAvailableResourceList(row);
  601. this.getWorkCenterOperatorList(row);
  602. this.scheduledModalFlag = true
  603. },
  604. addPlans () {
  605. // if (this.schedulingModalData.resourceId == '') {
  606. // this.$alert('请选择机台!', '错误', {
  607. // confirmButtonText: '确定'
  608. // })
  609. // return false
  610. // }
  611. // if (this.schedulingModalData.shiftNo == '') {
  612. // this.$alert('请选择派工班次!', '错误', {
  613. // confirmButtonText: '确定'
  614. // })
  615. // return false
  616. // }
  617. let data={
  618. scheduleQty: '',
  619. resourceId: this.schedulingModalData.resourceId,
  620. shiftNo: this.schedulingModalData.shiftNo,
  621. scheduleDate: null,
  622. operatorId:this.schedulingModalData.operatorId,
  623. createBy:this.$store.state.user.name,
  624. // jobType:'',
  625. }
  626. this.schedulingModalTableData.push(data)
  627. this.changeSum ();
  628. },
  629. changeSum () {
  630. let sum = 0
  631. if (this.schedulingModalTableData.length > 0) {
  632. for (let i = 0; i < this.schedulingModalTableData.length; i++) {
  633. if (this.schedulingModalTableData[i].scheduleQty != '' && this.schedulingModalTableData[i].scheduleQty != null) {
  634. sum += Number(this.schedulingModalTableData[i].scheduleQty)
  635. }
  636. }
  637. }
  638. this.schedulingModalData.sumQty = sum
  639. },
  640. splitScheduleTable (index) {
  641. this.schedulingModalTableData.splice(index, 1)
  642. this.changeSum()
  643. },
  644. getWorkCenterOperatorList(row){
  645. let inData={
  646. site:row.site,
  647. workCenterNo:row.workCenterNo,
  648. }
  649. getWorkCenterOperatorList(inData).then(({data}) => {
  650. this.operatorIdList = data.rows;
  651. })
  652. },
  653. getAvailableResourceList(row){
  654. let inData={
  655. site:row.site,
  656. orderNo:row.orderRef1,
  657. itemNo:row.itemNo,
  658. }
  659. getAvailableResourceList(inData).then(({data}) => {
  660. this.availableResourceList = data.rows;
  661. })
  662. },
  663. saveSchedule(){
  664. if(this.schedulingModalTableData.length==0){
  665. this.$alert('请添加派工记录!', '错误', {
  666. confirmButtonText: '确定'
  667. })
  668. return false
  669. }
  670. // if(this.schedulingModalData.qtyToSchedule<this.schedulingModalData.sumQty){
  671. // this.$alert('实际派工数量大于可派工数量!', '错误', {
  672. // confirmButtonText: '确定'
  673. // })
  674. // return false
  675. // }
  676. let flag=false;
  677. for (let i = 0; i <this.schedulingModalTableData.length; i++) {
  678. if(''==this.schedulingModalTableData[i].scheduleQty||this.schedulingModalTableData[i].scheduleQty==null){
  679. this.$alert('存在派工记录没有填写派工数量!', '错误', {
  680. confirmButtonText: '确定'
  681. })
  682. return false
  683. }
  684. if(this.schedulingModalTableData[i].scheduleQty<=0){
  685. this.$alert('派工数量必须大于0!', '错误', {
  686. confirmButtonText: '确定'
  687. })
  688. return false
  689. }
  690. if(''==this.schedulingModalTableData[i].resourceId||this.schedulingModalTableData[i].resourceId==null){
  691. this.$alert('存在派工记录没有选择机台!', '错误', {
  692. confirmButtonText: '确定'
  693. })
  694. return false
  695. }
  696. if(''==this.schedulingModalTableData[i].shiftNo||this.schedulingModalTableData[i].shiftNo==null){
  697. this.$alert('存在派工记录没有选择班次!', '错误', {
  698. confirmButtonText: '确定'
  699. })
  700. return false
  701. }
  702. // if(this.schedulingModalTableData[i].jobType==''||this.schedulingModalTableData[i].jobType==null){
  703. // this.$alert('请选择派工类型!', '错误', {
  704. // confirmButtonText: '确定'
  705. //
  706. // })
  707. // return false
  708. // }
  709. if(''==this.schedulingModalTableData[i].scheduleDate||this.schedulingModalTableData[i].scheduleDate==null){
  710. this.$alert('存在派工记录没有填写日期!', '错误', {
  711. confirmButtonText: '确定'
  712. })
  713. return false
  714. }
  715. if(''==this.schedulingModalTableData[i].operatorId||this.schedulingModalTableData[i].operatorId==null){
  716. this.$alert('存在派工记录没有选择操作员!', '错误', {
  717. confirmButtonText: '确定'
  718. })
  719. return false
  720. }
  721. if(this.schedulingModalTableData[i].scheduleDate!=this.schedulingModalData.orderDate){
  722. flag=true;
  723. }
  724. }
  725. if(flag){
  726. this.$confirm(`派工日期不是排产日期,是否继续`, '提示', {
  727. confirmButtonText: '确定',
  728. cancelButtonText: '取消',
  729. type: 'warning'
  730. }).then(() => {
  731. this.doSchedule();
  732. })
  733. }else {
  734. this.doSchedule();
  735. }
  736. },
  737. doSchedule(){
  738. let indata={
  739. orderNo: this.schedulingModalData.orderNo,
  740. site: this.schedulingModalData.site,
  741. orderDate: this.schedulingModalData.orderDate,
  742. partNo: this.schedulingModalData.partNo,
  743. itemNo: this.schedulingModalData.itemNo,
  744. workCenterNo: this.schedulingModalData.workCenterNo,
  745. sumQty: this.schedulingModalData.sumQty,
  746. scheduleDetail:this.schedulingModalTableData,
  747. efficiency:this.schedulingModalData.efficiency,
  748. orderRef1:this.schedulingModalData.orderRef1,
  749. remark:this.schedulingModalData.remark,
  750. }
  751. scheduleForSOTask(indata).then(({data}) => {
  752. if (data && data.code === 0) {
  753. this.scheduledModalFlag = false
  754. for (let i = 0; i <this.tableData.length ; i++) {
  755. if(this.tableData[i].orderNo==indata.orderNo &&this.tableData[i].itemNo==indata.itemNo){
  756. this.tableData[i].scheduledQty=data.qty;
  757. }
  758. }
  759. this.$message({
  760. message: '操作成功',
  761. type: 'success',
  762. duration: 1500,
  763. onClose: () => {
  764. }
  765. })
  766. } else {
  767. this.$alert(data.msg, '错误', {
  768. confirmButtonText: '确定'
  769. })
  770. }
  771. })
  772. },
  773. tableRowClassName ({row, rowIndex}) {
  774. return ''
  775. },
  776. },
  777. created() {
  778. }
  779. }
  780. </script>
  781. <style >
  782. .rq .el-table .cell {
  783. line-height: 20px;
  784. font-size: 12px;
  785. height: 20px;
  786. }
  787. .el-table .success-row {
  788. background: #1bb61b;
  789. }
  790. </style>