Extrusion.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <el-form
  3. class="form-no-message"
  4. :model="{ categoryMsg, ...workReport }"
  5. ref="formRef"
  6. :show-message="false"
  7. >
  8. <div class="message-box">
  9. <ul>
  10. <li> <span class="label">报工次数</span> {{ countMsg.reportNum }}</li>
  11. <li>
  12. <span class="label">累计合格品数量</span>
  13. {{ countMsg.standardTotalNum }}PCS</li
  14. >
  15. <li>
  16. <span class="label">累计合格品重量</span>
  17. {{ countMsg.standardTotalWeight }}KG</li
  18. >
  19. <li>
  20. <span class="label">累计投料重量</span>
  21. {{ countMsg.feedMaterielWeight }}KG</li
  22. >
  23. </ul>
  24. <div class="right">
  25. <el-form-item
  26. label="执行人工号"
  27. prop="executorId"
  28. required
  29. label-width="100px"
  30. ><personSelectRemote
  31. v-model="workReport.executorId"
  32. placeholder="请输入"
  33. @selfChange="
  34. (val, item) => (workReport.executorJobNum = item.jobNumber)
  35. "
  36. /></el-form-item>
  37. <el-form-item
  38. label="执行日期"
  39. required
  40. prop="executeTime"
  41. label-width="100px"
  42. ><el-date-picker
  43. v-model="workReport.executeTime"
  44. value-format="yyyy-MM-dd HH:mm:ss"
  45. type="datetime"
  46. format="yyyy-MM-dd HH:mm:ss"
  47. placeholder="请选择"
  48. :disabled="formData.dateType == 2"
  49. ></el-date-picker
  50. ></el-form-item>
  51. </div>
  52. </div>
  53. <el-card>
  54. <el-descriptions title="报工信息" direction="vertical" :column="7" border>
  55. <el-descriptions-item label="原料编码/名称" :span="2">
  56. <span class="label-required after" slot="label">原料编码/名称</span>
  57. <el-form-item
  58. label=""
  59. required
  60. label-width="0"
  61. class="w100"
  62. prop="categoryMsg.code"
  63. >
  64. <el-input
  65. placeholder="请输入"
  66. :value="`${categoryMsg.code}/${categoryMsg.name}`"
  67. @click.native="getMaterial"
  68. ></el-input>
  69. </el-form-item>
  70. </el-descriptions-item>
  71. <el-descriptions-item label="原料牌号">{{
  72. categoryMsg.brandNum
  73. }}</el-descriptions-item>
  74. <el-descriptions-item label="批次号">
  75. <span class="label-required after" slot="label">批次号</span>
  76. <el-form-item
  77. label=""
  78. required
  79. label-width="0"
  80. class="w100"
  81. prop="categoryMsg.batchNo"
  82. >
  83. <el-select v-model="categoryMsg.batchNo" placeholder="请选择">
  84. <el-option
  85. v-for="(item, index) in batchList"
  86. :key="index"
  87. :label="item.batchNum"
  88. :value="item.batchNum"
  89. @click.native="categoryMsg.totalWeight = item.storageNum"
  90. ></el-option>
  91. </el-select>
  92. </el-form-item>
  93. </el-descriptions-item>
  94. <el-descriptions-item label="原料重量(KG)">
  95. <span class="label-required after" slot="label">原料重量(KG)</span>
  96. <el-form-item
  97. label=""
  98. required
  99. label-width="0"
  100. class="w100"
  101. prop="categoryMsg.totalWeight"
  102. ><el-input
  103. v-model="categoryMsg.totalWeight"
  104. placeholder="请输入"
  105. ></el-input> </el-form-item
  106. ></el-descriptions-item>
  107. <el-descriptions-item label="质检项" :span="2">
  108. <el-input
  109. v-model="workReport.qualityItem"
  110. placeholder="请输入"
  111. ></el-input>
  112. </el-descriptions-item>
  113. <el-descriptions-item label="质检标准" :span="3">
  114. <el-input
  115. v-model="workReport.qualityStandard"
  116. placeholder="请输入"
  117. ></el-input
  118. ></el-descriptions-item>
  119. <el-descriptions-item label="">
  120. <span class="label-required after" slot="label">合格品数量(PCS)</span>
  121. <el-form-item
  122. label=""
  123. label-width="0"
  124. class="w100"
  125. required
  126. prop="productInfo.standardNum"
  127. ><el-input
  128. class="w100"
  129. v-model.number="workReport.productInfo.standardNum"
  130. @input="
  131. (value) =>
  132. (workReport.productInfo.standardNum = value
  133. ? parseInt(value)
  134. : value)
  135. "
  136. clearable
  137. ></el-input> </el-form-item
  138. ></el-descriptions-item>
  139. <el-descriptions-item label=""
  140. ><span class="label-required after" slot="label">合格品重量(KG)</span>
  141. <el-form-item
  142. label=""
  143. label-width="0"
  144. class="w100"
  145. prop="productInfo.standardWeight"
  146. ><el-input
  147. readonly
  148. class="w100"
  149. :value="
  150. (workReport.productInfo.standardWeight =
  151. workReport.productInfo.standardNum === ''
  152. ? ''
  153. : multiply(
  154. workReport.productInfo.standardNum,
  155. infoData.productUnitWeight || 1
  156. ))
  157. "
  158. clearable
  159. ></el-input> </el-form-item
  160. ></el-descriptions-item>
  161. <el-descriptions-item label="不合格品数量(PCS)">
  162. <el-input
  163. class="w100"
  164. v-model="workReport.productInfo.noStandardNum"
  165. @input="
  166. (value) =>
  167. (workReport.productInfo.noStandardNum = value
  168. ? parseInt(value)
  169. : value)
  170. "
  171. clearable
  172. ></el-input>
  173. </el-descriptions-item>
  174. <el-descriptions-item label="不合格品重量(KG)"
  175. ><el-input
  176. class="w100"
  177. :value="
  178. (workReport.productInfo.noStandardWeight =
  179. workReport.productInfo.noStandardNum === ''
  180. ? ''
  181. : multiply(
  182. workReport.productInfo.noStandardNum,
  183. infoData.productUnitWeight || 1
  184. ))
  185. "
  186. clearable
  187. ></el-input
  188. ></el-descriptions-item>
  189. <el-descriptions-item label="副产品重量(KG)"
  190. ><el-input
  191. class="w100"
  192. v-model="workReport.productInfo.byProductWeight"
  193. @input="
  194. (value) =>
  195. (workReport.productInfo.byProductWeight = value
  196. ? parseInt(value)
  197. : value)
  198. "
  199. clearable
  200. ></el-input
  201. ></el-descriptions-item>
  202. <el-descriptions-item label="备注">
  203. <el-input v-model="workReport.remark"></el-input
  204. ></el-descriptions-item>
  205. </el-descriptions>
  206. <el-descriptions
  207. title="设备信息"
  208. class="mt-16"
  209. direction="vertical"
  210. :column="7"
  211. border
  212. >
  213. <el-descriptions-item label="设备编码">{{
  214. workReportDeviceList.code
  215. }}</el-descriptions-item>
  216. <el-descriptions-item label="设备名称">{{
  217. workReportDeviceList.name
  218. }}</el-descriptions-item>
  219. <el-descriptions-item label="规格">{{
  220. workReportDeviceList.specification
  221. }}</el-descriptions-item>
  222. <el-descriptions-item label="型号">{{
  223. workReportDeviceList.model
  224. }}</el-descriptions-item>
  225. <el-descriptions-item label="设备位置">{{
  226. workReportDeviceList.path
  227. }}</el-descriptions-item>
  228. <el-descriptions-item label="操作" :span="2"
  229. ><el-link @click="getEquip" type="primary"
  230. >更改设备</el-link
  231. ></el-descriptions-item
  232. >
  233. <el-descriptions-item label="模具编码/名称"
  234. ><el-input
  235. class="w100"
  236. :value="`${moduleMsg.code}/${moduleMsg.name}`"
  237. @click.native="getCategory('5', 'moduleMsg')"
  238. ></el-input
  239. ></el-descriptions-item>
  240. <el-descriptions-item label="规格">{{
  241. moduleMsg.specification
  242. }}</el-descriptions-item>
  243. <el-descriptions-item label="型号">{{
  244. moduleMsg.model
  245. }}</el-descriptions-item>
  246. <el-descriptions-item label="冲压次数" :span="4"
  247. ><el-input
  248. placeholder="请输入"
  249. v-model="moduleMsg.extraField.stampingTimes"
  250. ></el-input
  251. ></el-descriptions-item>
  252. <el-descriptions-item label="舟皿编码/名称"
  253. ><el-input
  254. :value="`${boatMsg.code}/${boatMsg.name}`"
  255. @click.native="getCategory('8', 'boatMsg')"
  256. ></el-input
  257. ></el-descriptions-item>
  258. <el-descriptions-item label="规格">{{
  259. boatMsg.specification
  260. }}</el-descriptions-item>
  261. <el-descriptions-item label="槽数">{{ slotNum }}</el-descriptions-item>
  262. <el-descriptions-item label="数量"
  263. ><el-input
  264. placeholder="请输入"
  265. v-model="boatMsg.extraField.boatNum"
  266. ></el-input
  267. ></el-descriptions-item>
  268. </el-descriptions>
  269. </el-card>
  270. <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
  271. <materialDialog
  272. ref="materialRef"
  273. :params="{
  274. taskInstanceId: taskInfo.id,
  275. versionId: infoData.produceVersionId
  276. }"
  277. />
  278. <catogaryDialog ref="catogaryDialogRef" />
  279. </el-form>
  280. </template>
  281. <script>
  282. import { realTimeStorage } from '@/api/mainData';
  283. import personSelectRemote from '@/components/CommomSelect/person-select-remote';
  284. import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
  285. import materialDialog from '../materialDialog.vue';
  286. import catogaryDialog from '../catogaryDialog.vue';
  287. import { reportCount, getSoltNum } from '@/api/produceOrder';
  288. import { multiply } from '@/utils/math';
  289. import dayjs from 'dayjs';
  290. export default {
  291. components: {
  292. personSelectRemote,
  293. equipmentDailog,
  294. materialDialog,
  295. catogaryDialog
  296. },
  297. props: {
  298. infoData: {
  299. type: Object,
  300. default: () => ({})
  301. },
  302. formData: {
  303. type: Object,
  304. default: () => ({})
  305. },
  306. taskInfo: {
  307. type: Object,
  308. default: () => ({})
  309. },
  310. firstInfo: {
  311. type: Object,
  312. default: () => ({})
  313. },
  314. currentInfo: {
  315. type: Object,
  316. default: () => ({})
  317. }
  318. },
  319. data() {
  320. return {
  321. categoryMsg: {
  322. batchNo: '',
  323. totalWeight: '',
  324. brandNum: '',
  325. sourceCategoryId: '',
  326. rootCategoryLevelId: '1',
  327. name: '',
  328. code: ''
  329. },
  330. workReport: {
  331. qualityItem: '',
  332. qualityStandard: '',
  333. executorId: '',
  334. executorJobNum: '',
  335. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  336. remark: '',
  337. productInfo: {
  338. standardNum: '',
  339. byProductWeight: '',
  340. standardWeight: '',
  341. noStandardNum: '',
  342. noStandardWeight: ''
  343. }
  344. },
  345. // 设备
  346. workReportDeviceList: {
  347. code: '',
  348. name: '',
  349. path: '',
  350. model: '',
  351. rootCategoryLevelId: '',
  352. specification: ''
  353. },
  354. countMsg: {},
  355. // 模具信息
  356. moduleMsg: {
  357. code: '',
  358. name: '',
  359. path: '',
  360. model: '',
  361. rootCategoryLevelId: '',
  362. specification: '',
  363. extraField: {
  364. stampingTimes: ''
  365. }
  366. },
  367. // 舟皿信息
  368. boatMsg: {
  369. code: '',
  370. name: '',
  371. path: '',
  372. model: '',
  373. rootCategoryLevelId: '',
  374. specification: '',
  375. extraField: {
  376. boatNum: ''
  377. }
  378. },
  379. batchList: [],
  380. slotNum: ''
  381. };
  382. },
  383. watch: {
  384. taskInfo: {
  385. immediate: true,
  386. handler() {
  387. if (this.taskInfo.code) {
  388. this.getReportCount();
  389. }
  390. }
  391. },
  392. formData: {
  393. immediate: true,
  394. handler() {
  395. if (this.formData.dateType == 2) {
  396. this.$set(
  397. this.workReport,
  398. 'executeTime',
  399. this.formData.appointTime
  400. );
  401. }
  402. }
  403. },
  404. infoData: {
  405. immediate: true,
  406. handler() {
  407. if (
  408. this.infoData.id &&
  409. this.currentInfo.code == this.firstInfo.code
  410. ) {
  411. // 设备
  412. this.workReportDeviceList = Object.assign(
  413. {},
  414. this.workReportDeviceList,
  415. {
  416. code: this.infoData.deviceCode,
  417. name: this.infoData.deviceName,
  418. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  419. path: this.infoData.path[0]?.pathName,
  420. model: this.infoData.model,
  421. sourceInstanceId: this.infoData.sourceInstanceId,
  422. specification: this.infoData.specification
  423. }
  424. );
  425. }
  426. }
  427. }
  428. },
  429. created() {
  430. this.workReport.executorId = this.$store.state.user.info?.userId;
  431. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  432. },
  433. methods: {
  434. multiply,
  435. getCategory(id, memo) {
  436. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  437. if (id == '8') {
  438. getSoltNum(res.id).then((r) => {
  439. this.slotNum = r.slotNum;
  440. });
  441. }
  442. this[memo].rootCategoryLevelId = res.categoryLevelId;
  443. this[memo].code = res.code;
  444. this[memo].name = res.name;
  445. this[memo].specification = res.specification;
  446. this[memo].sourceInstanceId = res.id;
  447. if (memo === 'moduleMsg') {
  448. this[memo].model = res.modelType;
  449. this[memo].extraField.stampingTimes = '';
  450. } else {
  451. this[memo].extraField.boatNum = '';
  452. }
  453. });
  454. },
  455. getMaterial() {
  456. this.$refs.materialRef.open(this.categoryMsg, (res) => {
  457. this.categoryMsg.name = res.categoryName;
  458. this.categoryMsg.code = res.categoryCode;
  459. this.categoryMsg.sourceCategoryId = res.id;
  460. this.categoryMsg.brandNum = res.brandNum;
  461. realTimeStorage({
  462. categoryCode: res.categoryCode,
  463. factoryCode: this.infoData.werks || '14T1'
  464. }).then((res) => {
  465. this.batchList = res;
  466. });
  467. });
  468. },
  469. getEquip() {
  470. this.$refs.equipmentRef.openSingle(
  471. [this.workReportDeviceList],
  472. (res) => {
  473. this.workReportDeviceList.code = res.code;
  474. this.workReportDeviceList.name = res.name;
  475. this.workReportDeviceList.model = res.category?.category?.modelType;
  476. this.workReportDeviceList.specification =
  477. res.category?.category?.specification;
  478. this.workReportDeviceList.sourceInstanceId = res.id;
  479. this.workReportDeviceList.rootCategoryLevelId =
  480. res.rootCategoryLevelId;
  481. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  482. }
  483. );
  484. },
  485. async getReportCount() {
  486. const res = await reportCount({
  487. taskCode: this.taskInfo.code,
  488. workOrderId: this.infoData.id
  489. });
  490. this.countMsg = res;
  491. },
  492. report(fun) {
  493. this.$refs.formRef.validate((value, error) => {
  494. if (value) {
  495. if (!this.workReportDeviceList.code) {
  496. return this.$message.error('请选择设备');
  497. }
  498. this.$confirm('是否确定要报工?', '提示').then(() => {
  499. const workReportDeviceList = [];
  500. if (this.workReportDeviceList.code) {
  501. workReportDeviceList.push(this.workReportDeviceList);
  502. }
  503. if (this.moduleMsg.code) {
  504. workReportDeviceList.push(this.moduleMsg);
  505. }
  506. if (this.boatMsg.code) {
  507. workReportDeviceList.push(this.boatMsg);
  508. }
  509. fun({
  510. checkState: 1,
  511. isSapReportState: 1,
  512. workReport: this.workReport,
  513. workReportCategoryList: [this.categoryMsg],
  514. workReportDeviceList
  515. }).then(() => {
  516. // this.$message.success('报工成功!');
  517. // this.getReportCount();
  518. });
  519. });
  520. } else {
  521. this.$message.error('请输入必填项!');
  522. }
  523. });
  524. }
  525. }
  526. };
  527. </script>
  528. <style lang="scss" scoped>
  529. .message-box {
  530. display: flex;
  531. justify-content: space-between;
  532. align-items: center;
  533. margin-bottom: 16px;
  534. .label {
  535. margin-right: 5px;
  536. }
  537. ul {
  538. list-style: none;
  539. display: flex;
  540. align-items: center;
  541. justify-content: flex-start;
  542. li {
  543. margin-right: 20px;
  544. }
  545. }
  546. .right {
  547. padding-top: 22px;
  548. display: flex;
  549. align-items: center;
  550. }
  551. }
  552. </style>