improvedWrehousingDetail.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <template>
  2. <view @click='hidden' class="warp">
  3. <view class="top">
  4. <view class="top-left">{{warehouseName}}</view>
  5. <view>{{binNumber}}仓位</view>
  6. </view>
  7. <view class="content">
  8. <view class="row">
  9. <view class="left">任务编号</view>
  10. <view @click='inOutShow=true'>{{detailData.inOutTaskNo ? detailData.inOutTaskNo : "请选择任务编号"}}</view>
  11. <u-picker :range="inOutNoList" range-key="inOutTaskNo" @confirm='inOutChange' v-model="inOutShow" mode="selector">
  12. </u-picker>
  13. </view>
  14. <view class="row row-bottom">
  15. <view class="left">合同编号</view>
  16. <!-- <view @click='slectcontractNo'>{{detailData.contractNo}}</view> -->
  17. <input v-model='detailData.contractNo' class="right-bottom" placeholder="暂未获取到合同编号" disabled></input>
  18. </view>
  19. <view class="row">
  20. <view class="left">货名</view>
  21. <view class="right">{{detailData.goodsName}}</view>
  22. </view>
  23. <view class="row">
  24. <view class="left">类型</view>
  25. <view @click='show1=true'>{{detailData.type}}</view>
  26. <u-picker :range="typeList" range-key="type" @confirm='typePicker($event)' v-model="show1"
  27. mode="selector">
  28. </u-picker>
  29. </view>
  30. <view class="row row-bottom">
  31. <view class="left">毛重(吨)</view>
  32. <input type="digit" @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  33. placeholder="输入毛重"></input>
  34. </view>
  35. <view class="row row-bottom">
  36. <view class="left">皮重(吨)</view>
  37. <input type="digit" @input='calculate' v-model='detailData.tare' class="right-bottom" placeholder="输入皮重"></input>
  38. </view>
  39. <view class="row row-bottom">
  40. <view class="left">扣重(吨)</view>
  41. <input type="digit" @input='calculate' v-model='detailData.deductionWeight' class="right-bottom"
  42. placeholder="输入扣重"></input>
  43. </view>
  44. <view class="row row-bottom">
  45. <view class="left">净重(吨)</view>
  46. <input type="number" @input='' v-model='netWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  47. :disabled="true"></input>
  48. </view>
  49. <view class="row row-bottom">
  50. <view class="left">扣款(元/吨)</view>
  51. <input type="digit" @input='' v-model='detailData.deductionAmount' class="right-bottom" placeholder="输入扣款"></input>
  52. </view>
  53. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  54. <view class="left">扣重比</view>
  55. <input type="digit" @input='' v-model='detailData.buckleWeightRatio' class="right-bottom" placeholder="输入扣重比"
  56. @input="pureWeightCount"></input>
  57. </view>
  58. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  59. <view class="left">干粮水分(%)</view>
  60. <input type="digit" @input='' v-model='detailData.solidGrainWater' class="right-bottom" placeholder="输入干粮水分占比"
  61. @input="pureWeightCount"></input>
  62. </view>
  63. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  64. <view class="left">潮粮水分(%)</view>
  65. <input type="digit" @input='' v-model='detailData.tidalGrainWater' class="right-bottom" placeholder="输入潮粮水分占比"
  66. @input="pureWeightCount"></input>
  67. </view>
  68. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  69. <view class="left">纯重(吨)</view>
  70. <input type="digit" @input='calculate' v-model='detailData.pureWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  71. :disabled="true"></input>
  72. </view>
  73. <view class="row">
  74. <view class="left">品级</view>
  75. <view @click='show3=true'>{{detailData.grade}}</view>
  76. <u-picker :range="pjList" range-key="grade" @confirm='handlerPicker($event)' v-model="show3"
  77. mode="selector">
  78. </u-picker>
  79. </view>
  80. <view class="row">
  81. <view class="left">经办人</view>
  82. <view @click='show6=true'>{{detailData.agent}}</view>
  83. <u-picker :range="handlerList" range-key="staffName" @confirm='handlerPicker($event)' v-model="show6"
  84. mode="selector">
  85. </u-picker>
  86. </view>
  87. <view class="row">
  88. <view class="left">入库日期</view>
  89. <view @click='show4=true'>{{detailData.inOutDate}}</view>
  90. <u-picker v-model="show4" mode="time" @confirm='dateChange($event)' :params="params">
  91. </u-picker>
  92. </view>
  93. <view class="row row-bottom">
  94. <view class="left">入库类型</view>
  95. <input v-model='detailData.inOutType' class="right-bottom" @click="show5=true" :disabled="isSelectType"></input>
  96. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  97. v-model="show5" mode="selector">
  98. </u-picker>
  99. </view>
  100. <view class="row">
  101. <view class="left">入库方式</view>
  102. <view @click='show8=true'>{{detailData.outType?detailData.outType:'汽运'}}</view>
  103. <u-picker v-model="show8" mode="selector" range-key="name" :range="multiSelector" @confirm='outtypeChange($event)'>
  104. </u-picker>
  105. </view>
  106. <view class="row row-bottom" v-if="detailData.outType!='火运' && detailData.outType!='散船'">
  107. <view class="left">车牌号</view>
  108. <!-- 他运合同车牌号输入 -->
  109. <input v-model='detailData.carNo' @click.stop="handleShowKeyboard" disabled="true" class="right-bottom" placeholder="请输入车牌号" v-if="!showCar"></input>
  110. <master-keyboard ref="keyboard" keyboardtype="car" :randomNumber="true" :newCar="false" :defaultValue="detailData.carNo" @keyboardClick="handleClick"></master-keyboard>
  111. <!-- <input v-model='detailData.carNo' class="right-bottom" placeholder="请输入车牌号" v-if="!showCar"></input> -->
  112. <!-- <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view> -->
  113. <!-- 自运合同车牌号需下拉 -->
  114. <view v-if="!carno" v-show="showCar" @click="carno = true">{{detailData.carNo? detailData.carNo+'('+detailData.tranCarNo+')':"请选择车牌号"}}</view>
  115. <u-picker :range="carList" range-key="carNo1" @confirm='carPicker($event)' v-model="carno" mode="selector">
  116. </u-picker>
  117. </view>
  118. <view class="row row-bottom" v-if="detailData.outType=='火运'">
  119. <view class="left">车号</view>
  120. <input v-model='detailData.carNo' class="right-bottom" placeholder="请输入车号"></input>
  121. </view>
  122. <view class="row row-bottom" v-if="detailData.outType=='散船'">
  123. <view class="left">船名</view>
  124. <input v-model='detailData.carNo' class="right-bottom" placeholder="请输入船名"></input>
  125. </view>
  126. <view v-if='detailData.outType=="集装箱船"||!detailData.outType||detailData.outType=="汽运"'
  127. class="row row-bottom">
  128. <view class="left">箱号</view>
  129. <input v-model='detailData.boxNo' class="right-bottom" placeholder="请输入箱号" type="digit"></input>
  130. <input v-model='detailData.boxNoOther' class="right-bottom" placeholder="请输入箱号" type="digit"></input>
  131. </view>
  132. <view v-if='!detailData.outType||detailData.outType=="汽运" || detailData.outType=="集装箱船"' class="row row-bottom">
  133. <view class="left">封号</view>
  134. <input v-model='detailData.titleNo' class="right-bottom"
  135. placeholder="请输入封号" type="digit"></input>
  136. <input v-model='detailData.titleNoOther' class="right-bottom"
  137. placeholder="请输入封号" type="digit"></input>
  138. </view>
  139. <view v-if='detailData.outType=="火运"' class="row row-bottom">
  140. <view class="left">车厢号</view>
  141. <input v-model='detailData.boxNo' @input="toUpperCase" class="right-bottom" placeholder="请输入车厢号" type="digit"></input>
  142. <input v-model='detailData.boxNoOther' @input="toUpperCase1" class="right-bottom" placeholder="请输入车厢号" type="digit"></input>
  143. </view>
  144. <view v-if='detailData.outType=="散船"' class="row row-bottom">
  145. <view class="left">仓位号</view>
  146. <input v-model='detailData.binNo' class="right-bottom" placeholder="请输入仓位号"></input>
  147. </view>
  148. <view class="row row-bottom has-btn">
  149. <view class="left">成本(元/吨)</view>
  150. <input type="digit" v-if="detailData.inOutType=='采购入库'" v-model='detailData.cost' class="right-bottom"
  151. placeholder="自动获取" :disabled="isEditCB"></input>
  152. <u-button class="edit-btn" hover-class="none" @click="editCB">编辑</u-button>
  153. </view>
  154. <view class="row row-bottom has-btn">
  155. <view class="left">运费(元/吨)</view>
  156. <input type="digit" @input='' v-model='detailData.freight' :disabled="isEditYF" class="right-bottom"
  157. placeholder="自动获取"></input>
  158. <u-button class="edit-btn" hover-class="none" @click="editYF">编辑</u-button>
  159. </view>
  160. </view>
  161. <view class="content2">
  162. <view class="left">上传磅单</view>
  163. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1" :file-list="imgUrl"
  164. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  165. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  166. </view>
  167. <view class="content1">
  168. <view class="title">
  169. 质检数据(选填)
  170. </view>
  171. <view class="row row-bottom">
  172. <view class="left">质检员</view>
  173. <input v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  174. placeholder="输入质检员姓名"></input>
  175. </view>
  176. <view class="row row-bottom">
  177. <view class="left">水分(%)</view>
  178. <input type="digit" v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  179. placeholder="输入水分占比"></input>
  180. </view>
  181. <view class="row row-bottom" >
  182. <view class="left">容重(克/升)</view>
  183. <input type="digit" v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  184. placeholder="输入容重"></input>
  185. </view>
  186. <view class="row row-bottom">
  187. <view class="left">热损伤(%)</view>
  188. <input type="digit" v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  189. placeholder="输入热损伤占比"></input>
  190. </view>
  191. <view class="row row-bottom">
  192. <view class="left">杂质(%)</view>
  193. <input type="digit" v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  194. placeholder="输入杂质占比"></input>
  195. </view>
  196. <view class="row row-bottom">
  197. <view class="left">霉变粒(%)</view>
  198. <input type="digit" v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  199. placeholder="输入霉变粒占比"></input>
  200. </view>
  201. <view class="row row-bottom">
  202. <view class="left">不完善粒(%)</view>
  203. <input type="digit" v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  204. placeholder="输入不完善粒占比"></input>
  205. </view>
  206. </view>
  207. <u-toast ref="uToast" />
  208. <view class="bottom-btn">
  209. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  210. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  211. </view>
  212. </view>
  213. </template>
  214. <script>
  215. import {
  216. mapState
  217. } from 'vuex';
  218. import upload from '@/components/upload.vue';
  219. import helper from '@/common/helper.js';
  220. export default {
  221. components: {
  222. upload
  223. },
  224. data() {
  225. return {
  226. isSelectType:true,
  227. imgUrl: [],
  228. show: false,
  229. show1: false,
  230. show2: false,
  231. show3: false,
  232. show4: false,
  233. show5: false,
  234. show6: false,
  235. isPC: true,
  236. params: {
  237. year: true,
  238. month: true,
  239. day: true,
  240. },
  241. isEditCB: true,
  242. isEditYF: true,
  243. warehouseName: '',
  244. binNumber: '',
  245. multiSelector:[
  246. {name:'汽运',value:'0'},
  247. {name:'火运',value:'1'},
  248. {name:'集装箱船',value:'2'},
  249. {name:'散船',value:'3'},
  250. ],
  251. show8:false,
  252. typeList: [{
  253. type: "干粮"
  254. },
  255. {
  256. type: "潮粮"
  257. }
  258. ],
  259. pjList: [{
  260. grade: "一等品"
  261. },
  262. {
  263. grade: "二等品"
  264. },
  265. {
  266. grade: "三等品"
  267. },
  268. {
  269. grade: "等外"
  270. }
  271. ],
  272. handlerList: [],
  273. warehousingTypeList: [{constValue:'移库入库'},{constValue:'退库'}],
  274. action: this.$uploadUrl,
  275. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  276. btnLoading: false, //防止重复点击
  277. isAdd: true,
  278. netWeight: 0,
  279. inOutDate1: "",
  280. detailData: {
  281. outType:'汽运',
  282. contractNo: "请选择合同编号",
  283. carNo: '',
  284. type: "干粮",
  285. goodsName: "",
  286. inOutDate: '请输入库日期',
  287. grade: "一等品",
  288. agent: '请选择经办人',
  289. inOutType: '请选择入库类型',
  290. deductionWeight: 0,
  291. grossWeight: 0,
  292. tare: 0,
  293. deductionAmount: 0,
  294. netWeight: 0,
  295. warehouseInOutDetail: {},
  296. },
  297. inOutShow:false,
  298. inOutNoList:[],
  299. carList:[],//车牌号下拉
  300. showCar:false,
  301. carno:false,
  302. }
  303. },
  304. computed: {
  305. ...mapState(['hasLogin', 'userInfo']),
  306. },
  307. onLoad(options) {
  308. this.detailData =JSON.parse(options.data)
  309. this.netWeight = this.detailData.netWeight
  310. this.binNumber = this.detailData.binNumber
  311. this.warehouseName = this.detailData.warehouseName
  312. this.compId = helper.erpWarehouse.compId
  313. if(this.detailData.addressUrl){
  314. this.imgUrl.push({
  315. url: this.detailData.addressUrl.split(",")[0]
  316. })
  317. }
  318. },
  319. computed: {
  320. ...mapState(['hasLogin', 'userInfo']),
  321. },
  322. onShow() {
  323. this.getContractNoList();
  324. if (this.detailData.inOutType == '采购入库'&&this.detailData.status!='已暂存') {
  325. // this.detailData.freight = 0
  326. }else if(this.detailData.inOutType == '移库入库'){
  327. this.isSelectType = true
  328. }
  329. if (this.detailData.inOutType == '采购入库') {
  330. this.detailData.inOutTypeKey = 1
  331. } else if (this.detailData.inOutType == '移库入库') {
  332. this.detailData.inOutTypeKey = 3
  333. } else if (this.detailData.inOutType == '暂存入库') {
  334. this.detailData.inOutTypeKey = 4
  335. } else if (this.detailData.inOutType == '贸易服务入库') {
  336. this.detailData.inOutTypeKey = 5
  337. } else if (this.detailData.inOutType == '退库') {
  338. this.detailData.inOutTypeKey = 6
  339. }
  340. // if (!this.detailData.tranCarInfoList) this.detailData.tranCarInfoList = []
  341. // if (!this.detailData.contractNo) {
  342. // this.detailData.contractNo = '请选择合同编号'
  343. // } else {
  344. // if (this.detailData.tranCarInfoList.length == 0) {
  345. // this.isPC = false
  346. // }
  347. // }
  348. // if (!this.detailData.goodsName) {
  349. // this.detailData.goodsName = '货名'
  350. // }
  351. let _data = uni.getStorageSync('erpContractNo').contractNo
  352. console.log("当前合同",uni.getStorageSync('erpContractNo'))
  353. if(_data){
  354. this.detailData.contractNo = _data
  355. }
  356. if(uni.getStorageSync('ContractNoCar')){
  357. this.detailData.carNo = uni.getStorageSync('ContractNoCar')
  358. this.$api.doRequest('get', '/warehouseBaseInfo/selectCost', {
  359. contractNo: this.detailData.contractNo,
  360. carNo:this.detailData.carNo
  361. }).then(res => {
  362. if (res.data.code == 200) {
  363. this.detailData.cost = res.data.data
  364. }
  365. })
  366. }else{
  367. // this.detailData.carNo = uni.setStorageSync('erpContractNoList')[0].carNo
  368. }
  369. // 获取任务编号列表
  370. this.inOutNo()
  371. //获取经办人
  372. this.getPerson()
  373. },
  374. watch: {
  375. netWeight: function(v) {
  376. this.pureWeightCount()
  377. },
  378. },
  379. methods: {
  380. hidden(){
  381. this.$refs.keyboard.open(false)
  382. },
  383. handleShowKeyboard(){
  384. if(this.$refs.keyboard.open){
  385. this.$refs.keyboard.open(true)//true 键盘显示 false 键盘隐藏
  386. }else{
  387. this.$refs.keyboard[0].open(true)
  388. }
  389. },
  390. handleClick(e){
  391. this.detailData.carNo = e.value //键盘输入值
  392. },
  393. inOutNo(){
  394. this.$api.doRequest('get', '/inOutWarehouseTask/selectInOutWarehouseNo',
  395. {flag:2,warehouseName:this.warehouseName,
  396. agentKey : this.userInfo.id}).then(res => {
  397. this.inOutNoList = res.data.data
  398. // this.detailData.inOutTaskNo = this.inOutNoList[0].inOutTaskNo
  399. // this.detailData.agent = this.inOutNoList[0].agent
  400. // this.detailData.contractNo = this.inOutNoList[0].contractNo
  401. // this.detailData.goodsName = this.inOutNoList[0].goodsName
  402. // this.detailData.grade = this.inOutNoList[0].grade
  403. // this.detailData.inOutType = this.inOutNoList[0].inOutType
  404. //查询所有的合同 进行获取车牌号
  405. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  406. flag: 7,
  407. compId: helper.erpWarehouse.compId,
  408. }).then(res => {
  409. if (res.data.code == 200) {
  410. for(let i = 0 ; i < res.data.data.length ; i++){
  411. // "MYCGYMHLJ2021102401"
  412. if(res.data.data[i].contractNo == this.detailData.contractNo){//如果查到该合同
  413. if(res.data.data[i].deliverType == "1"){//判断自运1,他运2合同
  414. this.showCar = true
  415. }else{
  416. this.showCar = false
  417. }
  418. if(res.data.data[i].tranCarInfoList){
  419. for(var num = 0 ; num < res.data.data[i].tranCarInfoList.length; num++){
  420. res.data.data[i].tranCarInfoList[num].carNo1 = res.data.data[i].tranCarInfoList[num].carNo + '('+res.data.data[i].tranCarInfoList[num].tranCarNo+')'
  421. }
  422. this.carList = res.data.data[i].tranCarInfoList //车牌号下拉列表
  423. }
  424. }
  425. }
  426. }
  427. })
  428. })
  429. },
  430. inOutChange(e){
  431. this.detailData.inOutTaskNo = this.inOutNoList[e[0]].inOutTaskNo
  432. this.detailData.agent = this.inOutNoList[e[0]].agent
  433. this.detailData.contractNo = this.inOutNoList[e[0]].contractNo
  434. this.detailData.goodsName = this.inOutNoList[e[0]].goodsName
  435. this.detailData.grade = this.inOutNoList[e[0]].grade
  436. this.detailData.inOutType = this.inOutNoList[e[0]].inOutType
  437. },
  438. toUpperCase(val){
  439. this.detailData.boxNo = val.detail.value.toUpperCase()
  440. },
  441. toUpperCase1(val){
  442. this.detailData.boxNoOther = val.detail.value.toUpperCase()
  443. },
  444. usestartChange(e){
  445. this.usestart=this.multiSelector1[e].name
  446. },
  447. outtypeChange(e){
  448. this.detailData.outType=this.multiSelector[e].name
  449. },
  450. getContractNoList() {
  451. // this.imgUrl = []
  452. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  453. compId: this.compId,
  454. flag: 7,
  455. }).then(res => {
  456. if (res.data.code == 200) {
  457. for (let i = 0; i < res.data.data.length; i++) {
  458. if (res.data.data[i].contractNo == this.detailData.contractNo) {
  459. if (res.data.data[i].tranCarInfoList) {
  460. this.isPC = true
  461. uni.setStorageSync('erpContractNoCarList', res.data.data[i].tranCarInfoList);
  462. if(this.detailData.carNo){
  463. for(let i = 0 ; i < uni.getStorageSync('erpContractNoCarList').length;i++){
  464. if(uni.getStorageSync('erpContractNoCarList')[i].carNo == this.detailData.carNo)
  465. this.detailData.tranCarNo = uni.getStorageSync('erpContractNoCarList')[i].tranCarNo
  466. }
  467. }
  468. // uni.setStorageSync('erpContractNoList', res.data.data[i].tranCarInfoList);
  469. // this.detailData.tranCarInfoList = res.data.data[i].tranCarInfoList
  470. } else {
  471. this.isPC = false
  472. }
  473. }
  474. }
  475. }
  476. })
  477. },
  478. //计算纯重
  479. pureWeightCount() {
  480. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  481. .detailData.tidalGrainWater) {
  482. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  483. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  484. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  485. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  486. }
  487. },
  488. getPerson() {
  489. this.$api.doRequest('get', '/staff/query/getStaffListByCompId', {
  490. compId: this.compId
  491. }).then(res => {
  492. this.handlerList = res.data.data
  493. })
  494. },
  495. getrkType() {
  496. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  497. constId: 'CON5'
  498. }).then(res => {
  499. this.warehousingTypeList = res.data.data
  500. })
  501. },
  502. contractNopicker(e) {},
  503. typePicker(e) {
  504. console.log(e)
  505. this.detailData.type = this.typeList[e].type
  506. },
  507. pjPicker(e) {
  508. console.log(e)
  509. },
  510. handlerPicker(e) {
  511. console.log(e)
  512. this.detailData.agent = this.handlerList[e].staffName
  513. },
  514. dateChange(e) {
  515. console.log(e)
  516. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute + ":" + e.second
  517. },
  518. warehousingTypePicker(e) {
  519. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  520. if (this.detailData.inOutType == '采购入库') {
  521. this.detailData.inOutTypeKey = 1
  522. } else if (this.detailData.inOutType == '移库入库') {
  523. this.detailData.inOutTypeKey = 3
  524. } else if (this.detailData.inOutType == '暂存入库') {
  525. this.detailData.inOutTypeKey = 4
  526. } else if (this.detailData.inOutType == '贸易服务入库') {
  527. this.detailData.inOutTypeKey = 5
  528. } else if (this.detailData.inOutType == '退库') {
  529. this.detailData.inOutTypeKey = 6
  530. }
  531. let _data = uni.getStorageSync('erpContractNo')==''?{}:uni.getStorageSync('erpContractNo')
  532. if (this.detailData.inOutType == '采购入库') {
  533. this.detailData.freight = 0
  534. }else{this.detailData.freight = uni.getStorageSync('CarFreight')}
  535. },
  536. filterFileType(index, lists) {
  537. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  538. lists.splice(index, 1);
  539. // 当前文件不支持
  540. uni.showModal({
  541. title: '暂不支持当前图片类型',
  542. showCancel: false
  543. });
  544. } else {
  545. this.isAdd = false;
  546. }
  547. },
  548. calculate() {
  549. this.netWeight = (this.detailData.grossWeight - this.detailData.tare - this.detailData.deductionWeight).toFixed(2)
  550. },
  551. getImgUrl(res) {
  552. this.detailData.addressUrl = res
  553. console.log(res)
  554. console.log('------------res-----------')
  555. },
  556. onError(error) {
  557. alert(error)
  558. console.log('------------error-----------')
  559. console.log(error)
  560. },
  561. contractNopicker(e) {
  562. // this.detailData.goodsName=this.contractNoList[e[0]].goodsName
  563. // this.detailData.contractNo=this.contractNoList[e[0]].contractNo
  564. },
  565. binNumberpicker(e) {
  566. this.detailData.binNumber = this.positionList[e[0]].binNumber
  567. },
  568. getWeighingManagement() {
  569. this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  570. id: this.id
  571. }).then(res => {
  572. if (res.data.code == 200) {
  573. console.log(res)
  574. this.detailData = res.data.data
  575. }
  576. })
  577. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  578. id: this.cangId
  579. }).then(res => {
  580. if (res.data.code == 200) {
  581. this.positionList = res.data.data.warehousePositionInfoList
  582. }
  583. })
  584. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  585. compId: '',
  586. flag: 5
  587. }).then(res => {
  588. if (res.data.code == 200) {
  589. this.contractNoList = res.data.data
  590. }
  591. })
  592. },
  593. onProgress(e) {
  594. console.log(e)
  595. },
  596. onRemove(index) {},
  597. editCB() {
  598. this.isEditCB = false
  599. },
  600. editYF() {
  601. this.isEditYF = false
  602. },
  603. submit(num) {
  604. if (!this.detailData.contractNo) {
  605. this.$api.msg('合同编号不能为空')
  606. return
  607. }
  608. if (!this.detailData.goodsName) {
  609. this.$api.msg('货名不能为空')
  610. return
  611. }
  612. if (!this.detailData.grossWeight && num == 2) {
  613. this.$api.msg('毛重不能为空')
  614. return
  615. }
  616. if (isNaN(this.detailData.grossWeight) ||
  617. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  618. String(this.detailData.grossWeight).length -
  619. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  620. 3) ||
  621. this.detailData.grossWeight < 0 ||
  622. this.detailData.grossWeight > 10000
  623. ) {
  624. this.$api.msg('毛重输入错误!')
  625. return
  626. }
  627. if (!this.detailData.tare && num == 2) {
  628. this.$api.msg('皮重不能为空')
  629. return
  630. }
  631. if (isNaN(this.detailData.tare) ||
  632. (String(this.detailData.tare).indexOf('.') != -1 &&
  633. String(this.detailData.tare).length -
  634. (String(this.detailData.tare).indexOf('.') + 1) >
  635. 3) ||
  636. this.detailData.tare < 0 ||
  637. this.detailData.tare > 10000
  638. ) {
  639. this.$api.msg('皮重输入错误!')
  640. return
  641. }
  642. if (!this.detailData.deductionWeight && num == 2) {
  643. this.$api.msg('扣重不能为空')
  644. return
  645. }
  646. if (isNaN(this.detailData.deductionWeight) ||
  647. (String(this.detailData.deductionWeight).indexOf('.') != -1 &&
  648. String(this.detailData.deductionWeight).length -
  649. (String(this.detailData.deductionWeight).indexOf('.') + 1) >
  650. 3) ||
  651. this.detailData.deductionWeight < 0 ||
  652. this.detailData.deductionWeight > 10
  653. ) {
  654. this.$api.msg('扣重输入错误!')
  655. return
  656. }
  657. if (this.detailData.tare > this.detailData.grossWeight) {
  658. this.$api.msg('皮重不能大于毛重')
  659. return
  660. }
  661. if (this.netWeight <= 0 && num == 2) {
  662. this.$api.msg('净重不能小于等于0')
  663. return
  664. }
  665. if (this.detailData.type == "潮粮") {
  666. if (!this.detailData.buckleWeightRatio && num == 2) {
  667. this.$api.msg('扣重比不能为空')
  668. return
  669. }
  670. if (isNaN(this.detailData.buckleWeightRatio) ||
  671. (String(this.detailData.buckleWeightRatio).indexOf('.') != -1 &&
  672. String(this.detailData.buckleWeightRatio).length -
  673. (String(this.detailData.buckleWeightRatio).indexOf('.') + 1) >
  674. 2) ||
  675. this.detailData.buckleWeightRatio < 0 ||
  676. this.detailData.buckleWeightRatio > 2
  677. ) {
  678. this.$api.msg('扣重比输入错误!')
  679. return
  680. }
  681. if (!this.detailData.solidGrainWater && num == 2) {
  682. this.$api.msg('干粮水分不能为空')
  683. return
  684. }
  685. if (isNaN(this.detailData.solidGrainWater) ||
  686. (String(this.detailData.solidGrainWater).indexOf('.') != -1 &&
  687. String(this.detailData.solidGrainWater).length -
  688. (String(this.detailData.solidGrainWater).indexOf('.') + 1) >
  689. 1) ||
  690. this.detailData.solidGrainWater < 1 ||
  691. this.detailData.solidGrainWater > 40
  692. ) {
  693. this.$api.msg('干粮水分输入错误!')
  694. return
  695. }
  696. if (!this.detailData.tidalGrainWater && num == 2) {
  697. this.$api.msg('潮粮水分不能为空')
  698. return
  699. }
  700. if (isNaN(this.detailData.deductionAmount) ||
  701. (String(this.detailData.deductionAmount).indexOf('.') != -1 &&
  702. String(this.detailData.deductionAmount).length -
  703. (String(this.detailData.deductionAmount).indexOf('.') + 1) >
  704. 2) ||
  705. this.detailData.deductionAmount < 1 ||
  706. this.detailData.deductionAmount > 10000
  707. ) {
  708. this.$api.msg('扣款输入错误!')
  709. return
  710. }
  711. if (!this.detailData.deductionAmount && num == 2) {
  712. this.$api.msg('扣款不能为空')
  713. return
  714. }
  715. if (isNaN(this.detailData.tidalGrainWater) ||
  716. (String(this.detailData.tidalGrainWater).indexOf('.') != -1 &&
  717. String(this.detailData.tidalGrainWater).length -
  718. (String(this.detailData.tidalGrainWater).indexOf('.') + 1) >
  719. 1) ||
  720. this.detailData.tidalGrainWater < 1 ||
  721. this.detailData.tidalGrainWater > 40
  722. ) {
  723. this.$api.msg('潮粮水分输入错误!')
  724. return
  725. }
  726. if (this.detailData.tidalGrainWater < this.detailData.solidGrainWater) {
  727. this.$api.msg('潮粮水分输入错误!')
  728. return
  729. }
  730. if (!this.detailData.pureWeight && num == 2) {
  731. this.$api.msg('纯重不能为空')
  732. return
  733. }
  734. }
  735. if (this.detailData.grade == "请输入品级") {
  736. this.$api.msg('品级不能为空')
  737. return
  738. }
  739. if (this.detailData.agent == "请选择经办人") {
  740. this.$api.msg('经办人不能为空')
  741. return
  742. }
  743. if (this.detailData.inOutDate == "请选择入库日期") {
  744. this.$api.msg('入库日期不能为空')
  745. return
  746. }
  747. if (this.detailData.inOutType == "请选择入库类型") {
  748. this.$api.msg('入库类型不能为空')
  749. return
  750. }
  751. if (!this.detailData.carNo && num == 2) {
  752. this.$api.msg('车牌号不能为空')
  753. return
  754. }
  755. if (this.detailData.carNo.length != 7) {
  756. this.$api.msg('车牌号输入有误!')
  757. return
  758. }
  759. if (!this.detailData.addressUrl && num == 2) {
  760. this.$api.msg('请上传磅单')
  761. return
  762. }
  763. if (!this.detailData.cost && num == 2) {
  764. this.$api.msg('未获取到成本,请编辑后提交')
  765. return
  766. }
  767. if (String(this.detailData.cost).indexOf('.') != -1 && String(this.detailData
  768. .cost).length - (String(
  769. this.detailData.cost).indexOf('.') + 1) > 2) {
  770. this.$api.msg('成本输入错误')
  771. return
  772. }
  773. if (this.detailData.cost < 0 || this.detailData.cost > 20000) {
  774. this.$api.msg('成本输入错误')
  775. return
  776. }
  777. if (!this.detailData.freight && num == 2) {
  778. this.$api.msg('运费不能为空')
  779. return
  780. }
  781. if (this.detailData.warehouseInOutDetail.qualityInspector) {
  782. if (this.detailData.warehouseInOutDetail.qualityInspector < 2 || this.detailData
  783. .warehouseInOutDetail
  784. .qualityInspector > 10) {
  785. this.$api.msg('质检员姓名需要2-10个字')
  786. return
  787. }
  788. }
  789. if (this.detailData.warehouseInOutDetail.waterContent) {
  790. if (this.detailData.type == "潮粮" && this.detailData.warehouseInOutDetail.waterContent != this
  791. .detailData.tidalGrainWater) {
  792. this.$api.msg('水分占比与潮粮水分不一致')
  793. return
  794. }
  795. if (this.detailData.type == "干粮") {
  796. if (this.detailData.warehouseInOutDetail.waterContent < 0 || this.detailData
  797. .warehouseInOutDetail
  798. .waterContent > 40) {
  799. this.$api.msg('水分占比输入错误')
  800. return
  801. }
  802. }
  803. if (String(this.detailData.warehouseInOutDetail.waterContent).indexOf('.') != -1 && String(this
  804. .detailData.warehouseInOutDetail.waterContent).length - (String(
  805. this.detailData.warehouseInOutDetail.waterContent).indexOf('.') + 1) > 1) {
  806. this.$api.msg('水分占比输入错误')
  807. return
  808. }
  809. }
  810. if (this.detailData.warehouseInOutDetail.bulkDensity) {
  811. if (this.detailData.warehouseInOutDetail.bulkDensity < 500 || this.detailData.warehouseInOutDetail
  812. .bulkDensity > 1000) {
  813. this.$api.msg('容重输入错误')
  814. return
  815. }
  816. if (String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 && String(this
  817. .detailData.warehouseInOutDetail.bulkDensity).length - (
  818. String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) > 0) {
  819. this.$api.msg('容重输入错误')
  820. return
  821. }
  822. }
  823. if(this.detailData.goodsName!='小麦'){
  824. if (this.detailData.warehouseInOutDetail.jiaorenli) {
  825. if (this.detailData.warehouseInOutDetail.jiaorenli < 0 || this.detailData.warehouseInOutDetail
  826. .jiaorenli > 40) {
  827. this.$api.msg('热损伤占比输入错误')
  828. return
  829. }
  830. if (String(this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') != -1 && String(this
  831. .detailData
  832. .warehouseInOutDetail.jiaorenli).length - (String(
  833. this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') + 1) > 1) {
  834. this.$api.msg('热损伤占比输入错误')
  835. return
  836. }
  837. }
  838. }
  839. if (this.detailData.warehouseInOutDetail.impurity) {
  840. if (this.detailData.warehouseInOutDetail.impurity < 0 || this.detailData.warehouseInOutDetail
  841. .impurity > 40) {
  842. this.$api.msg('杂质占比输入错误')
  843. return
  844. }
  845. if (String(this.detailData.warehouseInOutDetail.impurity).indexOf('.') != -1 && String(this
  846. .detailData
  847. .warehouseInOutDetail.impurity).length - (String(
  848. this.detailData.warehouseInOutDetail.impurity).indexOf('.') + 1) > 1) {
  849. this.$api.msg('杂质占比输入错误')
  850. return
  851. }
  852. }
  853. if (this.detailData.warehouseInOutDetail.mildewGrain) {
  854. if (this.detailData.warehouseInOutDetail.mildewGrain < 0 || this.detailData.warehouseInOutDetail
  855. .mildewGrain > 40) {
  856. this.$api.msg('霉变粒占比输入错误')
  857. return
  858. }
  859. if (String(this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') != -1 && String(this
  860. .detailData
  861. .warehouseInOutDetail.mildewGrain).length - (String(
  862. this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') + 1) > 1) {
  863. this.$api.msg('霉变粒占比输入错误')
  864. return
  865. }
  866. }
  867. if (this.detailData.warehouseInOutDetail.imperfectGrain) {
  868. if (this.detailData.warehouseInOutDetail.imperfectGrain < 0 || this.detailData.warehouseInOutDetail
  869. .imperfectGrain > 40) {
  870. this.$api.msg('不完善粒占比输入错误')
  871. return
  872. }
  873. if (String(this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') != -1 && String(this
  874. .detailData
  875. .warehouseInOutDetail.imperfectGrain).length - (String(
  876. this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') + 1) > 1) {
  877. this.$api.msg('不完善粒占比输入错误')
  878. return
  879. }
  880. }
  881. this.detailData.baseId = helper.erpWarehouse.warehouseId
  882. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  883. this.detailData.positionId = helper.erpWarehouse.positionId
  884. this.detailData.binNumber = this.binNumber
  885. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  886. this.detailData.compId = helper.erpWarehouse.compId
  887. this.detailData.netWeight = this.netWeight
  888. this.detailData.backOffice = this.userInfo.userName
  889. this.detailData.backOfficeId = this.userInfo.id
  890. this.detailData.inOutFlag = 2
  891. this.detailData.taskType = "入库任务"
  892. this.detailData.pcFlag = 0
  893. let title = ""
  894. if (num == 1) {
  895. this.detailData.statusFlag = 1
  896. title = "暂存成功"
  897. } else if (num == 2) {
  898. this.detailData.statusFlag = 3
  899. title = "提交成功"
  900. }
  901. let that = this
  902. uni.showModal({
  903. content: "确定提交入库信息?",
  904. success(res) {
  905. if (res.confirm) {
  906. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  907. that.detailData).then(res => {
  908. if (res.data.code == 200) {
  909. that.$api.msg(title)
  910. setTimeout(() => {
  911. uni.navigateBack()
  912. }, 1000)
  913. }else{
  914. that.$api.msg(res.data.message)
  915. }
  916. })
  917. }
  918. }
  919. })
  920. },
  921. // slectcontractNo() {
  922. // uni.navigateTo({
  923. // url: '/pages/erp/warehousing/selectContractNo?compId=' + this.compId
  924. // })
  925. // },
  926. slectCarNo() {
  927. uni.navigateTo({
  928. url: '/pages/erp/warehousing/selectCarNo'
  929. })
  930. },
  931. }
  932. }
  933. </script>
  934. <style scoped lang="scss">
  935. uni-page-body {
  936. overflow: hidden;
  937. }
  938. .warp {
  939. margin: 10rpx;
  940. padding: 20rpx 20rpx 300rpx 20rpx;
  941. .top {
  942. display: flex;
  943. margin-bottom: 20rpx;
  944. border-radius: 20rpx;
  945. background: white;
  946. padding: 20rpx;
  947. .top-left {
  948. margin-right: 20rpx;
  949. }
  950. }
  951. }
  952. .content,
  953. .content1,
  954. .content2 {
  955. border-radius: 20rpx;
  956. background: white;
  957. padding: 20rpx;
  958. .title {
  959. font-size: 28rpx;
  960. font-weight: 600;
  961. color: #333333;
  962. }
  963. .row {
  964. display: flex;
  965. justify-content: space-between;
  966. border-bottom: 1px solid #EEEEEE;
  967. padding: 21rpx 0;
  968. .right,
  969. input {
  970. font-size: 28rpx;
  971. color: #333333;
  972. }
  973. }
  974. .row-bottom {
  975. // border: 0;
  976. .right-bottom {
  977. width: 280rpx;
  978. text-align: right;
  979. }
  980. }
  981. }
  982. .content1 {
  983. margin-top: 20rpx;
  984. }
  985. .content2 {
  986. margin-top: 10px;
  987. // display: flex;
  988. align-items: center;
  989. .left {
  990. margin-right: 20px;
  991. }
  992. }
  993. .submit {
  994. width: 40%;
  995. background: #22C572;
  996. border-radius: 10rpx;
  997. }
  998. .edit-btn {
  999. background: #22C572;
  1000. width: 100rpx;
  1001. height: 50rpx;
  1002. margin: 0;
  1003. color: white;
  1004. }
  1005. .has-btn {
  1006. align-items: center;
  1007. }
  1008. .bottom-btn {
  1009. padding: 30rpx;
  1010. background: #FFFFFF;
  1011. width: 92%;
  1012. position: fixed;
  1013. bottom: 0rpx;
  1014. display: flex;
  1015. z-index: 9999;
  1016. }
  1017. </style>