outstoreOperate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view style="padding-left: 2px;padding-right: 2px;">
  3. <!-- <view style="flex-direction: row;display: flex;padding: 1px;margin-top: 5px;">
  4. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">出库任务单号:</text>
  5. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{outTaskDtlMd.outTaskNo}}</text>
  6. </view> -->
  7. <view style="flex-direction: row;display: flex;margin-top: 5px;">
  8. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">生产令号:</text>
  9. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{outTaskDtlMd.bomNo}}</text>
  10. </view>
  11. <view style="flex-direction: row;display: flex;">
  12. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料号:</text>
  13. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{outTaskDtlMd.materialCode}}</text>
  14. </view>
  15. <view style="flex-direction: row;display: flex;">
  16. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料名称:</text>
  17. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{outTaskDtlMd.materialName}}</text>
  18. </view>
  19. <view style="flex-direction: row;display: flex;">
  20. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">规格型号/图号:</text>
  21. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{outTaskDtlMd.materialSpec}}</text>
  22. </view>
  23. <view style="flex-direction: row;flex-direction: row;display: flex;">
  24. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">需求数量:</text>
  25. <text style="align-self: center;font-size: 50rpx;font-weight: bold;color: blue;">{{outTaskDtlMd.qty - outTaskDtlMd.outQty}}</text>
  26. </view>
  27. <view style="flex-direction: row;display: flex;padding: 1px;">
  28. <text style="align-self: center;font-size: 35rpx;color: #0000ff;font-weight: bold;width: 260rpx;">扫码-物料号:</text>
  29. <input class="uni-input" style="font-size: 40rpx;font-weight: bold;" v-model="scanMaterialCode" :focus="foucusIndex === 0" @confirm="foucusChange0" @focus="getFoucus(0)"/>
  30. <!-- <uni-easyinput style="background:#FFF;margin-right: 5px;font-size: 80rpx;" v-model="scanMaterialCode" :errorMessage="isMaterialCodeErr" :focus="foucusIndex === 0" @confirm="foucusChange0" @input="input"></uni-easyinput> -->
  31. </view>
  32. <view style="flex-direction: row;display: flex;padding: 1px;">
  33. <text style="align-self: center;font-size: 35rpx;color: #0000ff;font-weight: bold;width: 260rpx;">扫码-BN/SN码:</text>
  34. <input class="uni-input" style="font-size: 40rpx;font-weight: bold;" v-model="scanBnSnCode" :focus="foucusIndex === 1" @confirm="foucusChange1" @focus="getFoucus(1)"/>
  35. </view>
  36. <view style="flex-direction: row;display: flex;padding: 1px;">
  37. <text style="align-self: center;font-size: 35rpx;color: #0000ff;font-weight: bold;width: 260rpx;">出库数量:</text>
  38. <input class="uni-input" type="number" style="font-size: 40rpx;font-weight: bold;color: red;" v-model="outNum" :focus="foucusIndex === 2" @confirm="foucusChange2" @focus="getFoucus(2)"/>
  39. </view>
  40. <view class="my-tips-view">{{tipMsg}}</view>
  41. <button type="primary" style="margin-top: 5px;" @click="resetData">重置</button>
  42. <button type="primary" style="margin-top: 15px;" @click="submitResult">出库结果提交</button>
  43. <!-- 提示信息弹窗 -->
  44. <!-- <view>
  45. <uni-popup ref="message" type="message">
  46. <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
  47. </uni-popup>
  48. </view> -->
  49. <view>
  50. <!-- 普通弹窗 -->
  51. <uni-popup ref="popup" background-color="#fff" @change="change" :mask-click="isMaskClick" @maskClick="maskClickFun">
  52. <view class="popup-content" style="flex-direction: column;display: flex;">
  53. <text class="text" style="color: red;font-weight: bold;">{{popTitleMsg}}</text>
  54. <text style="color: #333;font-size: 16px;margin-top: 15px;">{{popMsg}}</text>
  55. </view>
  56. </uni-popup>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. outTaskDtlMd: {},
  65. scanMaterialCode: '',
  66. scanBnSnCode: '',
  67. outNum: 0,
  68. foucusIndex: 0,
  69. tipMsg: '等待扫码确认物料号......',
  70. popTitleMsg: '请重新扫码!!',
  71. popMsg: '',
  72. isMaskClick: true,
  73. stockQty: 0
  74. }
  75. },
  76. onUnload() {
  77. },
  78. onLoad() {
  79. uni.$once('sendCheckedDeliverDtlData', (data) => {
  80. this.outTaskDtlMd = data
  81. })
  82. this.foucusIndex = 0
  83. },
  84. methods: {
  85. maskClickFun() {
  86. if(this.foucusIndex === 0 && (this.scanMaterialCode !== this.outTaskDtlMd.materialCode)) {
  87. this.scanMaterialCode = ''
  88. }
  89. else if(this.foucusIndex === 1 && (this.scanMaterialCode !== this.outTaskDtlMd.materialCode)) {
  90. if(this.isEmptyStr(this.scanMaterialCode)) {
  91. this.scanBnSnCode = ''
  92. this.foucusIndex = 0
  93. }
  94. else if(this.isEmptyStr(this.scanBnSnCode)) {
  95. this.foucusIndex = 1
  96. }
  97. else {
  98. this.scanBnSnCode = ''
  99. this.scanMaterialCode = ''
  100. this.resetFoucus(0)
  101. }
  102. }
  103. },
  104. change(e) {
  105. if(e.show) {
  106. }
  107. else {
  108. this.resetFoucus(this.foucusIndex)
  109. }
  110. },
  111. input(e) {
  112. if(e !== this.outTaskDtlMd.materialCode) {
  113. this.isMaterialCodeErr = true;
  114. }
  115. else {
  116. this.isMaterialCodeErr = false;
  117. }
  118. },
  119. async submitResult() {
  120. if(this.outNum <= 0) {
  121. this.popTitleMsg = '错误提示!!'
  122. this.popMsg = '出库数量不能为0'
  123. this.$refs.popup.open('center')
  124. this.foucusIndex = 2
  125. return;
  126. }
  127. if(this.stockQty <= 0) {
  128. this.popTitleMsg = '错误提示!!'
  129. this.popMsg = '库存数量为:0,无法出库'
  130. this.$refs.popup.open('center')
  131. return;
  132. }
  133. if((this.outTaskDtlMd.qty - this.outTaskDtlMd.outQty) < this.outNum) {
  134. this.popTitleMsg = '错误提示!!'
  135. this.popMsg = `出库数量【${this.outNum}】大于需求数量【${this.outTaskDtlMd.qty - this.outTaskDtlMd.outQty}】,无法出库`
  136. this.$refs.popup.open('center')
  137. return;
  138. }
  139. if(this.stockQty < this.outNum) {
  140. this.popTitleMsg = '错误提示!!'
  141. this.popMsg = `出库数量【${this.outNum}】大于库存数量【${this.stockQty}】,无法出库`
  142. this.$refs.popup.open('center')
  143. return;
  144. }
  145. uni.showLoading({
  146. title: "正在提交数据...",
  147. mask: true,
  148. })
  149. let tmpMd = this.outTaskDtlMd;
  150. tmpMd.outStoreQty = Number(this.outNum);
  151. tmpMd.OutNum = Number(this.outNum);
  152. tmpMd.BnSnCode = this.scanBnSnCode;
  153. let parm = {
  154. url : '/business/OutOutstoreRecord/AddOutstoreRecord',
  155. data: tmpMd,
  156. method: 'POST',
  157. isHaveToken : true
  158. }
  159. let retData = await getApp().RequestData(parm)
  160. if(retData.isSuccess) {
  161. if(retData.data.code == 200) {
  162. uni.navigateBack({
  163. url: '/pages/Outstore/outstoreDtlNew',
  164. success: () => {
  165. uni.hideLoading()
  166. uni.$emit('addOutstoreData',tmpMd);
  167. }
  168. });
  169. // console.log(retData.data)
  170. }
  171. else {
  172. uni.hideLoading()
  173. // console.log(retData.data)
  174. uni.showToast({
  175. title: '接口错误!' + retData.data.msg,
  176. icon: 'none',
  177. duration: 1500,
  178. mask:true,
  179. })
  180. }
  181. }
  182. else {
  183. uni.hideLoading()
  184. // console.log(retData)
  185. uni.showToast({
  186. title: '接口异常!' + retData.retMsg,
  187. icon: 'none',
  188. duration: 1500,
  189. mask:true,
  190. })
  191. }
  192. },
  193. isEmptyStr(s) {
  194. if (s == undefined || s === '') {
  195. return true
  196. }
  197. return false
  198. },
  199. foucusChange0(event) {
  200. if(this.isEmptyStr(this.scanMaterialCode)) {
  201. this.popTitleMsg = '请重新扫码!!'
  202. this.popMsg = '物料号不能为空'
  203. this.$refs.popup.open('center')
  204. return;
  205. }
  206. if(this.scanMaterialCode !== this.outTaskDtlMd.materialSpec) {
  207. this.popTitleMsg = '请重新扫码!!'
  208. this.popMsg = '物料号扫码确认错误'
  209. this.$refs.popup.open('center')
  210. return
  211. }
  212. let str = event.detail.value
  213. if(str.length !== 0) {
  214. this.foucusIndex = 1
  215. }
  216. else {
  217. this.resetFoucus(0)
  218. }
  219. this.tipMsg = "等待扫码 BN/SN码......"
  220. },
  221. foucusChange1(event) {
  222. if(this.isEmptyStr(this.scanMaterialCode)) {
  223. this.popTitleMsg = '请重新扫码!!'
  224. this.popMsg = '物料号不能为空'
  225. this.$refs.popup.open('center')
  226. return;
  227. }
  228. if(this.isEmptyStr(this.scanBnSnCode)) {
  229. this.popTitleMsg = '请重新扫码!!'
  230. this.popMsg = 'BN/SN码不能为空'
  231. this.$refs.popup.open('center')
  232. //this.resetFoucus(1)
  233. return
  234. }
  235. if(this.scanMaterialCode !== this.outTaskDtlMd.materialSpec) {
  236. this.popTitleMsg = '请重新扫码!!'
  237. this.popMsg = '物料号扫码确认错误'
  238. this.$refs.popup.open('center')
  239. return
  240. }
  241. // let str = event.detail.value
  242. // if(str.length !== 0) {
  243. // this.foucusIndex = 2
  244. // }
  245. this.tipMsg = "正在查询库存数据......"
  246. this.isMaskClick = false;
  247. this.popTitleMsg = '提示'
  248. this.popMsg = '正在查询库存数据......'
  249. this.$refs.popup.open('center')
  250. // let that = this
  251. let parm = {
  252. url : '/business/StkBalanceDtl/GetStkBalanceDtlList',
  253. data: {
  254. BomNo: this.outTaskDtlMd.bomNo,
  255. MaterialCode: this.scanMaterialCode,
  256. BnSnCode: this.scanBnSnCode,
  257. },
  258. method: 'GET',
  259. isHaveToken : true
  260. }
  261. getApp().RequestData(parm).then((res)=>{
  262. let retData = res;
  263. if(retData.isSuccess) {
  264. if(retData.data.code == 200) {
  265. if(retData.data.data.length === 0) {
  266. this.stockQty = 0
  267. setTimeout(() => {
  268. this.tipMsg = '库存数量为:' + this.stockQty
  269. this.$refs.popup.close()
  270. this.isMaskClick = true
  271. this.scanBnSnCode = ''
  272. // this.foucusIndex = 2
  273. this.resetFoucus(1)
  274. }, 1000)
  275. }
  276. else {
  277. this.stockQty = retData.data.data
  278. setTimeout(() => {
  279. this.tipMsg = '库存数量为:' + this.stockQty
  280. this.$refs.popup.close()
  281. this.isMaskClick = true
  282. // this.foucusIndex = 2
  283. this.resetFoucus(2)
  284. }, 1000)
  285. }
  286. }
  287. else {
  288. this.stockQty = 0
  289. this.tipMsg = '获取库存数量发生错误!!'
  290. this.$refs.popup.close()
  291. this.isMaskClick = true;
  292. this.scanBnSnCode = ''
  293. // this.foucusIndex = 1
  294. this.resetFoucus(1)
  295. }
  296. }
  297. else {
  298. this.stockQty = 0
  299. this.tipMsg = '获取库存数量发生错误!!'
  300. this.$refs.popup.close()
  301. this.isMaskClick = true;
  302. this.scanBnSnCode = ''
  303. // this.foucusIndex = 1
  304. this.resetFoucus(1)
  305. }
  306. });
  307. },
  308. foucusChange2(event) {
  309. if(this.outNum <= 0) {
  310. this.popTitleMsg = '错误提示!!'
  311. this.popMsg = '出库数量不能为0'
  312. this.$refs.popup.open('center')
  313. this.foucusIndex = 2
  314. return;
  315. }
  316. let str = event.detail.value
  317. if(str.length !== 0) {
  318. this.foucusIndex = 3
  319. }
  320. this.submitResult()
  321. },
  322. resetData() {
  323. this.resetFoucus(0)
  324. this.scanBnSnCode = ''
  325. this.scanMaterialCode = ''
  326. this.outNum = 0
  327. this.stockQty = 0
  328. this.tipMsg = '等待扫码确认物料号......'
  329. },
  330. isEmptyStr(s) {
  331. if (s == undefined || s === '') {
  332. return true
  333. }
  334. return false
  335. },
  336. resetFoucus(index) {
  337. this.foucusIndex = 3
  338. setTimeout(() => {
  339. this.foucusIndex = index;
  340. }, 5)
  341. },
  342. getFoucus(index) {
  343. this.foucusIndex = index
  344. }
  345. }
  346. }
  347. </script>
  348. <style lang="scss">
  349. @import '@/common/uni-nvue.css';
  350. .my-tips-view {
  351. margin-top: 5px;
  352. text-align: center;
  353. color: #aa007f;
  354. font-size: 20px;
  355. font-weight: bold;
  356. }
  357. .popup-content {
  358. // @include flex;
  359. display: flex;
  360. align-items: center;
  361. justify-content: center;
  362. padding: 15px;
  363. // height: 50px;
  364. background-color: #fff;
  365. }
  366. .text {
  367. font-size: 22px;
  368. color: #333;
  369. }
  370. </style>