warehouseManagementTare.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746
  1. // 出库登记
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="20">
  6. <h2 class="bg-left title">{{information}}</h2>
  7. </el-col>
  8. <el-col :span="4" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="revert()"><img width="6" height="10"
  10. style="vertical-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  11. </el-button>
  12. </el-col>
  13. </el-row>
  14. <ws-form ref="deptBudgetList" :model="deptBudgetList" :rules="rules">
  15. <div class="basicInformation">
  16. <h2>
  17. {{ deptBudgetList.warehouseName }}
  18. <span class="position" v-show="this.deptBudgetList.warehouseType == 1">
  19. {{ deptBudgetList.binNumber }}仓位
  20. </span>
  21. <span v-show="this.deptBudgetList.warehouseType == 2">(临)</span>
  22. </h2>
  23. <div class="small-title">基本信息</div>
  24. <ws-info-table>
  25. <!--任务编号-->
  26. <ws-form-item label="任务编号" span="1" prop="inOutTaskNo">
  27. <el-select filterable clearable v-model="deptBudgetList.inOutTaskNo" placeholder="请选择任务编号"
  28. class="typeselect" @change="contractNoChange">
  29. <el-option v-for="item in deptBudgetList1" :key="item.inOutTaskNo" :label="item.inOutTaskNo"
  30. :value="item.inOutTaskNo" />
  31. </el-select>
  32. </ws-form-item>
  33. <ws-form-item label="合同编号" span="1" prop="contractNo">
  34. <ws-select disabled v-model="deptBudgetList.contractNo" placeholder="请选择合同编号或移库任务编号" class="typeselect"
  35. @change='contractNoChange1'>
  36. <ws-option v-for="item in outContractNo" :key="item.constKey" :label="item.contractNo"
  37. :value="item.contractNo" />
  38. </ws-select>
  39. </ws-form-item>
  40. <ws-form-item label="提示" span="1" prop="tips">
  41. <ws-input disabled v-model="deptBudgetList.tips"
  42. maxlength="20" size="small" />
  43. </ws-form-item>
  44. <!-- 货名 -->
  45. <ws-form-item label="货名" span="1">
  46. <ws-select disabled v-model="deptBudgetList.goodsName" placeholder class="typeselect"
  47. @change="selectgoodsName">
  48. <ws-option v-for="item in goodnameList" :key="item.constKey" :label="item.constValue"
  49. :value="item.constValue" />
  50. </ws-select>
  51. </ws-form-item>
  52. <ws-form-item label="类型" span="1" prop="type">
  53. <ws-select disabled v-model="deptBudgetList.type" @change="typeChange">
  54. <ws-option v-for="item in typeList" :key="item" :label="item" :value="item" />
  55. </ws-select>
  56. </ws-form-item>
  57. <!--毛重(公斤)-->
  58. <ws-form-item label="毛重(公斤)" span="1" prop="grossWeight">
  59. <ws-input :disabled="allowEdit" @input="grossWeightchange" v-model="deptBudgetList.grossWeight"
  60. type="number" @mousewheel.native.prevent placeholder="请输入毛重" maxlength="20" size="small" />
  61. <el-button type="primary" v-if="information == '毛重检斤'" @click="openPort">重新获取</el-button>
  62. </ws-form-item>
  63. <!--皮重(公斤)-->
  64. <ws-form-item label="皮重(公斤)" span="1" prop="tare" class="readonly">
  65. <ws-input :disabled="allowEdit" @input="tarechange" v-model="deptBudgetList.tare" type="number"
  66. @mousewheel.native.prevent placeholder="请输入皮重" maxlength="100" size="small" />
  67. <el-button type="primary" v-if="information == '皮重检斤'" @click="openPort">重新获取</el-button>
  68. </ws-form-item>
  69. <!--净重(公斤)-->
  70. <ws-form-item label="净重(公斤)" span="1" prop="netWeight">
  71. <ws-input disabled v-model="deptBudgetList.netWeight" placeholder="不可编辑,自动计算" maxlength="120"
  72. size="small" />
  73. </ws-form-item>
  74. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="扣重比" span="1" prop="buckleWeightRatio" class="readonly">
  75. <ws-input @input='pureweight' v-model="deptBudgetList.buckleWeightRatio" type="number"
  76. @mousewheel.native.prevent placeholder="请输入扣重比" maxlength="100" size="small" />
  77. </ws-form-item>
  78. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="干粮水分占比" span="1" prop="solidGrainWater"
  79. class="readonly">
  80. <ws-input @input='pureweight' v-model="deptBudgetList.solidGrainWater" type="number"
  81. @mousewheel.native.prevent placeholder="请输入干粮水分占比" maxlength="100" size="small" />
  82. </ws-form-item>
  83. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="潮粮水分占比" span="1" prop="tidalGrainWater"
  84. class="readonly">
  85. <ws-input @input='pureweight' v-model="deptBudgetList.tidalGrainWater" type="number"
  86. @mousewheel.native.prevent placeholder="请输入潮粮水分占比" maxlength="100" size="small" />
  87. </ws-form-item>
  88. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="纯重" span="1" prop="pureWeight" class="readonly">
  89. <ws-input disabled v-model="deptBudgetList.pureWeight" type="number" @mousewheel.native.prevent
  90. placeholder="不可编辑,自动计算" maxlength="100" size="small" />
  91. </ws-form-item>
  92. <!-- 品级 -->
  93. <ws-form-item label="品级" span="1" class="readonly">
  94. <ws-select v-model="deptBudgetList.grade" placeholder="" class="typeselect" @change="selectpackingMethod">
  95. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  96. :value="item.constValue" />
  97. </ws-select>
  98. </ws-form-item>
  99. <!--经办人-->
  100. <ws-form-item label="经办人" span="1" prop="agent">
  101. <el-select v-model="deptBudgetList.agent" placeholder="请选择经办人" filterable clearable @change="selectstaff">
  102. <el-option v-for="item in options" :key="item.value" :label="item.staffName" :value="item.staffName" />
  103. </el-select>
  104. </ws-form-item>
  105. <!--出库日期-->
  106. <ws-form-item label="出库日期" span="1" prop="inOutDate" class="deliverydate">
  107. <ws-date-picker v-model="deptBudgetList.inOutDate" type="date" placeholder="请选择出库日期"
  108. value-format="yyyy-MM-dd" />
  109. </ws-form-item>
  110. <!-- 出库类型 -->
  111. <ws-form-item label="出库类型" span="1">
  112. <ws-input v-model='deptBudgetList.inOutType' class="right-bottom" :disabled="isSelectType"
  113. placeholder='暂无' />
  114. <!-- <ws-select
  115. v-model="deptBudgetList.deliveryType"
  116. placeholder=""
  117. class="typeselect"
  118. @change="selectstorageType"
  119. >
  120. <ws-option
  121. v-for="item in deliveryType"
  122. :key="item.constKey"
  123. :label="item.constValue"
  124. :value="item.constValue"
  125. />
  126. </ws-select> -->
  127. </ws-form-item>
  128. <!--车牌号-->
  129. <ws-form-item label="车牌号" span="1" prop="carNo">
  130. <ws-input v-if="!carstatus" v-model="deptBudgetList.carNo" placeholder="请输入车牌号" maxlength="7"
  131. size="small" />
  132. <el-select v-if="carstatus" filterable clearable :filter-method="dataFilter2" v-model="deptBudgetList.carNo"
  133. placeholder="请选择车牌号" class="typeselect" @change="carChange">
  134. <el-option v-for="item in options2" :key="item.constKey" :label="item.carNo + '(' + item.tranCarNo + ')'"
  135. :value="item.carNo" />
  136. </el-select>
  137. </ws-form-item>
  138. <ws-form-item label="箱号-1" span="1" prop="boxNo">
  139. <ws-input v-model="deptBudgetList.boxNo" placeholder="请输入箱号" maxlength="20"
  140. size="small" />
  141. </ws-form-item>
  142. <ws-form-item label="箱号-2" span="1" prop="boxNoOther">
  143. <ws-input v-model="deptBudgetList.boxNoOther" placeholder="请输入箱号" maxlength="20"
  144. size="small" />
  145. </ws-form-item>
  146. <ws-form-item label="封号-1" span="1" prop="titleNo">
  147. <ws-input v-model="deptBudgetList.titleNo" placeholder="请输入封号" maxlength="20"
  148. size="small" />
  149. </ws-form-item>
  150. <ws-form-item label="封号-2" span="1" prop="titleNoOther">
  151. <ws-input v-model="deptBudgetList.titleNoOther" placeholder="请输入封号" maxlength="20"
  152. size="small" />
  153. </ws-form-item>
  154. <ws-form-item label="车厢号-1" span="1" prop="wingNumber">
  155. <ws-input v-model="deptBudgetList.wingNumber" placeholder="请输入车厢号" maxlength="20"
  156. size="small" />
  157. </ws-form-item>
  158. <ws-form-item label="车厢号-2" span="1" prop="wingNumberOther">
  159. <ws-input v-model="deptBudgetList.wingNumberOther" placeholder="请输入车厢号" maxlength="20"
  160. size="small" />
  161. </ws-form-item>
  162. </ws-info-table>
  163. </div>
  164. <!-- <div class="small-title">上传磅单照片</div>
  165. <el-upload
  166. action="https://www.zthymaoyi.com/upload/admin"
  167. :show-file-list="false"
  168. :on-success="
  169. (res) => {
  170. uploadSuccessHandle1(res)
  171. }
  172. "
  173. class="avatar-uploader"
  174. accept=".jpg, .jpeg, .png, .gif"
  175. ><el-button size="small" type="primary">点击上传</el-button>
  176. </el-upload>
  177. <div v-if='deptBudgetList.addressUrl!=""'>
  178. <img style='width:100px;height:100px;' :src="deptBudgetList.addressUrl" alt="">
  179. </div> -->
  180. <div class="small-title">化验数据(选填)</div>
  181. <div class="inspector">
  182. <!--自检员-->
  183. <!-- <ws-form-item label="质检员" span="1" prop="qualityInspector">
  184. <ws-input
  185. v-model="deptBudgetList.warehouseInOutDetail.qualityInspector"
  186. placeholder="请输入质检员姓名"
  187. maxlength="120"
  188. size="small"
  189. />
  190. </ws-form-item> -->
  191. <ws-form-item label="质检员" span="1" prop="qualityInspector">
  192. <el-select v-model="deptBudgetList.warehouseInOutDetail.qualityInspector" placeholder="请选择质检员" filterable
  193. clearable @change="qualityInspectorChange">
  194. <el-option v-for="item in qualityInspectorList" :key="item.value" :label="item.staffName"
  195. :value="item.staffName" />
  196. </el-select>
  197. </ws-form-item>
  198. </div>
  199. <div class="neifor">
  200. <ws-info-table>
  201. <!--水分(%)<=-->
  202. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  203. <ws-input v-model="deptBudgetList.warehouseInOutDetail.waterContent" placeholder="请输入水分占比" maxlength="120"
  204. type="number" @mousewheel.native.prevent size="small" />
  205. </ws-form-item>
  206. <!--杂质(%)<=-->
  207. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  208. <ws-input v-model="deptBudgetList.warehouseInOutDetail.impurity" placeholder="请输入杂质占比" type="number"
  209. @mousewheel.native.prevent maxlength="120" size="small" />
  210. </ws-form-item>
  211. <!--容重(克/升)>=-->
  212. <ws-form-item label="容重(克/升)" span="1" prop="bulkDensity">
  213. <ws-input v-model="deptBudgetList.warehouseInOutDetail.bulkDensity" placeholder="请输入容重" type="number"
  214. @mousewheel.native.prevent maxlength="120" size="small" />
  215. </ws-form-item>
  216. <!--霉变粒(%)<=-->
  217. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  218. <ws-input v-model="deptBudgetList.warehouseInOutDetail.mildewGrain" placeholder="请输入霉变粒占比" maxlength="120"
  219. type="number" @mousewheel.native.prevent size="small" />
  220. </ws-form-item>
  221. <!--热损伤(%)<=-->
  222. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  223. <ws-input v-model="deptBudgetList.warehouseInOutDetail.jiaorenli" placeholder="请输入热损伤占比" type="number"
  224. @mousewheel.native.prevent maxlength="120" size="small" />
  225. </ws-form-item>
  226. <!--不完善粒(%)<=-->
  227. <ws-form-item label="不完善粒(%)" span="1" prop="imperfectGrain">
  228. <ws-input v-model="deptBudgetList.warehouseInOutDetail.imperfectGrain" placeholder="请输入不完善粒占比" type="number"
  229. @mousewheel.native.prevent maxlength="120" size="small" />
  230. </ws-form-item>
  231. </ws-info-table>
  232. </div>
  233. <div style="text-align: right; padding: 10px">
  234. <el-button v-if="information == '皮重检斤'" class="bg-bottom-up" size="small" @click="temporaryStorage()">保存
  235. </el-button>
  236. <el-button v-if="!allowEdit" class="bg-bottom-up" type="primary" size="small" @click="submit()">提交</el-button>
  237. </div>
  238. </ws-form>
  239. </div>
  240. </template>
  241. <script>
  242. import {
  243. pullDown,
  244. addstorageputList,
  245. goodsname,
  246. xialaNo,
  247. getstaff,
  248. goodsnameXiala,
  249. getReceiptTaskNo
  250. } from '@/model/warehouse/index'
  251. import Pagination from '@/components/Pagination'
  252. import WsUpload from '@/components/WsUpload'
  253. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  254. import {
  255. dayjs,
  256. EventBus
  257. } from 'base-core-lib'
  258. export default {
  259. name: 'viewSpareMoney',
  260. components: {
  261. WsUpload,
  262. Pagination,
  263. },
  264. watch: {
  265. isShow(val) {
  266. this.showType = val
  267. },
  268. },
  269. data() {
  270. return {
  271. deptBudgetList1: [],
  272. isSelectType: true,
  273. carstatus: false,
  274. qualityInspectorList: [],
  275. //弹出框
  276. dialogViewSpareMoney: false,
  277. dialogApproveFormVisible: false,
  278. // 船舶类型
  279. monetaryKey: null,
  280. // 表格显示数据
  281. tableDate: [],
  282. // 是否显示
  283. showType: true,
  284. readonly: true,
  285. // 年
  286. year: '',
  287. deptBudgetTotal: 0,
  288. currentPage: 1,
  289. pageSize: 10,
  290. searchType: 1,
  291. searchKeyWord: '',
  292. contractType: 2,
  293. startDate: null,
  294. endDate: null,
  295. goodnameList: {},
  296. // 提交类型
  297. submitType: true,
  298. deliveryType: [],
  299. typeList: ['干粮', '潮粮'],
  300. outContractNo: [],
  301. appendixIdsAdd: '',
  302. uploadSuccess: {},
  303. gradeList: [],
  304. agent: [],
  305. staffList: [],
  306. options: [],
  307. value: '',
  308. rules: {
  309. netWeight: [{
  310. required: true,
  311. type: 'number',
  312. message: '请输入活动名称',
  313. trigger: 'blur',
  314. }, ],
  315. },
  316. size: 10,
  317. compId: localStorage.getItem('ws-pf_compId'),
  318. skinInspector: localStorage.getItem('ws-pf_staffName'),
  319. deptCircularPage: {},
  320. packtypeList: {},
  321. date: {
  322. year: dayjs().format('YYYY'),
  323. month: dayjs().format('MM'),
  324. },
  325. contractList: [],
  326. deptBudgetList: {
  327. type: '干粮',
  328. addressUrl: '',
  329. warehouseInOutDetail: {},
  330. grossWeight: 0,
  331. tare: 0
  332. },
  333. historyList: [],
  334. pickerBeginDateBefore: {
  335. disabledDate: (time) => {
  336. return time.getTime() > Date.now()
  337. },
  338. },
  339. accessoryTFs: false,
  340. allowEdit: true,
  341. param: 9600,
  342. information: '',
  343. result1: '00'
  344. }
  345. },
  346. mounted() {
  347. this.information = this.$route.query.information
  348. if (this.$route.query.allowEdit == 1) {
  349. this.allowEdit = false
  350. } else {
  351. this.allowEdit = true
  352. }
  353. this.deptBudgetList.baseId = this.$route.query.baseId
  354. this.deptBudgetList.positionId = this.$route.query.positionId
  355. this.deptBudgetList.warehouseName = this.$route.query.warehouseName
  356. this.deptBudgetList.binNumber = this.$route.query.binNumber
  357. this.deptBudgetList.warehouseType = this.$route.query.warehouseType
  358. this.deptBudgetList.warehouseId = this.$route.query.warehouseId
  359. this.getList()
  360. getReceiptTaskNo({flag:1}).toPromise()
  361. .then((response) => {
  362. console.log(response)
  363. this.deptBudgetList1 = response
  364. })
  365. },
  366. methods: {
  367. async closePort() {
  368. console.log('closePort');
  369. this.reader.cancel()
  370. },
  371. async openPort() {
  372. console.log('openPort', navigator);
  373. if ('serial' in navigator) {
  374. // The Web Serial API is supported.
  375. console.log('the Web Serial API is supported.');
  376. console.log(this.param);
  377. const port = await navigator.serial.requestPort();
  378. await port.open({
  379. baudRate: this.param
  380. }); // set baud rate
  381. this.reader = port.readable.getReader();
  382. // 监听来自串行设备的数据
  383. while (true) {
  384. const {
  385. value,
  386. done
  387. } = await this.reader.read();
  388. // console.log("value",value);
  389. if (done) {
  390. // 允许稍后关闭串口。
  391. this.reader.releaseLock();
  392. break;
  393. }
  394. var result = '';
  395. //2。获取16进制字符串
  396. // var receData = HexConvert.ByteToString(value);
  397. // console.log("receData",receData);
  398. var flag = false;
  399. var flag1 = false;
  400. // for (var i = 0; i < value.length; i++) {
  401. // var tmp = String.fromCharCode(value[i])
  402. // if (tmp == '+') {
  403. // flag = true
  404. // }
  405. // if (flag && result.length < 6 && tmp != '+') {
  406. // result += tmp
  407. // }
  408. // }
  409. // if (this.information != '毛重检斤') {
  410. // if(parseInt(result)){
  411. // this.deptBudgetList.grossWeight = parseInt(result)
  412. // }
  413. // } else {
  414. // if(parseInt(result)){
  415. // this.deptBudgetList.tare = parseInt(result)
  416. // }
  417. // }
  418. if (this.deptBudgetList.warehouseName && (this.deptBudgetList.warehouseName == '山东诸城迈饶库' || this
  419. .deptBudgetList.warehouseName == '克东千红库' || this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库')) {
  420. for (var i = 0; i < value.length; i++) {
  421. var tmp = String.fromCharCode(value[i])
  422. if (tmp == '+') {
  423. flag = true
  424. }
  425. if (flag && result.length < 6 && tmp != '+') {
  426. result += tmp
  427. }
  428. }
  429. if (this.information == '毛重检斤') {
  430. if (parseInt(result) || parseInt(result) == 0) {
  431. this.deptBudgetList.grossWeight = parseInt(result)
  432. }
  433. } else {
  434. if (parseInt(result) || parseInt(result) == 0) {
  435. this.deptBudgetList.tare = parseInt(result)
  436. }
  437. }
  438. }
  439. else if (this.deptBudgetList.warehouseName && (this.deptBudgetList.warehouseName == '顺城粮库'||this.deptBudgetList.warehouseName == '鲅鱼圈金信库')) {
  440. for (var i = value.length - 1; i >= 0; i--) {
  441. var tmp = String.fromCharCode(value[i])
  442. console.log(tmp)
  443. if (String.fromCharCode(value[0]) == '.') {
  444. flag = true
  445. }
  446. if (flag && result.length < 9 && tmp != '='&& tmp != '.') {
  447. result += tmp
  448. }
  449. }
  450. if (this.information == '毛重检斤') {
  451. if (parseInt(result) || parseInt(result) == 0) {
  452. this.deptBudgetList.grossWeight = parseInt(result)
  453. }
  454. } else {
  455. if (parseInt(result) || parseInt(result) == 0) {
  456. this.deptBudgetList.tare = parseInt(result)
  457. }
  458. }
  459. }
  460. else {
  461. for (var i = 0; i < value.length; i++) {
  462. var tmp = String.fromCharCode(value[i])
  463. if ((value[0] != 49 && value[0] != 2)) {
  464. if ((value[value.length - 1] == 48 && value[value.length - 2] == 48)) {
  465. flag1 = true
  466. } else {
  467. break
  468. }
  469. }
  470. if (tmp == String.fromCharCode(32)) {
  471. flag = true
  472. }
  473. if (flag && result.length < 7 && tmp != String.fromCharCode(32) && !(value[value.length - 1] == 48 &&
  474. value[value.length - 2] == 48)) {
  475. result += tmp
  476. }
  477. if (flag1 && tmp != String.fromCharCode(32)) {
  478. if ((value[value.length - 1] == 48 && value[value.length - 2] == 48)) {
  479. if (i == 0) {
  480. this.result1 = tmp + '0'
  481. }
  482. }
  483. }
  484. }
  485. if (this.information == '毛重检斤') {
  486. if (parseInt(result) || parseInt(result) == 0) {
  487. this.deptBudgetList.grossWeight = parseInt(result + this.result1)
  488. }
  489. } else {
  490. if (parseInt(result) || parseInt(result) == 0) {
  491. this.deptBudgetList.tare = parseInt(result + this.result1)
  492. }
  493. }
  494. }
  495. // setTimeout(1000)
  496. // value 是一个 Uint8Array
  497. }
  498. await port.close();
  499. } else {
  500. console.log('the Web Serial API is not supported.', navigator);
  501. }
  502. },
  503. qualityInspectorChange(e) {
  504. console.log(e)
  505. },
  506. uploadSuccessHandle1(res) {
  507. this.deptBudgetList.addressUrl = res.url
  508. },
  509. //返回按钮
  510. revert() {
  511. this.$router.push({
  512. path: 'warehouseManagementList'
  513. })
  514. },
  515. carChange(e) {
  516. for (let i = 0; i < this.tranCarInfoList.length; i++) {
  517. if (this.tranCarInfoList[i].carNo == this.deptBudgetList.carNo) {
  518. this.deptBudgetList.tranCarNo = this.tranCarInfoList[i].tranCarNo
  519. }
  520. }
  521. },
  522. typeChange(e) {
  523. },
  524. contractNoChange(e) {
  525. for (let i = 0; i < this.deptBudgetList1.length; i++) {
  526. if (this.deptBudgetList1[i].inOutTaskNo == e) {
  527. var data=this.deptBudgetList1[i]
  528. if(this.deptBudgetList1[i].contractNo){
  529. this.deptBudgetList.contractNo = this.deptBudgetList1[i].contractNo
  530. }
  531. else{
  532. this.deptBudgetList.contractNo = this.deptBudgetList1[i].moveTaskNo
  533. }
  534. }
  535. }
  536. for (var i = 0; i < this.outContractNo.length; i++) {
  537. if (this.outContractNo[i].contractNo == this.deptBudgetList.contractNo) {
  538. if (this.outContractNo[i].inOutType == '销售出库') {
  539. this.deptBudgetList.tips='买方'+this.outContractNo[i].buyer
  540. this.deptBudgetList.inOutTypeKey = 1
  541. } else if (this.outContractNo[i].inOutType == '移库出库') {
  542. this.deptBudgetList.tips='入货库'+data.receiveWarehouse
  543. this.deptBudgetList.inOutTypeKey = 3
  544. } else if (this.outContractNo[i].inOutType == '暂存入库') {
  545. this.deptBudgetList.inOutTypeKey = 4
  546. } else if (this.outContractNo[i].inOutType == '贸易服务出库') {
  547. this.deptBudgetList.inOutTypeKey = 5
  548. } else if (this.outContractNo[i].inOutType == '采购出库') {
  549. this.deptBudgetList.inOutTypeKey = 6
  550. }
  551. this.deptBudgetList.goodsName = this.outContractNo[i].goodsName
  552. this.deptBudgetList.goodsNameKey = this.outContractNo[i].goodsNameKey
  553. this.deptBudgetList.grade = this.outContractNo[i].grade
  554. this.deptBudgetList.inOutType = this.outContractNo[i].inOutType
  555. if (this.outContractNo[i].deliverType == '1') {
  556. this.carstatus = true
  557. } else {
  558. this.carstatus = false
  559. }
  560. if (this.outContractNo[i].tranCarInfoList) {
  561. this.options2 = this.outContractNo[i].tranCarInfoList
  562. this.tranCarInfoList = this.outContractNo[i].tranCarInfoList
  563. this.carstatus = true
  564. }
  565. }
  566. }
  567. },
  568. contractNoChange1(e) {
  569. for (var i = 0; i < this.outContractNo.length; i++) {
  570. if (this.outContractNo[i].contractNo == e) {
  571. if (this.outContractNo[i].inOutType == '销售出库') {
  572. this.deptBudgetList.inOutTypeKey = 1
  573. } else if (this.outContractNo[i].inOutType == '移库出库') {
  574. this.deptBudgetList.inOutTypeKey = 3
  575. } else if (this.outContractNo[i].inOutType == '暂存入库') {
  576. this.deptBudgetList.inOutTypeKey = 4
  577. } else if (this.outContractNo[i].inOutType == '贸易服务出库') {
  578. this.deptBudgetList.inOutTypeKey = 5
  579. } else if (this.outContractNo[i].inOutType == '采购出库') {
  580. this.deptBudgetList.inOutTypeKey = 6
  581. }
  582. this.deptBudgetList.goodsName = this.outContractNo[i].goodsName
  583. this.deptBudgetList.goodsNameKey = this.outContractNo[i].goodsNameKey
  584. this.deptBudgetList.grade = this.outContractNo[i].grade
  585. this.deptBudgetList.inOutType = this.outContractNo[i].inOutType
  586. if (this.outContractNo[i].tranCarInfoList) {
  587. this.options2 = this.outContractNo[i].tranCarInfoList
  588. this.tranCarInfoList = this.outContractNo[i].tranCarInfoList
  589. this.carstatus = true
  590. }
  591. }
  592. }
  593. },
  594. dataFilter2(val) {
  595. this.deptBudgetList.carNo = val
  596. if (val) {
  597. //val存在
  598. this.options1 = this.outContractNo1.filter((item) => {
  599. if (
  600. !!~item.carNo.indexOf(val) ||
  601. !!~item.carNo.toUpperCase().indexOf(val.toUpperCase())
  602. ) {
  603. return true
  604. }
  605. })
  606. } else {
  607. //val为空时,还原数组
  608. this.options2 = this.tranCarInfoList
  609. }
  610. },
  611. dataFilter(val) {
  612. // console.log(val,"名")
  613. this.deptBudgetList.staffList = val
  614. if (val) {
  615. //val存在
  616. this.options = this.staffList.filter((item) => {
  617. if (
  618. !!~item.staffName.indexOf(val) ||
  619. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  620. ) {
  621. return true
  622. }
  623. })
  624. } else {
  625. //val为空时,还原数组
  626. this.options = this.staffList
  627. }
  628. },
  629. selectstaff(e) {
  630. for (var i = 0; i < this.staffList.length; i++) {
  631. if (this.staffList[i].staffName == e) {
  632. this.deptBudgetList.personChargeKey = this.staffList[i].staffId
  633. }
  634. }
  635. },
  636. pureweight(e) {
  637. console.log(this.deptBudgetList)
  638. if (this.deptBudgetList.netWeight && this.deptBudgetList.tidalGrainWater && this.deptBudgetList
  639. .solidGrainWater && this.deptBudgetList.buckleWeightRatio) {
  640. this.deptBudgetList.pureWeight = (this.deptBudgetList.netWeight * (100 - (this.deptBudgetList
  641. .tidalGrainWater - this.deptBudgetList.solidGrainWater) * this.deptBudgetList.buckleWeightRatio)) / 100
  642. }
  643. },
  644. temporaryStorage() {
  645. if (!this.deptBudgetList.goodsName) {
  646. this.$message({
  647. message: '货名不能为空',
  648. type: 'warning',
  649. })
  650. return
  651. }
  652. if (this.information == '毛重检斤' && !this.deptBudgetList.grossWeight) {
  653. this.$message({
  654. message: '毛重不能为空',
  655. type: 'warning',
  656. })
  657. return
  658. }
  659. if (this.information == '毛重检斤' && (
  660. this.deptBudgetList.grossWeight <= 0 ||
  661. this.deptBudgetList.grossWeight > 200000 ||
  662. (String(this.deptBudgetList.grossWeight).indexOf('.') != -1 &&
  663. String(this.deptBudgetList.grossWeight).length -
  664. (String(this.deptBudgetList.grossWeight).indexOf('.') + 1) >
  665. 3))) {
  666. this.$message({
  667. message: '毛重输入错误',
  668. type: 'warning',
  669. })
  670. return
  671. }
  672. if (this.information == '皮重检斤' && !this.deptBudgetList.tare) {
  673. this.$message({
  674. message: '皮重不能为空',
  675. type: 'warning',
  676. })
  677. return
  678. }
  679. if (this.information == '皮重检斤' && (
  680. this.deptBudgetList.tare < 0 ||
  681. this.deptBudgetList.tare > 200000 ||
  682. (String(this.deptBudgetList.tare).indexOf('.') != -1 &&
  683. String(this.deptBudgetList.tare).length -
  684. (String(this.deptBudgetList.tare).indexOf('.') + 1) >
  685. 3))) {
  686. this.$message({
  687. message: '皮重输入错误',
  688. type: 'warning',
  689. })
  690. return
  691. }
  692. if (!this.deptBudgetList.carNo) {
  693. this.$message({
  694. message: '车牌号不能为空',
  695. type: 'warning',
  696. })
  697. return
  698. }
  699. if (this.deptBudgetList.carNo.length > 7) {
  700. this.$message({
  701. message: '车牌号输入错误,请输入7个字符之内',
  702. type: 'warning',
  703. })
  704. return
  705. }
  706. if (!this.deptBudgetList.contractNo) {
  707. this.$message({
  708. message: '合同编号不能为空',
  709. type: 'warning',
  710. })
  711. return
  712. }
  713. // if (
  714. // this.deptBudgetList.contractNo.length < 6 ||
  715. // this.deptBudgetList.contractNo.length > 20
  716. // ) {
  717. // this.$message({
  718. // message: '合同编号长度不符合要求,请输入6-20个字符之内',
  719. // type: 'warning',
  720. // })
  721. // return
  722. // }
  723. //自检员
  724. if (this.deptBudgetList.warehouseInOutDetail.qualityInspector) {
  725. if (
  726. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length <
  727. 2 ||
  728. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length > 10
  729. ) {
  730. this.$message({
  731. message: '质检员姓名长度错误!',
  732. type: 'warning',
  733. })
  734. return
  735. }
  736. }
  737. if (this.deptBudgetList.warehouseInOutDetail.waterContent) {
  738. if (isNaN(this.deptBudgetList.warehouseInOutDetail.waterContent)) {
  739. this.$message({
  740. message: '水分(%)非数字!',
  741. type: 'warning',
  742. })
  743. return
  744. }
  745. if (
  746. this.deptBudgetList.warehouseInOutDetail.waterContent < 1 ||
  747. this.deptBudgetList.warehouseInOutDetail.waterContent > 40 ||
  748. (String(
  749. this.deptBudgetList.warehouseInOutDetail.waterContent
  750. ).indexOf('.') != -1 &&
  751. String(this.deptBudgetList.warehouseInOutDetail.waterContent)
  752. .length -
  753. (String(
  754. this.deptBudgetList.warehouseInOutDetail.waterContent
  755. ).indexOf('.') +
  756. 1) >
  757. 2)
  758. ) {
  759. this.$message({
  760. message: '水分(%)输入错误! 取值范围1-40之间且可以保留2小数',
  761. type: 'warning',
  762. })
  763. return
  764. }
  765. }
  766. //杂质
  767. if (this.deptBudgetList.warehouseInOutDetail.impurity) {
  768. if (isNaN(this.deptBudgetList.warehouseInOutDetail.impurity)) {
  769. this.$message({
  770. message: '杂质(%)非数字!',
  771. type: 'warning',
  772. })
  773. return
  774. }
  775. if (
  776. this.deptBudgetList.warehouseInOutDetail.impurity < 1 ||
  777. this.deptBudgetList.warehouseInOutDetail.impurity > 40 ||
  778. (String(this.deptBudgetList.warehouseInOutDetail.impurity).indexOf(
  779. '.'
  780. ) != -1 &&
  781. String(this.deptBudgetList.warehouseInOutDetail.impurity).length -
  782. (String(
  783. this.deptBudgetList.warehouseInOutDetail.impurity
  784. ).indexOf('.') +
  785. 1) >
  786. 2)
  787. ) {
  788. this.$message({
  789. message: '杂质(%)输入错误! 取值范围1-40之间且可以保留2小数',
  790. type: 'warning',
  791. })
  792. return
  793. }
  794. }
  795. //霉变
  796. if (this.deptBudgetList.warehouseInOutDetail.mildewGrain) {
  797. if (isNaN(this.deptBudgetList.warehouseInOutDetail.mildewGrain)) {
  798. this.$message({
  799. message: '霉变粒(%)非数字!',
  800. type: 'warning',
  801. })
  802. return
  803. }
  804. if (
  805. this.deptBudgetList.warehouseInOutDetail.mildewGrain < 1 ||
  806. this.deptBudgetList.warehouseInOutDetail.mildewGrain > 40 ||
  807. (String(this.deptBudgetList.warehouseInOutDetail.mildewGrain).indexOf(
  808. '.'
  809. ) != -1 &&
  810. String(this.deptBudgetList.warehouseInOutDetail.mildewGrain)
  811. .length -
  812. (String(
  813. this.deptBudgetList.warehouseInOutDetail.mildewGrain
  814. ).indexOf('.') +
  815. 1) >
  816. 2)
  817. ) {
  818. this.$message({
  819. message: '霉变粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  820. type: 'warning',
  821. })
  822. return
  823. }
  824. }
  825. //热损伤
  826. if (this.deptBudgetList.warehouseInOutDetail.jiaorenli) {
  827. if (isNaN(this.deptBudgetList.warehouseInOutDetail.jiaorenli)) {
  828. this.$message({
  829. message: '热损伤(%)非数字!',
  830. type: 'warning',
  831. })
  832. return
  833. }
  834. if (
  835. this.deptBudgetList.warehouseInOutDetail.jiaorenli < 1 ||
  836. this.deptBudgetList.warehouseInOutDetail.jiaorenli > 40 ||
  837. (String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).indexOf(
  838. '.'
  839. ) != -1 &&
  840. String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).length -
  841. (String(
  842. this.deptBudgetList.warehouseInOutDetail.jiaorenli
  843. ).indexOf('.') +
  844. 1) >
  845. 2)
  846. ) {
  847. this.$message({
  848. message: '热损伤(%)输入错误! 取值范围1-40之间且可以保留2小数',
  849. type: 'warning',
  850. })
  851. return
  852. }
  853. }
  854. //不完善粒(%)
  855. if (this.deptBudgetList.warehouseInOutDetail.imperfectGrain) {
  856. if (isNaN(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)) {
  857. this.$message({
  858. message: '不完善粒(%)非数字!',
  859. type: 'warning',
  860. })
  861. return
  862. }
  863. if (
  864. this.deptBudgetList.warehouseInOutDetail.imperfectGrain < 1 ||
  865. this.deptBudgetList.warehouseInOutDetail.imperfectGrain > 40 ||
  866. (String(
  867. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  868. ).indexOf('.') != -1 &&
  869. String(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)
  870. .length -
  871. (String(
  872. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  873. ).indexOf('.') +
  874. 1) >
  875. 2)
  876. ) {
  877. this.$message({
  878. message: '不完善粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  879. type: 'warning',
  880. })
  881. return
  882. }
  883. }
  884. //容重
  885. if (this.deptBudgetList.warehouseInOutDetail.bulkDensity) {
  886. if (isNaN(this.deptBudgetList.warehouseInOutDetail.bulkDensity)) {
  887. this.$message({
  888. message: '容重(克/升)非数字!',
  889. type: 'warning',
  890. })
  891. return
  892. }
  893. if (
  894. (this.deptBudgetList.warehouseInOutDetail.bulkDensity &&
  895. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 &&
  896. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).length -
  897. (String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) >
  898. 2) || this.deptBudgetList.warehouseInOutDetail.bulkDensity > 1000 || this.deptBudgetList
  899. .warehouseInOutDetail.bulkDensity < 0
  900. ) {
  901. this.$message({
  902. message: '容重输入错误',
  903. type: 'warning',
  904. })
  905. return
  906. }
  907. }
  908. console.log(this.deptBudgetList, '出库!!!!!')
  909. this.$confirm(`是否保存皮重检斤`, {
  910. cancelButtonText: '取消',
  911. confirmButtonText: '确定',
  912. type: 'warning',
  913. })
  914. .then(() => {
  915. this.$refs.deptBudgetList.validate((valid) => {
  916. if (valid) {
  917. this.deptBudgetList.compId = localStorage.getItem('ws-pf_compId')
  918. this.deptBudgetList.skinInspector = localStorage.getItem('ws-pf_staffName')
  919. this.deptBudgetList.inOutFlag = 1
  920. this.deptBudgetList.pcFlag = 1
  921. this.deptBudgetList.statusFlag = 1
  922. his.deptBudgetList.grossWeight /= 1000
  923. this.deptBudgetList.tare /= 1000
  924. this.deptBudgetList.netWeight = this.deptBudgetList.netWeight.toFixed(2)
  925. this.deptBudgetList.pureWeight /= 1000
  926. addstorageputList(this.deptBudgetList)
  927. .toPromise()
  928. .then((response) => {
  929. this.$message.success('保存成功')
  930. this.$router.push({
  931. path: 'warehouseManagementList'
  932. })
  933. })
  934. } else {
  935. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  936. return false
  937. }
  938. })
  939. })
  940. .catch(() => {
  941. return false
  942. })
  943. },
  944. //提交按钮
  945. submit() {
  946. if (!this.deptBudgetList.goodsName) {
  947. this.$message({
  948. message: '货名不能为空!',
  949. type: 'warning',
  950. })
  951. return
  952. }
  953. if (!this.deptBudgetList.grossWeight) {
  954. this.$message({
  955. message: '毛重不能为空!',
  956. type: 'warning',
  957. })
  958. return
  959. }
  960. if (
  961. this.deptBudgetList.grossWeight <= 0 ||
  962. this.deptBudgetList.grossWeight > 5000000 ||
  963. (String(this.deptBudgetList.grossWeight).indexOf('.') != -1 &&
  964. String(this.deptBudgetList.grossWeight).length -
  965. (String(this.deptBudgetList.grossWeight).indexOf('.') + 1) >
  966. 3)
  967. ) {
  968. this.$message({
  969. message: '毛重输入错误',
  970. type: 'warning',
  971. })
  972. return
  973. }
  974. if (!this.deptBudgetList.tare) {
  975. this.$message({
  976. message: '皮重不能为空!',
  977. type: 'warning',
  978. })
  979. return
  980. }
  981. if (
  982. this.deptBudgetList.tare < 0 ||
  983. this.deptBudgetList.tare > 500000 ||
  984. (String(this.deptBudgetList.tare).indexOf('.') != -1 &&
  985. String(this.deptBudgetList.tare).length -
  986. (String(this.deptBudgetList.tare).indexOf('.') + 1) >
  987. 3)
  988. ) {
  989. this.$message({
  990. message: '皮重输入错误',
  991. type: 'warning',
  992. })
  993. return
  994. }
  995. if (!this.deptBudgetList.netWeight) {
  996. this.$message({
  997. message: '净重不能为空!',
  998. type: 'warning',
  999. })
  1000. return
  1001. }
  1002. if (
  1003. this.deptBudgetList.netWeight <= 0 ||
  1004. this.deptBudgetList.netWeight >= 5000000
  1005. ) {
  1006. this.$message({
  1007. message: '净重输入错误!',
  1008. type: 'warning',
  1009. })
  1010. return
  1011. }
  1012. if (!this.deptBudgetList.grade) {
  1013. this.$message({
  1014. message: '品级不能为空!',
  1015. type: 'warning',
  1016. })
  1017. return
  1018. }
  1019. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.buckleWeightRatio) {
  1020. this.$message({
  1021. message: '扣重比不能为空',
  1022. type: 'warning'
  1023. })
  1024. return
  1025. }
  1026. if (
  1027. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.buckleWeightRatio < 0 ||
  1028. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.buckleWeightRatio > 3 ||
  1029. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.buckleWeightRatio).indexOf('.') != -1 &&
  1030. String(this.deptBudgetList.buckleWeightRatio).length -
  1031. (String(this.deptBudgetList.buckleWeightRatio).indexOf('.') + 1) >
  1032. 2)
  1033. ) {
  1034. this.$message({
  1035. message: '扣重比输入错误',
  1036. type: 'warning'
  1037. })
  1038. return
  1039. }
  1040. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.tidalGrainWater) {
  1041. this.$message({
  1042. message: '潮粮水分不能为空',
  1043. type: 'warning'
  1044. })
  1045. return
  1046. }
  1047. if (
  1048. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.tidalGrainWater < 1 ||
  1049. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.tidalGrainWater > 40 ||
  1050. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.tidalGrainWater).indexOf('.') != -1 &&
  1051. String(this.deptBudgetList.tidalGrainWater).length -
  1052. (String(this.deptBudgetList.tidalGrainWater).indexOf('.') + 1) >
  1053. 2)
  1054. ) {
  1055. this.$message({
  1056. message: '潮粮水分输入错误',
  1057. type: 'warning'
  1058. })
  1059. return
  1060. }
  1061. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.solidGrainWater) {
  1062. this.$message({
  1063. message: '干粮水分不能为空',
  1064. type: 'warning'
  1065. })
  1066. return
  1067. }
  1068. if (
  1069. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.solidGrainWater < 1 ||
  1070. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.solidGrainWater > 40 ||
  1071. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.solidGrainWater).indexOf('.') != -1 &&
  1072. String(this.deptBudgetList.solidGrainWater).length -
  1073. (String(this.deptBudgetList.solidGrainWater).indexOf('.') + 1) >
  1074. 1)
  1075. ) {
  1076. this.$message({
  1077. message: '干粮水分输入错误',
  1078. type: 'warning'
  1079. })
  1080. return
  1081. }
  1082. if (!this.deptBudgetList.agent) {
  1083. this.$message({
  1084. message: '经办人不能为空!',
  1085. type: 'warning',
  1086. })
  1087. return
  1088. }
  1089. if (
  1090. this.deptBudgetList.agent.length < 2 ||
  1091. this.deptBudgetList.agent.length > 10
  1092. ) {
  1093. this.$message({
  1094. message: '经办人姓名输入有误!',
  1095. type: 'warning',
  1096. })
  1097. return
  1098. }
  1099. if (!this.deptBudgetList.inOutDate) {
  1100. this.$message({
  1101. message: '出库日期不能为空!',
  1102. type: 'warning',
  1103. })
  1104. return
  1105. }
  1106. if (!this.deptBudgetList.inOutType) {
  1107. this.$message({
  1108. message: '出库类型不能为空!',
  1109. type: 'warning',
  1110. })
  1111. return
  1112. }
  1113. if (!this.deptBudgetList.carNo) {
  1114. this.$message({
  1115. message: '车牌号不能为空!',
  1116. type: 'warning',
  1117. })
  1118. return
  1119. }
  1120. if (
  1121. this.deptBudgetList.carNo.length < 6 &&
  1122. this.deptBudgetList.carNo.length <= 8
  1123. ) {
  1124. this.$message({
  1125. message: '车牌号输入有误!',
  1126. type: 'warning',
  1127. })
  1128. return
  1129. }
  1130. if (this.deptBudgetList.boxNo&&this.deptBudgetList.boxNo.length > 20) {
  1131. this.$message({
  1132. message: '箱号-1输入错误',
  1133. type: 'warning',
  1134. })
  1135. return
  1136. }
  1137. if (this.deptBudgetList.boxNoOther&&this.deptBudgetList.boxNoOther.length > 20) {
  1138. this.$message({
  1139. message: '箱号-2输入错误',
  1140. type: 'warning',
  1141. })
  1142. return
  1143. }
  1144. if (this.deptBudgetList.titleNo&&this.deptBudgetList.titleNo.length > 20) {
  1145. this.$message({
  1146. message: '封号-1输入错误',
  1147. type: 'warning',
  1148. })
  1149. return
  1150. }
  1151. if (this.deptBudgetList.titleNoOther&&this.deptBudgetList.titleNoOther.length > 20) {
  1152. this.$message({
  1153. message: '封号-2输入错误',
  1154. type: 'warning',
  1155. })
  1156. return
  1157. }
  1158. if (!this.deptBudgetList.contractNo) {
  1159. this.$message({
  1160. message: '合同编号不能为空!',
  1161. type: 'warning',
  1162. })
  1163. return
  1164. }
  1165. if (
  1166. this.deptBudgetList.contractNo.length < 6 ||
  1167. this.deptBudgetList.contractNo.length > 50
  1168. ) {
  1169. this.$message({
  1170. message: '合同编号输入有误!',
  1171. type: 'warning',
  1172. })
  1173. return
  1174. }
  1175. //自检员
  1176. if (this.deptBudgetList.warehouseInOutDetail.qualityInspector) {
  1177. if (
  1178. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length <
  1179. 2 ||
  1180. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length > 10
  1181. ) {
  1182. this.$message({
  1183. message: '质检员姓名长度错误!',
  1184. type: 'warning',
  1185. })
  1186. return
  1187. }
  1188. }
  1189. if (this.deptBudgetList.warehouseInOutDetail.waterContent) {
  1190. if (isNaN(this.deptBudgetList.warehouseInOutDetail.waterContent)) {
  1191. this.$message({
  1192. message: '水分(%)非数字!',
  1193. type: 'warning',
  1194. })
  1195. return
  1196. }
  1197. if (
  1198. this.deptBudgetList.warehouseInOutDetail.waterContent < 1 ||
  1199. this.deptBudgetList.warehouseInOutDetail.waterContent > 40 ||
  1200. (String(
  1201. this.deptBudgetList.warehouseInOutDetail.waterContent
  1202. ).indexOf('.') != -1 &&
  1203. String(this.deptBudgetList.warehouseInOutDetail.waterContent)
  1204. .length -
  1205. (String(
  1206. this.deptBudgetList.warehouseInOutDetail.waterContent
  1207. ).indexOf('.') +
  1208. 1) >
  1209. 2)
  1210. ) {
  1211. this.$message({
  1212. message: '水分(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1213. type: 'warning',
  1214. })
  1215. return
  1216. }
  1217. }
  1218. //杂质
  1219. if (this.deptBudgetList.warehouseInOutDetail.impurity) {
  1220. if (isNaN(this.deptBudgetList.warehouseInOutDetail.impurity)) {
  1221. this.$message({
  1222. message: '杂质(%)非数字!',
  1223. type: 'warning',
  1224. })
  1225. return
  1226. }
  1227. if (
  1228. this.deptBudgetList.warehouseInOutDetail.impurity < 1 ||
  1229. this.deptBudgetList.warehouseInOutDetail.impurity > 40 ||
  1230. (String(this.deptBudgetList.warehouseInOutDetail.impurity).indexOf(
  1231. '.'
  1232. ) != -1 &&
  1233. String(this.deptBudgetList.warehouseInOutDetail.impurity).length -
  1234. (String(
  1235. this.deptBudgetList.warehouseInOutDetail.impurity
  1236. ).indexOf('.') +
  1237. 1) >
  1238. 2)
  1239. ) {
  1240. this.$message({
  1241. message: '杂质(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1242. type: 'warning',
  1243. })
  1244. return
  1245. }
  1246. }
  1247. //霉变
  1248. if (this.deptBudgetList.warehouseInOutDetail.mildewGrain) {
  1249. if (isNaN(this.deptBudgetList.warehouseInOutDetail.mildewGrain)) {
  1250. this.$message({
  1251. message: '霉变粒(%)非数字!',
  1252. type: 'warning',
  1253. })
  1254. return
  1255. }
  1256. if (
  1257. this.deptBudgetList.warehouseInOutDetail.mildewGrain < 1 ||
  1258. this.deptBudgetList.warehouseInOutDetail.mildewGrain > 40 ||
  1259. (String(this.deptBudgetList.warehouseInOutDetail.mildewGrain).indexOf(
  1260. '.'
  1261. ) != -1 &&
  1262. String(this.deptBudgetList.warehouseInOutDetail.mildewGrain)
  1263. .length -
  1264. (String(
  1265. this.deptBudgetList.warehouseInOutDetail.mildewGrain
  1266. ).indexOf('.') +
  1267. 1) >
  1268. 2)
  1269. ) {
  1270. this.$message({
  1271. message: '霉变粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1272. type: 'warning',
  1273. })
  1274. return
  1275. }
  1276. }
  1277. //热损伤
  1278. if (this.deptBudgetList.warehouseInOutDetail.jiaorenli) {
  1279. if (isNaN(this.deptBudgetList.warehouseInOutDetail.jiaorenli)) {
  1280. this.$message({
  1281. message: '热损伤(%)非数字!',
  1282. type: 'warning',
  1283. })
  1284. return
  1285. }
  1286. if (
  1287. this.deptBudgetList.warehouseInOutDetail.jiaorenli < 1 ||
  1288. this.deptBudgetList.warehouseInOutDetail.jiaorenli > 40 ||
  1289. (String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).indexOf(
  1290. '.'
  1291. ) != -1 &&
  1292. String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).length -
  1293. (String(
  1294. this.deptBudgetList.warehouseInOutDetail.jiaorenli
  1295. ).indexOf('.') +
  1296. 1) >
  1297. 2)
  1298. ) {
  1299. this.$message({
  1300. message: '热损伤(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1301. type: 'warning',
  1302. })
  1303. return
  1304. }
  1305. }
  1306. //不完善粒(%)
  1307. if (this.deptBudgetList.warehouseInOutDetail.imperfectGrain) {
  1308. if (isNaN(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)) {
  1309. this.$message({
  1310. message: '不完善粒(%)非数字!',
  1311. type: 'warning',
  1312. })
  1313. return
  1314. }
  1315. if (
  1316. this.deptBudgetList.warehouseInOutDetail.imperfectGrain < 1 ||
  1317. this.deptBudgetList.warehouseInOutDetail.imperfectGrain > 40 ||
  1318. (String(
  1319. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  1320. ).indexOf('.') != -1 &&
  1321. String(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)
  1322. .length -
  1323. (String(
  1324. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  1325. ).indexOf('.') +
  1326. 1) >
  1327. 2)
  1328. ) {
  1329. this.$message({
  1330. message: '不完善粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1331. type: 'warning',
  1332. })
  1333. return
  1334. }
  1335. }
  1336. //容重
  1337. if (this.deptBudgetList.warehouseInOutDetail.bulkDensity) {
  1338. if (isNaN(this.deptBudgetList.warehouseInOutDetail.bulkDensity)) {
  1339. this.$message({
  1340. message: '容重(克/升)非数字!',
  1341. type: 'warning',
  1342. })
  1343. return
  1344. }
  1345. if (
  1346. (this.deptBudgetList.warehouseInOutDetail.bulkDensity &&
  1347. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 &&
  1348. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).length -
  1349. (String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) >
  1350. 2) || this.deptBudgetList.warehouseInOutDetail.bulkDensity > 1000 || this.deptBudgetList
  1351. .warehouseInOutDetail.bulkDensity < 0
  1352. ) {
  1353. this.$message({
  1354. message: '容重输入错误',
  1355. type: 'warning',
  1356. })
  1357. return
  1358. }
  1359. }
  1360. this.$confirm(`确定提交出库信息`, {
  1361. cancelButtonText: '取消',
  1362. confirmButtonText: '确定',
  1363. type: 'warning',
  1364. }).then(() => {
  1365. this.$refs.deptBudgetList.validate((valid) => {
  1366. if (valid) {
  1367. this.deptBudgetList.grossWeight /= 1000
  1368. this.deptBudgetList.tare /= 1000
  1369. this.deptBudgetList.netWeight /= 1000
  1370. this.deptBudgetList.pureWeight /= 1000
  1371. this.deptBudgetList.deductionAmount *= 1000
  1372. this.deptBudgetList.deductionWeight /= 1000
  1373. this.deptBudgetList.compId = localStorage.getItem('ws-pf_compId')
  1374. this.deptBudgetList.skinInspector = localStorage.getItem('ws-pf_staffName')
  1375. this.deptBudgetList.inOutFlag = 1
  1376. this.deptBudgetList.statusFlag = 3
  1377. addstorageputList(this.deptBudgetList)
  1378. .toPromise()
  1379. .then((response) => {
  1380. this.$message.success('添加成功')
  1381. this.$router.push({
  1382. path: 'warehouseManagementList'
  1383. })
  1384. }).catch((response) => {
  1385. this.deptBudgetList.grossWeight = Math.round(this.deptBudgetList.grossWeight*1000)
  1386. this.deptBudgetList.tare = Math.round(this.deptBudgetList.tare*1000)
  1387. this.deptBudgetList.netWeight = Math.round(this.deptBudgetList.netWeight*1000)
  1388. this.deptBudgetList.pureWeight = Math.round(this.deptBudgetList.pureWeight*1000)
  1389. this.deptBudgetList.deductionAmount = Math.round(this.deptBudgetList.deductionAmount/1000)
  1390. this.deptBudgetList.deductionWeight = Math.round(this.deptBudgetList.deductionWeight*1000)
  1391. })
  1392. } else {
  1393. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1394. return false
  1395. }
  1396. })
  1397. })
  1398. },
  1399. tarechange(e) {
  1400. if (this.deptBudgetList.grossWeight && this.deptBudgetList.tare) {
  1401. this.deptBudgetList.netWeight = Number(
  1402. this.deptBudgetList.grossWeight - this.deptBudgetList.tare
  1403. ).toFixed(2)
  1404. }
  1405. },
  1406. grossWeightchange(e) {
  1407. if (this.deptBudgetList.grossWeight && this.deptBudgetList.tare) {
  1408. this.deptBudgetList.netWeight = Number(
  1409. this.deptBudgetList.grossWeight - this.deptBudgetList.tare
  1410. ).toFixed(2)
  1411. }
  1412. },
  1413. selectgoodsName(e) {
  1414. for (var i = 0; i < this.goodnameList.length; i++) {
  1415. if (this.goodnameList[i].goodsName == e) {
  1416. this.deptBudgetList.goodsNameKey = this.goodnameList[i].goodsNameKey
  1417. if(e=='玉米(潮粮)'){
  1418. this.deptBudgetList.type='潮粮'
  1419. }else{
  1420. this.deptBudgetList.type='干粮'
  1421. }
  1422. }
  1423. }
  1424. },
  1425. selectpackingMethod(e) {
  1426. for (var i = 0; i < this.packtypeList.length; i++) {
  1427. if (this.packtypeList[i].constValue == e) {
  1428. this.deptBudgetList.packingMethodKey = this.packtypeList[i].constKey
  1429. }
  1430. }
  1431. },
  1432. selectstorageType(e) {
  1433. for (var i = 0; i < this.deliveryType.length; i++) {
  1434. if (this.deliveryType[i].constValue == e) {
  1435. this.deptBudgetList.inOutTypeKey = this.deliveryType[i].constKey
  1436. }
  1437. }
  1438. },
  1439. handleClose() {
  1440. this.accessoryTFs = false
  1441. },
  1442. handleSizeChange(val) {
  1443. console.log(`每页 ${val} 条`)
  1444. this.pageSize = val
  1445. this.getList()
  1446. },
  1447. handleCurrentChange(val) {
  1448. this.currentPage = val
  1449. console.log(`当前页: ${val}`)
  1450. this.getList()
  1451. },
  1452. getList() {
  1453. // 品级
  1454. pullDown({
  1455. constId: 'CON3'
  1456. })
  1457. .toPromise()
  1458. .then((response) => {
  1459. this.gradeList = response
  1460. })
  1461. // 类型
  1462. if (this.deptBudgetList.warehouseType == 1) {
  1463. // 货名
  1464. goodsname({
  1465. positionId: this.$route.query.positionId
  1466. })
  1467. .toPromise()
  1468. .then((response) => {
  1469. this.goodnameList = response
  1470. })
  1471. //类型
  1472. pullDown({
  1473. constId: 'CON6'
  1474. })
  1475. .toPromise()
  1476. .then((response) => {
  1477. this.deliveryType = response
  1478. })
  1479. } else if (this.deptBudgetList.warehouseType == 2) {
  1480. goodsnameXiala({
  1481. baseId: this.deptBudgetList.warehouseId
  1482. })
  1483. .toPromise()
  1484. .then((response) => {
  1485. this.goodnameList = response
  1486. })
  1487. pullDown({
  1488. constId: 'WARE2'
  1489. })
  1490. .toPromise()
  1491. .then((response) => {
  1492. this.deliveryType = response
  1493. })
  1494. }
  1495. //合同编号
  1496. xialaNo({
  1497. compId: localStorage.getItem('ws-pf_compId'),
  1498. flag: 5
  1499. })
  1500. .toPromise()
  1501. .then((response) => {
  1502. this.outContractNo = response
  1503. })
  1504. //经办人
  1505. getstaff({
  1506. compId: localStorage.getItem('ws-pf_compId'),
  1507. warehouseId: this.deptBudgetList.baseId
  1508. })
  1509. .toPromise()
  1510. .then((response) => {
  1511. // this.agent = response
  1512. this.qualityInspectorList = response
  1513. this.options = response
  1514. this.staffList = response
  1515. })
  1516. },
  1517. selecttaskType(e) {
  1518. for (var i = 0; i < this.taskTypeList.length; i++) {
  1519. if (this.taskTypeList[i].value == e) {
  1520. this.searchType = this.taskTypeList[i].type
  1521. }
  1522. }
  1523. },
  1524. fujian(row) {
  1525. if (
  1526. row.receiveAttachmentPath === null ||
  1527. row.receiveAttachmentPath === ''
  1528. ) {
  1529. EventBus.$emit(
  1530. 'warning',
  1531. this.$t('system.noticeCircular.NoInformation')
  1532. )
  1533. } else {
  1534. this.accessoryTFs = true
  1535. }
  1536. this.appendixIdss = row.receiveAttachmentPath
  1537. },
  1538. handleExamine(row) {
  1539. this.$router.push({
  1540. name: 'salesContractExamine',
  1541. query: {
  1542. id: row.id
  1543. },
  1544. })
  1545. },
  1546. //删除
  1547. approve() {},
  1548. listQuery() {},
  1549. total() {},
  1550. clearfiltQuery() {},
  1551. selectCrtDuty() {},
  1552. },
  1553. }
  1554. </script>
  1555. <style lang="scss" scoped>
  1556. /deep/.basicInformation {
  1557. .ws-info-table {
  1558. border: none;
  1559. }
  1560. .el-form-item {
  1561. width: 33.3333%;
  1562. border: none;
  1563. .el-form-item__label {
  1564. background: transparent;
  1565. border: none;
  1566. }
  1567. .el-form-item__content {
  1568. border: none;
  1569. }
  1570. }
  1571. }
  1572. .el-button--default {
  1573. color: #5473e8;
  1574. border-color: #5473e8;
  1575. }
  1576. .title {
  1577. position: relative;
  1578. padding-left: 10px;
  1579. }
  1580. .title::before {
  1581. content: '';
  1582. display: inline-block;
  1583. width: 5px;
  1584. height: 30px;
  1585. background: #5473e8;
  1586. position: absolute;
  1587. left: 0;
  1588. }
  1589. .el-form {
  1590. padding: 0 10%;
  1591. }
  1592. .el-button--primary {
  1593. background-color: #5878e8;
  1594. border-color: #5878e8;
  1595. }
  1596. .el-col {
  1597. background: #f6f7fc;
  1598. }
  1599. .bg-right {
  1600. text-align: right;
  1601. padding: 16px 20px;
  1602. }
  1603. .center {
  1604. position: relative;
  1605. top: 50px;
  1606. width: 40%;
  1607. height: 2000px;
  1608. margin: 0 auto;
  1609. }
  1610. //选填
  1611. /deep/.el-form-item {
  1612. width: 50%;
  1613. }
  1614. .container {
  1615. overflow: scroll;
  1616. height: 120vh;
  1617. }
  1618. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1619. text-align: center;
  1620. }
  1621. .deliverydate {
  1622. display: inline-block;
  1623. width: 10%;
  1624. }
  1625. .center {
  1626. margin-top: -60px;
  1627. width: 80%;
  1628. }
  1629. //仓位
  1630. .position {
  1631. background: #afb5cb;
  1632. border-radius: 2px;
  1633. font-size: 12px;
  1634. color: #ffffff;
  1635. line-height: 20px;
  1636. padding: 2px 4px;
  1637. position: relative;
  1638. top: -2px;
  1639. }
  1640. .neifor /deep/.ws-info-table .el-form-item .el-form-item__label {
  1641. background: #f6f7fc;
  1642. }
  1643. .neifor .ws-info-table {
  1644. border-left: 1px solid #cdd2dc;
  1645. border-top: 1px solid #cdd2dc;
  1646. }
  1647. .neifor .ws-info-table .el-form-item {
  1648. border-right: 1px solid #cdd2dc;
  1649. border-bottom: 1px solid #cdd2dc;
  1650. }
  1651. .inspector /deep/.ws-info-table .el-form-item .el-form-item__label {
  1652. width: 59px;
  1653. }
  1654. //表格文字
  1655. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1656. text-align: center;
  1657. font-size: 14px;
  1658. font-family: PingFangSC-Regular, PingFang SC;
  1659. font-weight: 400;
  1660. color: #8890b1;
  1661. line-height: 16px;
  1662. }
  1663. .inspector {
  1664. width: 50%;
  1665. }
  1666. //质检员
  1667. .inspector .el-form-item__content {
  1668. text-align: left;
  1669. margin-left: 0px;
  1670. }
  1671. .small-title {
  1672. position: relative;
  1673. padding: 10px;
  1674. font-weight: 600;
  1675. }
  1676. .small-title::before {
  1677. position: absolute;
  1678. content: '';
  1679. display: block;
  1680. background: #5473e8;
  1681. width: 4px;
  1682. height: 14px;
  1683. left: 0px;
  1684. top: 13px;
  1685. }
  1686. //下面列表
  1687. .neifor {
  1688. width: 80%;
  1689. background-color: #f6f7fc;
  1690. }
  1691. /deep/.neifor .ws-info-table .el-form-item .el-form-item__label {
  1692. width: 35%;
  1693. text-align: center;
  1694. }
  1695. /deep/.neifor .ws-info-table .el-form-item .el-form-item__content {
  1696. width: 60%;
  1697. background-color: #f6f7fc;
  1698. }
  1699. /deep/.neifor .el-input--small .el-input__inner {
  1700. width: 100%;
  1701. }
  1702. </style>