warehousing.vue 35 KB

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