outstoreDtlNew.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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: 190rpx;">出库任务单号:</view>
  6. <input class="uni-input" style="font-size: 40rpx;font-weight: bold;color: black;" disabled="true" v-model="outTaskNo"/>
  7. </view>
  8. <view class="uni-flex uni-row" style="margin-top: 3px;margin-bottom: 3px;">
  9. <view class="title" style="width: 190rpx;">规格型号\图号:</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="queryClick">查 询</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="SAP出库任务单数据:" type="line" style="margin-bottom: 3px;padding: 3px;">
  18. <view class="my-tips-view" v-if="isShowTips">没有查询到SAP出库任务单数据......</view>
  19. <uni-pagination :total="total" :current="current" :pageSize="pageSize" @change="pageChange" title="标题文字" v-if="!isShowTips" style="margin: 4px;"/>
  20. <view v-if="!isShowTips" style="text-align: center;">
  21. <text class="example-info">数据总量:{{ total }}条,每页数据:{{ pageSize }}</text>
  22. </view>
  23. <view v-for="(newsitem,key) in sapOutTaskList" :key="key">
  24. <view class="myDeliverDetail" @click="myDeliverDetailClick(newsitem)">
  25. <view style="flex-direction: row;flex-direction: row;height: 25px;display: flex;padding: 2px;border-radius: 5px 5px;">
  26. <text style="align-self: center;">物料编号:</text>
  27. <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.materialCode}}</text>
  28. <text :class="newsitem.keyFlag ? 'keyFlagRed' : 'keyFlagGray'" style="align-self: center;margin-left: 20px;">{{newsitem.keyFlag ? '★' : '■'}}</text>
  29. </view>
  30. <view class="line-h"></view>
  31. <view style="flex-direction: row;flex-direction: row;display: flex;-webkit-justify-content: space-between;justify-content: space-between;">
  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: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialName}}</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.materialSpec}}</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;">生产令号:</text>
  43. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: blue;word-wrap: break-word;width: 200px;">{{newsitem.bomNo}}</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;">BN/SN:</text>
  47. <text style="align-self: center;font-size: 30rpx;font-weight: bold;word-wrap: break-word;width: 200px;">{{newsitem.bnSnCode}}</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: 30rpx;font-weight: bold;">{{newsitem.qty}}</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: 35rpx;font-weight: bold;color: red;">{{newsitem.outQty}}</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.createBy}}</text>
  60. </view>
  61. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  62. <text style="align-self: center;color: #555;font-size: 25rpx;">创建时间:</text>
  63. <text style="align-self: center;font-size: 30rpx;">{{newsitem.createTime}}</text>
  64. </view>
  65. </view>
  66. <view v-if="newsitem.outQty < newsitem.qty" style="border-radius: 35px;width: 35px; background-color: lime;height: 35px;align-self: center;margin-right: 5px;"></view>
  67. <view v-else style="border-radius: 35px;width: 35px; background-color: lightgray;height: 35px;align-self: center;margin-right: 5px;"></view>
  68. </view>
  69. </view>
  70. </view>
  71. </uni-section>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. outTaskNo: '',
  79. foucusIndex: 0,
  80. materialSpecCode: '',
  81. isShowTips: true,
  82. sapOutTaskList:[],
  83. current: 1,
  84. total: 0,
  85. pageSize: 10
  86. }
  87. },
  88. onLoad(option) {
  89. this.outTaskNo = option.outTaskNo;
  90. uni.$on('addOutstoreData', this.addOutstoreData);
  91. this.queryUnFinishedFun(option.outTaskNo);
  92. },
  93. onUnload() {
  94. uni.$off('addOutstoreData', this.addOutstoreData)
  95. },
  96. methods: {
  97. async queryClick() {
  98. if(!this.isEmptyStr(this.materialSpecCode)) {
  99. await this.queryFun()
  100. }
  101. else {
  102. await this.queryUnFinishedFun(this.outTaskNo)
  103. }
  104. },
  105. async queryFun() {
  106. if(this.isEmptyStr(this.materialSpecCode)) {
  107. uni.showToast({
  108. title: '物料信息 不能为空!',
  109. icon: 'none',
  110. duration: 1500,
  111. mask:true,
  112. })
  113. this.foucusIndex = 1
  114. setTimeout(() => {
  115. this.foucusIndex = 0;
  116. }, 150)
  117. return
  118. }
  119. uni.showLoading({
  120. title: "正在查询...",
  121. mask: true,
  122. })
  123. this.sapOutTaskList = []
  124. let parm = {
  125. url : '/SapInterface/QuerySapOutTaskListForMaterialSpec?outTaskNo=' + this.outTaskNo + '&materialSpecCode=' + this.materialSpecCode,
  126. data: {
  127. },
  128. method: 'POST',
  129. isHaveToken : true
  130. }
  131. let retData = await getApp().RequestData(parm)
  132. // console.log(retData)
  133. if(retData.isSuccess) {
  134. if(retData.data.code == 200) {
  135. let len = retData.data.data.length
  136. this.sapOutTaskList = retData.data.data
  137. if(len > 0) {
  138. this.isShowTips = false
  139. }
  140. else {
  141. this.isShowTips = true;
  142. }
  143. }
  144. else {
  145. this.isShowTips = true
  146. }
  147. }
  148. else {
  149. this.isShowTips = true
  150. }
  151. uni.hideLoading()
  152. },
  153. resetCondition() {
  154. this.materialSpecCode = ''
  155. // this.sapOutTaskList = []
  156. this.isShowTips = true
  157. // this.foucusIndex = 1
  158. // setTimeout(() => {
  159. // this.foucusIndex = 0;
  160. // }, 150)
  161. this.queryUnFinishedFun(this.outTaskNo)
  162. },
  163. ResetFoucus() {
  164. this.foucusIndex = 1
  165. setTimeout(() => {
  166. this.foucusIndex = 0;
  167. }, 150)
  168. },
  169. isEmptyStr(s) {
  170. if (s == undefined || s === '') {
  171. return true
  172. }
  173. return false
  174. },
  175. myDeliverDetailClick(model) {
  176. model.outTaskNo = this.outTaskNo;
  177. if(model.outQty >= model.qty) {
  178. uni.showToast({
  179. title: '已全部出库',
  180. icon: 'error',
  181. mask: true,
  182. duration: 1500
  183. })
  184. } else {
  185. uni.navigateTo({
  186. url: '/pages/Outstore/outstoreOperate',
  187. success() {
  188. uni.$emit('sendCheckedDeliverDtlData',model)
  189. // console.log(model)
  190. }
  191. });
  192. }
  193. },
  194. addOutstoreData(data) {
  195. // console.log(data)
  196. // this.sapOutTaskList.forEach((item) => {
  197. // if(item.id === data.id) {
  198. // item.outQty += Number(data.OutNum);
  199. // }
  200. // })
  201. // let isFinish = this.sapOutTaskList.some(x => x.outQty < x.qty)
  202. // if(!isFinish) {
  203. // // console.log(111)
  204. // this.resetCondition()
  205. // }
  206. // else {
  207. // this.queryFun()
  208. // }
  209. this.queryUnFinishedFun(this.outTaskNo);
  210. },
  211. confirmFun() {
  212. this.queryFun()
  213. },
  214. pageChange(e) {
  215. this.current = e.current
  216. this.queryUnFinishedFun(this.outTaskNo)
  217. },
  218. async queryUnFinishedFun(outTaskNoStr) {
  219. this.sapOutTaskList = []
  220. let parm = {
  221. url : '/SapInterface/QuerySapOutTaskListUnfinished',
  222. data: {
  223. OutTaskNo: outTaskNoStr,
  224. PageNum: this.current,
  225. PageSize: this.pageSize
  226. },
  227. method: 'POST',
  228. isHaveToken : true
  229. }
  230. uni.showLoading({
  231. title: "正在查询...",
  232. mask: true,
  233. })
  234. let retData = await getApp().RequestData(parm)
  235. if(retData.isSuccess) {
  236. if(retData.data.code == 200) {
  237. // let len = retData.data.data.length
  238. // this.sapOutTaskList = retData.data.data
  239. let len = retData.data.data.result.length
  240. this.total = retData.data.data.totalNum
  241. if(len > 0) {
  242. this.isShowTips = false
  243. }
  244. else {
  245. this.isShowTips = true
  246. }
  247. this.sapOutTaskList = retData.data.data.result
  248. }
  249. else {
  250. this.isShowTips = true
  251. }
  252. }
  253. else {
  254. this.isShowTips = true
  255. }
  256. this.ResetFoucus()
  257. uni.hideLoading()
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss">
  263. .my-tips-view {
  264. /* margin-top: 50px; */
  265. text-align: center;
  266. color: #999999;
  267. font-size: 20px;
  268. font-weight: normal;
  269. }
  270. .myDeliverDetail {
  271. border: 1px solid #cccccc;
  272. border-radius: 5px;
  273. margin-top: 1px;
  274. }
  275. .myDeliverDetail:active {
  276. background-color: aliceblue;
  277. }
  278. .line-h {
  279. height: 1rpx;
  280. background-color: #cccccc;
  281. }
  282. .keyFlagRed {
  283. color: red;
  284. }
  285. .keyFlagGray {
  286. color: lightgray;
  287. }
  288. </style>