index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. <template>
  2. <view class='container'>
  3. <view class="content">
  4. <view>
  5. <text class='title'>批次号</text>
  6. <view class="batchNo uni-row">
  7. <view :class="{'batchNo-item':true, 'uni-row': true}" v-for="(item,index) in batchNoList"
  8. :key='index'>
  9. <!-- ,'batchNoCheck':batchNoCheck === item -->
  10. <!-- @click="handleCheckBatchNo(item)" -->
  11. {{ item.lotCode }}{{ item.isLast == 1 ? ' (尾批)': '' }}
  12. </view>
  13. </view>
  14. <view class="inpAndScan">
  15. <uni-easyinput v-if="batchNoList.length > 0" class="inp" suffixIcon="checkmarkempty"
  16. v-model="inpValue" placeholder="可手动修正批次" @iconClick="iconClick"></uni-easyinput>
  17. <view class="uni-row" style="justify-content: space-between;">
  18. <view v-if="batchNoList.length > 0 && curDept" class="scanLotCode" @click="handleDoLastLot">
  19. <text>是否加工尾批</text>
  20. </view>
  21. <view v-if="batchNoList.length > 0" class="scanLotCode" @click="handleConfirmLotCode">
  22. <text>扫码修正批次</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class='middle'>
  28. <view class='segment'></view>
  29. <uni-icons type="link" size="30" style="margin: 10rpx; transform: rotate(135deg);"></uni-icons>
  30. <view class='segment'></view>
  31. </view>
  32. <!-- <view>
  33. <text class='title'>扫码绑定载具</text>
  34. <view class="vehicleList uni-row">
  35. <view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
  36. <text>{{item.carrierCode}}</text>
  37. <text @click="handleDelVehicleNo(index)">×</text>
  38. </view>
  39. </view>
  40. <view>
  41. <button style='background-color: rgba(0, 226, 166,1);
  42. color: white;margin: 20rpx auto;
  43. width: 80%;' @click='handleScanCode'>扫码</button>
  44. </view>
  45. </view> -->
  46. <view class="selectedProcess">
  47. <uni-section title="请选择工序" type="square">
  48. <uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
  49. @change="handleProcessChange">
  50. <template v-slot:option="{item }">
  51. <!-- 自定义下拉框每一项的显示内容 -->
  52. <span>{{ (item.index) + 1}}</span>
  53. <span>{{ item.text }}</span>
  54. </template></uni-data-select>
  55. </uni-section>
  56. </view>
  57. <view class='middle'>
  58. <view class='segment'></view>
  59. <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
  60. <view class='segment'></view>
  61. </view>
  62. <view>
  63. <text class='title' style="margin-bottom: 40rpx;">基础信息</text>
  64. <view class="uni-row info" style="align-items: center;">
  65. <label for="HeatNo">炉号:</label>
  66. <uni-data-select v-if="isWasteRecyclingFlag" id="incomingInfo" class="uni-input data-select"
  67. v-model="basicInfo" :localdata="furnaceNumberInfoList" :clear="false"
  68. @change="handleFurnaceNumberChange"></uni-data-select>
  69. <text id="incomingInfo" v-else class="uni-input">废品回用</text>
  70. </view>
  71. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  72. <view class="uni-row info">
  73. <label for="productionPlanNo">计划单号:</label>
  74. <text id="productionPlanNo"
  75. class="uni-input">{{ basicInfo.productionPlanNo ? basicInfo.productionPlanNo : '-'}}</text>
  76. </view>
  77. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  78. <view class="uni-row info">
  79. <label for="lineNumber">序号:</label>
  80. <text id="lineNumber"
  81. class="uni-input">{{ basicInfo.lineNumber ? basicInfo.lineNumber : '-'}}</text>
  82. </view>
  83. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  84. <view class="uni-row info">
  85. <label for="factory">厂家:</label>
  86. <text id="factory"
  87. class="material uni-input">{{ basicInfo.factory ? basicInfo.factory : '-'}}</text>
  88. </view>
  89. <view class="uni-row info">
  90. <label for="brandNumber">牌号:</label>
  91. <text id="brandNumber"
  92. class="material uni-input">{{ basicInfo.brandNumber ? basicInfo.brandNumber : '-' }}</text>
  93. </view>
  94. <view class="uni-row info">
  95. <label for="spec">规格:</label>
  96. <text id="spec" class="material uni-input">{{ basicInfo.spec ? basicInfo.spec : '-' }}</text>
  97. </view>
  98. <view class="uni-row info">
  99. <label for="shape">形状:</label>
  100. <text id="shape" class="material uni-input">{{ basicInfo.shape ? basicInfo.shape : '-'}}</text>
  101. </view>
  102. <view class="uni-row info">
  103. <label for="diameter">材料直径:</label>
  104. <text id="diameter"
  105. class="material uni-input">{{ basicInfo.diameter ? basicInfo.diameter : '-' }}</text>
  106. </view>
  107. <view class="uni-row info">
  108. <label for="rawMaterialCode">原料编码:</label>
  109. <text id="rawMaterialCode"
  110. class="material uni-input">{{ basicInfo.rawMaterialCode ? basicInfo.rawMaterialCode : '-' }}</text>
  111. </view>
  112. <view class="uni-row info">
  113. <label for="incomingDate">来料日期:</label>
  114. <text id="incomingDate"
  115. class="material uni-input">{{ basicInfo.incomingDate ? basicInfo.incomingDate : '-' }}</text>
  116. </view>
  117. <view class="uni-row info">
  118. <label for="firstTechnicalRequirement">材质1:</label>
  119. <text id="firstTechnicalRequirement"
  120. class="material uni-input">{{ basicInfo.firstTechnicalRequirement ? basicInfo.firstTechnicalRequirement : '-' }}</text>
  121. </view>
  122. <view class="uni-row info">
  123. <label for="secondTechnicalRequirement">材质2:</label>
  124. <text id="secondTechnicalRequirement"
  125. class="material uni-input">{{ basicInfo.secondTechnicalRequirement ? basicInfo.secondTechnicalRequirement : '-' }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. <view class='bottom uni-row'>
  130. <button class='add' type=primary @click='handleAdd'>添加</button>
  131. </view>
  132. </view>
  133. <view
  134. style="background-color: #99999999; z-index: 5; position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"
  135. v-if="loading">
  136. </view>
  137. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  138. </template>
  139. <script setup>
  140. import {
  141. ref
  142. } from 'vue'
  143. import {
  144. onLoad,
  145. onReady
  146. } from '@dcloudio/uni-app'
  147. import {
  148. getLotList,
  149. getAbnormalityLot,
  150. getProcessListByLot,
  151. checkLotList
  152. } from "@/api/business/lot.js"
  153. import {
  154. saveDayWork
  155. } from '@/api/business/dayWork.js'
  156. import {
  157. store
  158. } from '@/store/index.js'
  159. import {
  160. getCarrierById,
  161. checkCarrier
  162. } from '@/api/business/carrier.js'
  163. import {
  164. isTakeStock
  165. } from '@/api/business/taksStackLot.js'
  166. import {
  167. getFurnaceNoInfo
  168. } from '@/api/p2/furnaceNoInfo.js'
  169. import {
  170. getToken
  171. } from '@/utils/auth'
  172. import {
  173. getProcessList
  174. } from '@/api/business/deptProcess.js'
  175. import QrScanner from '../vueQrCode/index.vue'
  176. import path from '@/api/base/path.js'
  177. import {
  178. getConfigKey
  179. } from '@/api/sys/user.js'
  180. const batchNoCheck = ref(null) // 批次号是否选中
  181. const batchNoList = ref([]) // 批次号列表
  182. const showQrCodeReader = ref(false);
  183. const vehicleList = ref([])
  184. const basicInfo = ref({}) // 基础信息对象
  185. const dayWork = ref({})
  186. const furnaceInfo = ref({})
  187. const wasteRecyclingList = ref([]) //废品回用批次
  188. const curPlan = ref({})
  189. const furnaceNumberInfoList = ref([])
  190. const isWasteRecyclingFlag = ref(true)
  191. const emit = defineEmits(['batchReporting-addBatch']);
  192. const inpValue = ref('')
  193. const loading = ref(false)
  194. const dataSource = ref(false)
  195. const curDept = ref(false) //判断当前工段是否是该批次的领料部门
  196. const lotList = ref([])
  197. const selectedProcess = ref(null)
  198. const processList = ref([])
  199. const url = ref("")
  200. onLoad(() => {
  201. // 处理特殊字符JSON解析失败报错
  202. curPlan.value = store.planDetails;
  203. dayWork.value = {
  204. productionPlanDetailId: curPlan.value.id,
  205. productionPlanId: curPlan.value.productionDetailId,
  206. technologicalProcessId: curPlan.value.technologicalProcessId,
  207. deptId: store.curDeptDetails.deptId
  208. }
  209. init();
  210. })
  211. function init() {
  212. let obj = {}
  213. obj.productionPlanDetailId = store.planDetails.id;
  214. //检查该计划单是否有可加工批次信息(包含单批单改和废品回用)
  215. //此方法不做任何处理,只在该计划单无任何批次加工时做出提示
  216. checkLotList(obj).then(res => {
  217. if (res.code != 200) {
  218. uni.showToast({
  219. icon: "none",
  220. title: res.msg,
  221. duration: 2500
  222. })
  223. }
  224. })
  225. //开始新批次,判断当前工段是否能开始这个批次(领料部门是当前工段的;批次的领料部门是当前工段的)
  226. //当前计划单的领料部门是当前工段
  227. if (store.normalStatus) {
  228. curDept.value = true
  229. //只查不是废品回用的批次
  230. getLotList(obj).then(res => {
  231. lotList.value = res.rows;
  232. if (res.rows.length > 0) {
  233. batchNoList.value = [res.rows[0]];
  234. dayWork.value.lotId = batchNoList.value[0].id;
  235. dayWork.value.lotCode = batchNoList.value[0].lotCode;
  236. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  237. store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  238. getProcessInfo(batchNoList.value[0])
  239. getFurnaceInfo(batchNoList.value[0])
  240. } else {
  241. batchNoList.value = res.rows;
  242. }
  243. })
  244. } else {
  245. //废品回用的批次(领料部门是当前工段)
  246. getAbnormalityLot({
  247. productionPlanDetailId: store.planDetails.id,
  248. requisitionDepartmentId: store.curDeptDetails.deptId,
  249. flag: true
  250. }).then(res => {
  251. wasteRecyclingList.value = res.rows
  252. if (res.rows.length > 0) {
  253. //如果废品回用的批次领料部门是当前计划的领料部门,则加到lotList
  254. lotList.value = res.rows
  255. batchNoList.value = [res.rows[0]];
  256. isWasteRecyclingFlag.value = true
  257. if (batchNoList.value[0].isWasteRecycling == 0) {
  258. isWasteRecyclingFlag.value = false
  259. }
  260. if (batchNoList.value[0].planType == 'HY') {
  261. isWasteRecyclingFlag.value = false
  262. }
  263. dayWork.value.lotId = batchNoList.value[0].id;
  264. dayWork.value.lotCode = batchNoList.value[0].lotCode;
  265. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  266. store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  267. getProcessInfo(batchNoList.value[0])
  268. //提示当前批次是废品回用
  269. if (batchNoList.value[0].isAmend == 1) {
  270. uni.showToast({
  271. icon: "none",
  272. title: "该批是单批单改",
  273. duration: 2000
  274. })
  275. } else if (batchNoList.value[0].isWasteRecycling == 1) {
  276. uni.showToast({
  277. icon: "none",
  278. title: "该批是废品回用",
  279. duration: 2000
  280. })
  281. }
  282. getFurnaceInfo(batchNoList.value[0])
  283. } else {
  284. uni.showToast({
  285. icon: "none",
  286. title: "没有废品回用或单批单改批次",
  287. duration: 2000
  288. })
  289. }
  290. })
  291. }
  292. }
  293. // function handleCheckBatchNo(item) {
  294. // batchNoCheck.value = item;
  295. // dayWork.value.lotId = item.id;
  296. // }
  297. // function handleDelVehicleNo(index) {
  298. // vehicleList.value.splice(index, 1);
  299. // }
  300. // function handleValidate() {
  301. // if (batchNoCheck.value && vehicleList.value) {
  302. // return true;
  303. // } else {
  304. // return false;
  305. // }
  306. // }
  307. function getFurnaceInfo(data) {
  308. if (data.isWasteRecycling == 0 && data.planType != 'HY') {
  309. isWasteRecyclingFlag.value = true
  310. let token = 'Bearer ' + getToken();
  311. let header = {
  312. Authorization: token
  313. }
  314. //判断拉取数据源
  315. getConfigKey('switch_data_source').then(res => {
  316. dataSource.value = res.msg == 'true'
  317. if(dataSource.value){
  318. console.log("切换数据源")
  319. }else{
  320. uni.request({
  321. url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
  322. data: {
  323. productionPlanNo: store.planDetails.productionPlanNo,
  324. lineNumber: store.planDetails.lineNumber
  325. },
  326. method: 'GET',
  327. header,
  328. sslVerify: false,
  329. success: (res) => {
  330. if (res.data.code == 200 && res.data.data.length > 0) {
  331. for (let i = 0; i < res.data.data.length; i++) {
  332. furnaceNumberInfoList.value[i] = {
  333. text: res.data.data[i].furnaceNumber + ' (' + res.data.data[i]
  334. .incomingDate + ')',
  335. // text: '2415800347000 (2024-05-06)',
  336. value: res.data.data[i]
  337. }
  338. }
  339. // basicInfo.value = res.data.data[0];
  340. // dayWork.value.furnaceNoInfo = basicInfo.value;
  341. }
  342. },
  343. fail: (err) => {
  344. console.log(err)
  345. }
  346. })
  347. }
  348. })
  349. } else {
  350. isWasteRecyclingFlag.value = false
  351. furnaceInfo.value.furnaceNumber = "废品回用"
  352. furnaceInfo.value.firstTechnicalRequirement = "废品回用"
  353. dayWork.value.furnaceNoInfo = furnaceInfo.value
  354. basicInfo.value = dayWork.value.furnaceNoInfo
  355. }
  356. }
  357. function iconClick() {
  358. checkLotCode(inpValue.value);
  359. }
  360. function checkLotCode(lotCode) {
  361. var lotCodes = lotList.value.map(obj => obj.lotCode)
  362. console.log(lotCodes.includes(lotCode))
  363. console.log(lotCodes)
  364. if (lotCodes.includes(lotCode)) {
  365. for (let i = 0; i < lotList.value.length; i++) {
  366. if (lotList.value[i].lotCode == lotCode) {
  367. batchNoList.value = [lotList.value[i]];
  368. dayWork.value.lotId = lotList.value[i].id;
  369. dayWork.value.lotCode = lotList.value[i].lotCode;
  370. dayWork.value.technologicalProcessId = lotList.value[i].technologicalProcessId;
  371. store.planDetails.technologicalProcessId = lotList.value[i].technologicalProcessId;
  372. if (batchNoList.value[0].isWasteRecycling == 1) {
  373. isWasteRecyclingFlag.value = false
  374. getFurnaceInfo(batchNoList.value[0])
  375. uni.showToast({
  376. icon: "none",
  377. title: "该批次号可用,该批是废品回用",
  378. duration: 2000
  379. })
  380. getProcessInfo(batchNoList.value[0])
  381. } else if (batchNoList.value[0].isAmend == 1) {
  382. isWasteRecyclingFlag.value = true
  383. getFurnaceInfo(batchNoList.value[0])
  384. uni.showToast({
  385. icon: "none",
  386. title: "该批次号可用,该批是单批单改",
  387. duration: 2000
  388. })
  389. getProcessInfo(batchNoList.value[0])
  390. } else {
  391. uni.showToast({
  392. icon: "none",
  393. title: "该批次号可用",
  394. duration: 2000
  395. })
  396. getProcessInfo(batchNoList.value[0])
  397. }
  398. return true;
  399. }
  400. }
  401. } else {
  402. getAbnormalList(lotCode);
  403. }
  404. }
  405. function getAbnormalList(lotCode) {
  406. console.log(store.normalStatus)
  407. if (store.normalStatus) {
  408. getAbnormalityLot({
  409. productionPlanDetailId: store.planDetails.id,
  410. requisitionDepartmentId: store.curDeptDetails.deptId,
  411. flag: true
  412. }).then(res => {
  413. if (res.rows.length > 0) {
  414. var abNormaLotCode = res.rows.map(obj => obj.lotCode)
  415. if (abNormaLotCode.includes(lotCode)) {
  416. uni.showToast({
  417. icon: "none",
  418. title: "该批次号是废品回用或单批单改",
  419. duration: 2000
  420. })
  421. return false;
  422. } else {
  423. uni.showToast({
  424. icon: "none",
  425. title: "该批次号已被使用或不属于该产品",
  426. duration: 2000
  427. })
  428. return false;
  429. }
  430. } else {
  431. uni.showToast({
  432. icon: "none",
  433. title: "该批次号已被使用或不属于该产品",
  434. duration: 2000
  435. })
  436. return false;
  437. }
  438. })
  439. } else {
  440. getLotList({
  441. productionPlanDetailId: store.planDetails.id
  442. }).then(res => {
  443. if (res.rows.length > 0) {
  444. console.log(res.rows)
  445. var normaLotCode = res.rows.map(obj => obj.lotCode)
  446. if (normaLotCode.includes(lotCode)) {
  447. uni.showToast({
  448. icon: "none",
  449. title: "该批次号是正常批",
  450. duration: 2000
  451. })
  452. return false;
  453. } else {
  454. uni.showToast({
  455. icon: "none",
  456. title: "该批次号已被使用或不属于该产品",
  457. duration: 2000
  458. })
  459. return false;
  460. }
  461. } else {
  462. uni.showToast({
  463. icon: "none",
  464. title: "该批次号已被使用或不属于该产品",
  465. duration: 2000
  466. })
  467. return false;
  468. }
  469. })
  470. }
  471. }
  472. function getProcessInfo(data) {
  473. getProcessList({
  474. deptId: store.curDeptDetails.deptId,
  475. }).then(res => {
  476. if (res.code == 200) {
  477. //过滤出工序交集
  478. //因为废品回用对工序进行单独的修改。所以重新查产品的工艺,如果该批不是废品回用,则查产品工序,如果是,则到
  479. //对应表查
  480. //通过批次号查
  481. //切换数据源
  482. data.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  483. getProcessListByLot(data).then(response => {
  484. let lotProcessList = response.data
  485. let filteredData = lotProcessList.filter((item1) =>
  486. res.data.some((item2) => item2.processCode === item1.processCode)
  487. );
  488. processList.value = filteredData.map((v, index) => ({
  489. text: v.processAlias,
  490. value: v.technologicalProcessDetailId ? v
  491. .technologicalProcessDetailId : v.id,
  492. processId: v.processId,
  493. processStepNumber: v.processStepNumber,
  494. index: index,
  495. technologicalProcessId: v.technologicalProcessId ? v
  496. .technologicalProcessId : v.lotTechnologicalProcessId
  497. }))
  498. selectedProcess.value = processList.value[0].value;
  499. dayWork.value.processId = processList.value[0].processId;
  500. dayWork.value.technologicalProcessId = processList.value[0].technologicalProcessId
  501. dayWork.value.technologicalProcessDetailId = selectedProcess.value
  502. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value ===
  503. selectedProcess.value) >= 0 ?
  504. processList.value.find(v => v.value === selectedProcess.value).processStepNumber :
  505. null
  506. })
  507. }
  508. })
  509. }
  510. function handleDoLastLot() {
  511. uni.showModal({
  512. title: '提示',
  513. content: '确认是否加工尾批?',
  514. success: function(res) {
  515. if (res.confirm) {
  516. if (lotList.value.some(item => item.isLast == 1)) {
  517. for (let i = 0; i < lotList.value.length; i++) {
  518. if (lotList.value[i].isLast == 1) {
  519. batchNoList.value = [lotList.value[i]];
  520. dayWork.value.lotId = lotList.value[i].id;
  521. dayWork.value.lotCode = lotList.value[i].lotCode;
  522. dayWork.value.isLast = '1';
  523. return;
  524. }
  525. }
  526. } else {
  527. uni.showToast({
  528. icon: 'none',
  529. title: '当前计划尾批已被加工',
  530. duration: 2500
  531. })
  532. }
  533. } else if (res.cancel) {}
  534. }
  535. });
  536. }
  537. function qrReaderClose() {
  538. showQrCodeReader.value = false;
  539. }
  540. function onDecodeHandler(ret) {
  541. showQrCodeReader.value = false;
  542. checkLotCode(ret);
  543. }
  544. function handleConfirmLotCode() {
  545. // 引入原生插件
  546. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  547. // // 调用插件的 mpaasScan 方法
  548. // mpaasScanModule.mpaasScan({
  549. // // 扫码识别类型,参数可多选,qrCode、barCode,
  550. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  551. // scanType: ["qrCode", "barCode"],
  552. // // 是否隐藏相册,默认false不隐藏
  553. // hideAlbum: false,
  554. // },
  555. // (ret) => {
  556. // console.log(ret);
  557. // // uni.showModal({
  558. // // title: "扫码结果",
  559. // // // 返回值中,有三个参数 resp_code、resp_message、resp_result
  560. // // // resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
  561. // // // resp_message 表示返回结果信息
  562. // // // resp_result 表示扫码结果,只有成功才会有返回
  563. // // content: JSON.stringify(ret),
  564. // // showCancel: false,
  565. // // confirmText: "确定",
  566. // // });
  567. // if (ret.resp_result) {
  568. // checkLotCode(ret.resp_result);
  569. // }
  570. // }
  571. // );
  572. showQrCodeReader.value = true;
  573. }
  574. function handleFurnaceNumberChange() {
  575. dayWork.value.furnaceNoInfo = basicInfo.value;
  576. }
  577. function handleProcessChange() {
  578. dayWork.value.technologicalProcessDetailId = selectedProcess.value;
  579. dayWork.value.processId = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ? processList
  580. .value.find(v => v.value === selectedProcess.value).processId : null
  581. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ?
  582. processList.value.find(v => v.value === selectedProcess.value).processStepNumber : null
  583. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  584. }
  585. /*
  586. // function handleScanCode() {
  587. // uni.scanCode({
  588. // scanType: ['qrCode'],
  589. // onlyFromCamera: true, // 只允许相机扫码
  590. // autoZoom: false,
  591. // success: function(res) {
  592. // let vehicleObj = JSON.parse(res.result);
  593. // if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  594. // uni.showToast({
  595. // icon: "error",
  596. // title: "请扫载具码",
  597. // duration: 1000
  598. // })
  599. // return;
  600. // }
  601. // for (let i = 0; i < vehicleList.value.length; i++) {
  602. // if (vehicleList.value[i].carrierId == vehicleObj.carrierId) {
  603. // uni.showToast({
  604. // icon: "error",
  605. // title: "载具已存在",
  606. // duration: 1000
  607. // })
  608. // return;
  609. // }
  610. // }
  611. // checkCarrier(vehicleObj.carrierId).then(response => {
  612. // if (response.code == 200) {
  613. // vehicleList.value.push(vehicleObj);
  614. // } else {
  615. // uni.showToast({
  616. // icon: 'none',
  617. // title: response.msg
  618. // })
  619. // return;
  620. // }
  621. // })
  622. // }
  623. // });
  624. // }
  625. */
  626. function handleAdd() {
  627. if (selectedProcess.value == null) {
  628. uni.showToast({
  629. icon: 'none',
  630. title: '请选择工序后再开始批次'
  631. })
  632. return;
  633. }
  634. if (dayWork.value.furnaceNoInfo == null) {
  635. uni.showToast({
  636. icon: 'none',
  637. title: '请选择炉号再开始批次'
  638. })
  639. return;
  640. }
  641. dayWork.value.isWasteRecycling = batchNoList.value[0].isWasteRecycling
  642. dayWork.value.isAmend = batchNoList.value[0].isAmend
  643. dayWork.value.fromId = batchNoList.value[0].fromId
  644. dayWork.value.isSuperaddition = batchNoList.value[0].isSuperaddition
  645. dayWork.value.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  646. store.furnaceNumberInfo = basicInfo.value;
  647. if (checkLotCode(dayWork.value.lotCode)) {
  648. isTakeStock().then(response => {
  649. if (response.data) {
  650. uni.showToast({
  651. icon: 'none',
  652. title: '正在盘点,不能开始新批次',
  653. duration: 2000
  654. })
  655. } else {
  656. loading.value = true
  657. uni.showLoading({
  658. title: '加载中'
  659. });
  660. saveDayWork(dayWork.value).then(res => {
  661. console.log(res)
  662. if (res.code === 200) {
  663. uni.showToast({
  664. icon: 'success',
  665. title: '添加成功',
  666. duration: 2000
  667. });
  668. // uni.$emit('batchReporting-addBatch');
  669. // uni.$emit('dayworkItemUpdate');
  670. uni.navigateBack({
  671. url: '/pages/batchReporting/index'
  672. })
  673. } else {
  674. uni.showToast({
  675. icon: 'none',
  676. title: res.msg,
  677. duration: 2000
  678. });
  679. }
  680. loading.value = false
  681. uni.hideLoading()
  682. })
  683. }
  684. })
  685. } else {
  686. uni.showToast({
  687. icon: "none",
  688. title: "该批次号已被使用或不属于该产品",
  689. duration: 2000
  690. })
  691. }
  692. }
  693. </script>
  694. <style lang="scss">
  695. .container {
  696. height: 90%;
  697. background-color: #f5f5f5;
  698. padding-bottom: 112rpx;
  699. }
  700. .bottom {
  701. background-color: white;
  702. width: 100%;
  703. position: fixed;
  704. bottom: 0;
  705. align-items: center;
  706. background-color: #ffffff;
  707. padding: 16rpx 0;
  708. .add {
  709. margin: 0 auto;
  710. width: 80%;
  711. height: 80rpx;
  712. }
  713. }
  714. .content {
  715. position: relative;
  716. width: auto;
  717. background-color: rgba(255, 255, 255, 1);
  718. margin: 32rpx;
  719. padding-bottom: 50rpx;
  720. padding-top: 20rpx;
  721. border-radius: 12rpx;
  722. height: 100%;
  723. overflow: auto;
  724. .title {
  725. width: auto;
  726. font-size: 36rpx;
  727. font-weight: bold;
  728. text-align: center;
  729. }
  730. }
  731. .inpAndScan {
  732. justify-content: space-between;
  733. width: calc(88% + 20rpx);
  734. margin: 0 auto;
  735. .inp {
  736. width: calc(100% - 16rpx);
  737. margin: 10rpx auto;
  738. height: 74rpx;
  739. }
  740. .scanLotCode {
  741. border-radius: 6rpx;
  742. border: 1rpx solid rgba(22, 132, 252, 1);
  743. height: 60rpx;
  744. margin: 10rpx;
  745. height: 72rpx;
  746. width: 46%;
  747. text-align: center;
  748. line-height: 72rpx;
  749. background-color: rgba(22, 132, 252, 1);
  750. color: white;
  751. }
  752. }
  753. .batchNo {
  754. // justify-content: flex-start;
  755. // flex-wrap: wrap;
  756. // width: auto;
  757. // height: 320rpx;
  758. // overflow: auto;
  759. // padding-left: calc(100% - 88% - 4rpx - 40rpx);
  760. // margin-bottom: 40rpx;
  761. // border-radius: 6rpx;
  762. justify-content: center;
  763. .batchNo-item {
  764. justify-content: center;
  765. align-items: center;
  766. width: 88%;
  767. margin: 10rpx;
  768. height: 72rpx;
  769. border: 1px solid rgba(213, 213, 213, 1);
  770. border-radius: 6rpx;
  771. }
  772. .batchNoCheck {
  773. color: #FFF;
  774. border: 1rpx solid rgba(22, 132, 252, 1);
  775. background-color: rgba(22, 132, 252, 1);
  776. }
  777. }
  778. .vehicleList {
  779. justify-content: flex-start;
  780. flex-wrap: wrap;
  781. width: auto;
  782. height: 120rpx;
  783. overflow: auto;
  784. padding: 0 80rpx;
  785. .vehicleNo {
  786. padding: 0 10rpx;
  787. margin: 10rpx;
  788. justify-content: space-between;
  789. align-items: center;
  790. width: 230rpx;
  791. height: 60rpx;
  792. border: 1px solid rgba(213, 213, 213, 1);
  793. border-radius: 6rpx;
  794. }
  795. }
  796. .middle {
  797. display: flex;
  798. flex-direction: row;
  799. align-items: center;
  800. justify-content: center
  801. }
  802. .segment {
  803. width: 280rpx;
  804. background-color: rgba(213, 213, 213, 1);
  805. border: 1rpx solid rgba(213, 213, 213, 1);
  806. }
  807. .info {
  808. width: 94%;
  809. justify-content: space-around;
  810. padding: 10rpx;
  811. margin: 0 auto;
  812. label {
  813. flex: 1;
  814. text-combine-upright: all;
  815. margin: 0 30rpx 0 20rpx;
  816. }
  817. text {
  818. flex: 3;
  819. // width: 80%;
  820. }
  821. .data-select {
  822. flex: 3;
  823. width: 80%;
  824. height: 60rpx;
  825. margin-right: 40rpx;
  826. border-radius: 18rpx;
  827. background-color: #FFF;
  828. .data-select-options {
  829. width: 200rpx;
  830. }
  831. }
  832. }
  833. .material {
  834. height: auto;
  835. width: 60%;
  836. }
  837. .selectedProcess {
  838. width: 88%;
  839. margin: 20rpx auto 40rpx;
  840. }
  841. </style>