Extrusion.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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"
  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'),
  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. // path: this.infoData.,
  376. // model: this.infoData.,
  377. // rootCategoryLevelId: this.infoData.,
  378. // specification: this.infoData.
  379. }
  380. );
  381. }
  382. }
  383. }
  384. },
  385. created () {
  386. this.workReport.executorId = this.$store.state.user.info?.userId;
  387. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  388. },
  389. methods: {
  390. getCategory (id, memo) {
  391. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  392. this[memo].rootCategoryLevelId = res.categoryLevelId;
  393. this[memo].code = res.code;
  394. this[memo].name = res.name;
  395. this[memo].specification = res.specification;
  396. this[memo].sourceInstanceId = res.id;
  397. if (memo === 'moduleMsg') {
  398. this[memo].model = res.modelType;
  399. this[memo].extraField.stampingTimes = '';
  400. } else {
  401. this[memo].extraField.num = '';
  402. }
  403. });
  404. },
  405. getMaterial () {
  406. this.$refs.materialRef.open(this.categoryMsg, (res) => {
  407. this.categoryMsg.name = res.categoryName;
  408. this.categoryMsg.code = res.categoryCode;
  409. this.categoryMsg.sourceCategoryId = res.id;
  410. this.categoryMsg.brandNum = res.brandNum;
  411. realTimeStorage({
  412. categoryCode: res.categoryCode,
  413. factoryCode: this.infoData.werks
  414. }).then((res) => {
  415. this.batchList = res;
  416. });
  417. });
  418. },
  419. getEquip () {
  420. this.$refs.equipmentRef.openSingle(
  421. [this.workReportDeviceList],
  422. (res) => {
  423. this.workReportDeviceList.code = res.code;
  424. this.workReportDeviceList.name = res.name;
  425. this.workReportDeviceList.model = res.modelType;
  426. this.workReportDeviceList.specification = res.specification;
  427. this.workReportDeviceList.sourceInstanceId = res.id;
  428. this.workReportDeviceList.rootCategoryLevelId =
  429. res.rootCategoryLevelId;
  430. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  431. }
  432. );
  433. },
  434. async getReportCount () {
  435. const res = await reportCount({
  436. taskCode: this.taskInfo.code,
  437. workOrderId: this.infoData.id
  438. });
  439. this.countMsg = res;
  440. },
  441. report (fun) {
  442. this.$refs.formRef.validate((value) => {
  443. if (value) {
  444. this.$confirm('是否确定要报工?', '提示').then(() => {
  445. const workReportDeviceList = [];
  446. if (this.workReportDeviceList.code) {
  447. workReportDeviceList.push(this.workReportDeviceList);
  448. }
  449. if (this.moduleMsg.code) {
  450. workReportDeviceList.push(this.moduleMsg);
  451. }
  452. if (this.boatMsg.code) {
  453. workReportDeviceList.push(this.boatMsg);
  454. }
  455. fun({
  456. checkState: 1,
  457. workReport: this.workReport,
  458. workReportCategoryList: [this.categoryMsg],
  459. workReportDeviceList
  460. }).then(() => {
  461. this.$message.success('报工成功!');
  462. this.getReportCount();
  463. });
  464. });
  465. }
  466. });
  467. }
  468. }
  469. };
  470. </script>
  471. <style lang="scss" scoped>
  472. .message-box {
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. margin-bottom: 16px;
  477. .label {
  478. margin-right: 5px;
  479. }
  480. ul {
  481. list-style: none;
  482. display: flex;
  483. align-items: center;
  484. justify-content: flex-start;
  485. li {
  486. margin-right: 20px;
  487. }
  488. }
  489. .right {
  490. padding-top: 22px;
  491. display: flex;
  492. align-items: center;
  493. }
  494. }
  495. </style>