Extrusion.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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
  254. ref="equipmentRef"
  255. :isPlan="true"
  256. :produceVersionId="infoData.produceVersionId"
  257. />
  258. <materialDialog
  259. ref="materialRef"
  260. :params="{
  261. taskInstanceId: taskInfo.id,
  262. versionId: infoData.produceVersionId
  263. }"
  264. />
  265. <catogaryDialog ref="catogaryDialogRef" />
  266. </el-form>
  267. </template>
  268. <script>
  269. import { realTimeStorage } from '@/api/mainData';
  270. import personSelectRemote from '@/components/CommomSelect/person-select-remote';
  271. import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
  272. import materialDialog from '../materialDialog.vue';
  273. import catogaryDialog from '../catogaryDialog.vue';
  274. import { reportCount } from '@/api/produceOrder';
  275. import dayjs from 'dayjs';
  276. export default {
  277. components: {
  278. personSelectRemote,
  279. equipmentDailog,
  280. materialDialog,
  281. catogaryDialog
  282. },
  283. props: {
  284. infoData: {
  285. type: Object,
  286. default: () => ({})
  287. },
  288. taskInfo: {
  289. type: Object,
  290. default: () => ({})
  291. }
  292. },
  293. data () {
  294. return {
  295. categoryMsg: {
  296. batchNo: '',
  297. totalWeight: '',
  298. brandNum: '',
  299. sourceCategoryId: '',
  300. rootCategoryLevelId: '1',
  301. name: '',
  302. code: ''
  303. },
  304. workReport: {
  305. qualityItem: '',
  306. qualityStandard: '',
  307. executorId: '',
  308. executorJobNum: '',
  309. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  310. remark: '',
  311. productInfo: {
  312. standardNum: '',
  313. standardWeight: '',
  314. noStandardNum: '',
  315. noStandardWeight: ''
  316. }
  317. },
  318. // 设备
  319. workReportDeviceList: {
  320. code: '',
  321. name: '',
  322. path: '',
  323. model: '',
  324. rootCategoryLevelId: '',
  325. specification: ''
  326. },
  327. countMsg: {},
  328. // 模具信息
  329. moduleMsg: {
  330. code: '',
  331. name: '',
  332. path: '',
  333. model: '',
  334. rootCategoryLevelId: '',
  335. specification: '',
  336. extraField: {
  337. stampingTimes: ''
  338. }
  339. },
  340. // 舟皿信息
  341. boatMsg: {
  342. code: '',
  343. name: '',
  344. path: '',
  345. model: '',
  346. rootCategoryLevelId: '',
  347. specification: '',
  348. extraField: {
  349. num: ''
  350. }
  351. },
  352. batchList: []
  353. };
  354. },
  355. watch: {
  356. taskInfo: {
  357. immediate: true,
  358. handler () {
  359. if (this.taskInfo.code) {
  360. this.getReportCount();
  361. }
  362. }
  363. },
  364. infoData: {
  365. immediate: true,
  366. handler () {
  367. if (this.infoData.id) {
  368. // 设备
  369. this.workReportDeviceList = Object.assign(
  370. {},
  371. this.workReportDeviceList,
  372. {
  373. code: this.infoData.deviceCode,
  374. name: this.infoData.deviceName,
  375. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  376. path: this.infoData.path[0]?.pathName,
  377. model: this.infoData.model,
  378. sourceInstanceId: this.infoData.sourceInstanceId,
  379. specification: this.infoData.specification
  380. }
  381. );
  382. }
  383. }
  384. }
  385. },
  386. created () {
  387. this.workReport.executorId = this.$store.state.user.info?.userId;
  388. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  389. },
  390. methods: {
  391. getCategory (id, memo) {
  392. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  393. this[memo].rootCategoryLevelId = res.categoryLevelId;
  394. this[memo].code = res.code;
  395. this[memo].name = res.name;
  396. this[memo].specification = res.specification;
  397. this[memo].sourceInstanceId = res.id;
  398. if (memo === 'moduleMsg') {
  399. this[memo].model = res.modelType;
  400. this[memo].extraField.stampingTimes = '';
  401. } else {
  402. this[memo].extraField.num = '';
  403. }
  404. });
  405. },
  406. getMaterial () {
  407. this.$refs.materialRef.open(this.categoryMsg, (res) => {
  408. this.categoryMsg.name = res.categoryName;
  409. this.categoryMsg.code = res.categoryCode;
  410. this.categoryMsg.sourceCategoryId = res.id;
  411. this.categoryMsg.brandNum = res.brandNum;
  412. realTimeStorage({
  413. categoryCode: res.categoryCode,
  414. factoryCode: this.infoData.werks || '14T1'
  415. }).then((res) => {
  416. this.batchList = res;
  417. });
  418. });
  419. },
  420. getEquip () {
  421. this.$refs.equipmentRef.openSingle(
  422. [this.workReportDeviceList],
  423. (res) => {
  424. this.workReportDeviceList.code = res.code;
  425. this.workReportDeviceList.name = res.name;
  426. this.workReportDeviceList.model = res.modelType;
  427. this.workReportDeviceList.specification = res.specification;
  428. this.workReportDeviceList.sourceInstanceId = res.id;
  429. this.workReportDeviceList.rootCategoryLevelId =
  430. res.rootCategoryLevelId;
  431. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  432. }
  433. );
  434. },
  435. async getReportCount () {
  436. const res = await reportCount({
  437. taskCode: this.taskInfo.code,
  438. workOrderId: this.infoData.id
  439. });
  440. this.countMsg = res;
  441. },
  442. report (fun) {
  443. this.$refs.formRef.validate((value, error) => {
  444. if (value) {
  445. if (!this.workReportDeviceList.code) {
  446. return this.$message.error('请选择设备');
  447. }
  448. this.$confirm('是否确定要报工?', '提示').then(() => {
  449. const workReportDeviceList = [];
  450. if (this.workReportDeviceList.code) {
  451. workReportDeviceList.push(this.workReportDeviceList);
  452. }
  453. if (this.moduleMsg.code) {
  454. workReportDeviceList.push(this.moduleMsg);
  455. }
  456. if (this.boatMsg.code) {
  457. workReportDeviceList.push(this.boatMsg);
  458. }
  459. fun({
  460. checkState: 1,
  461. workReport: this.workReport,
  462. workReportCategoryList: [this.categoryMsg],
  463. workReportDeviceList
  464. }).then(() => {
  465. this.$message.success('报工成功!');
  466. this.getReportCount();
  467. });
  468. });
  469. } else {
  470. this.$message.error('请输入必填项!');
  471. }
  472. });
  473. }
  474. }
  475. };
  476. </script>
  477. <style lang="scss" scoped>
  478. .message-box {
  479. display: flex;
  480. justify-content: space-between;
  481. align-items: center;
  482. margin-bottom: 16px;
  483. .label {
  484. margin-right: 5px;
  485. }
  486. ul {
  487. list-style: none;
  488. display: flex;
  489. align-items: center;
  490. justify-content: flex-start;
  491. li {
  492. margin-right: 20px;
  493. }
  494. }
  495. .right {
  496. padding-top: 22px;
  497. display: flex;
  498. align-items: center;
  499. }
  500. }
  501. </style>