inspectOperateNew.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view>
  3. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;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;">{{deliverNo}}</text>
  6. </view>
  7. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  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;">{{SapDeliverRecordSumMd.materialCode}}</text>
  10. </view>
  11. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  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;">{{SapDeliverRecordSumMd.materialName}}</text>
  14. </view>
  15. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  16. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">规格型号/图号:</text>
  17. <input class="uni-input" style="margin-right: 5px;" v-model="materialSpecCode" :focus="foucusIndex === 0" @confirm="foucusChange0" placeholder="请输规格型号/图号" />
  18. </view>
  19. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
  20. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单数量:</text>
  21. <text style="align-self: center;font-size: 40rpx;font-weight: bold;">{{SapDeliverRecordSumMd.sumQty}}</text>
  22. </view>
  23. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
  24. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">已质检数量:</text>
  25. <text style="align-self: center;font-size: 40rpx;font-weight: bold;color: blue;">{{SapDeliverRecordSumMd.sumCheckQty}}</text>
  26. </view>
  27. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px; margin-top: 5px;">
  28. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">BN/SN码:</text>
  29. <input class="uni-input" style="margin-right: 5px;" v-model="bnSnCode" :focus="foucusIndex === 1" @confirm="foucusChange1" placeholder="请输BN/SN码" />
  30. </view>
  31. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px; margin-top: 5px;">
  32. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">合格数量:</text>
  33. <input class="uni-input" type="number" style="margin-right: 5px;" v-model="checkOkQty" :focus="foucusIndex === 2" @confirm="foucusChange2" placeholder="请输合格数量" />
  34. </view>
  35. <button type="primary" style="margin-top: 15px;" @click="submitResult">质检结果提交</button>
  36. <button type="primary" style="margin-top: 8px;" @click="resetCondition">重 置</button>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. SapDeliverRecordSumMd: {},
  44. bnSnCode: '',
  45. checkOkQty: '',
  46. foucusIndex: 0,
  47. materialSpecCode: '',
  48. deliverNo: '',
  49. }
  50. },
  51. onUnload() {
  52. },
  53. onLoad(option) {
  54. this.deliverNo = option.deliverNo;
  55. },
  56. methods: {
  57. async submitResult() {
  58. // let that = this;
  59. if(this.isEmptyStr(this.materialSpecCode)) {
  60. uni.showToast({
  61. title: '规格型号/图号 不能为空!',
  62. icon: 'none',
  63. duration: 1000,
  64. mask:true,
  65. })
  66. return
  67. }
  68. if(this.isEmptyStr(this.bnSnCode)) {
  69. uni.showToast({
  70. title: 'BN/SN码不能为空!',
  71. icon: 'none',
  72. duration: 1000,
  73. mask:true,
  74. })
  75. return
  76. }
  77. if(Number(this.checkOkQty) <= 0) {
  78. uni.showToast({
  79. title: '未输入质检合格数量!',
  80. icon: 'none',
  81. duration: 1000,
  82. mask:true,
  83. })
  84. return
  85. }
  86. if((Number(this.checkOkQty) + this.SapDeliverRecordSumMd.sumCheckQty) > this.SapDeliverRecordSumMd.qty) {
  87. uni.showToast({
  88. title: '质检合格数量录入错误,数量不能大于未录入数!',
  89. icon: 'none',
  90. duration: 1000,
  91. mask:true,
  92. })
  93. return
  94. }
  95. let tmpMd = {};
  96. tmpMd.DeliverNo = this.deliverNo;
  97. tmpMd.MaterialSpec = this.materialSpecCode;
  98. tmpMd.bnSnCode = this.bnSnCode;
  99. tmpMd.checkOkQty = this.checkOkQty;
  100. let parm = {
  101. url : '/business/QaInspectRecord/addSapDeliverDtlInspectResult',
  102. data: tmpMd,
  103. method: 'POST',
  104. isHaveToken : true
  105. }
  106. let retData = await getApp().RequestData(parm)
  107. if(retData.isSuccess) {
  108. if(retData.data.code == 200) {
  109. let parm1 = {
  110. url : '/business/SapDeliverRecord/GetSapDeliverIsAllChecked',
  111. data: {},
  112. method: 'GET',
  113. isHaveToken : true
  114. }
  115. let retData1 = await getApp().RequestData(parm1)
  116. if(retData1.data.data)
  117. {
  118. uni.navigateBack({
  119. url: '/pages/Inspect/inspect01',
  120. success: () => {
  121. uni.$emit('QueryInspect01',null);
  122. }
  123. });
  124. }
  125. else
  126. {
  127. this.resetCondition()
  128. }
  129. }
  130. else {
  131. uni.showToast({
  132. title: '提交数据失败!' + retData.data.msg,
  133. icon: 'none',
  134. duration: 1000,
  135. mask:true,
  136. })
  137. }
  138. }
  139. else {
  140. uni.showToast({
  141. title: '接口异常!' + retData.retMsg,
  142. icon: 'none',
  143. duration: 1000,
  144. mask:true,
  145. })
  146. }
  147. },
  148. isEmptyStr(s) {
  149. if (s == undefined || s === '') {
  150. return true
  151. }
  152. return false
  153. },
  154. async foucusChange0(event) {
  155. let str = event.detail.value
  156. let parm = {
  157. url : '/business/SapDeliverRecord/GetSapDeliverRecordSum?materialSpecCode=' + this.materialSpecCode + '&deliverNo=' + this.deliverNo,
  158. data: { },
  159. method: 'POST',
  160. isHaveToken : true
  161. }
  162. let retData = await getApp().RequestData(parm)
  163. // console.log(retData)
  164. if(retData.isSuccess) {
  165. if(retData.data.code == 200) {
  166. let tmpMd = retData.data.data
  167. if(tmpMd.sumQty <= tmpMd.sumCheckQty) {
  168. let tmpMaterialSpecCode = this.materialSpecCode
  169. uni.showToast({
  170. title: `物料号:【${tmpMaterialSpecCode}】\r\n已全部质检完成!!`,
  171. icon: 'none',
  172. duration: 1500,
  173. mask:true,
  174. success: () => {
  175. this.materialSpecCode = ''
  176. this.foucusIndex = 3;
  177. setTimeout(() => {
  178. this.foucusIndex = 0;
  179. }, 100)
  180. }
  181. })
  182. }
  183. else {
  184. this.SapDeliverRecordSumMd = retData.data.data
  185. this.foucusIndex = 1
  186. }
  187. }
  188. else {
  189. uni.showToast({
  190. title: '获取交验单明细数据失败!\r\n' + retData.data.msg,
  191. icon: 'none',
  192. duration: 1500,
  193. mask:true,
  194. success: () => {
  195. this.materialSpecCode = ''
  196. this.foucusIndex = 3;
  197. setTimeout(() => {
  198. this.foucusIndex = 0;
  199. }, 100)
  200. }
  201. })
  202. }
  203. }
  204. else {
  205. uni.showToast({
  206. title: '接口异常!' + retData.retMsg,
  207. icon: 'none',
  208. duration: 1500,
  209. mask:true,
  210. success: () => {
  211. this.materialSpecCode = ''
  212. this.foucusIndex = 3;
  213. setTimeout(() => {
  214. this.foucusIndex = 0;
  215. }, 100)
  216. }
  217. })
  218. }
  219. },
  220. foucusChange1(event) {
  221. let str = event.detail.value
  222. if(str.length !== 0) {
  223. this.foucusIndex = 2
  224. }
  225. },
  226. foucusChange2(event) {
  227. let str = event.detail.value
  228. if(str.length !== 0) {
  229. this.foucusIndex = 3
  230. }
  231. },
  232. resetCondition() {
  233. this.materialSpecCode = ''
  234. this.SapDeliverRecordSumMd = {}
  235. this.bnSnCode = ''
  236. this.checkOkQty = ''
  237. this.foucusIndex = 3;
  238. setTimeout(() => {
  239. this.foucusIndex = 0;
  240. }, 100)
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss">
  246. @import '@/common/uni-nvue.css';
  247. </style>