receiveDetailPage.blade.php 18 KB

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