putaway.blade.php 27 KB

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