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

588 lines
19 KiB

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
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
2 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 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
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
2 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
3 years ago
3 years ago
3 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
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
1 year ago
2 years ago
4 years ago
4 years ago
4 years ago
3 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
2 years ago
2 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" >
  4. <el-form-item :label="'混炼任务单号:'">
  5. <el-input v-model="searchData.taskNo" style="width: 120px"></el-input>
  6. </el-form-item >
  7. <el-form-item >
  8. <span slot="label" style="" @click="getBaseList(5)"><a herf="#">物料编码</a></span>
  9. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'合并日期:'">
  12. <el-date-picker
  13. style="width: 130px"
  14. v-model="searchData.startDate"
  15. type="date"
  16. value-format="yyyy-MM-dd"
  17. placeholder="选择日期">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item style="margin-top: 23px;">
  21. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  22. </el-form-item>
  23. <el-form-item :label="' '">
  24. <el-date-picker
  25. style="width: 130px"
  26. v-model="searchData.endDate"
  27. type="date"
  28. value-format="yyyy-MM-dd"
  29. placeholder="选择日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item :label="'是否报工:'">
  33. <el-select filterable v-model="searchData.reportFlag" style="width: 120px">
  34. <el-option label="全部" value=""></el-option>
  35. <el-option label="否" value="N"></el-option>
  36. <el-option label="是" value="Y"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item :label="' '">
  40. <el-button @click="search()" style="margin-left: 0px;margin-top: 0px" type="primary">查询</el-button>
  41. <el-button @click="scanReport()" style="margin-left: 0px;margin-top: 0px" type="primary">扫码报工</el-button>
  42. <download-excel
  43. :fields="exportDataStandard"
  44. :data="tableData"
  45. type="xlsx"
  46. :name="exportName"
  47. :header="exportHeader"
  48. :footer="exportFooter"
  49. :defaultValue="exportDefaultValue"
  50. :fetch="createExportData"
  51. :before-generate="startDownload"
  52. :before-finish="finishDownload"
  53. worksheet="导出信息"
  54. class="el-button el-button--primary el-button--medium">
  55. {{'导出'}}
  56. </download-excel>
  57. </el-form-item>
  58. </el-form>
  59. <el-table
  60. :height="height"
  61. :data="tableData"
  62. border
  63. style="width: 100%">
  64. <el-table-column
  65. prop=""
  66. header-align="center"
  67. align="center"
  68. min-width="160"
  69. label="操作">
  70. <template slot-scope="scope" class="foo_container">
  71. <a type="text" size="small" @click="printHunlianCard(scope.row)">混炼任务单</a>
  72. <a type="text" v-if="scope.row.reportFlag=='N'" size="small" @click="reportTaskModal(scope.row)">报工</a>
  73. <a type="text" v-if="scope.row.reportFlag=='Y'&&scope.row.wareHouseFlag=='N'" size="small" @click="cancelReportTask(scope.row)">取消报工</a>
  74. <a type="text" size="small" @click="printPartCard(scope.row)">物料标识卡</a>
  75. <a type="text" size="small" @click="detailModal(scope.row)">查看周计划明细</a>
  76. <a type="text" v-if="scope.row.reportFlag=='N'" size="small" @click="cancelTask(scope.row)">取消任务</a>
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. prop="taskNo"
  81. header-align="center"
  82. align="left"
  83. min-width="80"
  84. label="混炼任务单号">
  85. </el-table-column>
  86. <el-table-column
  87. prop="partNo"
  88. header-align="center"
  89. align="left"
  90. min-width="70"
  91. label="混炼物料编码">
  92. </el-table-column>
  93. <el-table-column
  94. prop="partDesc"
  95. header-align="center"
  96. align="left"
  97. min-width="100"
  98. label="混炼胶名称">
  99. </el-table-column>
  100. <el-table-column
  101. prop="taskQty"
  102. header-align="center"
  103. align="right"
  104. min-width="100"
  105. label="混炼胶数量">
  106. </el-table-column>
  107. <el-table-column
  108. prop="createDate"
  109. header-align="center"
  110. align="left"
  111. min-width="70"
  112. label="合并日期">
  113. </el-table-column>
  114. <el-table-column
  115. prop="createBy"
  116. header-align="center"
  117. align="left"
  118. min-width="70"
  119. label="创建人">
  120. </el-table-column>
  121. <el-table-column
  122. prop="reportFlag"
  123. header-align="center"
  124. align="left"
  125. min-width="70"
  126. label="是否报工">
  127. </el-table-column>
  128. <el-table-column
  129. prop="reportQty"
  130. header-align="center"
  131. align="right"
  132. min-width="70"
  133. label="报工数量">
  134. </el-table-column>
  135. <el-table-column
  136. prop="wareHouseFlag"
  137. header-align="center"
  138. align="left"
  139. min-width="70"
  140. label="是否入库">
  141. </el-table-column>
  142. <el-table-column
  143. prop="orderRef1"
  144. header-align="center"
  145. align="left"
  146. min-width="100"
  147. label="合并生产订单号">
  148. </el-table-column>
  149. </el-table>
  150. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag title="周计划清单" :visible.sync="detailFlag" width="600px">
  151. <el-table
  152. height="300"
  153. :data="detailList"
  154. border
  155. style="width: 100%">
  156. <el-table-column
  157. prop="taskNo"
  158. header-align="center"
  159. align="left"
  160. min-width="80"
  161. label="混炼任务单号">
  162. </el-table-column>
  163. <el-table-column
  164. prop="orderNo"
  165. header-align="center"
  166. align="left"
  167. min-width="70"
  168. label="周计划号">
  169. </el-table-column>
  170. <el-table-column
  171. prop="partDesc"
  172. header-align="center"
  173. align="left"
  174. min-width="100"
  175. label="混炼胶名称">
  176. </el-table-column>
  177. <el-table-column
  178. prop="orderQty"
  179. header-align="center"
  180. align="right"
  181. min-width="70"
  182. label="周计划数量">
  183. </el-table-column>
  184. <el-table-column
  185. prop="hunlianQty"
  186. header-align="center"
  187. align="right"
  188. min-width="70"
  189. label="混炼胶数量">
  190. </el-table-column>
  191. <el-table-column
  192. prop="orderDate"
  193. header-align="center"
  194. align="left"
  195. min-width="100"
  196. label="周计划日期">
  197. </el-table-column>
  198. </el-table>
  199. <span slot="footer" class="dialog-footer">
  200. <el-button @click="detailFlag = false" type="primary">取消</el-button>
  201. </span>
  202. </el-dialog>
  203. <el-dialog title="报工扫描" :close-on-click-modal="false" v-drag :visible.sync="scanModalFlag" width="215px">
  204. <el-form :inline="true" label-position="top" style="margin-left: 22px;margin-top: -5px;" @submit.native.prevent>
  205. <el-form-item :label="'混炼任务号:'">
  206. <el-input v-model="scanTaskNo" ref="start" style="width: 130px;" @keyup.enter.native="doScanTaskNo()"></el-input>
  207. </el-form-item>
  208. </el-form>
  209. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  210. <el-button type="primary" @click="doScanTaskNo()">报工</el-button>
  211. <el-button type="primary" @click="scanModalFlag = false">取消</el-button>
  212. </el-footer>
  213. </el-dialog>
  214. <el-dialog title="保存报工" :close-on-click-modal="false" v-drag :visible.sync="reportModalFlag" width="470px">
  215. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  216. <el-form-item :label="'任务单号:'">
  217. <el-input v-model="reportData.taskNo" disabled style="width: 130px"></el-input>
  218. </el-form-item>
  219. <el-form-item :label="'所需数量:'">
  220. <el-input v-model="reportData.qtyRequired" disabled style="width: 130px"></el-input>
  221. </el-form-item>
  222. <el-form-item :label="'库存数量:'">
  223. <el-input v-model="reportData.qtyOnHand" disabled style="width: 130px"></el-input>
  224. </el-form-item>
  225. </el-form>
  226. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
  227. <el-form-item :label="'混炼胶报工重量:'" >
  228. <el-input v-model="reportData.qtyReal" :disabled="reportFlag" type="number" style="width: 130px"></el-input>
  229. </el-form-item>
  230. <el-form-item :label="'库存抵扣数量:'">
  231. <el-input v-model="reportData.qtyRef" type="number" style="width: 130px"></el-input>
  232. </el-form-item>
  233. </el-form>
  234. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  235. <el-button type="primary" @click="reportSave()">保存</el-button>
  236. <el-button type="primary" @click="reportModalFlag = false">取消</el-button>
  237. </el-footer>
  238. </el-dialog>
  239. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  240. </div>
  241. </template>
  242. <script>
  243. import {
  244. getHunlianTaskData,getHunlianTaskDetailData,cancelTask,reportTask,cancelReportTask,getPartNoOnHand,getHunLianPrintData
  245. } from "@/api/production.js"
  246. import {
  247. printTransNoLabel,
  248. } from "@/views/modules/print/print_transNo_label.js"
  249. import {
  250. printHunlianLabel,
  251. } from "@/views/modules/print/print_hunlian_card.js"
  252. import {
  253. printPartLabel,
  254. } from "@/views/modules/print/print_part_label.js"
  255. import decimalUtil from '../../../utils/decimalUtil'
  256. import Chooselist from '@/views/modules/common/Chooselist'
  257. export default {
  258. components: {
  259. Chooselist
  260. },
  261. data () {
  262. return {
  263. reportFlag:false,
  264. searchData:{
  265. taskNo:'',
  266. partNo:'',
  267. startDate:'',
  268. endDate:'',
  269. reportFlag:'N',
  270. },
  271. height:200,
  272. tagNo:'',
  273. tableData:[],
  274. detailList:[],
  275. detailFlag:false,
  276. reportModalFlag:false,
  277. reportData:{
  278. site:'',
  279. taskNo:'',
  280. qtyRequired: '',
  281. reportQty:'',
  282. qtyOnHand:'',
  283. qtyReal:'',
  284. qtyRef:'',
  285. },
  286. scanModalFlag:false,
  287. scanTaskNo:'',
  288. // 导出 start
  289. exportData: [],
  290. exportDataStandard: {
  291. '混炼任务单号': 'taskNo',
  292. '混炼物料编码': 'partNo',
  293. '混炼胶名称': 'partDesc',
  294. '混炼胶数量': 'taskQty',
  295. '合并日期': 'createDate',
  296. '创建人': 'createBy',
  297. '是否报工': 'reportFlag',
  298. '报工数量': 'reportQty',
  299. '是否入库': 'wareHouseFlag',
  300. '合并生产订单号': 'orderRef1',
  301. },
  302. exportName: '日计划列表' + this.getStrDate(),
  303. exportHeader: ['日计划列表'],
  304. exportFooter: [],
  305. exportDefaultValue: '',
  306. // 导出 end
  307. }
  308. },
  309. mounted() {
  310. this.$nextTick(()=>{
  311. this.height = window.innerHeight - 180;
  312. })
  313. },
  314. methods: {
  315. getBaseList (val,type) {
  316. this.tagNo = val
  317. this.$nextTick(() => {
  318. let strVal = ''
  319. if (val === 5) {
  320. strVal = this.searchData.partNo
  321. }
  322. this.$refs.baseList.init(val, strVal)
  323. })
  324. },
  325. /* 列表方法的回调 */
  326. getBaseData (val) {
  327. if (this.tagNo === 5) {
  328. this.searchData.partNo = val.PartNo
  329. }
  330. },
  331. search(){
  332. getHunlianTaskData(this.searchData).then(({data}) => {
  333. this.tableData = data.rows;
  334. })
  335. },
  336. detailModal(row){
  337. let inData={
  338. site:row.site,
  339. taskNo:row.taskNo,
  340. }
  341. getHunlianTaskDetailData(inData).then(({data}) => {
  342. this.detailList = data.rows;
  343. })
  344. this.detailFlag=true;
  345. },
  346. getPartNoOnHand(site,partNo){
  347. let inData={
  348. site:site,
  349. partNo:partNo,
  350. }
  351. getPartNoOnHand(inData).then(({data}) => {
  352. if (data && data.code === 0) {
  353. if(data.row!=null){
  354. this.reportData.qtyOnHand=data.row.qtyOnHand;
  355. }else {
  356. this.reportData.qtyOnHand=0;
  357. }
  358. } else {
  359. this.$alert(data.msg, '错误', {
  360. confirmButtonText: '确定'
  361. })
  362. }
  363. })
  364. },
  365. printHunlianCard(row){
  366. getHunLianPrintData(row).then(({data}) => {
  367. if (data && data.code === 0) {
  368. if(data.rows.length>0){
  369. let array=[];
  370. array.push(data.rows[0])
  371. printHunlianLabel(array)
  372. }
  373. }
  374. })
  375. },
  376. printPartCard(row){
  377. let array=[];
  378. let data={
  379. // printerName:'大标签打印机',
  380. orderNo:'*',
  381. userId:this.$store.state.user.name,
  382. partNo:row.partNo,
  383. sScheduledDate:row.createDate,
  384. operatorName:this.$store.state.user.name,
  385. partDesc:row.partDesc,
  386. qtyRequired:row.taskQty,
  387. toExpireDays:row.toExpireDays,
  388. remark:row.remark,
  389. }
  390. array.push(data)
  391. printPartLabel(array)
  392. },
  393. cancelTask(row){
  394. this.$confirm(`是否删除混炼任务单?`, '提示', {
  395. confirmButtonText: '确定',
  396. cancelButtonText: '取消',
  397. type: 'warning'
  398. }).then(() => {
  399. let inData={
  400. site:row.site,
  401. taskNo:row.taskNo,
  402. userId:this.$store.state.user.name,
  403. orderRef1:row.orderRef1,
  404. }
  405. cancelTask(inData).then(({data}) => {
  406. if (data && data.code === 0) {
  407. this.search ();
  408. this.$message({
  409. message: '操作成功',
  410. type: 'success',
  411. duration: 1500,
  412. onClose: () => {
  413. }
  414. })
  415. } else {
  416. this.$alert(data.msg, '错误', {
  417. confirmButtonText: '确定'
  418. })
  419. }
  420. })
  421. }).catch(() => {
  422. })
  423. },
  424. reportTaskModal(row){
  425. if(row.orderRef1==''||row.orderRef1==null){
  426. this.reportFlag=true
  427. }else {
  428. this.reportFlag=false
  429. }
  430. this.reportData.site=row.site;
  431. this.reportData.taskNo=row.taskNo;
  432. this.reportData.qtyRequired=row.taskQty;
  433. this.reportData.reportQty='';
  434. this.reportData.partNo=row.partNo;
  435. this.reportData.userId=row.userId;
  436. this.reportData.qtyReal=0;
  437. this.reportData.qtyRef=0;
  438. this.getPartNoOnHand(row.site,row.partNo);
  439. this.reportModalFlag=true;
  440. },
  441. cancelReportTask(row){
  442. this.$confirm(`是否取消报工?`, '提示', {
  443. confirmButtonText: '确定',
  444. cancelButtonText: '取消',
  445. type: 'warning'
  446. }).then(() => {
  447. cancelReportTask(row).then(({data}) => {
  448. if (data && data.code === 0) {
  449. this.search ();
  450. } else {
  451. this.$alert(data.msg, '错误', {
  452. confirmButtonText: '确定'
  453. })
  454. }
  455. })
  456. }).catch(() => {
  457. })
  458. },
  459. reportSave(){
  460. this.reportData.reportQty=Number(Number(this.reportData.qtyReal)+Number(this.reportData.qtyRef)).toFixed(2);
  461. if(this.reportData.reportQty<this.reportData.qtyRequired){
  462. this.$alert('报工数量不足,无法报工!', '错误', {
  463. confirmButtonText: '确定'
  464. })
  465. return false
  466. }
  467. this.$confirm(`确认是否报工?`, '提示', {
  468. confirmButtonText: '确定',
  469. cancelButtonText: '取消',
  470. type: 'warning'
  471. }).then(() => {
  472. reportTask(this.reportData).then(({data}) => {
  473. if (data && data.code === 0) {
  474. this.search ();
  475. this.reportModalFlag=false;
  476. data.printData.seqNo='*'
  477. let inList=[];
  478. inList.push(data.printData)
  479. printTransNoLabel(inList)
  480. this.$message({
  481. message: '操作成功',
  482. type: 'success',
  483. duration: 1500,
  484. onClose: () => {
  485. }
  486. })
  487. } else {
  488. this.$alert(data.msg, '错误', {
  489. confirmButtonText: '确定'
  490. })
  491. }
  492. })
  493. }).catch(() => {
  494. })
  495. },
  496. scanReport(){
  497. this.scanTaskNo='';
  498. this.scanModalFlag=true;
  499. this.$nextTick(() => { this.$refs.start.focus();})
  500. },
  501. doScanTaskNo(){
  502. if(this.scanTaskNo==''||this.scanTaskNo==null){
  503. this.$alert("请扫描任务单二维码", '错误', {
  504. confirmButtonText: '确定'
  505. })
  506. return false
  507. }
  508. let inData={
  509. taskNo:this.scanTaskNo,
  510. reportFlag:'N'
  511. }
  512. getHunlianTaskData(inData).then(({data}) => {
  513. let list = data.rows;
  514. if(list.length==0){
  515. this.scanTaskNo=''
  516. this.$alert("该任务单不存在或者已经报过工!", '错误', {
  517. confirmButtonText: '确定'
  518. })
  519. return false
  520. }else {
  521. let row=list[0]
  522. if(row.flFlag=='N'){
  523. this.$message.error("尚未发料,不允许报工!")
  524. return
  525. }
  526. if(row.orderRef1==''||row.orderRef1==null){
  527. this.reportFlag=true
  528. }else {
  529. this.reportFlag=false
  530. }
  531. this.reportData.site=row.site;
  532. this.reportData.taskNo=row.taskNo;
  533. this.reportData.qtyRequired=row.taskQty;
  534. this.reportData.reportQty='';
  535. this.reportData.partNo=row.partNo;
  536. this.reportData.userId=row.userId;
  537. this.reportData.qtyReal=0;
  538. this.reportData.qtyRef=0;
  539. this.getPartNoOnHand(row.site,row.partNo);
  540. this.scanModalFlag = false
  541. this.reportModalFlag=true;
  542. }
  543. })
  544. },
  545. createExportData () {
  546. return this.tableData
  547. },
  548. startDownload () {
  549. // this.exportData = this.dataList
  550. },
  551. finishDownload () {
  552. },
  553. getStrDate () {
  554. let dd = new Date()
  555. let Y = dd.getFullYear()
  556. let M = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)// 获取当前月份的日期,不足10补0
  557. let D = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()// 获取当前几号,不足10补0
  558. let H = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  559. let MM = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  560. let S = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  561. return Y + M + D + H + MM + S
  562. }
  563. },
  564. created() {
  565. }
  566. }
  567. </script>
  568. <style >
  569. .el-table .cell {
  570. padding: 0px;
  571. }
  572. </style>