store-out.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!-- 手动出库 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar title="手动出库" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  8. </view>
  9. <view slot="right" @tap="$utils.back()">
  10. <span style="color: #FFFFFF;">返回</span>
  11. </view>
  12. </uni-nav-bar>
  13. <view class="container">
  14. <view class="title">
  15. <span>
  16. <span style="color: red;">*</span>
  17. 出库信息
  18. </span>
  19. </view>
  20. <view class="text">
  21. <view class="label">领料人:</view>
  22. <select-lay :value="operateUser" placeholder="默认当前用户" :options="userList" @selectitem="selectitem" :zindex="2000"></select-lay>
  23. </view>
  24. <view class="text">
  25. <view class="label">仓库:</view>
  26. <select-lay :zindex="1000" :value="plcStationCode" :options="selectList" @selectitem="storeSelectitem"></select-lay>
  27. </view>
  28. <view class="text">
  29. <view class="label">出库类型:</view>
  30. <select-lay :value="stockChangeType" :options="typeList" @selectitem="typeSelectitem"></select-lay>
  31. </view>
  32. <view class="text" style="align-items: flex-start;">
  33. <view class="label">备注:</view>
  34. <u-input v-model="remark" type="textarea" :border="true" />
  35. </view>
  36. <view class="text" style="margin: 20rpx 0 30rpx 0;">
  37. <view class="label">领料时间:</view>
  38. <view style="line-height: 1;">{{ time }}</view>
  39. </view>
  40. <view class="title flex-between">
  41. <span>
  42. <span style="color: red;">*</span>
  43. 出库列表
  44. </span>
  45. <a href="#" @click="scan">+扫描添加</a>
  46. </view>
  47. <view class="list">
  48. <view class="item" v-for="(item, index) in scanList" :key="index">
  49. <view class="row">
  50. <view class="col">
  51. <view class="value">{{ item.materialCode }}</view>
  52. </view>
  53. <view class="col">
  54. <view class="value">{{ item.materialName }}</view>
  55. </view>
  56. </view>
  57. <view class="row sub-row">
  58. <view class="col">
  59. <view class="label">规格:</view>
  60. <view class="value">{{ item.spec }}</view>
  61. </view>
  62. <view class="col">
  63. <view class="label">数量:</view>
  64. <view class="value">{{ item.quantity }}米</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import DateFormat from '../../../js_sdk/xfl-DateFormat/DateFormat.js';
  75. export default {
  76. data() {
  77. return {
  78. timer: null,
  79. time: new DateFormat(new Date()).toString(),
  80. show: false,
  81. operateUser: this.$storage.getStorageSync('userInfo').id,
  82. plcStationCode: '1',
  83. stockChangeType: '20',
  84. remark: '',
  85. isReading: false,
  86. scanList: [],
  87. userList: [],
  88. selectList: [],
  89. typeList: [
  90. { label: '出库', value: 20 },
  91. { label: '盘点删除', value: 21 },
  92. { label: '补出库', value: 23 },
  93. ]
  94. };
  95. },
  96. methods: {
  97. /* 选择类型 */
  98. typeSelectitem(index, item) {
  99. this.stockChangeType = item.value;
  100. },
  101. /* 选择领料人 */
  102. selectitem(index, item) {
  103. this.operateUser = item.value;
  104. },
  105. /* 选择仓库 */
  106. storeSelectitem(index, item) {
  107. this.plcStationCode = item.value;
  108. uni.setStorage({
  109. key: 'plcStationCode',
  110. data: item.value
  111. })
  112. },
  113. cfm(){
  114. let obj = {
  115. userId: this.operateUser,
  116. plcCode: this.plcStationCode,
  117. rfidItems: this.scanList.map(item => item.rfidCode),
  118. stockChangeType: this.stockChangeType,
  119. remark: this.remark
  120. }
  121. if((this.roleKey == 'sewing' || this.roleKey == 'crop') && this.stockChangeType == 20){
  122. obj.stockChangeType = 30
  123. }
  124. console.log(obj)
  125. this.$http.HandleMacStockInOut(obj).then(res => {
  126. console.log(res)
  127. if(res.code === 0) {
  128. this.materialReceiveSubmit()
  129. this.$msg.showToast(res.msg || '操作成功!')
  130. this.timer = setTimeout(() => {
  131. this.$utils.back()
  132. }, 2000)
  133. }
  134. })
  135. },
  136. materialReceiveSubmit(){
  137. if(this.stockChangeType == 29 || this.stockChangeType == 20 || this.stockChangeType == 30){
  138. uni.request({
  139. url: 'http://120.79.80.64:8050' + '/cloudApi/materialReceive/list',
  140. method: 'POST',
  141. header:{
  142. 'Content-Type' : 'application/json',
  143. },
  144. data: {
  145. jobNo: this.userInfo.jobNo
  146. },
  147. success: res => {
  148. console.log(res);
  149. },
  150. });
  151. }
  152. },
  153. /* 扫描添加 */
  154. scan() {
  155. this.$utils.open('/pages/store-out-manage/store-out/store-out-scan')
  156. },
  157. getList () {
  158. this.$http.GetApplyStockOutTemp().then(res => {
  159. console.log(res)
  160. if(res.code === 0) {
  161. this.scanList = res.result
  162. }
  163. })
  164. },
  165. /* 添加扫描到的退货数据 */
  166. pushData(data) {
  167. console.log(this.scanList)
  168. let flag = true
  169. this.scanList.forEach(item => {
  170. if(item.rfidCode === data.rfidCode) {
  171. flag = false
  172. }
  173. })
  174. if(flag) {
  175. this.scanList.push(data)
  176. } else {
  177. setTimeout(() => {
  178. this.$msg.showToast('标签已存在!')
  179. }, 100)
  180. }
  181. },
  182. /* 获取用户列表 */
  183. getUserPageList() {
  184. this.$http.GetUserPageList({
  185. pageIndex: 1,
  186. pageSize: 999,
  187. takeUser: true
  188. }).then(res => {
  189. if(res.code == 0) {
  190. let list = res.result.list.map(item => {
  191. return {
  192. label: item.realName,
  193. value: item.id
  194. }
  195. })
  196. this.userList = list
  197. }
  198. })
  199. },
  200. /* 手持机获取仓库 */
  201. getStockHouse() {
  202. this.$http.GetStockHouse().then(res => {
  203. if(res.code === 0) {
  204. this.selectList = res.result.map(item => {
  205. return {
  206. label: item.name,
  207. value: item.plcCode
  208. }
  209. })
  210. }
  211. })
  212. }
  213. },
  214. onLoad(option) {
  215. this.getUserPageList()
  216. this.getStockHouse()
  217. console.log(option)
  218. uni.$on('scan-list', res => {
  219. console.log('?????????????')
  220. console.log(res)
  221. this.pushData(res)
  222. })
  223. uni.getStorage({
  224. key: 'plcStationCode',
  225. success: (res) => {
  226. this.plcStationCode = res.data
  227. }
  228. });
  229. },
  230. onUnload() {
  231. clearTimeout(this.timer)
  232. uni.$off('scan-list')
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .container-wrap {
  238. overflow: hidden;
  239. .container {
  240. padding: 20rpx;
  241. height: calc(100vh - var(--status-bar-height) - 44px);
  242. overflow: auto;
  243. padding-bottom: 100rpx;
  244. .text {
  245. padding: 10rpx 0;
  246. display: flex;
  247. align-items: center;
  248. font-size: 24rpx;
  249. .label {
  250. width: 150rpx;
  251. text-align: right;
  252. }
  253. }
  254. .list {
  255. margin: 10rpx 0;
  256. .item {
  257. padding: 20rpx;
  258. margin-bottom: 10rpx;
  259. background-color: #FFFFFF;
  260. border: 1rpx solid rgba(215, 215, 215, 1);
  261. border-radius: 10rpx;
  262. .row {
  263. &.border {
  264. border-bottom: 1px solid rgba(215, 215, 215, 1);
  265. }
  266. .label {
  267. width: 80rpx;
  268. }
  269. .col {
  270. &:last-child {
  271. justify-content: flex-end;
  272. }
  273. }
  274. }
  275. .sub-row {
  276. align-items: flex-start;
  277. .label, .value {
  278. font-size: 24rpx;
  279. color: #7F7F7F;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. }
  286. </style>