inspectOperate.vue 7.5 KB

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