From cfdbd0eadeb5dbe4ff8872bb67f43ae8f323a799 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 13 十月 2025 09:35:13 +0800
Subject: [PATCH] 优化入库单导入功能
---
HTML/views/SOSetting/ExportNoticeAddFrom.html | 1028 ++++++++++++++++++++++++++++----------------------------
1 files changed, 511 insertions(+), 517 deletions(-)
diff --git a/HTML/views/SOSetting/ExportNoticeAddFrom.html b/HTML/views/SOSetting/ExportNoticeAddFrom.html
index 95df954..f8961d2 100644
--- a/HTML/views/SOSetting/ExportNoticeAddFrom.html
+++ b/HTML/views/SOSetting/ExportNoticeAddFrom.html
@@ -1,344 +1,274 @@
<!DOCTYPE html>
<html>
- <head>
- <meta charset="utf-8">
- <title>娣诲姞鍑哄簱鍗�</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, minExum-scale=1.0, maxExum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
- <style>
+<head>
+ <meta charset="utf-8">
+ <title>娣诲姞鍑哄簱鍗�</title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width, initial-scale=1.0, minExum-scale=1.0, maxExum-scale=1.0, user-scalable=0">
+ <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+ <style>
.isShow{
- display: block;
- }
+ display: block;
+ }
.isNoShow{
- display: none;
- }
- </style>
- </head>
- <body>
- <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 0 0 0;">
- <div class="layui-form-item" style="margin-bottom: 0px;">
- <!-- <div class="layui-inline">
- <label class="layui-form-label">鍑哄簱浠撳簱</label>
- <div class="layui-input-inline">
- <select name="WarehouseId" id="WarehouseId" lay-filter="WarehouseId" lay-verify="required" lay-search>
- <option value=""></option>
- </select>
- </div>
- </div> -->
- <div class="layui-inline">
- <label class="layui-form-label">鍗曟嵁绫诲瀷</label>
- <div class="layui-input-inline">
- <select name="Type" id="Type" lay-filter="Type" lay-verify="required" lay-search>
- <!-- <option value=""></option> -->
- <!--JC26-->
- <option value="0">鎴愬搧鍑哄簱</option>
- <option value="1">棰嗘枡鍑哄簱</option>
- <option value="2">鎶芥鍑哄簱</option>
- <option value="4">涓嶅悎鏍煎搧鍑哄簱</option>
- <option value="5">涓棿鍝佸嚭搴�</option>
- <!-- <option value="7">鍏朵粬鍑哄簱</option> -->
- <option value="9">閲囪喘閫�璐у嚭搴�</option>
- </select>
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label" id="CustomerNamep">瀹㈡埛鍚嶇О</label>
- <div class="layui-input-inline">
- <select name="CustomerNo" id="CustomerNo" lay-search>
- <option value=""></option>
- </select>
- </div>
- </div>
- <div class="layui-inline " id="chengyunshang">
- <label class="layui-form-label">鎵胯繍鍟�</label>
- <div class="layui-input-inline">
- <select name="LogisticsId" id="LogisticsId" lay-search>
- <option value=""></option>
- </select>
- </div>
- </div>
- <div class="layui-inline">
- <div style="padding-bottom: 2px;margin-left: 15px;">
- <button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add">娣诲姞鏄庣粏</button>
- <button type="submit" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit=""
- lay-filter="form1">绔嬪嵆鎻愪氦</button>
- </div>
+ display: none;
+ }
+ </style>
+</head>
+<body>
+ <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 0 0 0;">
+ <div class="layui-form-item" style="margin-bottom: 0px;">
+
+ <div class="layui-inline">
+ <label class="layui-form-label">鍗曟嵁绫诲瀷</label>
+ <div class="layui-input-inline">
+ <select name="Type" id="Type" lay-filter="Type" lay-verify="required" lay-search>
+ <!-- <option value=""></option> -->
+ <!--JC26-->
+ <option value="0">鎴愬搧鍑哄簱</option>
+ <option value="1">棰嗘枡鍑哄簱</option>
+ <option value="2">鎶芥鍑哄簱</option>
+ <option value="4">涓嶅悎鏍煎搧鍑哄簱</option>
+ <option value="7">鍏朵粬鍑哄簱</option>
+ <option value="9">鐢熶骇棰嗘枡鍑哄簱</option>
+ </select>
</div>
</div>
-
- <div class="layui-card">
- <div class="layui-card-body">
-
- <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
-
- <!-- <script type="text/html" id="switchTpl">
+ <div class="layui-inline">
+ <label class="layui-form-label">鍑哄簱浠撳簱</label>
+ <div class="layui-input-inline">
+ <select name="WarehouseId" id="WarehouseId" lay-filter="WarehouseId" lay-verify="required"
+ lay-search>
+ <option value=""></option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label" id="CustomerNamep">瀹㈡埛鍚嶇О</label>
+ <div class="layui-input-inline">
+ <select name="CustomerNo" id="CustomerNo" lay-search>
+ <option value=""></option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-inline " id="chengyunshang">
+ <label class="layui-form-label">鎵胯繍鍟�</label>
+ <div class="layui-input-inline">
+ <select name="LogisticsId" id="LogisticsId" lay-search>
+ <option value=""></option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <div style="padding-bottom: 2px;margin-left: 15px;">
+ <button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add">娣诲姞鏄庣粏</button>
+ <button type="submit" class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit=""
+ lay-filter="form1">绔嬪嵆鎻愪氦</button>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-card">
+ <div class="layui-card-body">
+
+ <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
+
+ <!-- <script type="text/html" id="switchTpl">
<input type="checkbox" name="IsBale" value="{{d.LAY_TABLE_INDEX}}" lay-skin="switch" lay-text="鏄瘄鍚�" lay-filter="IsBaleDemo" {{ d.IsBale == "1" ? 'checked' : '' }}>
</script>
<script type="text/html" id="checkboxTpl">
<input type="checkbox" name="IsBelt" value="{{d.LAY_TABLE_INDEX}}" lay-skin="switch" lay-text="鏄瘄鍚�" lay-filter="IsBeltDemo" {{ d.IsBelt == "1" ? 'checked' : '' }}>
</script> -->
- <script type="text/html" id="table-content-list">
+ <script type="text/html" id="table-content-list">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"> <i
class="layui-icon layui-icon-delete"></i>鍒犻櫎</a>
</script>
-
- </div>
+
</div>
</div>
+ </div>
- <script src="../../layuiadmin/layui/layui.js"></script>
- <script src="../../js/public.js"></script>
- <script src="../../js/jquery-3.5.1.min.js"></script>
- <script src="../../js/jquery.cookie.js"></script>
- <script>
- layui.config({
- base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
- }).extend({
- index: 'lib/index' //涓诲叆鍙fā鍧�
- }).use(['index', 'form', 'layer', 'laydate', 'table','jquery'], function() {
- var $ = layui.$,
- form = layui.form,
- table = layui.table,
- layer = layui.layer;
-
- // getWareHouseList();
- getCustomerList();
- getLogisticsInfoList();
-
- window.success = function(data) {
- console.log(data);
- refreshTable(data);
- };
+ <script src="../../layuiadmin/layui/layui.js"></script>
+ <script src="../../js/public.js"></script>
+ <script src="../../js/jquery-3.5.1.min.js"></script>
+ <script src="../../js/jquery.cookie.js"></script>
+ <script>
+ layui.config({
+ base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
+ }).extend({
+ index: 'lib/index' //涓诲叆鍙fā鍧�
+ }).use(['index', 'form', 'layer', 'laydate', 'table', 'jquery'], function () {
+ var $ = layui.$,
+ form = layui.form,
+ table = layui.table,
+ layer = layui.layer;
- var arr = [];
- var TypeValue=$("#Type").val();
- function refreshTable(data) {
- //table.clear();
-
- for (var i in data) {
- var isHave = false;
- data[i].ExQty = 0;
- data[i].IsBale="0";
- data[i].IsBelt="0";
-
- for(var j in arr){
- if(arr[j].SkuNo == data[i].SkuNo && arr[j].LotNo == data[i].LotNo){
- isHave = true;
- break;
- }
+ getWareHouseList();
+ getCustomerList();
+ getLogisticsInfoList();
+
+ window.success = function (data) {
+ console.log(data);
+ refreshTable(data);
+ };
+
+ var arr = [];
+ var TypeValue = $("#Type").val();
+ function refreshTable(data) {
+ //table.clear();
+
+ for (var i in data) {
+ var isHave = false;
+ data[i].ExQty = 0;
+ data[i].IsBale = "0";
+ data[i].IsBelt = "0";
+
+ for (var j in arr) {
+ if (arr[j].SkuNo == data[i].SkuNo && arr[j].LotNo == data[i].LotNo) {
+ isHave = true;
+ break;
}
- if(isHave){
- continue;
- }
- arr.push(data[i]); //灞炴��
}
- $.extend(infoOptions, {
- data: arr
- });
- infoOptions.page = {
- curr: 1
+ if (isHave) {
+ continue;
}
- table.render(infoOptions);
-
+ arr.push(data[i]); //灞炴��
}
- var infoOptions = {
- elem: '#LAY-app-content-list',
- height: 'full-160',
- id: 'LAY-app-content-list',
- page: true,
- limit: pageCnt,
- limits: pageLimits,
- cellMinWidth: 60, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板
- cols: [
- [{
- field: 'SkuNo',
- title: '鐗╁搧缂栫爜',
- align: 'center',
- fixed: 'left',
- width:140,
- }, {
- field: 'SkuName',
- title: '鐗╁搧鍚嶇О',
- align: 'center',
- fixed: 'left',
- }, {
- field: 'LotNo',
- title: '鎵规',
- align: 'center',
- minWidth:140,
- }, {
- field: 'Standard',
- title: '鐗╁搧瑙勬牸',
- align: 'center',
- }, {
- field: 'Qty',
- title: '搴撳瓨鏁伴噺',
- align: 'center',
- width:100,
- }, {
- field: 'ExQty',
- title: '鍑哄簱鏁伴噺',
- align: 'center',
- width:100,
- edit: 'number',
- event: 'dataNumber'
- },
- // {
- // field:'IsBale',
- // title:'鏄惁瑁瑰寘',
- // width:90,
- // templet: '#switchTpl',
- // unresize: true //鏄惁绂佺敤鎷栨嫿鍒楀
- // }, {
- // field:'IsBelt',
- // title:'鏄惁鎵撳甫',
- // width:90,
- // templet: '#checkboxTpl',
- // unresize: true //鏄惁绂佺敤鎷栨嫿鍒楀
- // },
- {
- title: '鎿嶄綔',
- align: 'center',
- width:90,
- templet: '#table-content-list',
- fixed: 'right',
- }]
- ],
- };
- // //鐩戝惉瑁瑰寘鎿嶄綔
- // form.on('switch(IsBaleDemo)', function(obj){
- // if (obj.elem.checked) {
- // for (var k in arr) {
- // if (arr[k].LAY_TABLE_INDEX == obj.value) {
- // arr[k].IsBale = "1";
- // }
- // }
-
- // }else{
- // for (var k in arr) {
- // if (arr[k].LAY_TABLE_INDEX == obj.value) {
- // arr[k].IsBale = "0";
- // }
- // }
- // }
- // });
-
- // //鐩戝惉鎵撳甫鎿嶄綔
- // form.on('switch(IsBeltDemo)', function(obj){
- // if (obj.elem.checked) {
- // for (var k in arr) {
- // if (arr[k].LAY_TABLE_INDEX == obj.value) {
- // arr[k].IsBelt = "1";
- // }
- // }
-
- // }else{
- // for (var k in arr) {
- // if (arr[k].LAY_TABLE_INDEX == obj.value) {
- // arr[k].IsBelt = "0";
- // }
- // }
- // }
- // });
- //鍒濆娓叉煋
- refreshTable(null);
- var $ = layui.$;
- var active = {
- add: function() {
- // if ($("#WarehouseId").val()== "") {
- // layer.msg("璇烽�夋嫨浠撳簱锛�", {
- // icon: 2,
- // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- // },function() {});
- // return;
- // }
- if ($("#Type").val()== "") {
- layer.msg("璇烽�夋嫨鍗曟嵁绫诲瀷锛�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- },function() {});
- return;
- }
- if($("#Type").val()=='6'){
- if($("#CustomerNo").val()==''){
- layer.msg("浠e偍鍗曟嵁璇烽�夋嫨璐т富锛�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function () {
-
- });
- return;
- }
- }
- layer.open({
- type: 2,
- title: '閫夋嫨鐗╁搧淇℃伅',
- content: 'ExportSelectSkuFrom.html?Type='+$("#Type").val()+'&OwnerNo='+$("#CustomerNo").val(),
- maxmin: true,
- area: ['950px', '90%'],
- fixed: false,
- });
- }
- };
- $('.layui-btn.layuiadmin-btn-list').on('click', function() {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
+ $.extend(infoOptions, {
+ data: arr
});
+ infoOptions.page = {
+ curr: 1
+ }
+ table.render(infoOptions);
- table.on('tool(LAY-app-content-list)', function(obj) {
- var data = obj.data;
- if (obj.event === 'del') {
- var ii = -1;
- for (var j in arr) {
- if (obj.data.SkuNo == arr[j].SkuNo && arr[j].LotNo == obj.data.LotNo) {
- ii = j;
- break;
- }
+ }
+ var infoOptions = {
+ elem: '#LAY-app-content-list',
+ height: 'full-160',
+ id: 'LAY-app-content-list',
+ page: true,
+ limit: pageCnt,
+ limits: pageLimits,
+ cellMinWidth: 60,
+ cols: [
+ [{
+ field: 'SkuNo',
+ title: '鐗╁搧缂栫爜',
+ align: 'center',
+ fixed: 'left',
+ width: 140,
+ }, {
+ field: 'SkuName',
+ title: '鐗╁搧鍚嶇О',
+ align: 'center',
+ fixed: 'left',
+ }, {
+ field: 'LotNo',
+ title: '鎵规',
+ align: 'center',
+ minWidth: 140,
+ }, {
+ field: 'Standard',
+ title: '鐗╁搧瑙勬牸',
+ align: 'center',
+ }, {
+ field: 'Qty',
+ title: '搴撳瓨鏁伴噺',
+ align: 'center',
+ width: 100,
+ // 鏍煎紡鍖栧簱瀛樻暟閲忔樉绀轰负4浣嶅皬鏁�
+ templet: function (d) {
+ return parseFloat(d.Qty).toFixed(4);
}
- if (ii > -1) {
- arr.splice(ii, 1);
- obj.del();
- }
- } else if (obj.event === 'dataNumber') {
- $(".layui-input.layui-table-edit").attr("type", "number");
- }
- });
+ }, {
+ field: 'ExQty',
+ title: '鍑哄簱鏁伴噺',
+ align: 'center',
+ width: 100,
+ edit: 'text', // 鏀逛负text鏀寔灏忔暟杈撳叆
+ event: 'dataNumber'
+ }, {
+ title: '鎿嶄綔',
+ align: 'center',
+ width: 90,
+ templet: '#table-content-list',
+ fixed: 'right',
+ }]
+ ],
+ };
+ // {
+ // field:'IsBale',
+ // title:'鏄惁瑁瑰寘',
+ // width:90,
+ // templet: '#switchTpl',
+ // unresize: true //鏄惁绂佺敤鎷栨嫿鍒楀
+ // }, {
+ // field:'IsBelt',
+ // title:'鏄惁鎵撳甫',
+ // width:90,
+ // templet: '#checkboxTpl',
+ // unresize: true //鏄惁绂佺敤鎷栨嫿鍒楀
+ // },
+ // //鐩戝惉瑁瑰寘鎿嶄綔
+ // form.on('switch(IsBaleDemo)', function(obj){
+ // if (obj.elem.checked) {
+ // for (var k in arr) {
+ // if (arr[k].LAY_TABLE_INDEX == obj.value) {
+ // arr[k].IsBale = "1";
+ // }
+ // }
- form.verify({
- emptyNo: function(value) {
- if (value == '') {
- return '';
- } else {
- var ver = /^[0-9]+$/;
- if (!ver.test(value)) {
- return '鍙兘杈撳叆姝f暣鏁�';
- }
- }
- }
- });
- var isrun = 0;
- form.on('submit(form1)', function(data) {
- if(isrun == 1){
- return;
- }
- isrun = 1;
- if (infoOptions.data == 0) {
- layer.msg("璇锋坊鍔犳槑缁嗭紒", {
+ // }else{
+ // for (var k in arr) {
+ // if (arr[k].LAY_TABLE_INDEX == obj.value) {
+ // arr[k].IsBale = "0";
+ // }
+ // }
+ // }
+ // });
+
+ // //鐩戝惉鎵撳甫鎿嶄綔
+ // form.on('switch(IsBeltDemo)', function(obj){
+ // if (obj.elem.checked) {
+ // for (var k in arr) {
+ // if (arr[k].LAY_TABLE_INDEX == obj.value) {
+ // arr[k].IsBelt = "1";
+ // }
+ // }
+
+ // }else{
+ // for (var k in arr) {
+ // if (arr[k].LAY_TABLE_INDEX == obj.value) {
+ // arr[k].IsBelt = "0";
+ // }
+ // }
+ // }
+ // });
+
+ //鍒濆娓叉煋
+ refreshTable(null);
+ var $ = layui.$;
+ var active = {
+ add: function () {
+ if ($("#WarehouseId").val() == "") {
+ layer.msg("璇烽�夋嫨浠撳簱锛�", {
icon: 2,
time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {
-
- });
- isrun = 0;
+ }, function () { });
return;
}
- var type= $("#Type").val();
- if(type=='6'){
- var CustomerNo=$("#CustomerNo").val();
- if(CustomerNo==''){
+ if ($("#Type").val() == "") {
+ layer.msg("璇烽�夋嫨鍗曟嵁绫诲瀷锛�", {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () { });
+ return;
+ }
+ if ($("#Type").val() == '6') {
+ if ($("#CustomerNo").val() == '') {
layer.msg("浠e偍鍗曟嵁璇烽�夋嫨璐т富锛�", {
icon: 2,
time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
@@ -348,217 +278,281 @@
return;
}
}
- var DataList = [];
- console.log(infoOptions.data);
- for (var i in infoOptions.data) {
- console.log(infoOptions.data[i].ExQty);
- if (infoOptions.data[i].ExQty == "") {
- layer.msg("璇疯緭鍏ュ嚭搴撴暟閲忥紒", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
-
- if(infoOptions.data[i].ExQty.indexOf('.')>=0){
- layer.msg("鍑哄簱鏁伴噺蹇呴』鏄ぇ浜�0鐨勬暣鏁�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
- if(infoOptions.data[i].ExQty.indexOf('-')>=0){
- layer.msg("鍑哄簱鏁伴噺蹇呴』鏄ぇ浜�0鐨勬暣鏁�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
- if(infoOptions.data[i].ExQty.charAt(0)=='0'){
- layer.msg("鍑哄簱鏁伴噺蹇呴』鏄ぇ浜�0鐨勬暣鏁�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
-
- if (infoOptions.data[i].ExQty <= 0) {
- layer.msg("鍑哄簱鏁伴噺蹇呴』澶т簬0锛�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
- if (infoOptions.data[i].ExQty > infoOptions.data[i].Qty) {
- layer.msg("鍑哄簱鏁伴噺涓嶈兘澶т簬搴撳瓨鏁伴噺锛�", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- return;
- }
- var item = {
- SkuNo: infoOptions.data[i].SkuNo,
- LotNo: infoOptions.data[i].LotNo,
- Qty: parseInt(infoOptions.data[i].ExQty),
- IsBale:infoOptions.data[i].IsBale,
- IsBelt:infoOptions.data[i].IsBelt,
- };
- DataList.push(item); //灞炴��
- }
-
- var param = {
- Type: data.field.Type,
- CustomerNo: data.field.CustomerNo,
-
- LogisticsId: parseInt(data.field.LogisticsId),
- Detail: DataList
- }
- sendData(IP + "/BllSo/AddExportNotice", param, 'post', function(res) {
- console.log(res);
- if (res.code == 0) { //鎴愬姛
- layer.msg(res.msg, {
- icon: 1,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {
- parent.location.reload();
- parent.layer.close(layer.index);
- });
- isrun = 0;
- } else if(res.code == 1) { //涓嶆垚鍔�
- layer.msg(res.msg, {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
- isrun = 0;
- }
+ console.log($("#WarehouseId").val());
+
+ layer.open({
+ type: 2,
+ title: '閫夋嫨鐗╁搧淇℃伅',
+ content: 'ExportSelectSkuFrom.html?houseId=' + $("#WarehouseId").val() + '&Type=' + $("#Type").val() + '&OwnerNo=' + $("#CustomerNo").val(),
+ maxmin: true,
+ area: ['950px', '90%'],
+ fixed: false,
});
- return false;
- });
-
-
- //涓嬫媺鍗曟嵁绫诲瀷閫変腑鍚庝簨浠�
- form.on('select(Type)', function(data) {
- var value = data.value;
- if(value!=TypeValue){
- getCustomerList();
- arr = [];
- // 娓叉煋Table
- refreshTable(null);
- TypeValue=value;
+ }
+ };
+ $('.layui-btn.layuiadmin-btn-list').on('click', function () {
+ var type = $(this).data('type');
+ active[type] ? active[type].call(this) : '';
+ });
+
+ table.on('tool(LAY-app-content-list)', function (obj) {
+ var data = obj.data;
+ if (obj.event === 'del') {
+ var ii = -1;
+ for (var j in arr) {
+ if (obj.data.SkuNo == arr[j].SkuNo && arr[j].LotNo == obj.data.LotNo) {
+ ii = j;
+ break;
+ }
+ }
+ if (ii > -1) {
+ arr.splice(ii, 1);
+ obj.del();
+ }
+ } else if (obj.event === 'dataNumber') {
+ $(".layui-input.layui-table-edit").attr("type", "number");
+ }
+ });
+
+ form.verify({
+ emptyNo: function (value) {
+ if (value == '') {
+ return '';
+ } else {
+ var ver = /^[0-9]+$/;
+ if (!ver.test(value)) {
+ return '鍙兘杈撳叆姝f暣鏁�';
+ }
+ }
+ }
+ });
+ var isrun = 0;
+ form.on('submit(form1)', function (data) {
+ if (isrun == 1) {
+ return;
+ }
+ isrun = 1;
+ if (infoOptions.data == 0) {
+ layer.msg("璇锋坊鍔犳槑缁嗭紒", {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () {
+
+ });
+ isrun = 0;
+ return;
+ }
+ var type = $("#Type").val();
+ if (type == '6') {
+ var CustomerNo = $("#CustomerNo").val();
+ if (CustomerNo == '') {
+ layer.msg("浠e偍鍗曟嵁璇烽�夋嫨璐т富锛�", {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () {
+
+ });
+ return;
+ }
+ }
+ var DataList = [];
+
+ // 鍙繚鐣欎竴涓獙璇佸惊鐜紝绉婚櫎閲嶅浠g爜
+ for (var i in infoOptions.data) {
+ const exqtyStr = (infoOptions.data[i].ExQty || '').trim();
+ const stockQty = parseFloat(infoOptions.data[i].Qty) || 0;
+
+ // 楠岃瘉鏄惁涓虹┖
+ if (exqtyStr === "") {
+ layer.msg("璇疯緭鍏ュ嚭搴撴暟閲忥紒", { icon: 2, time: 2000 });
+ isrun = 0;
+ return;
+ }
+
+ // 楠岃瘉鏁板瓧鏍煎紡锛堟敮鎸佹鏁板拰鏈�澶�4浣嶅皬鏁帮級
+ const decimalRegex = /^(0|[1-9]\d*)(\.\d{1,4})?$/;
+ if (!decimalRegex.test(exqtyStr)) {
+ layer.msg("鍑哄簱鏁伴噺蹇呴』鏄ぇ浜�0鐨勬暟瀛楋紝涓旀渶澶氫繚鐣�4浣嶅皬鏁帮紒", { icon: 2, time: 2000 });
+ isrun = 0;
+ return;
+ }
+
+ // 杞崲涓烘诞鐐规暟骞跺鐞嗙簿搴�
+ const precision = 10000;
+ const exqty = Math.round(parseFloat(exqtyStr) * precision) / precision;
+
+ // 楠岃瘉鏄惁澶т簬0
+ if (exqty < 0) {
+ layer.msg("鍑哄簱鏁伴噺蹇呴』澶т簬0锛�", { icon: 2, time: 2000 });
+ isrun = 0;
+ return;
+ }
+
+ // 楠岃瘉涓嶈秴杩囧簱瀛樻暟閲�
+ if (exqty > stockQty) {
+ layer.msg("鍑哄簱鏁伴噺涓嶈兘澶т簬搴撳瓨鏁伴噺锛�", { icon: 2, time: 2000 });
+ isrun = 0;
+ return;
+ }
+
+ // 鏍煎紡鍖栧嚭搴撴暟閲忎负4浣嶅皬鏁�
+ const formattedExQty = exqty.toFixed(4);
+ infoOptions.data[i].ExQty = formattedExQty;
+
+ // 鏋勫缓鏁版嵁瀵硅薄
+ var item = {
+ SkuNo: infoOptions.data[i].SkuNo,
+ LotNo: infoOptions.data[i].LotNo,
+ Qty: parseFloat(formattedExQty),//parseFloat(infoOptions.data[i].Qty), // 淇濈暀4浣嶅皬鏁扮簿搴�
+ IsBale: infoOptions.data[i].IsBale,
+ IsBelt: infoOptions.data[i].IsBelt,
+ //ExQty: parseFloat(formattedExQty),
+
+ };
+ DataList.push(item);
+ }
+
+ var param = {
+ Type: data.field.Type,
+ CustomerNo: data.field.CustomerNo,
+ WareHouseNo: data.field.WarehouseId,
+ LogisticsId: parseInt(data.field.LogisticsId),
+ Detail: DataList
+ }
+ sendData(IP + "/BllSo/AddExportNotice", param, 'post', function (res) {
+ console.log(res);
+ if (res.code == 0) { //鎴愬姛
+ layer.msg(res.msg, {
+ icon: 1,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () {
+ parent.location.reload();
+ parent.layer.close(layer.index);
+ });
+ isrun = 0;
+ } else if (res.code == 1) { //涓嶆垚鍔�
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () { });
+ isrun = 0;
}
});
- //鑾峰彇浠撳簱涓嬫媺妗嗕俊鎭�
- // function getWareHouseList(){
- // sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function(res) {
-
- // if (res.code == 0) { //鎴愬姛
- // $("#WarehouseId").empty();
- // // $("#WarehouseId").append('<option value =""></option>');
- // for (var i = 0; i < res.data.length; i++) {
- // $("#WarehouseId").append('<option value =' + res.data[i].WareHouseNo + '>' +
- // res.data[i].WareHouseName + '</option>');
- // }
- // $("#WarehouseId option[value='W01']").attr("selected", "selected")
- // form.render('select');
- // } else { //涓嶆垚鍔�
- // layer.msg(res.msg, {
- // icon: 2,
- // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- // }, function() {});
- // }
- // });
- // }
- //鑾峰彇瀹㈡埛涓嬫媺妗嗕俊鎭�
- function getCustomerList() {
- sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function(res) {
- if (res.code == 0) { //鎴愬姛
- $("#CustomerNo").empty();
- $("#CustomerNo").append('<option value =""></option>');
- for (var i = 0; i < res.data.length; i++) {
- var TypeNum = 0;
-
- switch($("#Type").val())
- {
- case "0": //鎴愬搧鍑哄簱
- TypeNum = 0;
- console.log(TypeNum)
- break;
- case "1": //棰嗘枡鍑哄簱
- case "2": //鎶芥鍑哄簱
- case "3": //鐗╂枡鍙栨牱鍑哄簱
- case "4": //涓嶅悎鏍煎搧鍑哄簱
- case "5": //涓棿鍝佸嚭搴�
- case "6": //浠e偍鍑哄簱
- case "7": //鍏朵粬鍑哄簱
- case "8": //瀵勫瓨鍑哄簱
- TypeNum = 2;
- console.log(TypeNum)
- break;
- }
- //鍒ゆ柇鍗曟嵁绫诲瀷
- if (TypeNum == 0)
- {
- if (res.data[i].Type == 0)
- {
- $("#CustomerNamep").html("瀹㈡埛");
- $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
+ return false;
+ });
+
+
+ //涓嬫媺鍗曟嵁绫诲瀷閫変腑鍚庝簨浠�
+ form.on('select(Type)', function (data) {
+ var value = data.value;
+ if (value != TypeValue) {
+ getCustomerList();
+ arr = [];
+ // 娓叉煋Table
+ refreshTable(null);
+ TypeValue = value;
+ }
+ });
+ //鑾峰彇浠撳簱淇℃伅
+ function getWareHouseList() {
+ sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function (res) {
+
+ if (res.code == 0) { //鎴愬姛
+ $("#WarehouseId").empty();
+ $("#WarehouseId").append('<option value =""></option>');
+ for (var i = 0; i < res.data.length; i++) {
+ $("#WarehouseId").append('<option value =' + res.data[i].WareHouseNo + '>' +
+ res.data[i].WareHouseName + '</option>');
+ }
+ //$("#WarehouseId option[value='W01']").attr("selected", "selected")
+ form.render('select');
+ } else { //涓嶆垚鍔�
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () { });
+ }
+ });
+ }
+ //鑾峰彇瀹㈡埛涓嬫媺妗嗕俊鎭�
+ function getCustomerList() {
+ sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) {
+ if (res.code == 0) { //鎴愬姛
+ $("#CustomerNo").empty();
+ $("#CustomerNo").append('<option value =""></option>');
+ for (var i = 0; i < res.data.length; i++) {
+ var TypeNum = 0;
+
+ switch ($("#Type").val()) {
+ case "0": //鎴愬搧鍑哄簱
+ TypeNum = 0;
+ console.log(TypeNum)
+ break;
+ case "1": //棰嗘枡鍑哄簱
+ case "2": //鎶芥鍑哄簱
+ case "3": //鐗╂枡鍙栨牱鍑哄簱
+ case "4": //涓嶅悎鏍煎搧鍑哄簱
+ case "5": //涓棿鍝佸嚭搴�
+ case "6": //浠e偍鍑哄簱
+ case "7": //鍏朵粬鍑哄簱
+ case "8": //瀵勫瓨鍑哄簱
+ TypeNum = 2;
+ console.log(TypeNum)
+ break;
+ }
+ //鍒ゆ柇鍗曟嵁绫诲瀷
+ if (TypeNum == 0) {
+ if (res.data[i].Type == 0) {
+ $("#CustomerNamep").html("瀹㈡埛");
+ $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
res.data[i].CustomerName + '</option>');
- }
- }
- else if (TypeNum == 1)
- {
- if (res.data[i].Type == 1)
- {
- $("#CustomerNamep").html("渚涘簲鍟�");
- $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
- res.data[i].CustomerName + '</option>');
- }
- }
- else if (TypeNum == 2)
- {
- if (res.data[i].Type == 2)
- {
- $("#CustomerNamep").html("璐т富");
- $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
- res.data[i].CustomerName + '</option>');
- }
}
}
- form.render('select');
- } else { //涓嶆垚鍔�
- layer.msg(res.msg, {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
+ else if (TypeNum == 1) {
+ if (res.data[i].Type == 1) {
+ $("#CustomerNamep").html("渚涘簲鍟�");
+ $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
+ res.data[i].CustomerName + '</option>');
+ }
+ }
+ else if (TypeNum == 2) {
+ if (res.data[i].Type == 2) {
+ $("#CustomerNamep").html("璐т富");
+ $("#CustomerNo").append('<option value =' + res.data[i].CustomerNo + '>' +
+ res.data[i].CustomerName + '</option>');
+ }
+ }
}
- });
- }
- //鑾峰彇鐗╂祦鎵胯繍鍟嗕笅鎷夋淇℃伅
- function getLogisticsInfoList() {
- sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) {
- if (res.code == 0) { //鎴愬姛
- $("#LogisticsId").empty();
- $("#LogisticsId").append('<option value =""></option>');
- for (var i = 0; i < res.data.length; i++) {
- $("#LogisticsId").append('<option value =' + res.data[i].Id + '>' +
- res.data[i].CarrierName + '</option>');
- }
- form.render('select');
- } else { //涓嶆垚鍔�
- layer.msg(res.msg, {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- }, function() {});
+ form.render('select');
+ } else { //涓嶆垚鍔�
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () { });
+ }
+ });
+ }
+ //鑾峰彇鐗╂祦鎵胯繍鍟嗕笅鎷夋淇℃伅
+ function getLogisticsInfoList() {
+ sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function (res) {
+ if (res.code == 0) { //鎴愬姛
+ $("#LogisticsId").empty();
+ $("#LogisticsId").append('<option value =""></option>');
+ for (var i = 0; i < res.data.length; i++) {
+ $("#LogisticsId").append('<option value =' + res.data[i].Id + '>' +
+ res.data[i].CarrierName + '</option>');
}
- });
- }
- })
- </script>
- </body>
-</html>
+ form.render('select');
+ } else { //涓嶆垚鍔�
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ }, function () { });
+ }
+ });
+ }
+ })
+ </script>
+</body>
+
+</html>
\ No newline at end of file
--
Gitblit v1.8.0