receiveDetailPage.blade.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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 col-sm-12">
  6. <div class="card-header text-center bg-transparent" id="header_title">
  7. <span class="font-weight-bold h3">收货</span>
  8. </div>
  9. <div class="">
  10. <div class="form-group row m-1">
  11. <span class="font-weight-bold text-sm-right" v-if="asnno">
  12. @{{ asnno }}_已收/待收数量: <span class="h5">@{{ asn_receivedqty }}/@{{ asn_expectedqty }}</span></span>
  13. </div>
  14. <div class="form-group row m-1 mt-1">
  15. <span class="text-right">
  16. <span class="fa fa-search fa-lg" aria-hidden="true" @click="selectAsnDetails()"></span>
  17. <label for="sku" class="text-right text-info font-weight-bold h5">产品*:</label>
  18. </span>
  19. <input type="text" class="form-control form-control-sm col-8 font-weight-bold" id="sku" autocomplete="off" placeholder="输入商品sku或商品条码"
  20. :class="errors.sku ? 'is-invalid' : ''" @keydown.enter="enterVal($event)" v-model="info.sku" @blur="checkedSku()">
  21. <span class="invalid-feedback offset-3" role="alert" v-if="errors.sku">
  22. <strong>@{{ errors.sku[0] }}</strong>
  23. </span>
  24. </div>
  25. <div v-if="isInit">
  26. <div class="form-group row m-1">
  27. <label for="name" class="text-right h5">品名:</label>
  28. <span id="name">@{{ info.name }}</span>
  29. </div>
  30. <div class="form-group row m-1">
  31. <label for="quantity" class="text-right h5">已收/预收数量:</label>
  32. <span>&nbsp;&nbsp;&nbsp;</span>
  33. <span id="quantity" class="font-weight-bold">@{{ info.receivedqty?info.receivedqty:0 }}/@{{ info.expectedqty?info.expectedqty:0 }}</span>
  34. </div>
  35. <div class="form-group row m-1">
  36. <label for="amount" class="text-right text-info font-weight-bold h5">实收数量*:</label>
  37. <input type="number" class="form-control form-control-sm col-8 font-weight-bold" id="amount" autocomplete="off"
  38. :class="errors.amount ? 'is-invalid' : ''" v-model="info.amount" @keydown.enter="enterVal($event)">
  39. <span class="invalid-feedback offset-3" role="alert" v-if="errors.amount">
  40. <strong>@{{ errors.amount[0] }}</strong>
  41. </span>
  42. </div>
  43. {{-- <div class="form-group row m-1">--}}
  44. {{-- <label for="location" class="text-right">目标库位:</label>--}}
  45. {{-- <input type="text" class="form-control form-control-sm col-8" id="location" autocomplete="off"--}}
  46. {{-- @keydown.enter="enterVal($event)" v-model="info.location">--}}
  47. {{-- </div>--}}
  48. <div class="form-group row m-1">
  49. <label for="trackNumber" class="text-right text-info font-weight-bold h5">容器号*:</label>
  50. <input type="text" class="form-control form-control-sm col-8 font-weight-bold" id="trackNumber" autocomplete="off"
  51. @keydown.enter="enterVal($event)" :class="errors.trackNumber ? 'is-invalid' : ''" v-model="info.trackNumber">
  52. <span class="invalid-feedback offset-3" role="alert" v-if="errors.trackNumber">
  53. <strong>@{{ errors.trackNumber[0] }}</strong>
  54. </span>
  55. </div>
  56. </div>
  57. <div style="overflow: auto;overflow-x: hidden" id="cardTable" v-if="!isInit">
  58. <table class="table-sm table-striped table-bordered table-hover mb-3"
  59. style="background: rgb(255, 255, 255);">
  60. <tr v-for="(asnDetail,i) in asnDetails" @click="selectTrOne(i,asnDetail.sku)" :class="selectTr===i+1?'focusing' : ''">
  61. <td style="filter:grayscale(30%);">
  62. <div>
  63. <div style="transform:scale(1)" class="pl-0">
  64. <span><span class="text-danger font-weight-bold h5">产品:</span><span class="text-black h5">@{{ asnDetail.sku }}</span></span>
  65. <span><span class="font-weight-bold h5">行号:</span><span class="text-lowercase h5" >@{{ asnDetail.asnlineno }}</span></span>
  66. <span class="text-right float-right h5">选中:<input type="checkbox" @click="checked(asnDetail)"></span>
  67. <span><span class="text-lowercase h5">品名:</span><span class="text-lowercase h5">@{{ asnDetail.skudescrc }} </span></span>
  68. <span><span class="text-black h5">预期数量:</span><span class="text-black-50 h5">@{{ asnDetail.expectedqty }}</span></span>
  69. <span><span class="text-black h5">已收数量:</span><span class="text-black-50 h5">@{{ asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each }}</span></span>
  70. </div>
  71. </div>
  72. </td>
  73. </tr>
  74. </table>
  75. </div>
  76. </div>
  77. <div class="border-top border-dark" v-if="basSku.lot_id">
  78. <div class="form-group row">
  79. <span class="col-6" v-if="basSku.lot_id.lotkey01==='Y'">
  80. <label for="lotatt01" class=" text-right text-info font-weight-bold h5">生产日期:</label><br>
  81. <input type="date" class="form-control form-control-sm h5 font-weight-bold"
  82. :class="errors.lotatt01 ? 'is-invalid' : ''" id="lotatt01" v-model="info.lotatt01">
  83. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt01">
  84. <strong>@{{ errors.lotatt01[0] }}</strong>
  85. </span>
  86. </span>
  87. <span class="col-6" v-if="basSku.lot_id.lotkey02==='Y'">
  88. <label for="lotatt02" class=" text-right text-info font-weight-bold h5">失效日期:</label>
  89. <input type="date" class="form-control form-control-sm h5 font-weight-bold"
  90. :class="errors.lotatt02 ? 'is-invalid' : ''" id="lotatt02" v-model="info.lotatt02">
  91. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt02">
  92. <strong>@{{ errors.lotatt02[0] }}</strong>
  93. </span>
  94. </span>
  95. </div>
  96. <div class="form-group row">
  97. <span class="col-6" v-if="basSku.lot_id.lotkey04==='Y'">
  98. <label for="lotatt04" class=" text-right text-info font-weight-bold h5">批号:</label><br>
  99. <input type="text" class="form-control form-control-sm h5 font-weight-bold" :class="errors.lotatt04 ? 'is-invalid' : ''" autocomplete="off"
  100. id="lotatt04" v-model="info.lotatt04">
  101. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt04">
  102. <strong>@{{ errors.lotatt04[0] }}</strong>
  103. </span>
  104. </span>
  105. <span class="col-6" v-if="basSku.lot_id.lotkey05==='Y'">
  106. <label for="lotatt05" class=" text-right text-info font-weight-bold h5">属性仓:</label>
  107. <select class="form-control form-control-sm h5 font-weight-bold" :class="errors.lotatt05 ? 'is-invalid' : ''"
  108. id="lotatt05" v-model="info.lotatt05">
  109. <option v-for="(attributeLocation,i) in attributeLocations" :value="attributeLocation.code">@{{ attributeLocation.codename_c }}</option>
  110. </select>
  111. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt05">
  112. <strong>@{{ errors.lotatt05[0] }}</strong>
  113. </span>
  114. </span>
  115. </div>
  116. <div class="form-group row">
  117. <span class="col-6" v-if="basSku.lot_id.lotkey08==='Y'">
  118. <label for="lotatt08" class=" text-right text-info font-weight-bold h5">质量状态:</label>
  119. <select class="form-control form-control-sm h5 font-weight-bold"
  120. :class="errors.lotatt08 ? 'is-invalid' : ''" id="lotatt08" v-model="info.lotatt08">
  121. <option v-for="(quality,i) in qualityStatus" :value="quality.code">@{{ quality.codename_c }}</option>
  122. </select>
  123. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt08">
  124. <strong>@{{ errors.lotatt08[0] }}</strong>
  125. </span>
  126. </span>
  127. <span class="col-6" v-if="basSku.lot_id.lotkey03==='Y'">
  128. <label for="lotatt03" class=" text-right text-info font-weight-bold h5">入库日期:</label>
  129. <input type="date" class="form-control form-control-sm h5 font-weight-bold"
  130. :class="errors.lotatt03 ? 'is-invalid' : ''" id="lotatt03" v-model="info.lotatt03">
  131. <span class="invalid-feedback offset-3" role="alert" v-if="errors.lotatt03">
  132. <strong>@{{ errors.lotatt03[0] }}</strong>
  133. </span>
  134. </span>
  135. </div>
  136. </div>
  137. <div class="card-footer bg-transparent">
  138. <button type="button" id="confirm" class="btn btn-md btn-success font-weight-bold float-right" @click="ensure()">确定</button>
  139. <button type="button" id="cancel" class="btn btn-md btn-danger font-weight-bold float-left" @click="cancel()">取消</button>
  140. </div>
  141. </div>
  142. </div>
  143. @stop
  144. @section('lastScript')
  145. <script type="text/javascript">
  146. new Vue({
  147. el:"#container",
  148. data:{
  149. asnno:'{!! $asnno !!}',
  150. customerid:'{!! $customerid !!}',
  151. asn_expectedqty:'{!! $asn_expectedqty !!}',
  152. asn_receivedqty:'{!! $asn_receivedqty !!}',
  153. qualityStatus:{!! $qualityStatus !!},
  154. attributeLocations:{!! $attributeLocations !!},
  155. basSku:{},
  156. permissionList:[ //允许聚焦许可列表
  157. "sku","amount","trackNumber"
  158. ],
  159. asnDetails:[],
  160. info:{},
  161. errors:{},
  162. isAndroid:false,
  163. isInit:true,
  164. element:[
  165. "sku","amount","trackNumber"
  166. ],
  167. selectTr:'',
  168. },
  169. mounted(){
  170. if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
  171. this.pageInit();
  172. $("#container").removeClass("d-none");
  173. document.getElementById("sku").focus();
  174. },
  175. methods:{
  176. //页面初始化
  177. pageInit(){
  178. if (!this.isAndroid)return;
  179. let element = document.getElementById("navbarSupportedContent").parentElement;
  180. element.className = "row";
  181. element.children[0].className += " col-5";
  182. element.innerHTML = element.children[0].outerHTML;
  183. let e1 = document.getElementById("menu");
  184. let e2 = document.getElementById("demand-div");
  185. if (e1)e1.remove();
  186. if (e2)e2.remove();
  187. document.getElementById('app').firstElementChild.style.display = 'none';
  188. },
  189. selectTrOne(i,sku){
  190. if (this.selectTr===i+1){
  191. this.selectTr=0
  192. }else {
  193. this.selectTr=i+1;
  194. }
  195. },
  196. checkedSku(){
  197. if (!this.info.sku)return;
  198. let url = '{{url('store/handInStorage/getBasSkuWithLot')}}';
  199. window.axios.post(url,{asnno:this.asnno,customerid:this.customerid,sku:this.info.sku})
  200. .then(res=>{
  201. if (res.data.success){
  202. this.fillInfo(res.data.asnDetail);
  203. if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
  204. if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
  205. this.basSku=res.data.basSku;
  206. this.$forceUpdate()
  207. }else {
  208. this.clearInfo();
  209. document.getElementById("sku").focus();
  210. window.tempTip.setDuration(2000);
  211. window.tempTip.show(res.data.data);
  212. window.tempTip.showErrorAudio();
  213. }
  214. }).catch(err=>{
  215. window.tempTip.setDuration(2000);
  216. window.tempTip.show("网络错误:"+err);
  217. window.tempTip.showErrorAudio();
  218. })
  219. },
  220. checked(asnDetail){
  221. this.isInit=true;
  222. this.fillInfo(asnDetail);
  223. let url = '{{url('store/handInStorage/getBasSkuWithLot')}}';
  224. window.axios.post(url,{asnno:this.asnno,customerid:this.customerid,sku:this.info.sku})
  225. .then(res=>{
  226. if (res.data.success){
  227. if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
  228. if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
  229. this.basSku=res.data.basSku;
  230. this.$forceUpdate()
  231. }else {
  232. window.tempTip.setDuration(2000);
  233. window.tempTip.show(res.data.data);
  234. window.tempTip.showErrorAudio();
  235. }
  236. }).catch(err=>{
  237. window.tempTip.setDuration(2000);
  238. window.tempTip.show("网络错误:"+err);
  239. window.tempTip.showErrorAudio();
  240. })
  241. },
  242. clearInfo(){
  243. this.info.sku='';
  244. this.info.name='';
  245. this.info.expectedqty=0;
  246. this.info.receivedqty=0;
  247. this.info.amount='';
  248. this.info.asnlineno='';
  249. this.info.lotatt01='';
  250. this.info.lotatt02='';
  251. this.info.lotatt03='';
  252. this.info.lotatt04='';
  253. this.info.lotatt05='';
  254. this.info.lotatt08='';
  255. this.$forceUpdate()
  256. },
  257. fillInfo(asnDetail){
  258. this.info.sku=asnDetail.sku;
  259. this.info.name=asnDetail.skudescrc;
  260. this.info.expectedqty=asnDetail.expectedqty?asnDetail.expectedqty:asnDetail.expectedqty_each;
  261. this.info.receivedqty=asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each;
  262. this.info.amount=Number(this.info.expectedqty)-Number(this.info.receivedqty);
  263. this.info.asnlineno=asnDetail.asnlineno;
  264. },
  265. checkInfo(){
  266. let error = {};
  267. if (!this.info.sku)error.sku = ["条码必填"];
  268. if (!this.info.amount)error.amount = ["实收数量必填"];
  269. if (this.info.amount==0)error.amount = ["实收数量不可为零"];
  270. if (!this.info.trackNumber)error.trackNumber = ["容器号必填"];
  271. if (this.info.amount && ((Number(this.info.amount)+Number(this.info.receivedqty))>Number(this.info.expectedqty)))error.amount = ["总数不能超过预期数"];
  272. if (this.basSku.lot_id && this.basSku.lot_id.lotkey01==='Y' && !this.info.lotatt01) error.lotatt01=["生产日期为选"];
  273. if (this.basSku.lot_id && this.basSku.lot_id.lotkey02==='Y' && !this.info.lotatt02) error.lotatt02=["失效日期为选"];
  274. if (this.basSku.lot_id && this.basSku.lot_id.lotkey03==='Y' && !this.info.lotatt03) error.lotatt03=["入库日期为选"];
  275. if (this.basSku.lot_id && this.basSku.lot_id.lotkey04==='Y' && !this.info.lotatt04) error.lotatt04=["批号未填"];
  276. if (this.basSku.lot_id && this.basSku.lot_id.lotkey05==='Y' && !this.info.lotatt05) error.lotatt05=["属性仓未选"];
  277. if (this.basSku.lot_id && this.basSku.lot_id.lotkey08==='Y' && !this.info.lotatt08) error.lotatt08=["质量状态未选"];
  278. if (JSON.stringify(error)!=='{}'){this.errors = error;}
  279. },
  280. enterVal(e){
  281. let index = this.element.indexOf(e.target.id)+1;
  282. let element = document.getElementById(this.element[index]);
  283. if (element){
  284. element.focus();
  285. element.select();
  286. }
  287. e.preventDefault();
  288. return false;
  289. },
  290. selectAsnDetails(){
  291. this.isInit=false;
  292. this.info={};
  293. let url = '{{url('store/handInStorage/selectAsnDetails')}}';
  294. window.axios.post(url,{asnno:this.asnno})
  295. .then(res=>{
  296. if (res.data.success){
  297. this.asnDetails=res.data.data;
  298. this.$forceUpdate()
  299. }else {
  300. window.tempTip.setDuration(3000);
  301. window.tempTip.show(res.data.data);
  302. this.isInit=true;
  303. window.tempTip.showErrorAudio();
  304. }
  305. }).catch(err=>{
  306. window.tempTip.setDuration(3000);
  307. window.tempTip.show("网络错误:"+err);
  308. window.tempTip.showErrorAudio();
  309. })
  310. },
  311. ensure(){
  312. this.errors={};//初始errors状态
  313. this.checkInfo();
  314. this.info.customerid=this.customerid;
  315. this.info.asnno=this.asnno;
  316. // if (this.info.trackNumber==''||this.info.trackNumber==null||this.info.trackNumber==undefined)this.info.trackNumber='';
  317. if (this.info.location==''||this.info.location==null||this.info.location==undefined)this.info.location='';
  318. if (this.info.lotatt02==''||this.info.lotatt02==null||this.info.lotatt02==undefined)this.info.lotatt02='';
  319. if (Number(this.info.receivedqty)===Number(this.info.expectedqty)){
  320. window.tempTip.setDuration(2000); window.tempTip.show("收货已完成");
  321. }
  322. if(JSON.stringify(this.errors)!=='{}')return;
  323. this.ensureSubmit();
  324. },
  325. ensureSubmit(){
  326. tempTip.setDuration(99999);
  327. tempTip.waitingTip('提交中');
  328. let url = '{{url('store/handInStorage/fluxHandIn')}}';
  329. if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info})
  330. .then(res=>{
  331. if (res.data.success){
  332. // this.info={};
  333. this.clearInfo();
  334. this.asn_expectedqty=res.data.data.expectedqty;
  335. this.asn_receivedqty=res.data.data.receivedqty;
  336. this.asnDetails=[];
  337. this.$forceUpdate();
  338. tempTip.setDuration(2000);
  339. tempTip.cancelWaitingTip();
  340. tempTip.showSuccess('收货成功');
  341. document.getElementById("sku").focus();
  342. document.getElementById("sku").select();
  343. if (this.asn_expectedqty==this.asn_receivedqty)
  344. window.location.href="{{url('store/handInStorage/receive')}}";
  345. }else {
  346. tempTip.setDuration(3000);
  347. tempTip.cancelWaitingTip();
  348. tempTip.show(res.data.data);
  349. tempTip.showErrorAudio();
  350. }
  351. }).catch(err=>{
  352. tempTip.setDuration(2000);
  353. tempTip.cancelWaitingTip();
  354. tempTip.show("网络错误:"+err);
  355. tempTip.showErrorAudio();
  356. })
  357. },
  358. cancel(){
  359. setTimeout(function () {
  360. window.location.reload();
  361. document.getElementById("sku").focus();
  362. },100);
  363. },
  364. },
  365. });
  366. </script>
  367. @stop