Extrusion.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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.num"
  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. firstInfo:{
  306. type: Object,
  307. default: () => ({})
  308. },
  309. currentInfo:{
  310. type: Object,
  311. default: () => ({})
  312. }
  313. },
  314. data () {
  315. return {
  316. categoryMsg: {
  317. batchNo: '',
  318. totalWeight: '',
  319. brandNum: '',
  320. sourceCategoryId: '',
  321. rootCategoryLevelId: '1',
  322. name: '',
  323. code: ''
  324. },
  325. workReport: {
  326. qualityItem: '',
  327. qualityStandard: '',
  328. executorId: '',
  329. executorJobNum: '',
  330. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  331. remark: '',
  332. productInfo: {
  333. standardNum: '',
  334. byProductWeight: '',
  335. standardWeight: '',
  336. noStandardNum: '',
  337. noStandardWeight: ''
  338. }
  339. },
  340. // 设备
  341. workReportDeviceList: {
  342. code: '',
  343. name: '',
  344. path: '',
  345. model: '',
  346. rootCategoryLevelId: '',
  347. specification: ''
  348. },
  349. countMsg: {},
  350. // 模具信息
  351. moduleMsg: {
  352. code: '',
  353. name: '',
  354. path: '',
  355. model: '',
  356. rootCategoryLevelId: '',
  357. specification: '',
  358. extraField: {
  359. stampingTimes: ''
  360. }
  361. },
  362. // 舟皿信息
  363. boatMsg: {
  364. code: '',
  365. name: '',
  366. path: '',
  367. model: '',
  368. rootCategoryLevelId: '',
  369. specification: '',
  370. extraField: {
  371. num: ''
  372. }
  373. },
  374. batchList: [],
  375. slotNum:''
  376. };
  377. },
  378. watch: {
  379. taskInfo: {
  380. immediate: true,
  381. handler () {
  382. if (this.taskInfo.code) {
  383. this.getReportCount();
  384. }
  385. }
  386. },
  387. formData: {
  388. immediate: true,
  389. handler () {
  390. if (this.formData.dateType==2) {
  391. this.$set(this.workReport,'executeTime',this.formData.appointTime);
  392. }
  393. }
  394. },
  395. infoData: {
  396. immediate: true,
  397. handler () {
  398. if (this.infoData.id) {
  399. // 设备
  400. this.workReportDeviceList = Object.assign(
  401. {},
  402. this.workReportDeviceList,
  403. {
  404. code: this.infoData.deviceCode,
  405. name: this.infoData.deviceName,
  406. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  407. path: this.infoData.path[0]?.pathName,
  408. model: this.infoData.model,
  409. sourceInstanceId: this.infoData.sourceInstanceId,
  410. specification: this.infoData.specification
  411. }
  412. );
  413. }
  414. }
  415. }
  416. },
  417. created () {
  418. this.workReport.executorId = this.$store.state.user.info?.userId;
  419. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  420. },
  421. methods: {
  422. getCategory (id, memo) {
  423. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  424. if(id=='8'){
  425. getSoltNum(res.id).then(r=>{
  426. this.slotNum = r.slotNum
  427. })
  428. }
  429. this[memo].rootCategoryLevelId = res.categoryLevelId;
  430. this[memo].code = res.code;
  431. this[memo].name = res.name;
  432. this[memo].specification = res.specification;
  433. this[memo].sourceInstanceId = res.id;
  434. if (memo === 'moduleMsg') {
  435. this[memo].model = res.modelType;
  436. this[memo].extraField.stampingTimes = '';
  437. } else {
  438. this[memo].extraField.num = '';
  439. }
  440. });
  441. },
  442. getMaterial () {
  443. this.$refs.materialRef.open(this.categoryMsg, (res) => {
  444. this.categoryMsg.name = res.categoryName;
  445. this.categoryMsg.code = res.categoryCode;
  446. this.categoryMsg.sourceCategoryId = res.id;
  447. this.categoryMsg.brandNum = res.brandNum;
  448. realTimeStorage({
  449. categoryCode: res.categoryCode,
  450. factoryCode: this.infoData.werks || '14T1'
  451. }).then((res) => {
  452. this.batchList = res;
  453. });
  454. });
  455. },
  456. getEquip () {
  457. this.$refs.equipmentRef.openSingle(
  458. [this.workReportDeviceList],
  459. (res) => {
  460. this.workReportDeviceList.code = res.code;
  461. this.workReportDeviceList.name = res.name;
  462. this.workReportDeviceList.model = res.category?.category?.modelType;
  463. this.workReportDeviceList.specification =
  464. res.category?.category?.specification;
  465. this.workReportDeviceList.sourceInstanceId = res.id;
  466. this.workReportDeviceList.rootCategoryLevelId =
  467. res.rootCategoryLevelId;
  468. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  469. }
  470. );
  471. },
  472. async getReportCount () {
  473. const res = await reportCount({
  474. taskCode: this.taskInfo.code,
  475. workOrderId: this.infoData.id
  476. });
  477. this.countMsg = res;
  478. },
  479. report (fun) {
  480. this.$refs.formRef.validate((value, error) => {
  481. if (value) {
  482. if (!this.workReportDeviceList.code) {
  483. return this.$message.error('请选择设备');
  484. }
  485. this.$confirm('是否确定要报工?', '提示').then(() => {
  486. const workReportDeviceList = [];
  487. if (this.workReportDeviceList.code) {
  488. workReportDeviceList.push(this.workReportDeviceList);
  489. }
  490. if (this.moduleMsg.code) {
  491. workReportDeviceList.push(this.moduleMsg);
  492. }
  493. if (this.boatMsg.code) {
  494. workReportDeviceList.push(this.boatMsg);
  495. }
  496. fun({
  497. checkState: 1,
  498. workReport: this.workReport,
  499. workReportCategoryList: [this.categoryMsg],
  500. workReportDeviceList
  501. }).then(() => {
  502. // this.$message.success('报工成功!');
  503. // this.getReportCount();
  504. });
  505. });
  506. } else {
  507. this.$message.error('请输入必填项!');
  508. }
  509. });
  510. }
  511. }
  512. };
  513. </script>
  514. <style lang="scss" scoped>
  515. .message-box {
  516. display: flex;
  517. justify-content: space-between;
  518. align-items: center;
  519. margin-bottom: 16px;
  520. .label {
  521. margin-right: 5px;
  522. }
  523. ul {
  524. list-style: none;
  525. display: flex;
  526. align-items: center;
  527. justify-content: flex-start;
  528. li {
  529. margin-right: 20px;
  530. }
  531. }
  532. .right {
  533. padding-top: 22px;
  534. display: flex;
  535. align-items: center;
  536. }
  537. }
  538. </style>