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

469 lines
17 KiB

2 years ago
2 years ago
2 years ago
2 years ago
9 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
10 months ago
10 months ago
10 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
10 months ago
2 years ago
2 years ago
  1. <script>
  2. import {
  3. checkIsPacking,
  4. getPackagePrintDataList,
  5. getSOScheduleRoutingDataPrint
  6. } from "../../../api/production/generateReport";
  7. import {
  8. getPhotoAddressData
  9. } from '@/api/pad.js'
  10. import {printPackageLabelNoPreview} from "../print/print_package_label-NOOREVIEW";
  11. export default {
  12. data() {
  13. return {
  14. searchData: {
  15. seqNo: undefined,
  16. flag: '',
  17. },
  18. number: 1,
  19. weight: 1,
  20. flag: false,
  21. soScheduleRouting: {},
  22. picData: {
  23. site: '',
  24. partNo: '',
  25. },
  26. fileTitle: "文件名 (" + 0 + "/" + 0 + ")",
  27. fileName: '',
  28. num: 1,
  29. currentData: '',
  30. photoDatas: [],
  31. uploadImg: [],
  32. showviewer: false,
  33. url: '',
  34. photoUrl: '',
  35. }
  36. },
  37. mounted() {
  38. this.$refs.focusInput.focus()
  39. },
  40. activated() {
  41. this.$refs.focusInput.focus()
  42. },
  43. computed: {
  44. seqNo: function () {
  45. return this.searchData.seqNo;
  46. }
  47. },
  48. watch: {},
  49. methods: {
  50. selectBySeqNo() {
  51. // 查询数据
  52. this.getSOScheduleRoutingData();
  53. },
  54. getSOScheduleRoutingData() {
  55. if (!this.searchData.seqNo) {
  56. this.$message.warning("派工单号为空")
  57. return
  58. }
  59. let params = {
  60. seqNo: this.searchData.seqNo,
  61. userId: this.$store.state.user.name
  62. };
  63. getSOScheduleRoutingDataPrint(params).then(({data}) => {
  64. if (data && data.code === 0) {
  65. if (data.total === 0) {
  66. this.$message.warning("派工单不存在")
  67. } else if (data.total === 1) {
  68. this.soScheduleRouting = data.rows[0];
  69. this.checkIsPacking()
  70. } else {
  71. this.soScheduleRouting = data.rows.find((item) => item.site === this.$store.state.user.site && item.seqNo === this.searchData.seqNo)
  72. this.checkIsPacking()
  73. }
  74. if (data.row) {
  75. this.soScheduleRouting.qtyBag = data.row[0].qtyBag
  76. this.soScheduleRouting.bag = data.row[0].bag
  77. this.soScheduleRouting.qty = data.row[0].qty
  78. this.soScheduleRouting.carton = data.row[0].carton
  79. }
  80. if (data.data) {
  81. this.soScheduleRouting.sScheduledDate2 = data.data.sScheduledDate;
  82. this.soScheduleRouting.operatorName2 = data.data.operatorName;
  83. this.soScheduleRouting.approveQty2 = data.data.qtyApprove;
  84. }
  85. } else {
  86. this.$message.warning(data.msg)
  87. this.cleanAll()
  88. }
  89. }).catch((error) => {
  90. this.cleanAll()
  91. this.$message.error(error);
  92. })
  93. },
  94. cleanAll() {
  95. Object.keys(this.soScheduleRouting).forEach(key => {
  96. this.soScheduleRouting[key] = '';
  97. });
  98. Object.keys(this.picData).forEach(key => {
  99. this.picData[key] = '';
  100. });
  101. this.fileName = null;
  102. this.fileTitle = "文件名 (" + 0 + "/" + 0 + ")";
  103. this.photoUrl = null;
  104. },
  105. checkIsPacking() {
  106. let params = {
  107. site: this.soScheduleRouting.site,
  108. workCenterNo: this.soScheduleRouting.sWorkCenterNo,
  109. }
  110. checkIsPacking(params).then(({data}) => {
  111. if (data && data.code === 0) {
  112. this.getData(this.soScheduleRouting.site, this.soScheduleRouting.partNo)
  113. } else {
  114. this.getData('', '')
  115. this.soScheduleRouting = {};
  116. this.$message.warning(data.msg)
  117. this.searchData = {
  118. seqNo: undefined,
  119. flag: '',
  120. }
  121. }
  122. }).catch((error) => {
  123. this.$message.error(error)
  124. this.searchData = {
  125. seqNo: undefined,
  126. flag: '',
  127. }
  128. this.soScheduleRouting = {};
  129. })
  130. },
  131. printLabel() {
  132. if (!this.searchData.seqNo){
  133. this.$message.warning("请先扫描派工单号");
  134. return;
  135. }
  136. if (!this.soScheduleRouting.site) {
  137. this.$message.warning("请先扫描派工单号")
  138. return
  139. }
  140. if (this.soScheduleRouting.qtyBag === null || this.soScheduleRouting.qtyBag === undefined) {
  141. this.$message.warning("未维护每袋数量")
  142. return;
  143. }
  144. let params = {
  145. previousSeqNo: this.soScheduleRouting.previousSeqNo,
  146. site: this.soScheduleRouting.site,
  147. orderNo: this.soScheduleRouting.orderNo,
  148. seqNo:this.searchData.seqNo
  149. }
  150. if (this.searchData.flag === 'Y') {
  151. this.flag = true;
  152. return;
  153. }
  154. this.printPackageLabelNoPreview(params)
  155. },
  156. printPackageLabelNoPreview(params) {
  157. if (!params) {
  158. this.$message.warning("参数为空")
  159. return
  160. }
  161. // 发起请求
  162. getPackagePrintDataList(params).then(({data}) => {
  163. if (data && data.code === 0) {
  164. data.rows[0].tcpValue = 0
  165. printPackageLabelNoPreview(data.rows);
  166. this.searchData.flag = '';
  167. this.flag = false
  168. } else {
  169. this.$message.warning(data.msg)
  170. }
  171. }).catch((error) => {
  172. this.$message.error(error)
  173. })
  174. },
  175. printLabelEntity() {
  176. let params = {
  177. previousSeqNo: this.soScheduleRouting.previousSeqNo,
  178. site: this.soScheduleRouting.site,
  179. orderNo: this.soScheduleRouting.orderNo,
  180. seqNo: this.soScheduleRouting.seqNo,
  181. }
  182. params.number = this.number;
  183. this.printPackageLabelNoPreview(params)
  184. },
  185. getData(site, partNo) {
  186. this.picData.partNo = partNo;
  187. this.picData.site = site;
  188. this.getPhoto();
  189. },
  190. getPhoto() {
  191. getPhotoAddressData(this.picData).then(({data}) => {
  192. this.photoDatas = data.rows;
  193. if (this.photoDatas.length == 0) {
  194. this.fileTitle = "文件名 (" + 0 + "/" + 0 + ")";
  195. this.photoUrl = null;
  196. return false;
  197. }
  198. this.fileName = this.photoDatas[this.num - 1].attaFileNameDb;
  199. this.fileTitle = "文件名 (" + this.num + "/" + this.photoDatas.length + ")";
  200. this.photoUrl = this.$store.state.user.padSopUrl + this.photoDatas[this.num - 1].attaFileNameDb;
  201. // this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  202. })
  203. },
  204. nextPicture() {
  205. if (this.photoDatas.length == 0) {
  206. this.fileTitle = "文件名 (" + 0 + "/" + 0 + ")";
  207. this.$alert('该物料没有上传图片!', '错误', {
  208. confirmButtonText: '确定'
  209. })
  210. return false;
  211. }
  212. if (this.num == this.photoDatas.length) {
  213. this.num = 1;
  214. } else {
  215. this.num = this.num + 1;
  216. }
  217. this.fileName = this.photoDatas[this.num - 1].attaFileNameDb;
  218. this.fileTitle = "文件名 (" + this.num + "/" + this.photoDatas.length + ")";
  219. this.photoUrl = this.$store.state.user.padSopUrl + this.photoDatas[this.num - 1].attaFileNameDb;
  220. // this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  221. },
  222. lastPicture() {
  223. if (this.photoDatas.length == 0) {
  224. this.fileTitle = "文件名 (" + 0 + "/" + 0 + ")";
  225. this.$alert('该物料没有上传图片!', '错误', {
  226. confirmButtonText: '确定'
  227. })
  228. return false;
  229. }
  230. if (this.num == 1) {
  231. this.num = this.photoDatas.length;
  232. } else {
  233. this.num = this.num - 1;
  234. }
  235. this.fileName = this.photoDatas[this.num - 1].attaFileNameDb;
  236. this.fileTitle = "文件名 (" + this.num + "/" + this.photoDatas.length + ")";
  237. this.photoUrl = this.$store.state.user.padSopUrl + this.photoDatas[this.num - 1].attaFileNameDb;
  238. // this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  239. },
  240. },
  241. }
  242. </script>
  243. <template>
  244. <div style="padding: 5px">
  245. <el-form size="medium" class="title" :model="seqNo" label-position="top" :inline="true">
  246. <el-form-item label="派工单号">
  247. <el-input-number size="medium" style="width: 100%;margin-top: -5px;" :controls="false" ref="focusInput" :min="0"
  248. v-model="searchData.seqNo" @keyup.enter.native="selectBySeqNo"></el-input-number>
  249. </el-form-item>
  250. <el-form-item label=" ">
  251. <el-select v-model="searchData.flag">
  252. <el-option value="" label="标准袋数"></el-option>
  253. <el-option value="Y" label="零数袋"></el-option>
  254. </el-select>
  255. </el-form-item>
  256. <el-form-item label=" ">
  257. <el-button type="primary" @click="printLabel">打印标签</el-button>
  258. </el-form-item>
  259. </el-form>
  260. <div class="content">
  261. <el-card style="height: 800px;margin-top: 20px">
  262. <el-form :model="soScheduleRouting" label-position="top">
  263. <el-row :gutter="20">
  264. <el-col :span="6">
  265. <el-form-item label="派工单号">
  266. <el-input v-model="soScheduleRouting.seqNo" readonly></el-input>
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="6">
  270. <el-form-item label="工厂编码">
  271. <el-input v-model="soScheduleRouting.site" readonly></el-input>
  272. </el-form-item>
  273. </el-col>
  274. <el-col :span="6">
  275. <el-form-item label="生产订单号">
  276. <el-input v-model="soScheduleRouting.orderNo" readonly></el-input>
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="6">
  280. <el-form-item label=" ">
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="6">
  284. <el-form-item label="产品编码">
  285. <el-input v-model="soScheduleRouting.partNo" readonly></el-input>
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="6">
  289. <el-form-item label="产品名称">
  290. <el-input v-model="soScheduleRouting.partDesc" readonly></el-input>
  291. </el-form-item>
  292. </el-col>
  293. <el-col :span="6">
  294. <el-form-item label="派工单类型">
  295. <el-input v-model="soScheduleRouting.scheduleType" readonly></el-input>
  296. </el-form-item>
  297. </el-col>
  298. <el-col :span="6">
  299. <el-form-item label="派工日期">
  300. <el-input v-model="soScheduleRouting.sScheduledDate" readonly></el-input>
  301. </el-form-item>
  302. </el-col>
  303. <el-col :span="6">
  304. <el-form-item label="检验工单号">
  305. <el-input v-model="soScheduleRouting.previousSeqNo" readonly></el-input>
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="6">
  309. <el-form-item label="检验日期">
  310. <el-input v-model="soScheduleRouting.sScheduledDate2" readonly></el-input>
  311. </el-form-item>
  312. </el-col>
  313. <el-col :span="6">
  314. <el-form-item label="检验员">
  315. <el-input v-model="soScheduleRouting.operatorName2" readonly></el-input>
  316. </el-form-item>
  317. </el-col>
  318. <el-col :span="6">
  319. <el-form-item label="检验合格数量">
  320. <el-input v-model="soScheduleRouting.approveQty2" readonly></el-input>
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="6">
  324. <el-form-item label="工序号">
  325. <el-input v-model="soScheduleRouting.itemNo" readonly></el-input>
  326. </el-form-item>
  327. </el-col>
  328. <el-col :span="6">
  329. <el-form-item label="工序名称">
  330. <el-input v-model="soScheduleRouting.itemDesc" readonly></el-input>
  331. </el-form-item>
  332. </el-col>
  333. <el-col :span="12">
  334. <el-form-item label=" ">
  335. </el-form-item>
  336. </el-col>
  337. <el-col :span="6">
  338. <el-form-item label="机台ID">
  339. <el-input v-model="soScheduleRouting.sResourceID" readonly></el-input>
  340. </el-form-item>
  341. </el-col>
  342. <el-col :span="6">
  343. <el-form-item label="班次">
  344. <el-input v-model="soScheduleRouting.sShiftNo" readonly></el-input>
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="6">
  348. <el-form-item label="加工中心编码">
  349. <el-input v-model="soScheduleRouting.sWorkCenterNo" readonly></el-input>
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="6">
  353. <el-form-item label="操作员姓名">
  354. <el-input v-model="soScheduleRouting.operatorName" readonly></el-input>
  355. </el-form-item>
  356. </el-col>
  357. <el-col :span="6">
  358. <el-form-item label="每袋数量">
  359. <el-input v-model="soScheduleRouting.qtyBag" readonly></el-input>
  360. </el-form-item>
  361. </el-col>
  362. <el-col :span="6">
  363. <el-form-item label="每箱袋装数">
  364. <el-input v-model="soScheduleRouting.bag" readonly></el-input>
  365. </el-form-item>
  366. </el-col>
  367. <el-col :span="6">
  368. <el-form-item label="整箱数量">
  369. <el-input v-model="soScheduleRouting.qty" readonly></el-input>
  370. </el-form-item>
  371. </el-col>
  372. <el-col :span="6">
  373. <el-form-item label="纸箱尺寸">
  374. <el-input v-model="soScheduleRouting.carton" readonly></el-input>
  375. </el-form-item>
  376. </el-col>
  377. </el-row>
  378. </el-form>
  379. <div class="pad" style="float: left;width: 33%;margin-top: 2%">
  380. <h5 style="margin-left: 30px;font-size: 20px">产品图片</h5>
  381. <el-form :inline="true" style="margin-left: 30px" label-position="top">
  382. <el-form-item :label="'产品编码:'" style="margin-left: 0px">
  383. <el-input v-model="picData.partNo" readonly style="width: 220px"></el-input>
  384. </el-form-item>
  385. </el-form>
  386. <el-form :inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
  387. <el-form-item :label="fileTitle">
  388. <el-input v-model="fileName" style="width: 374px" readonly></el-input>
  389. </el-form-item>
  390. </el-form>
  391. <el-form :inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
  392. <el-form-item :label="' '">
  393. <el-button @click="lastPicture()" style="margin-left: 10px;height: 35px;width: 90px" type="primary">
  394. 上一张
  395. </el-button>
  396. </el-form-item>
  397. <el-form-item :label="' '">
  398. <el-button @click="nextPicture()" style="margin-left: 25px;height: 35px;width: 90px" type="primary">
  399. 下一张
  400. </el-button>
  401. </el-form-item>
  402. </el-form>
  403. </div>
  404. <div id="padPhoto" style="text-align: center;float: left;width: 66%;vertical-align:middle;margin-top: 5px">
  405. <img style="max-width: 100%;max-height: 450px;vertical-align:middle;" :src="photoUrl">
  406. </div>
  407. </el-card>
  408. </div>
  409. <el-dialog title="提示" :visible.sync="flag" @open="()=>{
  410. this.$nextTick(()=>{
  411. this.$refs.dialogInput.focus();
  412. })
  413. }" @close="()=>{
  414. this.number = 1
  415. }" width="15vw" top="30vh">
  416. <el-form label-position="top" class="title">
  417. <el-form-item label="零数量">
  418. <el-input-number size="medium" style="width: 100%;text-align: left" :controls="false" ref="dialogInput"
  419. :min="1" v-model="number" @keyup.enter.native="selectBySeqNo"></el-input-number>
  420. </el-form-item>
  421. <!-- <el-form-item label="重量">-->
  422. <!-- <el-input-number size="medium" style="width: 100%;text-align: left" :controls="false" ref="dialogInput"-->
  423. <!-- :min="1" v-model="weight" @keyup.enter.native="selectBySeqNo"></el-input-number>-->
  424. <!-- </el-form-item>-->
  425. </el-form>
  426. <div style="height: 20px;width: 100%"></div>
  427. <div style="text-align: center;margin-bottom: 5px">
  428. <el-button type="primary" @click="printLabelEntity">确定</el-button>
  429. </div>
  430. <div style="height: 5px;width: 100%"></div>
  431. </el-dialog>
  432. </div>
  433. </template>
  434. <style scoped>
  435. .title .el-input-number /deep/ .el-input__inner {
  436. text-align: left;
  437. margin-top: 5px;
  438. padding-right: 5px !important;
  439. padding-left: 5px !important;
  440. }
  441. .el-form-item--medium /deep/ .el-form-item__label {
  442. font-size: 16px;
  443. line-height: 30px;
  444. height: 30px;
  445. }
  446. .el-form-item--medium /deep/ .el-form-item__content {
  447. margin-bottom: 5px;
  448. }
  449. .el-form-item--medium /deep/ .el-form-item__content .el-button {
  450. width: 80px;
  451. height: 30px;
  452. }
  453. .el-form-item--medium /deep/ .el-form-item__content .el-input .el-input__inner {
  454. font-size: 16px;
  455. line-height: 30px;
  456. height: 30px !important;
  457. }
  458. </style>