From 588407f3ad4279a7ed792dfaaee2ef91b57aa179 Mon Sep 17 00:00:00 2001
From: 况洋洋 <3283105747@qq.com>
Date: 星期四, 10 七月 2025 18:24:20 +0800
Subject: [PATCH] 采购入库增加入库类型选择、后端代码优化
---
H5/BarCfBefore.aspx | 77 +++++++++++++++
H5/Js/BarCfBefore.js | 168 +++++++++++++++++++++++++++++++++
H5/PurchaseInventory.aspx | 1
H5/Js/PurchaseInventory.js | 21 ++--
H5/BarCfBefore.aspx.cs | 14 ++
5 files changed, 271 insertions(+), 10 deletions(-)
diff --git a/H5/BarCfBefore.aspx b/H5/BarCfBefore.aspx
new file mode 100644
index 0000000..c7e8829
--- /dev/null
+++ b/H5/BarCfBefore.aspx
@@ -0,0 +1,77 @@
+锘�<%@ Page Title="鍏ュ簱鍓嶆媶鏂�" Language="C#" MasterPageFile="~/Mst.master" AutoEventWireup="true" CodeFile="BarCfBefore.aspx.cs" Inherits="H5_BarCfBefore" %>
+<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
+ <style>
+ .bg-info {
+ background-color:#fff;
+ }
+
+</style>
+</asp:Content>
+<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
+ <van-nav-bar
+ title="鍏ュ簱鍓嶆媶鏂�"
+ left-text="杩斿洖"
+ left-arrow
+ @click-left="GoBack()"
+></van-nav-bar>
+ <div class="mySolid">
+ <van-cell-group>
+ <van-field
+ ref="barcode"
+ v-model="formData.barcode"
+ label="鐗╂枡鏉$爜"
+ clearable
+ placeholder="璇锋壂鐮�"
+ :right-icon-size="19"
+ v-focus.noKeyboard
+ @keyup.enter.native="getScan"
+<%-- @change="getScan"--%>
+></van-field>
+ <van-field
+ v-model="formData.itemNo"
+ label="鐗╂枡缂栫爜"
+ placeholder=""
+ disabled
+></van-field>
+ <van-field
+ v-model="formData.itemName"
+ label="鐗╂枡鍚嶇О"
+ placeholder=""
+ disabled
+></van-field>
+ <van-field
+ v-model="formData.itemModel"
+ label="鐗╂枡瑙勬牸"
+ placeholder=""
+ disabled
+></van-field>
+ <van-field
+ v-model="formData.sumQuantity"
+ label="鏉$爜鏁伴噺"
+ placeholder="鏉$爜鏁伴噺"
+ disabled
+></van-field>
+ <van-field
+ ref="cfNum"
+ v-model="formData.cfNum"
+ label="鎷嗗垎鏁伴噺"
+ clearable
+ placeholder="璇疯緭鍏ユ媶鍒嗘暟閲�"
+ @input="handleNumberInput3"
+ :right-icon-size="19"
+ v-focus.noKeyboard
+></van-field>
+</van-cell-group>
+ </div>
+
+ <van-button type="primary" @click="getChaiFen" >纭鎷嗗垎</van-button>
+ <%--<van-button type="primary" @click="ToErp" >瀹℃牳</van-button>--%>
+<%-- <van-button type="primary" @click="cleraCode" >娓呴櫎搴撲綅缂栫爜</van-button>--%>
+</asp:Content>
+<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server">
+ <comloading v-if="isLoading"></comloading>
+ <%--<comback ></comback>--%>
+</asp:Content>
+<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
+ <script src="Js/BarCfBefore.js?<%=001 %>"></script>
+</asp:Content>
\ No newline at end of file
diff --git a/H5/BarCfBefore.aspx.cs b/H5/BarCfBefore.aspx.cs
new file mode 100644
index 0000000..1783644
--- /dev/null
+++ b/H5/BarCfBefore.aspx.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+public partial class H5_BarCfBefore : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/H5/Js/BarCfBefore.js b/H5/Js/BarCfBefore.js
new file mode 100644
index 0000000..526f35f
--- /dev/null
+++ b/H5/Js/BarCfBefore.js
@@ -0,0 +1,168 @@
+锘縱ar vm = new Vue({
+ el: '#app',
+ data: function () {
+ return {
+ isLoading: false,
+ userInfo: {
+ "loginGuid": '',
+ "loginAccount": '',
+ },
+ formData: {
+ barcode: "",
+ itemNo: "",
+ sumQuantity: 0
+ },
+ itemInsFormData: {},
+ tableData: [],
+ itemTableData: [],
+ barMessage: "",
+
+ Message: "",
+ messageCenter: {},
+ messageId: 0,
+
+ showClearIcon: false,
+ focus1: true,
+ focus2: false,
+ isActive: 0,
+ index: 0,
+ currentTab: 0,
+ contentScrollW: 0, // 瀵艰埅鍖哄搴�
+ scrollLeft: 0, // 妯悜婊氬姩鏉′綅缃�
+ fullHeight: "",
+ }
+ },
+ mounted() {
+ var that = this;
+ this.userInfo = {
+ loginGuid: this.GetLoginInfor().loginGuid,
+ loginAccount: this.GetLoginInfor().loginAccount,
+ };
+ },
+ methods: {
+ //getModel() {
+ // var that = this;
+ // that.isLoading = true;
+ // that.AxiosHttp("post", 'MesDepotSections/GetSectionName', {
+ // sectionCode: that.formData.sectionCode
+ // }, false)
+ // .then(function (res) {
+ // var json = res;
+ // if (json.status == 0) {
+ // that.formData.sectionName = json.data.tbBillList;
+ // }
+ // else {
+ // that.$toast.fail(json.message);
+ // that.formData.sectionName = "";
+ // }
+ // that.isLoading = false;
+ // })
+ // .catch(function (error) {
+ // that.isLoading = false;
+ // that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ // console.log(error);
+ // that.$refs.daa001.focus();
+ // });
+ //},
+ getScan() {
+ var that = this;
+
+ that.isLoading = true;
+ that.AxiosHttp("post", 'MesBarCF/GetBarInfoBefore', {
+ barcode: that.formData.barcode,
+ }, false)
+ .then(function (res) {
+ var json = res;
+ if (json.status == 0) {
+
+ that.formData.sumQuantity = json.data.tbBillList.quantity;
+
+ that.formData.itemNo = json.data.tbMesItems.itemNo;
+ that.formData.itemName = json.data.tbMesItems.itemName;
+ that.formData.itemModel = json.data.tbMesItems.itemModel;
+
+ //that.itemInsFormData = json.data.tbBillList.itemIns;
+ //that.itemTableData = json.data.tbBillList.itemInDetails;
+ //that.tableData = json.data.tbBillList.invItemInCDetails;
+ //that.barMessage = json.data.tbBillList.message;
+ //that.$refs.barcode.focus();
+ //that.formData.barcode = null;
+ that.$refs.cfNum.focus();
+ }
+ else {
+ that.$toast.fail(json.message);
+ that.$refs.barcode.focus();
+ that.formData.barcode = null;
+ }
+ //that.$notify({ type: 'success', message: json.message });
+ that.isLoading = false;
+ })
+ .catch(function (error) {
+ that.isLoading = false;
+ that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ console.log(error);
+ that.$refs.barcode.focus();
+ });
+ },
+ getChaiFen() {
+ if (this.isLoading) {
+ return;
+ }
+
+ var that = this;
+
+ if (that.formData.cfNum * 1 <= 0) {
+ that.$toast.fail("鎷嗗垎鏁伴噺涓嶈兘涓虹┖锛�");
+ return;
+ }
+ // ... existing code ...
+ if (parseFloat(that.formData.cfNum) > parseFloat(that.formData.sumQuantity)) {
+ that.$toast.fail("鎷嗗垎鏁伴噺涓嶈兘澶т簬鏉$爜鏁伴噺锛�");
+ return;
+ }
+ // ... existing code ...
+ if (that.formData.barcode.length * 1 <= 0) {
+ that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
+ return;
+ }
+ that.isLoading = true;
+ that.AxiosHttp("post", 'MesBarCF/BarCfBefore', {
+ userName: that.userInfo.loginAccount,
+ barcode: that.formData.barcode,
+ CfNum: that.formData.cfNum,
+ }, false)
+ .then(function (res) {
+ var json = res;
+ if (json.status == 0) {
+ // that.modeInfo = json.data.tbBillList;
+ // 鎷嗗垎鍏ㄥ眬璋冪敤鏂规硶
+ that.sendPrintMessage(json.data.tbBillList);
+ that.$refs.barcode.focus();
+ that.formData.barcode = null;
+ that.formData.cfNum = null;
+ that.$notify({ type: 'success', message: json.message });
+ }
+ else {
+ that.$toast.fail(json.message);
+ that.$refs.cfNum.focus();
+ }
+ that.isLoading = false;
+ })
+ .catch(function (error) {
+ that.isLoading = false;
+ that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ console.log(error);
+ });
+ },
+ //cleraCode() {
+ // this.formData.sectionCode = null;
+ //},
+ handleNumberInput3(value) {
+ this.formData.cfNum = value.replace(/[^\d.]/g, '') // 1. 鍘婚櫎闈炴暟瀛楀拰灏忔暟鐐�
+ .replace(/(\..*)\./g, '$1') // 2. 绂佹澶氫釜灏忔暟鐐�
+ .replace(/^\./g, '');
+ },
+
+
+ }
+})
\ No newline at end of file
diff --git a/H5/Js/PurchaseInventory.js b/H5/Js/PurchaseInventory.js
index b680737..615bf63 100644
--- a/H5/Js/PurchaseInventory.js
+++ b/H5/Js/PurchaseInventory.js
@@ -47,19 +47,19 @@
};
},
methods: {
+
getInfo() {
this.show = true;
},
- onSelect(item) {
- // 榛樿鎯呭喌涓嬬偣鍑婚�夐」鏃朵笉浼氳嚜鍔ㄦ敹璧�
- // 鍙互閫氳繃 close-on-click-action 灞炴�у紑鍚嚜鍔ㄦ敹璧�
+
+ // 淇 onSelect 鏂规硶
+ onSelect(item) { // item 鏄�変腑鐨勫璞★紙濡� { name: "姝e父鍏ュ簱" }锛�
+ this.rkType = item.name; // 鎻愬彇 name 瀛楁浣滀负閫変腑鍊�
this.show = false;
-
- this.rkType = item.name;
- //this.GetMesItemBlDetailByBillNo();
- //this.$toast(item.name);
-
+ console.log('閫変腑鐨勫叆搴撶被鍨�:', this.rkType);
},
+
+
getModel() {
var that = this;
that.isLoading = true;
@@ -103,13 +103,14 @@
that.$playSound('error');
return;
}
-
+ console.log('鎻愪氦鍓� rkType 鐨勫��:', this.rkType); // 纭鏄惁涓哄崟涓瓧绗︿覆
+ console.log('鎻愪氦鍓� rkType 鐨勭被鍨�:', typeof this.rkType); // 搴旇緭鍑� "string"
that.isLoading = true;
that.AxiosHttp("post", 'MesInvItemInCDetails/SaveBarCodes', {
sectionCode: that.sectionCode,
userName: that.userInfo.loginAccount,
barcode: that.formData.barcode,
- cgrkType: that.actions
+ cgrkType: this.rkType // 鐩存帴浣跨敤 rkType锛岄粯璁ゅ�兼垨閫変腑鍊�
}, false)
.then(function (res) {
var json = res;
diff --git a/H5/PurchaseInventory.aspx b/H5/PurchaseInventory.aspx
index 0ad2df3..25f159f 100644
--- a/H5/PurchaseInventory.aspx
+++ b/H5/PurchaseInventory.aspx
@@ -25,6 +25,7 @@
v-model="rkType"
v-focus.noKeyboard
><template #button>
+
<van-button size="small" type="info" plain @click="getInfo" >閫夋嫨</van-button>
</template></van-field>
<van-field
--
Gitblit v1.9.3