Extrusion.vue 16 KB

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