inspectOperateNew.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. this.resetCondition()
  110. }
  111. else {
  112. uni.showToast({
  113. title: '提交数据失败!' + retData.data.msg,
  114. icon: 'none',
  115. duration: 1000,
  116. mask:true,
  117. })
  118. }
  119. }
  120. else {
  121. uni.showToast({
  122. title: '接口异常!' + retData.retMsg,
  123. icon: 'none',
  124. duration: 1000,
  125. mask:true,
  126. })
  127. }
  128. },
  129. isEmptyStr(s) {
  130. if (s == undefined || s === '') {
  131. return true
  132. }
  133. return false
  134. },
  135. async foucusChange0(event) {
  136. let str = event.detail.value
  137. let parm = {
  138. url : '/business/SapDeliverRecord/GetSapDeliverRecordSum?materialSpecCode=' + this.materialSpecCode + '&deliverNo=' + this.deliverNo,
  139. data: { },
  140. method: 'POST',
  141. isHaveToken : true
  142. }
  143. let retData = await getApp().RequestData(parm)
  144. // console.log(retData)
  145. if(retData.isSuccess) {
  146. if(retData.data.code == 200) {
  147. let tmpMd = retData.data.data
  148. if(tmpMd.sumQty <= tmpMd.sumCheckQty) {
  149. let tmpMaterialSpecCode = this.materialSpecCode
  150. uni.showToast({
  151. title: `物料号:【${tmpMaterialSpecCode}】\r\n已全部质检完成!!`,
  152. icon: 'none',
  153. duration: 1500,
  154. mask:true,
  155. success: () => {
  156. this.materialSpecCode = ''
  157. this.foucusIndex = 3;
  158. setTimeout(() => {
  159. this.foucusIndex = 0;
  160. }, 100)
  161. }
  162. })
  163. }
  164. else {
  165. this.SapDeliverRecordSumMd = retData.data.data
  166. this.foucusIndex = 1
  167. }
  168. }
  169. else {
  170. uni.showToast({
  171. title: '获取交验单明细数据失败!\r\n' + retData.data.msg,
  172. icon: 'none',
  173. duration: 1500,
  174. mask:true,
  175. success: () => {
  176. this.materialSpecCode = ''
  177. this.foucusIndex = 3;
  178. setTimeout(() => {
  179. this.foucusIndex = 0;
  180. }, 100)
  181. }
  182. })
  183. }
  184. }
  185. else {
  186. uni.showToast({
  187. title: '接口异常!' + retData.retMsg,
  188. icon: 'none',
  189. duration: 1500,
  190. mask:true,
  191. success: () => {
  192. this.materialSpecCode = ''
  193. this.foucusIndex = 3;
  194. setTimeout(() => {
  195. this.foucusIndex = 0;
  196. }, 100)
  197. }
  198. })
  199. }
  200. },
  201. foucusChange1(event) {
  202. let str = event.detail.value
  203. if(str.length !== 0) {
  204. this.foucusIndex = 2
  205. }
  206. },
  207. foucusChange2(event) {
  208. let str = event.detail.value
  209. if(str.length !== 0) {
  210. this.foucusIndex = 3
  211. }
  212. },
  213. resetCondition() {
  214. this.materialSpecCode = ''
  215. this.SapDeliverRecordSumMd = {}
  216. this.bnSnCode = ''
  217. this.checkOkQty = ''
  218. this.foucusIndex = 3;
  219. setTimeout(() => {
  220. this.foucusIndex = 0;
  221. }, 100)
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss">
  227. @import '@/common/uni-nvue.css';
  228. </style>