inspectOperate.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view style="padding: 3px;">
  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;">{{deliverDtlMd.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;">{{deliverDtlMd.bomNo}}</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;">{{deliverDtlMd.materialCode}}</text>
  14. </view>
  15. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;margin-top: 5px;margin-bottom: 5px;">
  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;">{{deliverDtlMd.materialName}}</text>
  18. </view>
  19. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  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;">{{deliverDtlMd.materialSpec}}</text>
  22. </view>
  23. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  24. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单数量:</text>
  25. <text style="align-self: center;font-size: 40rpx;font-weight: bold;">{{deliverDtlMd.sumQty}}</text>
  26. </view>
  27. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  28. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">已质检数量:</text>
  29. <text style="align-self: center;font-size: 40rpx;font-weight: bold;color: blue;">{{deliverDtlMd.sumCheckQty}}</text>
  30. </view>
  31. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px; ">
  32. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 230rpx;">BN/SN码:</text>
  33. <input class="uni-input" style="margin-right: 5px;font-size: 40rpx;font-weight: bold;" v-model="bnSnCode" :focus="foucusIndex === 0" placeholder="请输BN/SN码" />
  34. </view>
  35. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  36. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 230rpx;">合格数量:</text>
  37. <input class="uni-input" type="number" style="margin-right: 5px;color: blue;font-size: 40rpx;font-weight: bold;" v-model="checkOkQty" placeholder="请输合格数量" />
  38. </view>
  39. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  40. <text style="align-self: center;font-size: 35rpx;color: red;width: 230rpx;">不合格数量:</text>
  41. <input class="uni-input" type="number" style="margin-right: 5px;color: red;font-size: 40rpx;font-weight: bold;" v-model="checkNgQty" placeholder="请输不合格数量" />
  42. </view>
  43. <button type="primary" style="margin-top: 20px;" @click="resetCondition">重 置</button>
  44. <button type="primary" style="margin-top: 20px;" @click="submitResult">质检结果提交</button>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. deliverDtlMd: {},
  52. bnSnCode: '',
  53. checkOkQty: 0,
  54. checkNgQty: 0,
  55. foucusIndex: 0
  56. }
  57. },
  58. onUnload() {
  59. },
  60. onLoad() {
  61. uni.$once('sendDeliverDtlData', (data) => {
  62. this.deliverDtlMd = data
  63. this.checkOkQty = data.sumQty - data.sumCheckQty
  64. })
  65. },
  66. methods: {
  67. async submitResult() {
  68. // let that = this;
  69. if(this.isEmptyStr(this.bnSnCode)) {
  70. uni.showToast({
  71. title: 'BN/SN码不能为空!',
  72. icon: 'none',
  73. duration: 1000
  74. })
  75. return;
  76. }
  77. if(Number(this.checkOkQty) <= 0 && Number(this.checkNgQty) <= 0) {
  78. uni.showToast({
  79. title: '质检合格数量和不合格数量,至少需要输入一项!',
  80. icon: 'none',
  81. duration: 1000
  82. })
  83. return;
  84. }
  85. if((Number(this.checkOkQty) + Number(this.checkNgQty) + this.deliverDtlMd.sumCheckQty) > this.deliverDtlMd.sumQty) {
  86. uni.showToast({
  87. title: '质检合格数量+不合格数量 不能大于未质检数量。录入错误!',
  88. icon: 'none',
  89. duration: 1000
  90. })
  91. return;
  92. }
  93. let tmpMd = this.deliverDtlMd;
  94. tmpMd.DeliverNo = this.deliverNo;
  95. tmpMd.MaterialSpec = this.materialSpecCode;
  96. tmpMd.BnSnCode = this.bnSnCode;
  97. tmpMd.CheckOkQty = this.checkOkQty;
  98. tmpMd.CheckNgQty = this.checkNgQty;
  99. let parm = {
  100. url : '/business/QaInspectRecord/addSapDeliverDtlInspectResult',
  101. data: tmpMd,
  102. method: 'POST',
  103. isHaveToken : true
  104. }
  105. let retData = await getApp().RequestData(parm)
  106. if(retData.isSuccess) {
  107. if(retData.data.code == 200) {
  108. uni.navigateBack({
  109. url: '/pages/Inspect/inspectDtlNew',
  110. success: () => {
  111. uni.$emit('CallSapDeliverDtlQueryFunc',null);
  112. }
  113. });
  114. }
  115. else {
  116. uni.showToast({
  117. title: '提交数据失败!' + retData.data.msg,
  118. icon: 'none',
  119. duration: 1000
  120. })
  121. }
  122. }
  123. else {
  124. uni.showToast({
  125. title: '接口异常!' + retData.retMsg,
  126. icon: 'none',
  127. duration: 1000
  128. })
  129. }
  130. },
  131. isEmptyStr(s) {
  132. if (s == undefined || s === '') {
  133. return true
  134. }
  135. return false
  136. },
  137. foucusChange0(event) {
  138. let str = event.detail.value
  139. if(str.length !== 0) {
  140. this.foucusIndex = 1
  141. }
  142. },
  143. foucusChange1(event) {
  144. let str = event.detail.value
  145. if(str.length !== 0) {
  146. this.foucusIndex = 2
  147. }
  148. },
  149. resetCondition() {
  150. this.bnSnCode = ''
  151. this.foucusIndex = 1
  152. setTimeout(() => {
  153. this.foucusIndex = 0;
  154. }, 150)
  155. this.checkOkQty = this.deliverDtlMd.sumQty - this.deliverDtlMd.sumCheckQty
  156. this.checkNgQty = 0
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. @import '@/common/uni-nvue.css';
  163. </style>