receiveDetailPage.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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?info.receivedqty:0 }}/@{{ info.expectedqty?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","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. if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
  197. if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
  198. this.basSku=res.data.basSku;
  199. this.$forceUpdate()
  200. return;
  201. }
  202. this.clearInfo();
  203. window.tempTip.setDuration(2000);
  204. window.tempTip.show(res.data.data);
  205. }).catch(err=>{
  206. window.tempTip.setDuration(2000);
  207. window.tempTip.show("网络错误:"+err);
  208. })
  209. },
  210. checked(asnDetail){
  211. this.isInit=true;
  212. this.fillInfo(asnDetail);
  213. let url = '{{url('store/handInStorage/getBasSkuWithLot')}}';
  214. window.axios.post(url,{asnno:this.asnno,customerid:this.customerid,sku:this.info.sku})
  215. .then(res=>{
  216. if (res.data.success){
  217. if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
  218. if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
  219. this.basSku=res.data.basSku;
  220. this.$forceUpdate()
  221. return;
  222. }
  223. window.tempTip.setDuration(2000);
  224. window.tempTip.show(res.data.data);
  225. }).catch(err=>{
  226. window.tempTip.setDuration(2000);
  227. window.tempTip.show("网络错误:"+err);
  228. })
  229. },
  230. clearInfo(){
  231. this.info.name='';
  232. this.info.expectedqty=0;
  233. this.info.receivedqty=0;
  234. this.$forceUpdate()
  235. },
  236. fillInfo(asnDetail){
  237. this.info.sku=asnDetail.sku;
  238. this.info.name=asnDetail.skudescrc;
  239. this.info.expectedqty=asnDetail.expectedqty;
  240. this.info.receivedqty=asnDetail.receivedqty;
  241. this.info.amount=Number(this.info.expectedqty)-Number(this.info.receivedqty);
  242. this.info.asnlineno=asnDetail.asnlineno;
  243. },
  244. checkInfo(){
  245. let error = {};
  246. if (!this.info.sku)error.sku = ["条码必填"];
  247. if (!this.info.amount)error.amount = ["实收数量必填"];
  248. if (!this.info.trackNumber)error.trackNumber = ["容器号必填"];
  249. if (this.info.amount && ((Number(this.info.amount)+Number(this.info.receivedqty))>Number(this.info.expectedqty)))error.amount = ["总数不能超过预期数"];
  250. if (this.basSku.lot_id && this.basSku.lot_id.lotkey01==='Y' && !this.info.lotatt01) error.lotatt01=["生产日期为选"];
  251. if (this.basSku.lot_id && this.basSku.lot_id.lotkey02==='Y' && !this.info.lotatt02) error.lotatt02=["失效日期为选"];
  252. if (this.basSku.lot_id && this.basSku.lot_id.lotkey03==='Y' && !this.info.lotatt03) error.lotatt03=["入库日期为选"];
  253. if (this.basSku.lot_id && this.basSku.lot_id.lotkey04==='Y' && !this.info.lotatt04) error.lotatt04=["批号未填"];
  254. if (this.basSku.lot_id && this.basSku.lot_id.lotkey05==='Y' && !this.info.lotatt05) error.lotatt05=["属性仓未选"];
  255. if (this.basSku.lot_id && this.basSku.lot_id.lotkey08==='Y' && !this.info.lotatt08) error.lotatt08=["质量状态未选"];
  256. if (JSON.stringify(error)!=='{}'){this.errors = error;}
  257. },
  258. enterVal(e){
  259. let index = this.element.indexOf(e.target.id)+1;
  260. let element = document.getElementById(this.element[index]);
  261. if (element)element.focus();
  262. e.preventDefault();
  263. return false;
  264. },
  265. selectAsnDetails(){
  266. this.isInit=false;
  267. this.info={};
  268. let url = '{{url('store/handInStorage/selectAsnDetails')}}';
  269. window.axios.post(url,{asnno:this.asnno})
  270. .then(res=>{
  271. if (res.data.success){
  272. this.asnDetails=res.data.data;
  273. this.$forceUpdate()
  274. return;
  275. }else {
  276. window.tempTip.setDuration(2000);
  277. window.tempTip.show(res.data.data);
  278. this.isInit=true;
  279. }
  280. }).catch(err=>{
  281. window.tempTip.setDuration(2000);
  282. window.tempTip.show("网络错误:"+err);
  283. })
  284. },
  285. ensure(){
  286. this.errors={};//初始errors状态
  287. this.checkInfo();
  288. this.info.customerid=this.customerid;
  289. this.info.asnno=this.asnno;
  290. // if (this.info.trackNumber==''||this.info.trackNumber==null||this.info.trackNumber==undefined)this.info.trackNumber='';
  291. if (this.info.location==''||this.info.location==null||this.info.location==undefined)this.info.location='';
  292. if (this.info.lotatt02==''||this.info.lotatt02==null||this.info.lotatt02==undefined)this.info.lotatt02='';
  293. if (Number(this.info.receivedqty)===Number(this.info.expectedqty)){
  294. window.tempTip.setDuration(2000); window.tempTip.show("收货已完成");
  295. }
  296. let url = '{{url('store/handInStorage/fluxHandIn')}}';
  297. if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info})
  298. .then(res=>{
  299. if (res.data.success){
  300. window.tempTip.setDuration(2000);
  301. window.tempTip.showSuccess(res.data.data);
  302. this.info={};
  303. this.asnDetails=[];
  304. this.$forceUpdate();
  305. document.getElementById("sku").focus();
  306. return;
  307. }
  308. window.tempTip.setDuration(2000);
  309. window.tempTip.show(res.data.data);
  310. }).catch(err=>{
  311. window.tempTip.setDuration(2000);
  312. window.tempTip.show("网络错误:"+err);
  313. })
  314. },
  315. cancel(){
  316. setTimeout(function () {
  317. window.location.reload();
  318. document.getElementById("sku").focus();
  319. },100);
  320. },
  321. },
  322. });
  323. </script>
  324. @stop