赫艾前端
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.

941 lines
33 KiB

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