putaway.blade.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. @extends('layouts.app')
  2. @section('title')手持入库-上架@endsection
  3. @section('content')
  4. <div class="d-none" id="container">
  5. <div class="card offset-md-3 col-md-6">
  6. <div class="card-header text-center bg-transparent" id="header_title">
  7. <span class="font-weight-bold h3">上架</span>
  8. <<<<<<< HEAD
  9. =======
  10. {{-- <span class="font-weight-bold text-danger">暂停使用</span>--}}
  11. >>>>>>> b0347ca84d8eeedd9c1ac88b1c55b77c6a0613e8
  12. </div>
  13. <div>
  14. <div class="form-group row m-1">
  15. <span class="text-right">
  16. <h5 for="trackNumber" class="text-right mt-2 font-weight-bold">容器号:</h5>
  17. </span>
  18. <input type="text" class="form-control col-8 font-weight-bold" id="trackNumber" autocomplete="off"
  19. placeholder="支持货主,asn,跟踪号或不填"
  20. :class="errors.trackNumber ? 'is-invalid' : ''" @keydown.enter="enterVal($event)"
  21. v-model="info.trackNumber">
  22. <span class="invalid-feedback offset-3" role="alert" v-if="errors.trackNumber">
  23. <strong>@{{ errors.trackNumber[0] }}</strong>
  24. </span>
  25. <button class="btn btn-sm btn-info" @click="getPaTaskByTraceInOrCustomerOrAsnOrNull()">搜索</button>
  26. </div>
  27. <div class="form-group row m-1">
  28. <span class="text-right">
  29. <h5 for="barCode" class="text-right mt-2 font-weight-bold">商品条码:</h5>
  30. </span>
  31. <input type="text" class="form-control col-8 font-weight-bold" id="barCode" autocomplete="off"
  32. :class="errors.barCode ? 'is-invalid' : ''" @keydown.enter="enterVal($event)"
  33. v-model="info.barCode" @blur="getTsk()" >
  34. <span class="invalid-feedback offset-3" role="alert" v-if="errors.barCode">
  35. <strong>@{{ errors.barCode[0] }}</strong>
  36. </span>
  37. </div>
  38. <div class="">
  39. <div>
  40. <div class="form-group row m-1">
  41. <h5 for="name" class="text-right mt-2 font-weight-bold">商品品名:</h5>
  42. <span id="name">@{{ info.name }}</span>
  43. </div>
  44. <div class="form-group row m-1">
  45. <h5 for="amount" class="text-right mt-2 font-weight-bold">上架总数:</h5>
  46. <input type="text" class="form-control col-4 font-weight-bold" style="width: 10px"
  47. id="amount" autocomplete="off"
  48. :class="errors.amount ? 'is-invalid' : ''"
  49. @keydown.enter="enterVal($event)" v-model="info.amount"><span id="paTotal"
  50. v-if="info.paTotal">&nbsp;&nbsp;<span class="font-weight-bold">/&nbsp;&nbsp;@{{ info.paTotal }}</span></span>
  51. <span class="invalid-feedback offset-3" role="alert" v-if="errors.amount">
  52. <strong>@{{ errors.amount[0] }}</strong>
  53. </span>
  54. </div>
  55. <div class="form-group row m-1">
  56. <h5 for="location" class="text-right mt-2 font-weight-bold">目标库位:</h5>
  57. <input type="text" class="form-control col-8 font-weight-bold" id="location"
  58. autocomplete="off"
  59. :class="errors.location ? 'is-invalid' : ''"
  60. @keydown.enter="enterVal($event)" v-model="info.location">
  61. <span class="invalid-feedback offset-3" role="alert" v-if="errors.location">
  62. <strong>@{{ errors.location[0] }}</strong>
  63. </span>
  64. </div>
  65. </div>
  66. </div>
  67. <div style="overflow: auto;overflow-x: hidden" id="cardTable" v-show="tasks.length>0 && !info.barCode">
  68. <table class="table-sm table-striped table-bordered table-hover mb-3"
  69. style="background: rgb(255, 255, 255);">
  70. <tr v-for="(task,i) in tasks">
  71. <td style="filter:grayscale(30%);">
  72. <div>
  73. <div style="transform:scale(1)" class="pl-0">
  74. <span><span class="text-black h5">ASN:</span><span class="text-black font-weight-bold h5">@{{ task.docno }}</span></span>
  75. <span><span class="text-black h5">货主:</span><span
  76. class="text-black font-weight-bold h5">@{{ task.customerid }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  77. <span><span class="text-black h5">sku:</span><span
  78. class="text-black h5">@{{ task.sku }}</span><span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  79. <span class="text-right float-right" v-show="info.barCode">选中:<input type="checkbox" :id="'task_'+i"
  80. @click="checked($event,task)"></span>
  81. <span><span class="text-lowercase h5">待上架/总量:</span><span
  82. class="text-lowercase text-info font-weight-bold h5">@{{ task.qty}}/@{{ task.receivedqty?task.receivedqty:task.receivedqty_each }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  83. <span><span class="h5">容器号:</span><span class="h5">@{{ task.plantoid }} </span></span>
  84. <span v-if="task.lotatt01"><span class="text-black h5">生产日期:</span><span
  85. class="text-black font-weight-bold h5">@{{ task.lotatt01 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  86. <span v-if="task.lotatt02"><span class="text-black h5">失效日期:</span><span
  87. class="text-black font-weight-bold h5">@{{ task.lotatt02 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  88. <span v-if="task.lotatt03"><span class="text-black h5">入库日期:</span><span
  89. class="text-black font-weight-bold h5">@{{ task.lotatt03 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  90. <span v-if="task.lotatt04"><span class="text-black h5">批号:</span><span
  91. class="text-black font-weight-bold h5">@{{ task.lotatt04 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  92. <span v-if="task.lotatt05"><span class="text-black h5">属性仓:</span><span
  93. class="text-black font-weight-bold h5">@{{ task.lotatt05 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  94. <span v-if="task.lotatt08"><span class="text-black h5">质量状态:</span><span
  95. class="text-black font-weight-bold h5">@{{ task.lotatt08 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
  96. </div>
  97. </div>
  98. </td>
  99. </tr>
  100. </table>
  101. </div>
  102. <div style="overflow: auto;overflow-x: hidden" class="bg-secondary" v-if="invLots.length>0">
  103. <span class="font-weight-bold ml-1 text-white">库存余量</span>
  104. <table class="table-sm table-striped table-bordered table-hover mb-3"
  105. style="background: rgb(255, 255, 255);">
  106. <tr v-for="(invLot,i) in invLots" @click="selectTrOne(i,invLot.locationid)" :class="selectTr===i+1?'focusing' : ''">
  107. <td style="filter:grayscale(30%);">
  108. <div>
  109. <div style="transform:scale(1)" class="pl-0">
  110. <span v-if="invLot.customerid">
  111. <span class="text-black">货主:</span>
  112. <span class="text-black font-weight-bold">@{{ invLot.customerid }}</span>
  113. </span>
  114. <span v-if="invLot.alternate_sku1">
  115. <span class="text-black">条码:</span>
  116. <span class="text-danger">@{{ invLot.alternate_sku1 }}</span></span>
  117. <span v-if="invLot.locationid">
  118. <span>库位:</span>
  119. <span class="font-weight-bold">@{{ invLot.locationid }} </span>
  120. </span>
  121. <span v-if="invLot.qty">
  122. <span class="text-lowercase">数量:</span>
  123. <span class="text-lowercase font-weight-bold">@{{ invLot.qty }} </span><span>&nbsp;&nbsp;</span>
  124. </span>
  125. <span v-if="invLot.lotatt01">
  126. <span class="text-black">生产日期:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt01 }}</span>
  127. <span>&nbsp;&nbsp;</span>
  128. </span>
  129. <span v-if="invLot.lotatt02">
  130. <span class="text-black">失效日期:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt02 }}</span>
  131. <span>&nbsp;&nbsp;</span>
  132. </span>
  133. <span v-if="invLot.lotatt03">
  134. <span class="text-black">入库日期:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt03 }}</span>
  135. <span>&nbsp;&nbsp;</span>
  136. </span>
  137. <span v-if="invLot.lotatt04">
  138. <span class="text-black">批号:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt04 }}</span>
  139. <span>&nbsp;&nbsp;</span>
  140. </span>
  141. <span v-if="invLot.lotatt05">
  142. <span class="text-black">属性仓:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt05 }}</span>
  143. <span>&nbsp;&nbsp;</span>
  144. </span>
  145. <span v-if="invLot.lotatt08">
  146. <span class="text-black">质量状态:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt08 }}</span>
  147. <span>&nbsp;&nbsp;</span>
  148. </span>
  149. </div>
  150. </div>
  151. </td>
  152. </tr>
  153. </table>
  154. </div>
  155. <span v-if="mes" class="text-danger font-weight-bold" >@{{ mes }}</span>
  156. <div class="card-footer bg-transparent">
  157. <button type="button" id="confirm" class="btn btn-md btn-success font-weight-bold float-right"
  158. @click="ensure()">确定
  159. </button>
  160. <button type="button" id="cancel" class="btn btn-md btn-danger font-weight-bold float-left" @click="cancel()">
  161. 取消
  162. </button>
  163. </div>
  164. </div>
  165. </div>
  166. @stop
  167. @section('lastScript')
  168. <script type="text/javascript">
  169. new Vue({
  170. el: "#container",
  171. data: {
  172. height: 0,//屏幕高度
  173. info: {},
  174. errors: {},
  175. tasks: [],
  176. invLots: [],
  177. checkData: [],
  178. selectTr: '',
  179. isAndroid: false,
  180. element: [
  181. "trackNumber","barCode", "amount", "location",
  182. ],
  183. mes:'',
  184. },
  185. mounted() {
  186. if (navigator.userAgent.indexOf("Android") !== -1) this.isAndroid = true;
  187. this.pageInit();
  188. $("#container").removeClass("d-none");
  189. document.getElementById("trackNumber").focus();
  190. },
  191. methods: {
  192. //页面初始化
  193. pageInit() {
  194. if (!this.isAndroid) return;
  195. let element = document.getElementById("navbarSupportedContent").parentElement;
  196. element.className = "row";
  197. element.children[0].className += " col-5";
  198. element.innerHTML = element.children[0].outerHTML;
  199. let e1 = document.getElementById("menu");
  200. let e2 = document.getElementById("demand-div");
  201. if (e1) e1.remove();
  202. if (e2) e2.remove();
  203. document.getElementById('app').firstElementChild.style.display = 'none';
  204. },
  205. clearData(){
  206. this.info.name='';
  207. this.tasks=[];
  208. this.invLots=[];
  209. this.checkData=[];
  210. this.$forceUpdate();
  211. },
  212. selectTrOne(i,location){
  213. if (this.selectTr===i+1){
  214. this.selectTr=0
  215. }else {
  216. this.selectTr=i+1;
  217. this.info.location=location;
  218. }
  219. },
  220. checked(e, task, element = undefined) {
  221. if (!element)element = e.target;
  222. let _this = this;
  223. if (element.checked) {
  224. if (_this.checkData.length === 0) {
  225. _this.checkData.push(task);
  226. _this.fillInfo(task);
  227. } else if (_this.checkData.length > 0) {
  228. this.checkData.some(function (item, i) {
  229. if (item.customerid == task.customerid
  230. && item.plantolotnum == task.plantolotnum
  231. && item.sku == task.sku) {
  232. _this.checkData.push(task)
  233. _this.fillInfo(task);
  234. return true;
  235. } else {
  236. $('#'+element.id).prop('checked', false);
  237. window.tempTip.setDuration(3000);
  238. window.tempTip.show('货主,批次不同,不可同时上架');
  239. window.tempTip.showErrorAudio();
  240. }
  241. });
  242. }
  243. }else {
  244. _this.checkData.some(function (item, i) {
  245. if (item.taskid == task.taskid
  246. && item.taskid_sequence == task.taskid_sequence) {
  247. _this.checkData.splice(i, 1);
  248. _this.updateInfo(task);
  249. return true;
  250. }
  251. });
  252. }
  253. _this.$forceUpdate();
  254. },
  255. fillInfo(task){
  256. this.info.name=task.skudescrc;
  257. if (this.info.paTotal==''||this.info.paTotal==null||this.info.paTotal==undefined){this.info.paTotal=0;}
  258. this.info.paTotal+=Number(task.qty);
  259. // this.info.location=task.plantolocation;
  260. },
  261. updateInfo(task){
  262. this.info.name=task.skudescrc;
  263. this.info.paTotal-=Number(task.qty);
  264. // this.info.location=task.plantolocation;
  265. },
  266. getPaTaskByTraceInOrCustomerOrAsnOrNull() {
  267. let _this=this;
  268. _this.clearData();
  269. let url = '{{url('store/handInStorage/getPaTaskByTraceInOrCustomerOrAsnOrNull')}}';
  270. window.axios.post(url, {trackNumber:this.info.trackNumber,barCode:null})
  271. .then(res => {
  272. if (res.data.success) {
  273. this.tasks = res.data.data;
  274. this.$forceUpdate();
  275. setTimeout(function (){
  276. this.height=window.screen.availHeight;
  277. document.getElementById('cardTable').style.height=this.height*0.35+'px';
  278. },10)
  279. return;
  280. }
  281. this.tasks=[];
  282. window.tempTip.setDuration(3000);
  283. window.tempTip.show(res.data.data);
  284. window.tempTip.showErrorAudio();
  285. }).catch(err => {
  286. this.tasks=[];
  287. window.tempTip.setDuration(3000);
  288. window.tempTip.show("网络错误:" + err);
  289. window.tempTip.showErrorAudio();
  290. })
  291. },
  292. getTsk() {
  293. let _this=this;
  294. _this.clearChecked();
  295. _this.clearData();
  296. if (!this.info.barCode)return;
  297. if (!this.info.trackNumber){
  298. window.tempTip.setDuration(3000);
  299. window.tempTip.show('容器号必填');
  300. return;
  301. }
  302. let url = '{{url('store/handInStorage/getTsk')}}';
  303. window.axios.post(url, {trackNumber:this.info.trackNumber,barCode: this.info.barCode})
  304. .then(res => {
  305. if (res.data.success) {
  306. this.tasks = res.data.data;
  307. this.invLots = res.data.inv;
  308. if (this.invLots.length==0)this.mes='库内暂无该商品库存信息,请自行选定上架库位';
  309. this.$forceUpdate();
  310. setTimeout(function () {
  311. document.getElementById("task_0").checked=true;
  312. let element={};
  313. element.checked=true;
  314. _this.checked(1,_this.tasks[0],element)
  315. _this.tasks.forEach(function (task,i){
  316. if (i==0)return;
  317. if (task.customerid == _this.tasks[0].customerid
  318. && task.plantolotnum == _this.tasks[0].plantolotnum
  319. && task.sku == _this.tasks[0].sku){
  320. document.getElementById("task_"+i).checked=true;
  321. _this.checked(1,_this.tasks[i],element);
  322. }
  323. })
  324. // document.getElementById('cardTable').remove();
  325. document.getElementById('cardTable').style.height=null;
  326. }, 100);
  327. return;
  328. }
  329. this.tasks=[];
  330. this.info.barCode='';
  331. document.getElementById("barCode").focus();
  332. window.tempTip.setDuration(3000);
  333. window.tempTip.show(res.data.data);
  334. window.tempTip.showErrorAudio();
  335. }).catch(err => {
  336. this.tasks=[];
  337. window.tempTip.setDuration(3000);
  338. window.tempTip.show("网络错误:" + err);
  339. window.tempTip.showErrorAudio();
  340. })
  341. },
  342. clearChecked(){
  343. this.checkData=[];
  344. this.info.paTotal=0;//设置上架总数
  345. $('input[type=checkbox]').each(function() {
  346. let self = $(this);
  347. self.prop('checked', false);
  348. });
  349. },
  350. clearInfo(){
  351. this.info.name='';
  352. this.info.amount='';
  353. this.info.barCode='';
  354. this.info.location='';
  355. this.info.paTotal='';
  356. },
  357. ensure() {
  358. this.errors={};//初始errors状态
  359. this.verifyInfoAndCheckData();
  360. if (JSON.stringify(this.errors) !== '{}')return;
  361. this.ensureSubmit();
  362. },
  363. ensureSubmit() {
  364. tempTip.setDuration(99999);
  365. tempTip.waitingTip('提交中');
  366. let url = '{{url('store/handInStorage/handFluxPa')}}';
  367. if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info,checkData:this.checkData})
  368. .then(res=>{
  369. if (res.data.success){
  370. tempTip.setDuration(3000);
  371. tempTip.cancelWaitingTip();
  372. tempTip.showSuccess(res.data.data);
  373. // this.info={};
  374. this.clearInfo();
  375. this.checkData=[];
  376. this.tasks=[];
  377. this.invLots=[];
  378. this.$forceUpdate()
  379. document.getElementById("trackNumber").select();
  380. return;
  381. }
  382. tempTip.setDuration(3000);
  383. tempTip.cancelWaitingTip();
  384. tempTip.show(res.data.data);
  385. tempTip.showErrorAudio();
  386. }).catch(err=>{
  387. tempTip.setDuration(3000);
  388. tempTip.cancelWaitingTip();
  389. tempTip.show("网络错误:"+err);
  390. tempTip.showErrorAudio();
  391. })
  392. },
  393. cancel() {
  394. setTimeout(function () {
  395. window.location.reload();
  396. document.getElementById("trackNumber").focus();
  397. }, 100);
  398. },
  399. enterVal(e) {
  400. let index = this.element.indexOf(e.target.id) + 1;
  401. let element = document.getElementById(this.element[index]);
  402. if (element) element.focus();
  403. e.preventDefault();
  404. return false;
  405. },
  406. verifyInfoAndCheckData(){
  407. let error = {};
  408. // if (!this.info.trackNumber) error.trackNumber = ["容器号必填"];
  409. if (!this.info.barCode) error.barCode = ["条码必填"];
  410. if (!this.info.amount) error.amount = ["上架数量必填"];
  411. if (Number(this.info.paTotal)!==0 && Number(this.info.amount)>Number(this.info.paTotal)) error.amount = ["上架数量不能超过上架总数必填"];
  412. if (!this.info.location) error.location = ["目标库位必填"];
  413. if (JSON.stringify(error) !== '{}') {this.errors = error;}
  414. },
  415. },
  416. });
  417. </script>
  418. @stop