steel_restackAdd.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. // 新增倒垛作业
  2. <template>
  3. <div class="steel_restackAdd">
  4. <PageTitle>返回</PageTitle>
  5. <div class="search">
  6. <div class="warehouse">
  7. <span>仓库名称:</span>
  8. <el-select v-model="value1" placeholder="请选择" @change="onchange1()">
  9. <el-option
  10. v-for="(item,i) in options1"
  11. :key="i"
  12. :label="item.label"
  13. :value="item.value"
  14. >
  15. </el-option>
  16. </el-select>
  17. </div>
  18. <div class="stack">
  19. <span>垛位:</span>
  20. <el-select v-model="value2" placeholder="请选择" @change ="onchange2()">
  21. <el-option
  22. v-for="(item,i) in options2"
  23. :key="i"
  24. :label="item.label"
  25. :value="item.value"
  26. >
  27. </el-option>
  28. </el-select>
  29. </div>
  30. <div class="gradationnumber">
  31. <span>层次:</span>
  32. <el-select v-model="value3" placeholder="请选择" @change="onchange3()">
  33. <el-option
  34. v-for="(item,i) in options3"
  35. :key="i"
  36. :label="item.label"
  37. :value="item.value">
  38. </el-option>
  39. </el-select>
  40. <el-button type="primary" class="btn" @click="selectMaterial()">新增倒垛单</el-button>
  41. </div>
  42. </div>
  43. <el-drawer
  44. :visible.sync="table"
  45. direction="rtl"
  46. size="50%"
  47. :show-close="false"
  48. >
  49. <el-button @click="open">取消</el-button>
  50. <el-button type="primary" @click="makeSure1">新增</el-button>
  51. <div class="warehouse">
  52. <span>仓库名称:</span>
  53. <el-select v-model="value1" placeholder="请选择" @change="onchange1()">
  54. <el-option
  55. v-for="(item,i) in options1"
  56. :key="i"
  57. :label="item.label"
  58. :value="item.value"
  59. >
  60. </el-option>
  61. </el-select>
  62. </div>
  63. <div class="stack">
  64. <span>垛位:</span>
  65. <el-select v-model="value2" placeholder="请选择" @change ="onchange2()">
  66. <el-option
  67. v-for="(item,i) in options2"
  68. :key="i"
  69. :label="item.label"
  70. :value="item.value"
  71. >
  72. </el-option>
  73. </el-select>
  74. </div>
  75. <div class="gradationnumber">
  76. <span>层次:</span>
  77. <el-select v-model="value3" placeholder="请选择" @change="onchange3()">
  78. <el-option
  79. v-for="(item,i) in options3"
  80. :key="i"
  81. :label="item.label"
  82. :value="item.value">
  83. </el-option>
  84. </el-select>
  85. </div>
  86. <div class="stack">
  87. <span>新垛位:</span>
  88. <el-select v-model="value5" placeholder="请选择" @change ="onchange5()">
  89. <el-option
  90. v-for="(item,i) in options5"
  91. :key="i"
  92. :label="item.label"
  93. :value="item.value"
  94. >
  95. </el-option>
  96. </el-select>
  97. </div>
  98. <div class="tablecls">
  99. <!-- 查询所有的物资 -->
  100. <dilTable v-bind.sync="option" @selection-change="selectionChange1">
  101. <!-- 操作列 -->
  102. <el-table-column fixed="right" label="件数" prop="quantity" width="100">
  103. <template slot-scope="scope">
  104. <el-input
  105. class="textinput1"
  106. v-model.number="scope.row.quantity"
  107. ></el-input>
  108. </template>
  109. </el-table-column>
  110. </dilTable>
  111. </div>
  112. </el-drawer>
  113. <div class="table" >
  114. <dilTable v-bind.sync="options11" @selection-change="selectionChange"></diltable>
  115. </div>
  116. <div class="search">
  117. <div class="warehouse">
  118. <span>仓库名称:</span>
  119. <el-select v-model="value1" disabled placeholder="请选择" @change="onchange4()">
  120. <el-option
  121. v-for="(item,i) in options1"
  122. :key="i"
  123. :label="item.label"
  124. :value="item.value"
  125. >
  126. </el-option>
  127. </el-select>
  128. </div>
  129. <div class="stack">
  130. <span>新垛位:</span>
  131. <el-select v-model="value5" placeholder="请选择" @change ="onchange5()">
  132. <el-option
  133. v-for="(item,i) in options5"
  134. :key="i"
  135. :label="item.label"
  136. :value="item.value"
  137. >
  138. </el-option>
  139. </el-select>
  140. </div>
  141. </div>
  142. <div class="table">
  143. <dilTable v-bind.sync="options" ></diltable>
  144. </div>
  145. </div>
  146. </template>
  147. <script>
  148. // import PageTitle from "@/components/Page/Title";
  149. export default {
  150.   data(){
  151.     return{
  152. table:false,
  153. sselectionList1: [],
  154. form1:{},
  155.       inputText:"",
  156. options11:{
  157.     // first请求数据的地址
  158.     requestUrl: "/api/v1/wms/getWmspRestackMakeResultList?apiId=106",
  159. selectionType: "select",
  160.   },
  161.       options:{
  162.         // first请求数据的地址
  163.       requestUrl: "/api/v1/wms/getWmspRestackMakeResultList?apiId=106",
  164.       },
  165. //仓库
  166. options1:[],
  167. // 选中的仓库
  168. value1:'',
  169. // 垛位
  170. options2:[],
  171. // 选中垛位
  172. value2:'',
  173. // 层次
  174. options3:[],
  175. // 选中的层次
  176. value3:'',
  177. // 新增下拉框
  178. // 垛位
  179. options5:[],
  180. // 选中垛位
  181. value5:'',
  182. inf: {},
  183. // 每个物资型号的件数
  184. quantity:[],
  185. option: {
  186. // 表格请求物资型号
  187. requestUrl: "/api/v1/wms/getMaterialTypeList?warehouseid="+this.value1+"&stackingId="+this.value2+"&gradtionNumber="+this.value3+"&apiId=437",
  188. // 控制显示多选列
  189. selectionType: "select",
  190. },
  191.     }
  192.   },
  193. mounted(){
  194. this.initialization();
  195. //新增下拉框方法
  196. // this.initialization1();
  197. },
  198. methods: {
  199. // 创建选择物资型号的方法
  200. selectMaterial(){
  201. this.table =true
  202. this.option.requestUrl="/api/v1/wms/getMaterialTypeList?warehouseid="+this.value1+"&stackingId="+this.value2+"&gradtionNumber="+this.value3+"&apiId=437";
  203. },
  204. // 返回选中的物资信息
  205. selectionChange1(selection) {
  206. this.selectionList1 = [];
  207. this.selectionList1 = selection;
  208. },
  209. // 新增倒垛单
  210. makeSure1() {
  211. this.table = false;
  212. let maps =this.selectionList1;
  213. console.log("maps",maps)
  214. if(
  215. maps[0]==null
  216. )this.$message.error("存在空值!");
  217. else
  218. this.axios
  219. .post("/api/v1/wms/createRestackMakeResult?keeperId=2&beforeLevel="+this.value3+"&afterStackingId="+this.value5+"&afterWarehouseId="+this.value1+"&afterBeforeStackingId="+this.value2+"&resultRemark="+"",maps)
  220. .then((res) => {
  221. if (res.data.code == 200) {
  222. this.$message({
  223. type: "success",
  224. message: "新增成功!",
  225. });
  226. this.$router.go(-1);
  227. }else{
  228. this.$message.error("新增失败,可能存在重复!");
  229. }
  230. });
  231. },
  232. open() {
  233. if (this.selectionList1.length != 0) {
  234. this.$confirm("取消会将已选择的数据清空, 是否继续?", "提示", {
  235. confirmButtonText: "确定",
  236. cancelButtonText: "取消",
  237. type: "warning",
  238. })
  239. .then(() => {
  240. this.selectionList1 = [];
  241. this.table = false;
  242. })
  243. .catch(() => {});
  244. } else {
  245. this.table = false;
  246. }
  247. },
  248. // 添加倒垛单
  249. toInsert() {
  250. this.$router.push({
  251. name: 'steel_restackTransfer',
  252. params: {
  253. mapValue:{
  254. valus:"ssss",
  255. cangku:this.value1,
  256. duowei:this.value2,
  257. cengci:this.value3
  258. }
  259. }
  260. })
  261. },
  262. //初始化选择仓库垛位
  263. initialization(){
  264. this.axios.get('/api/v1/wms/selectWarehouse').then((res)=>{
  265. this.options1 = res.data.data
  266. this.axios.post('/api/v1/wms/getWmspRestackMakeResultList?apiId=106',{
  267. warehouseid:this.value1
  268. })
  269. })
  270. },
  271. onchange1(){
  272. console.log(1);
  273. // 查询选中的仓库垛位
  274. this.axios.get('/api/v1/wms/selectStackingId?warehouseid='+this.value1).then((res)=>{
  275. this.options2 = res.data.data;
  276. this.options5=res.data.data;
  277. this.options11.requestUrl="/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid="+this.value1;
  278. this.options.requestUrl = "/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid=" + this.value1;
  279. })
  280. },
  281. onchange2(){
  282. if(this.value1 == ''){
  283. this.$message({
  284. message: '请选择仓库之后!再选择',
  285. type: 'warning'
  286. });
  287. this.value2 = ''
  288. }else{
  289. console.log('-----')
  290. console.log(this.value2)
  291. // this.options11.requestUrl="/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid="+this.value1+"&stackingId="+this.value2;
  292. // this.options.requestUrl ="/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid="+this.value1+"&stackingId="+this.value2;
  293. // console.log(this.options11.requestUrl)
  294. //选择仓库层次号
  295. this.axios.get('/api/v1/wms/selectGardationNumber?warehouseid='+this.value1+'&stackingId='+this.value2).then((res)=>{
  296. this.options3 = res.data.data;
  297. console.log("层次选择"+this.options3)})
  298. console.log("fasdsaf")
  299. }},
  300. onchange3(){
  301. console.log("change3")
  302. if(this.value2 == ''||this.value1==''){
  303. this.$message({
  304. message: '请选择仓库和垛位之后!再选择',
  305. type: 'warning'
  306. });
  307. this.value3 = ''
  308. }else{
  309. console.log(this.value1,this.value2)
  310. this.options11.requestUrl="/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid="+this.value1 +
  311. "&stackingId="+this.value2+"&gradtionNumber=" + this.value3
  312. }
  313. },
  314. onchange4(){
  315. // console.log(1);
  316. // 查询选中的仓库垛位
  317. this.axios.get('/api/v1/wms/selectStackingId?warehouseid='+this.value1).then((res)=>{
  318. console.log( this.options5 = res.data.data)
  319. // this.options5 = res.data.data;
  320. this.axios.post('/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid='+this.value1)
  321. })
  322. },
  323. onchange5(){
  324. this.options.requestUrl = "/api/v1/wms/getWmspRestackMakeResultList?apiId=106&warehouseid="+this.value1+"&stackingId="+this.value5;
  325. },
  326. onclick(){
  327.       console.log("点击事件");
  328.      },
  329. // 确认
  330. onClickConfirm() {
  331. //console.log("inf",this.inf);
  332. let wmspRestackMakeResult={
  333. //垛位id
  334. stackingId:this.inf[0].stackingId,
  335. //层次
  336. // gridGradationNumber:that.value3,
  337. //倒垛前网格id
  338. GridId:this.inf[0].GridId,
  339. //仓库id
  340. warehouseid:this.value1,
  341. //倒垛后的垛位id
  342. stackingId1:this.value5,
  343. //倒垛后的层次id
  344. // gridGradationNumber1:that.value6,
  345. };
  346. //初始化maplist
  347. var maplist=[];
  348. this.inf.forEach((item,i)=>{
  349. //初始化mapItem
  350. var mapItem={
  351. //物资编码
  352. materialCode:"",
  353. //物资炉号
  354. materialFurnaceNumber:"",
  355. // 物资理重
  356. materialTheoreticalWeight:0,
  357. //物资名称
  358. materialName:"",
  359. //物资件数
  360. makeMaterialNumber:0,
  361. //物资id
  362. materialId:0,
  363. };
  364. mapItem.materialCode=item.materialCode;
  365. mapItem.materialFurnaceNumber=item.materialFurnaceNumber;
  366. mapItem.materialTheoreticalWeight=item.materialTheoreticalWeight;
  367. mapItem.materialName=item.materialName;
  368. mapItem.makeMaterialNumber=item.makeMaterialNumber;
  369. mapItem.materialId=item.materialId;
  370. maplist.push(mapItem);
  371. });
  372. let map = {
  373. wmspRestackMakeResult : wmspRestackMakeResult,
  374. maplist: maplist
  375. };
  376. console.log(map)
  377. // console.log("map",map);
  378. this.axios
  379. .post("/api/v1/wms/addRestackMakeResult/", map)
  380. .then((res) => {
  381. if(res.data.code == 200){
  382. this.$router.push("/steel_restack")
  383. this.$message({
  384. type: "success",
  385. message: "新增成功!",
  386. });
  387. }
  388. });
  389. },
  390. selectionChange(row) {
  391. console.log("当前选中行的数据:");
  392. console.log(row);
  393. this.inf = row;
  394. console.log(this.inf);
  395. },
  396. // 取消
  397. cancel() {
  398. this.$router.go(-1);
  399. },
  400. },
  401. };
  402. </script>
  403. <style lang="scss" scode>
  404. .steel_restackAdd{
  405. .search{
  406. height: 5rem;
  407. display: flex;
  408. align-items:center;
  409. padding-left:0.625rem;
  410. .warehouse,.stack,.gradationnumber{
  411. margin-left: 1.25rem;
  412. }
  413. }
  414. .form{
  415. display: inline;
  416. justify-content: center;
  417. margin-left: 1.25rem;
  418. }
  419. .button_box{
  420. width: 90%;
  421. position: fixed;
  422. bottom: 1.25rem;
  423. display: flex;
  424. justify-content: center;
  425. }
  426. }
  427. </style>