receiveDetailPage.blade.php 19 KB

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