index.vue 24 KB

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