store-out.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. userInfo: this.$storage.getStorageSync('userInfo'),
  83. plcStationCode: '1',
  84. stockChangeType: '20',
  85. remark: '',
  86. isReading: false,
  87. scanList: [],
  88. userList: [],
  89. selectList: [],
  90. typeList: [
  91. { label: '出库', value: 20 },
  92. { label: '盘点删除', value: 21 },
  93. { label: '补出库', value: 23 },
  94. ],
  95. roleKey:null,
  96. };
  97. },
  98. methods: {
  99. /* 选择类型 */
  100. typeSelectitem(index, item) {
  101. this.stockChangeType = item.value;
  102. },
  103. /* 选择领料人 */
  104. selectitem(index, item) {
  105. this.operateUser = item.value;
  106. this.roleKey = item.roleKey
  107. console.log(this.userInfo)
  108. },
  109. /* 选择仓库 */
  110. storeSelectitem(index, item) {
  111. this.plcStationCode = item.value;
  112. uni.setStorage({
  113. key: 'plcStationCode',
  114. data: item.value
  115. })
  116. },
  117. cfm(){
  118. let obj = {
  119. userId: this.operateUser,
  120. plcCode: this.plcStationCode,
  121. rfidItems: this.scanList.map(item => item.rfidCode),
  122. stockChangeType: this.stockChangeType,
  123. remark: this.remark
  124. }
  125. console.log(this.roleKey)
  126. console.log(this.stockChangeType)
  127. if((this.roleKey == 'sewing' || this.roleKey == 'crop')){
  128. if(this.stockChangeType == 20) obj.stockChangeType = 30
  129. }
  130. console.log(obj)
  131. this.$http.HandleMacStockInOut(obj).then(res => {
  132. console.log(res)
  133. if(res.code === 0) {
  134. this.materialReceiveSubmit(obj)
  135. this.$msg.showToast(res.msg || '操作成功!')
  136. this.timer = setTimeout(() => {
  137. this.$utils.back()
  138. }, 2000)
  139. }
  140. })
  141. },
  142. materialReceiveSubmit(obj){
  143. console.log(obj)
  144. if(obj.stockChangeType == 29 || obj.stockChangeType == 20 || obj.stockChangeType == 30){
  145. uni.request({
  146. url: 'http://120.79.80.64:8050' + '/cloudApi/materialReceive/submit',
  147. method: 'POST',
  148. header:{
  149. 'Content-Type' : 'application/json',
  150. },
  151. data: {
  152. checkUserId: this.userInfo.id
  153. },
  154. success: res => {
  155. console.log(res);
  156. },fail(err) {
  157. console.log(err);
  158. }
  159. });
  160. }
  161. },
  162. /* 扫描添加 */
  163. scan() {
  164. this.$utils.open('/pages/store-out-manage/store-out/store-out-scan')
  165. },
  166. getList () {
  167. this.$http.GetApplyStockOutTemp().then(res => {
  168. console.log(res)
  169. if(res.code === 0) {
  170. this.scanList = res.result
  171. }
  172. })
  173. },
  174. /* 添加扫描到的退货数据 */
  175. pushData(data) {
  176. console.log(this.scanList)
  177. let flag = true
  178. this.scanList.forEach(item => {
  179. if(item.rfidCode === data.rfidCode) {
  180. flag = false
  181. }
  182. })
  183. if(flag) {
  184. this.scanList.push(data)
  185. } else {
  186. setTimeout(() => {
  187. this.$msg.showToast('标签已存在!')
  188. }, 100)
  189. }
  190. },
  191. /* 获取用户列表 */
  192. getUserPageList() {
  193. this.$http.GetUserPageList({
  194. pageIndex: 1,
  195. pageSize: 999,
  196. takeUser: true
  197. }).then(res => {
  198. console.log(res)
  199. if(res.code == 0) {
  200. let list = res.result.list.map(item => {
  201. return {
  202. label: item.realName,
  203. value: item.id,
  204. roleKey: item.roleKey
  205. }
  206. })
  207. this.userList = list
  208. }
  209. })
  210. },
  211. /* 手持机获取仓库 */
  212. getStockHouse() {
  213. this.$http.GetStockHouse().then(res => {
  214. if(res.code === 0) {
  215. this.selectList = res.result.map(item => {
  216. return {
  217. label: item.name,
  218. value: item.plcCode
  219. }
  220. })
  221. }
  222. })
  223. }
  224. },
  225. onLoad(option) {
  226. this.getUserPageList()
  227. this.getStockHouse()
  228. console.log(option)
  229. uni.$on('scan-list', res => {
  230. console.log('?????????????')
  231. console.log(res)
  232. this.pushData(res)
  233. })
  234. uni.getStorage({
  235. key: 'plcStationCode',
  236. success: (res) => {
  237. this.plcStationCode = res.data
  238. }
  239. });
  240. },
  241. onUnload() {
  242. clearTimeout(this.timer)
  243. uni.$off('scan-list')
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .container-wrap {
  249. overflow: hidden;
  250. .container {
  251. padding: 20rpx;
  252. height: calc(100vh - var(--status-bar-height) - 44px);
  253. overflow: auto;
  254. padding-bottom: 100rpx;
  255. .text {
  256. padding: 10rpx 0;
  257. display: flex;
  258. align-items: center;
  259. font-size: 24rpx;
  260. .label {
  261. width: 150rpx;
  262. text-align: right;
  263. }
  264. }
  265. .list {
  266. margin: 10rpx 0;
  267. .item {
  268. padding: 20rpx;
  269. margin-bottom: 10rpx;
  270. background-color: #FFFFFF;
  271. border: 1rpx solid rgba(215, 215, 215, 1);
  272. border-radius: 10rpx;
  273. .row {
  274. &.border {
  275. border-bottom: 1px solid rgba(215, 215, 215, 1);
  276. }
  277. .label {
  278. width: 80rpx;
  279. }
  280. .col {
  281. &:last-child {
  282. justify-content: flex-end;
  283. }
  284. }
  285. }
  286. .sub-row {
  287. align-items: flex-start;
  288. .label, .value {
  289. font-size: 24rpx;
  290. color: #7F7F7F;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </style>