addSteelInbound.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <!-- 新增入库转预留作业页面 -->
  3. <div class="addCheckWarehouse">
  4. <page-title>预留转入库作业</page-title>
  5. <div class="material from">
  6. <span class="text">物资规格型号:</span>
  7. <el-input class="input" v-model="materialName" disabled> </el-input>
  8. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  9. </div>
  10. <div class="materialNumber from">
  11. <span class="text">最大入库件数:</span>
  12. <el-input class="input" v-model="max" disabled> </el-input>
  13. </div>
  14. <div class="materialNumber from">
  15. <span class="text">件数:</span>
  16. <el-input class="input" v-model.lazy="materialNumber"> </el-input>
  17. </div>
  18. <div class="materialNumber from">
  19. <span class="text">理重(磅重)</span>
  20. <el-input class="input" v-model="materialTheWeight" disabled> </el-input>
  21. </div>
  22. <div class="materialNumber from">
  23. <span class="text">实重</span>
  24. <el-input class="input" v-model="actuallyWeight"> </el-input>
  25. </div>
  26. <div class="materialNumber from">
  27. <span class="text">备注</span>
  28. <el-input class="input" v-model="remark"> </el-input>
  29. </div>
  30. <!-- 模态窗口 -->
  31. <el-drawer :visible.sync="drawer" :direction="direction" size="50%">
  32. <div style="margin-bottom: 10px">
  33. <el-input
  34. placeholder="请输入内容"
  35. v-model="input"
  36. style="margin-top: 10px; margin-right: 10px; width: 250px"
  37. clearable
  38. ></el-input>
  39. <el-button type="primary" class="btn" @click="onclick(a)">
  40. <i class="el-icon-search"></i>查询
  41. </el-button>
  42. </div>
  43. <div v-show="a == 1">
  44. <dilTable v-bind.sync="first" @radio-change="currentRadioChange1">
  45. <el-table-column label="操作" width="140px">
  46. <template slot-scope="scope">
  47. <el-input v-model.number="scope.row.quantity" style="width:60px">
  48. </el-input>
  49. <el-button
  50. type="text"
  51. size="mini"
  52. @click="deleteInboundMaterial(scope.row)"
  53. >删除</el-button
  54. >
  55. </template>
  56. </el-table-column>
  57. </dilTable>
  58. </div>
  59. <div v-show="a == 2">
  60. <dilTable
  61. v-bind.sync="second"
  62. @radio-change="currentRadioChange2"
  63. ></dilTable>
  64. </div>
  65. </el-drawer>
  66. <div class="button_box">
  67. <el-button @click="onClickCancel">返回</el-button>
  68. <el-button type="primary" @click="onClickConfirm" :disabled="disabled"
  69. >确认</el-button
  70. >
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import PageTitle from "@/components/Page/Title";
  76. import { sjTime, isNumber, isIntegerNumber } from "@/utils/sharedJsFile";
  77. import { getCookie } from "@/utils/util.js";
  78. export default {
  79. components: { PageTitle },
  80. data() {
  81. return {
  82. startTime: null,
  83. endTime: null,
  84. max: null,
  85. disabled: false,
  86. //仓库名称
  87. warehouseName: null,
  88. //物资名称
  89. materialName: null,
  90. //物资编码
  91. materialCode: null,
  92. // 物资规格
  93. materialSpecification: null,
  94. // 物资型号
  95. materialModel: null,
  96. //盘点数量
  97. materialNumber: null,
  98. //物资id
  99. materialId: null,
  100. //是否需要打开模态窗口
  101. drawer: false,
  102. a: 1,
  103. direction: "rtl",
  104. input: "",
  105. first: {
  106. requestUrl: "",
  107. selectionType: "radio",
  108. mapList1: []
  109. },
  110. second: {
  111. requestUrl: "",
  112. selectionType: "radio"
  113. },
  114. materialTheWeight: 0,
  115. actuallyWeight: 0,
  116. remark: null
  117. };
  118. },
  119. watch: {
  120. drawer(val) {
  121. if (!val) {
  122. this.input = null;
  123. }
  124. },
  125. materialNumber() {
  126. this.getTheoreticalByInfo();
  127. }
  128. },
  129. created() {
  130. let strTime = this.formatDate(new Date(), "yyyy-MM-dd hh:mm:ss");
  131. this.startTime = Date.parse(new Date(strTime));
  132. this.endTime = new Date(this.startTime + 86400000);
  133. },
  134. methods: {
  135. deleteInboundMaterial(row) {
  136. if (Number(row.quantity) > 0) {
  137. this.$confirm("确定删除?继续", "提示", {
  138. cancelButtonText: "取消",
  139. confirmButtonText: "确定"
  140. }).then(() => {
  141. console.log(row);
  142. this.axios
  143. .post(
  144. "/api/v1/wms/deleteInboundMaterial?warehouseId=3&materialCode=" +
  145. row.materialCode +
  146. "&materialSpecification=" +
  147. row.materialSpecification +
  148. "&materialModel=" +
  149. row.materialModel +
  150. "&quantity=" +
  151. row.quantity
  152. )
  153. .then(res => {
  154. if (res.data.code == 200) {
  155. this.$message.success("删除成功");
  156. this.first.requestUrl =
  157. "/api/v1/wms/getSteelMaterialModelList?apiId=447&warehouseId=" +
  158. 3 +
  159. "&status=" +
  160. 1 +
  161. "&con=" +
  162. "" +
  163. "&startTime=" +
  164. sjTime(this.startTime) +
  165. "&endTime=" +
  166. sjTime(this.endTime) +
  167. "&i=" +
  168. new Date();
  169. } else {
  170. this.$message.error("删除失败");
  171. }
  172. });
  173. });
  174. } else {
  175. this.$message.warning("请输入需要删除的物资件数");
  176. }
  177. },
  178. getTheoreticalByInfo() {
  179. this.axios
  180. .post(
  181. "/api/v1/wms/getTheoreticalByInfo?warehouseId=" +
  182. 3 +
  183. "&materialCode=" +
  184. this.materialCode +
  185. "&materialSpecification=" +
  186. this.materialSpecification +
  187. "&materialModel=" +
  188. this.materialModel +
  189. "&num=" +
  190. this.materialNumber +
  191. "&status=1" +
  192. "&i=" +
  193. new Date()
  194. )
  195. .then(res => {
  196. if (res.data.data == -1) {
  197. this.$message.error("数量超出");
  198. this.materialTheWeight = null;
  199. } else {
  200. this.materialTheWeight = parseFloat(res.data.data);
  201. }
  202. });
  203. },
  204. formatDate(date, fmt) {
  205. if (/(y+)/.test(fmt)) {
  206. fmt = fmt.replace(
  207. RegExp.$1,
  208. (date.getFullYear() + "").substr(4 - RegExp.$1.length)
  209. );
  210. }
  211. let o = {
  212. "M+": date.getMonth() + 1,
  213. "d+": date.getDate(),
  214. "h+": 0,
  215. "m+": 0,
  216. "s+": 0
  217. };
  218. for (let k in o) {
  219. if (new RegExp(`(${k})`).test(fmt)) {
  220. let str = o[k] + "";
  221. fmt = fmt.replace(
  222. RegExp.$1,
  223. RegExp.$1.length === 1 ? str : this.padLeftZero(str)
  224. );
  225. }
  226. }
  227. return fmt;
  228. },
  229. padLeftZero(str) {
  230. return ("00" + str).substr(str.length);
  231. },
  232. onclick(a) {
  233. if (a == 1) {
  234. console.log(this.input);
  235. this.first.requestUrl =
  236. "/api/v1/wms/getSteelMaterialModelList?apiId=447&warehouseId=" +
  237. 3 +
  238. "&status=" +
  239. 1 +
  240. "&con=" +
  241. this.input +
  242. "&startTime=" +
  243. sjTime(this.startTime) +
  244. "&endTime=" +
  245. sjTime(this.endTime) +
  246. "&i=" +
  247. new Date();
  248. }
  249. },
  250. ondrawer(num) {
  251. this.drawer = true;
  252. this.a = num;
  253. if (num == 1) {
  254. this.first.requestUrl =
  255. "/api/v1/wms/getSteelMaterialModelList?apiId=447&warehouseId=" +
  256. 3 +
  257. "&status=" +
  258. 1 +
  259. "&con=" +
  260. "" +
  261. "&startTime=" +
  262. sjTime(this.startTime) +
  263. "&endTime=" +
  264. sjTime(this.endTime) +
  265. "&i=" +
  266. new Date();
  267. }
  268. },
  269. // 返回
  270. onClickCancel() {
  271. this.$router.push("/steel_inbound");
  272. },
  273. currentRadioChange1(selection) {
  274. console.log(selection);
  275. this.materialName = selection.materialName;
  276. this.materialCode = selection.materialCode;
  277. this.materialSpecification = selection.materialSpecification;
  278. this.materialModel = selection.materialModel;
  279. this.max = selection.max;
  280. },
  281. currentRadioChange2(selection) {
  282. this.warehouseId = selection.warehouseId;
  283. this.warehouseName = selection.warehouseName;
  284. },
  285. // 确认
  286. onClickConfirm() {
  287. this.disabled = true;
  288. // if(isNumber(this.actuallyWeight))
  289. if (!isNumber(this.actuallyWeight)) {
  290. this.$message.error("实重填写不正确");
  291. return;
  292. }
  293. this.axios
  294. .post(
  295. "/api/v1/wms/insertReserved?warehouseId=" +
  296. 3 +
  297. "&materialCode=" +
  298. this.materialCode +
  299. "&materialSpecification=" +
  300. this.materialSpecification +
  301. "&materialModel=" +
  302. this.materialModel +
  303. "&quantity=" +
  304. this.materialNumber +
  305. "&actuallyWeight=" +
  306. Number(parseFloat(this.actuallyWeight)) +
  307. "&materialTheWeight=" +
  308. Number(parseFloat(this.materialTheWeight)) +
  309. "&remark=" +
  310. this.remark
  311. )
  312. .then(res => {
  313. console.log(res.data);
  314. if (res.data.code == "200") {
  315. this.$message({
  316. message: "入库成功!",
  317. type: "success"
  318. });
  319. this.disabled = false;
  320. this.onClickCancel();
  321. this.$router.go(-1);
  322. } else if (res.data.code == "201") {
  323. this.$message({
  324. message: "入库的数量不正确",
  325. type: "faile"
  326. });
  327. this.disabled = false;
  328. }
  329. this.$router.go(-1);
  330. })
  331. .catch(() => {
  332. this.disabled = false;
  333. });
  334. }
  335. }
  336. };
  337. </script>
  338. <style lang="scss" scope>
  339. .addCheckWarehouse {
  340. .contractDetails {
  341. width: 100%;
  342. }
  343. .from {
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. margin-top: 5px;
  348. margin-bottom: 20px;
  349. }
  350. .warehouse {
  351. display: flex;
  352. justify-content: center;
  353. margin-top: 20px;
  354. margin-right: 70px;
  355. .text {
  356. display: inline-block;
  357. width: 170px;
  358. text-align: right;
  359. }
  360. .input {
  361. width: 250px;
  362. margin-right: 20px;
  363. }
  364. }
  365. .material {
  366. display: flex;
  367. justify-content: center;
  368. margin-top: 20px;
  369. .text {
  370. display: inline-block;
  371. width: 170px;
  372. text-align: right;
  373. }
  374. .input {
  375. width: 250px;
  376. margin-right: 20px;
  377. }
  378. }
  379. .materialNumber {
  380. display: flex;
  381. justify-content: center;
  382. margin-top: 20px;
  383. margin-right: 70px;
  384. .text {
  385. display: inline-block;
  386. width: 170px;
  387. text-align: right;
  388. }
  389. .input {
  390. width: 250px;
  391. margin-right: 20px;
  392. }
  393. }
  394. .button_box {
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. width: 100%;
  399. height: 100px;
  400. }
  401. }
  402. </style>