outassembleDtlNew.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view>
  3. <view class="uni-form-item uni-column">
  4. <view class="uni-flex uni-row">
  5. <view class="title" style="width: 150rpx;">生产令号:</view>
  6. <input class="uni-input" style="font-size: 40rpx;font-weight: bold;color: black;" disabled="true" v-model="bomNo"/>
  7. </view>
  8. <view class="uni-flex uni-row" style="margin-top: 3px;margin-bottom: 3px;">
  9. <view class="title" style="width: 150rpx;">物料号:</view>
  10. <input class="uni-input" style="margin-right: 5px;" :focus="foucusIndex === 0" v-model="materialSpecCode" placeholder="请输入物料信息" @confirm="confirmFun"/>
  11. </view>
  12. <view class="uni-flex uni-row">
  13. <button type="primary" style="-webkit-flex: 1;flex: 1;margin-left: 5px;" @click="queryFun">查 询</button>
  14. <button type="primary" style="-webkit-flex: 1;flex: 1;margin-left: 5px;margin-right: 5px;" @click="resetCondition">重 置</button>
  15. </view>
  16. </view>
  17. <uni-section title="关键件清单数据:" type="line" style="margin-bottom: 3px;padding: 3px;">
  18. <view class="my-tips-view" v-if="isShowTips">没有查询到关键件清单数据......</view>
  19. <view v-for="(newsitem,key) in sapOutTaskList" :key="key">
  20. <view class="myDeliverDetail" @click="myDeliverDetailClick(newsitem)">
  21. <view style="flex-direction: row;flex-direction: row;height: 25px;display: flex;padding: 2px;border-radius: 5px 5px;">
  22. <text style="align-self: center;">物料编号:</text>
  23. <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.materialCode}}</text>
  24. <!-- <text :class="newsitem.keyFlag ? 'keyFlagRed' : 'keyFlagGray'" style="align-self: center;margin-left: 20px;">{{newsitem.keyFlag ? '★' : '■'}}</text> -->
  25. </view>
  26. <view class="line-h"></view>
  27. <view style="flex-direction: row;flex-direction: row;display: flex;-webkit-justify-content: space-between;justify-content: space-between;">
  28. <view>
  29. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  30. <text style="align-self: center;color: #555;font-size: 25rpx;">物料名称:</text>
  31. <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialName}}</text>
  32. </view>
  33. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  34. <text style="align-self: center;color: #555;font-size: 25rpx;">规格型号/图号:</text>
  35. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: blue;word-wrap: break-word;width: 200px;">{{newsitem.materialSpec}}</text>
  36. </view>
  37. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  38. <text style="align-self: center;color: #555;font-size: 25rpx;">生产令号:</text>
  39. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: blue;word-wrap: break-word;width: 200px;">{{newsitem.bomNo}}</text>
  40. </view>
  41. <!-- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  42. <text style="align-self: center;color: #555;font-size: 25rpx;">BN/SN:</text>
  43. <text style="align-self: center;font-size: 30rpx;font-weight: bold;word-wrap: break-word;width: 200px;">{{newsitem.bnSnCode}}</text>
  44. </view> -->
  45. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  46. <text style="align-self: center;color: #555;font-size: 25rpx;">装配需求数量:</text>
  47. <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.qty}}</text>
  48. </view>
  49. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  50. <text style="align-self: center;color: #555;font-size: 25rpx;">已装配数量:</text>
  51. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: red;">{{newsitem.assembleQty}}</text>
  52. </view>
  53. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  54. <text style="align-self: center;color: #555;font-size: 25rpx;">创建人:</text>
  55. <text style="align-self: center;font-size: 30rpx;">{{newsitem.createBy}}</text>
  56. </view>
  57. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  58. <text style="align-self: center;color: #555;font-size: 25rpx;">创建时间:</text>
  59. <text style="align-self: center;font-size: 30rpx;">{{newsitem.createTime}}</text>
  60. </view>
  61. </view>
  62. <view v-if="newsitem.assembleQty < newsitem.qty" style="border-radius: 35px;width: 35px; background-color: lime;height: 35px;align-self: center;margin-right: 5px;"></view>
  63. <view v-else style="border-radius: 35px;width: 35px; background-color: lightgray;height: 35px;align-self: center;margin-right: 5px;"></view>
  64. </view>
  65. </view>
  66. </view>
  67. </uni-section>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. bomNo: '',
  75. foucusIndex: 0,
  76. materialSpecCode: '',
  77. isShowTips: true,
  78. sapOutTaskList:[],
  79. }
  80. },
  81. onLoad(option) {
  82. this.bomNo = option.bomNo;
  83. uni.$on('addAssembleDtlData', this.addAssembleDtlData)
  84. },
  85. onUnload() {
  86. uni.$off('addAssembleDtlData', this.addAssembleDtlData)
  87. },
  88. methods: {
  89. async queryFun() {
  90. if(this.isEmptyStr(this.materialSpecCode)) {
  91. uni.showToast({
  92. title: '物料信息 不能为空!',
  93. icon: 'none',
  94. duration: 1500,
  95. mask:true,
  96. })
  97. this.foucusIndex = 1
  98. setTimeout(() => {
  99. this.foucusIndex = 0;
  100. }, 100)
  101. return
  102. }
  103. uni.showLoading({
  104. title: "正在查询...",
  105. mask: true,
  106. })
  107. this.sapOutTaskList = []
  108. let parm = {
  109. url : '/business/SapBomRecord/QuerySapBomRecordListForMaterialSpec?bomNo=' + this.bomNo + '&materialSpecCode=' + this.materialSpecCode,
  110. data: {
  111. },
  112. method: 'POST',
  113. isHaveToken : true
  114. }
  115. let retData = await getApp().RequestData(parm)
  116. // console.log(retData)
  117. if(retData.isSuccess) {
  118. if(retData.data.code == 200) {
  119. let len = retData.data.data.length
  120. this.sapOutTaskList = retData.data.data
  121. if(len > 0) {
  122. this.isShowTips = false
  123. }
  124. else {
  125. this.isShowTips = true
  126. this.resetCondition()
  127. }
  128. }
  129. else {
  130. this.isShowTips = true
  131. this.resetCondition()
  132. }
  133. }
  134. else {
  135. this.isShowTips = true
  136. this.resetCondition()
  137. }
  138. uni.hideLoading()
  139. },
  140. resetCondition() {
  141. this.foucusIndex++
  142. // console.log(this.foucusIndex)
  143. this.materialSpecCode = ''
  144. this.sapOutTaskList = []
  145. this.isShowTips = true
  146. setTimeout(() => {
  147. this.foucusIndex = 0;
  148. // console.log('额呵呵呵!!!')
  149. }, 150)
  150. // this.foucusIndex = 0;
  151. },
  152. isEmptyStr(s) {
  153. if (s == undefined || s === '') {
  154. return true
  155. }
  156. return false
  157. },
  158. myDeliverDetailClick(model) {
  159. model.bomNo = this.bomNo;
  160. if(model.assembleQty >= model.qty) {
  161. uni.showToast({
  162. title: '已全部出库',
  163. icon: 'error',
  164. mask: true,
  165. duration: 1500
  166. })
  167. } else {
  168. uni.navigateTo({
  169. url: '/pages/Outstore/outassembleOperate',
  170. success() {
  171. uni.$emit('sendCheckedDeliverDtlData',model)
  172. // console.log(model)
  173. }
  174. });
  175. }
  176. },
  177. addAssembleDtlData(data) {
  178. // console.log(data)
  179. this.sapOutTaskList.forEach((item) => {
  180. if(item.id === data.id) {
  181. item.assembleQty += Number(data.assembleNum);
  182. }
  183. })
  184. let isFinish = this.sapOutTaskList.some(x => x.assembleQty < x.qty)
  185. if(!isFinish) {
  186. // console.log(111)
  187. this.resetCondition()
  188. // console.log(1221)
  189. }
  190. else {
  191. this.queryFun()
  192. }
  193. },
  194. confirmFun() {
  195. this.queryFun()
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss">
  201. .my-tips-view {
  202. /* margin-top: 50px; */
  203. text-align: center;
  204. color: #999999;
  205. font-size: 20px;
  206. font-weight: normal;
  207. }
  208. .myDeliverDetail {
  209. border: 1px solid #cccccc;
  210. border-radius: 5px;
  211. margin-top: 1px;
  212. }
  213. .myDeliverDetail:active {
  214. background-color: aliceblue;
  215. }
  216. .line-h {
  217. height: 1rpx;
  218. background-color: #cccccc;
  219. }
  220. .keyFlagRed {
  221. color: red;
  222. }
  223. .keyFlagGray {
  224. color: lightgray;
  225. }
  226. </style>