Extrusion.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. : workReport.productInfo.standardNum *
  154. (infoData.productUnitWeight || 1))
  155. "
  156. clearable
  157. ></el-input> </el-form-item
  158. ></el-descriptions-item>
  159. <el-descriptions-item label="不合格品数量(PCS)">
  160. <el-input
  161. class="w100"
  162. v-model="workReport.productInfo.noStandardNum"
  163. @input="
  164. (value) =>
  165. (workReport.productInfo.noStandardNum = value
  166. ? parseInt(value)
  167. : value)
  168. "
  169. clearable
  170. ></el-input>
  171. </el-descriptions-item>
  172. <el-descriptions-item label="不合格品重量(KG)"
  173. ><el-input
  174. class="w100"
  175. :value="
  176. (workReport.productInfo.noStandardWeight =
  177. workReport.productInfo.noStandardNum === ''
  178. ? ''
  179. : workReport.productInfo.noStandardNum *
  180. (infoData.productUnitWeight || 1))
  181. "
  182. clearable
  183. ></el-input
  184. ></el-descriptions-item>
  185. <el-descriptions-item label="副产品重量(KG)"
  186. ><el-input
  187. class="w100"
  188. v-model="workReport.productInfo.byProductWeight"
  189. @input="
  190. (value) =>
  191. (workReport.productInfo.byProductWeight = value
  192. ? parseInt(value)
  193. : value)
  194. "
  195. clearable
  196. ></el-input
  197. ></el-descriptions-item>
  198. <el-descriptions-item label="备注">
  199. <el-input v-model="workReport.remark"></el-input
  200. ></el-descriptions-item>
  201. </el-descriptions>
  202. <el-descriptions
  203. title="设备信息"
  204. class="mt-16"
  205. direction="vertical"
  206. :column="7"
  207. border
  208. >
  209. <el-descriptions-item label="设备编码">{{
  210. workReportDeviceList.code
  211. }}</el-descriptions-item>
  212. <el-descriptions-item label="设备名称">{{
  213. workReportDeviceList.name
  214. }}</el-descriptions-item>
  215. <el-descriptions-item label="规格">{{
  216. workReportDeviceList.specification
  217. }}</el-descriptions-item>
  218. <el-descriptions-item label="型号">{{
  219. workReportDeviceList.model
  220. }}</el-descriptions-item>
  221. <el-descriptions-item label="设备位置">{{
  222. workReportDeviceList.path
  223. }}</el-descriptions-item>
  224. <el-descriptions-item label="操作" :span="2"
  225. ><el-link @click="getEquip" type="primary"
  226. >更改设备</el-link
  227. ></el-descriptions-item
  228. >
  229. <el-descriptions-item label="模具编码/名称"
  230. ><el-input
  231. class="w100"
  232. :value="`${moduleMsg.code}/${moduleMsg.name}`"
  233. @click.native="getCategory('5', 'moduleMsg')"
  234. ></el-input
  235. ></el-descriptions-item>
  236. <el-descriptions-item label="规格">{{
  237. moduleMsg.specification
  238. }}</el-descriptions-item>
  239. <el-descriptions-item label="型号">{{
  240. moduleMsg.model
  241. }}</el-descriptions-item>
  242. <el-descriptions-item label="冲压次数" :span="4"
  243. ><el-input
  244. placeholder="请输入"
  245. v-model="moduleMsg.extraField.stampingTimes"
  246. ></el-input
  247. ></el-descriptions-item>
  248. <el-descriptions-item label="舟皿编码/名称"
  249. ><el-input
  250. :value="`${boatMsg.code}/${boatMsg.name}`"
  251. @click.native="getCategory('8', 'boatMsg')"
  252. ></el-input
  253. ></el-descriptions-item>
  254. <el-descriptions-item label="规格">{{
  255. boatMsg.specification
  256. }}</el-descriptions-item>
  257. <el-descriptions-item label="槽数">{{ slotNum }}</el-descriptions-item>
  258. <el-descriptions-item label="数量"
  259. ><el-input
  260. placeholder="请输入"
  261. v-model="boatMsg.extraField.boatNum"
  262. ></el-input
  263. ></el-descriptions-item>
  264. </el-descriptions>
  265. </el-card>
  266. <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
  267. <materialDialog
  268. ref="materialRef"
  269. :params="{
  270. taskInstanceId: taskInfo.id,
  271. versionId: infoData.produceVersionId
  272. }"
  273. />
  274. <catogaryDialog ref="catogaryDialogRef" />
  275. </el-form>
  276. </template>
  277. <script>
  278. import { realTimeStorage } from '@/api/mainData';
  279. import personSelectRemote from '@/components/CommomSelect/person-select-remote';
  280. import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
  281. import materialDialog from '../materialDialog.vue';
  282. import catogaryDialog from '../catogaryDialog.vue';
  283. import { reportCount, getSoltNum } from '@/api/produceOrder';
  284. import dayjs from 'dayjs';
  285. export default {
  286. components: {
  287. personSelectRemote,
  288. equipmentDailog,
  289. materialDialog,
  290. catogaryDialog
  291. },
  292. props: {
  293. infoData: {
  294. type: Object,
  295. default: () => ({})
  296. },
  297. formData: {
  298. type: Object,
  299. default: () => ({})
  300. },
  301. taskInfo: {
  302. type: Object,
  303. default: () => ({})
  304. }
  305. },
  306. data () {
  307. return {
  308. categoryMsg: {
  309. batchNo: '',
  310. totalWeight: '',
  311. brandNum: '',
  312. sourceCategoryId: '',
  313. rootCategoryLevelId: '1',
  314. name: '',
  315. code: ''
  316. },
  317. workReport: {
  318. qualityItem: '',
  319. qualityStandard: '',
  320. executorId: '',
  321. executorJobNum: '',
  322. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  323. remark: '',
  324. productInfo: {
  325. standardNum: '',
  326. byProductWeight: '',
  327. standardWeight: '',
  328. noStandardNum: '',
  329. noStandardWeight: ''
  330. }
  331. },
  332. // 设备
  333. workReportDeviceList: {
  334. code: '',
  335. name: '',
  336. path: '',
  337. model: '',
  338. rootCategoryLevelId: '',
  339. specification: ''
  340. },
  341. countMsg: {},
  342. // 模具信息
  343. moduleMsg: {
  344. code: '',
  345. name: '',
  346. path: '',
  347. model: '',
  348. rootCategoryLevelId: '',
  349. specification: '',
  350. extraField: {
  351. stampingTimes: ''
  352. }
  353. },
  354. // 舟皿信息
  355. boatMsg: {
  356. code: '',
  357. name: '',
  358. path: '',
  359. model: '',
  360. rootCategoryLevelId: '',
  361. specification: '',
  362. extraField: {
  363. boatNum: ''
  364. }
  365. },
  366. batchList: [],
  367. slotNum: ''
  368. };
  369. },
  370. watch: {
  371. taskInfo: {
  372. immediate: true,
  373. handler () {
  374. if (this.taskInfo.code) {
  375. this.getReportCount();
  376. }
  377. }
  378. },
  379. formData: {
  380. immediate: true,
  381. handler () {
  382. if (this.formData.dateType == 2) {
  383. this.$set(
  384. this.workReport,
  385. 'executeTime',
  386. this.formData.appointTime
  387. );
  388. }
  389. }
  390. },
  391. infoData: {
  392. immediate: true,
  393. handler () {
  394. if (this.infoData.id) {
  395. // 设备
  396. this.workReportDeviceList = Object.assign(
  397. {},
  398. this.workReportDeviceList,
  399. {
  400. code: this.infoData.deviceCode,
  401. name: this.infoData.deviceName,
  402. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  403. path: this.infoData.path[0]?.pathName,
  404. model: this.infoData.model,
  405. sourceInstanceId: this.infoData.sourceInstanceId,
  406. specification: this.infoData.specification
  407. }
  408. );
  409. }
  410. }
  411. }
  412. },
  413. created () {
  414. this.workReport.executorId = this.$store.state.user.info?.userId;
  415. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  416. },
  417. methods: {
  418. getCategory (id, memo) {
  419. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  420. if (id == '8') {
  421. getSoltNum(res.id).then((r) => {
  422. this.slotNum = r.slotNum;
  423. });
  424. }
  425. this[memo].rootCategoryLevelId = res.categoryLevelId;
  426. this[memo].code = res.code;
  427. this[memo].name = res.name;
  428. this[memo].specification = res.specification;
  429. this[memo].sourceInstanceId = res.id;
  430. if (memo === 'moduleMsg') {
  431. this[memo].model = res.modelType;
  432. this[memo].extraField.stampingTimes = '';
  433. } else {
  434. this[memo].extraField.boatNum = '';
  435. }
  436. });
  437. },
  438. getMaterial () {
  439. this.$refs.materialRef.open(this.categoryMsg, (res) => {
  440. this.categoryMsg.name = res.categoryName;
  441. this.categoryMsg.code = res.categoryCode;
  442. this.categoryMsg.sourceCategoryId = res.id;
  443. this.categoryMsg.brandNum = res.brandNum;
  444. realTimeStorage({
  445. categoryCode: res.categoryCode,
  446. factoryCode: this.infoData.werks || '14T1'
  447. }).then((res) => {
  448. this.batchList = res;
  449. });
  450. });
  451. },
  452. getEquip () {
  453. this.$refs.equipmentRef.openSingle(
  454. [this.workReportDeviceList],
  455. (res) => {
  456. this.workReportDeviceList.code = res.code;
  457. this.workReportDeviceList.name = res.name;
  458. this.workReportDeviceList.model = res.category?.category?.modelType;
  459. this.workReportDeviceList.specification =
  460. res.category?.category?.specification;
  461. this.workReportDeviceList.sourceInstanceId = res.id;
  462. this.workReportDeviceList.rootCategoryLevelId =
  463. res.rootCategoryLevelId;
  464. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  465. }
  466. );
  467. },
  468. async getReportCount () {
  469. const res = await reportCount({
  470. taskCode: this.taskInfo.code,
  471. workOrderId: this.infoData.id
  472. });
  473. this.countMsg = res;
  474. },
  475. report (fun) {
  476. this.$refs.formRef.validate((value, error) => {
  477. if (value) {
  478. if (!this.workReportDeviceList.code) {
  479. return this.$message.error('请选择设备');
  480. }
  481. this.$confirm('是否确定要报工?', '提示').then(() => {
  482. const workReportDeviceList = [];
  483. if (this.workReportDeviceList.code) {
  484. workReportDeviceList.push(this.workReportDeviceList);
  485. }
  486. if (this.moduleMsg.code) {
  487. workReportDeviceList.push(this.moduleMsg);
  488. }
  489. if (this.boatMsg.code) {
  490. workReportDeviceList.push(this.boatMsg);
  491. }
  492. fun({
  493. checkState: 1,
  494. workReport: this.workReport,
  495. workReportCategoryList: [this.categoryMsg],
  496. workReportDeviceList
  497. }).then(() => {
  498. // this.$message.success('报工成功!');
  499. // this.getReportCount();
  500. });
  501. });
  502. } else {
  503. this.$message.error('请输入必填项!');
  504. }
  505. });
  506. }
  507. }
  508. };
  509. </script>
  510. <style lang="scss" scoped>
  511. .message-box {
  512. display: flex;
  513. justify-content: space-between;
  514. align-items: center;
  515. margin-bottom: 16px;
  516. .label {
  517. margin-right: 5px;
  518. }
  519. ul {
  520. list-style: none;
  521. display: flex;
  522. align-items: center;
  523. justify-content: flex-start;
  524. li {
  525. margin-right: 20px;
  526. }
  527. }
  528. .right {
  529. padding-top: 22px;
  530. display: flex;
  531. align-items: center;
  532. }
  533. }
  534. </style>