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

455 lines
16 KiB

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