Demo
2024-03-07 e7864a4dcecba72ccbb06dfb6a3d4a77c65f2a3c
HTML/views/ASNSetting/ArrivalNoticeDetail.html
@@ -47,9 +47,15 @@
         <div class="layui-input-inline">
            <select name="Type" id="Type" lay-filter="Type" lay-search>
               <!-- <option value=""></option> -->
               <!-- JC09 -->
               <option value="0" selected>标准产品入库</option>
               <option value="1">非标产品入库</option>
               <!-- JC24 -->
               <option value="0" selected>成品入库</option>
               <option value="1">采购入库</option>
               <option value="2">中间品入库</option>
               <option value="3">退货入库</option>
               <option value="4">车间余料退回入库</option>
               <option value="5">其它入库</option>
               <option value="6">代储入库</option>
               <option value="7">寄存入库</option>
               <!-- JC08 -->
               <!-- <option value="0">成品入库</option>
               <option value="1">原料入库</option>
@@ -57,7 +63,7 @@
            </select>
         </div>
         <label class="layui-form-label">客户名称</label>
         <label class="layui-form-label" style="width: 70px;"><p id="CustomerNamep">客户</p></label>
         <div class="layui-input-inline">
            <select name="CustomerName" id="CustomerName" lay-verify="" lay-search>
               <option value=""></option>
@@ -110,7 +116,15 @@
               </script>
               <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>
               </script>
               <script type="text/html" id="table-content-Packlist">
                  {{#
                     function GetPack(d){
                        return d.PackagNo + '-' + d.PackagName;
                     }
                  }}
                  {{ GetPack(d) }}
               </script>
            </div>
         </div>
      </div>
@@ -155,7 +169,7 @@
                  {field: 'UnitName',title: '计量单位',align: 'center',width: 70}, 
                  {field: 'Standard',title: '规格',width: 160,align: 'center'}, 
                  {field: 'LotText',title: '批次描述',align: 'center',edit: 'text',width: 160}, 
                  {field: 'PackagNo',title: '包装名称',width: 160},
                  {field: 'PackagNo',title: '包装名称',width: 160, templet: "#table-content-Packlist"},
                  {field: 'Price',title: '单价',align: 'center',width: 80}, 
                  {field: 'Money',title: '金额',align: 'center',width: 100}, 
                  {field: 'UDF1',title: '自定义列1',align: 'center',edit: 'text',width: 140}, 
@@ -425,6 +439,7 @@
            active = {
               add: function () {
                  var typeValue = $("#Type").val();
                  console.log(typeValue)
                  layer.open({
                     type: 2,
                     title: '添加明细',
@@ -458,6 +473,7 @@
            var value = data.value;
            if(value!=TypeValue){
               console.log(value);
               getCustomerList();
               arr = [];
               // 渲染Table
               refreshTable(null);
@@ -551,6 +567,19 @@
               });
               return;
            }
            var type= $("#Type").val();
            if(type=='6'){
               var customerName=$("#CustomerName").val();
               if(customerName==''){
                  layer.msg("代储单据请选择货主!", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  }, function () {
                  });
                  return;
               }
            }
            SetArrivalNotice();
         });
@@ -579,13 +608,72 @@
         // 绑定下拉信息
         function getCustomerList() {
            /*
            0:客户
               退货入库
               3
            1:供应商
               采购入库、其它入库
               1、5
            2:货主
               成品入库、中间品入库、车间余料入库、代储入库
               0、2、4、6
            */
            sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) {
               if (res.code == 0) { //成功
                  $("#CustomerName").empty();
                  $("#CustomerName").append('<option value =""></option>');
                  for (var i = 0; i < res.data.length; i++) {
                     $("#CustomerName").append('<option value =' + res.data[i].CustomerNo + '>' +
                        res.data[i].CustomerName + '</option>');
                     var TypeNum = 0;
                     switch($("#Type").val())
                     {
                        case "3": //退货入库
                           TypeNum = 0;
                           console.log(TypeNum)
                           break;
                        case "1": //采购入库
                        case "5": //其它入库
                           TypeNum = 1;
                           console.log(TypeNum)
                           break;
                        case "0": //成品入库
                        case "2": //中间品入库
                        case "4": //车间余料入库
                        case "6": //代储入库
                        case "7": //寄存入库
                           TypeNum = 2;
                           console.log(TypeNum)
                           break;
                     }
                     //判断单据类型
                     if (TypeNum == 0)
                     {
                        if (res.data[i].Type == 0)
                        {
                           $("#CustomerNamep").html("客户");
                           $("#CustomerName").append('<option value =' + res.data[i].CustomerNo + '>' +
                           res.data[i].CustomerName + '</option>');
                        }
                     }
                     else if (TypeNum == 1)
                     {
                        if (res.data[i].Type == 1)
                        {
                           $("#CustomerNamep").html("供应商");
                           $("#CustomerName").append('<option value =' + res.data[i].CustomerNo + '>' +
                           res.data[i].CustomerName + '</option>');
                        }
                     }
                     else if (TypeNum == 2)
                     {
                        if (res.data[i].Type == 2)
                        {
                           $("#CustomerNamep").html("货主");
                           $("#CustomerName").append('<option value =' + res.data[i].CustomerNo + '>' +
                           res.data[i].CustomerName + '</option>');
                        }
                     }
                  }
                  form.render('select');
               } else { //不成功
@@ -615,12 +703,14 @@
               }
               arr.push(data[i]); //属性
            }
            $.extend(infoOptions, {
               data: arr
            });
            infoOptions.page = {
               curr: 1
            }
            console.log(infoOptions)
            table.render(infoOptions);
         }
         
@@ -700,11 +790,32 @@
                  return -1;
               }
               if (arr[i].LotNo == "" || arr[i].LotNo ==undefined) {
                  layer.msg("请输入批次!", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return -1;
                  //判断是否为对应不需要批次的单据
                  var TypeNum = 0;
                  switch($("#Type").val())
                  {
                     //1:采购入库 2:中间品入库 5:其它入库 6:代储入库 7:寄存入库
                     case "1" :
                     case "2" :
                     case "5" :
                     case "6" :
                     case "7" :
                        console.log($("#Type").val())
                        TypeNum = 1;
                        break;
                  }
                  console.log(TypeNum)
                  if (TypeNum == 0)
                  {
                     layer.msg("请输入批次!1", {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                     });
                     return -1;
                  }
               }
               
               if (!reg.test(arr[i].Qty)) {