zrg
2024-01-16 7de00c5824ecfd39fec748386298ba0cedd4504e
WebTM/views/Éú²ú¹ÜÀí/Éú²úÈÎÎñµ¥/Sc_ICMOBillEdit_NoTable.html
@@ -422,6 +422,18 @@
                                            </div>
                                        </div>
                                    </div>
                                    <!--隐藏字段-->
                                    <div class="layui-row" style="display:none;">
                                        <div class="layui-inline">
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="hidden" name="HSourceInterID" id="HSourceInterID" lay-verify="HSourceInterID" value="0">
                                                <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" lay-verify="HSourceEntryID" value="0">
                                                <input type="hidden" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" value="">
                                                <input type="hidden" name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType" value="">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -563,6 +575,26 @@
            //保存提交
            form.on('submit(btnSave)', function (data) {//提交
                //#region åˆ¤æ–­æºå•状态
                var HSourceBillData = "";
                var HSourceBillData = getSourceBillStatus_SeOrderBill();            //获取源单数据
                if (HSourceBillData != "none") {
                    if (HSourceBillData.length == 0) {
                        if ($("#HSourceInterID").val() != 0) {
                            layer.alert("保存失败!未查询到源单单据!", { icon: 5 });
                            return;
                        }
                    } else if (HSourceBillData[0]["状态"] != "已审核") {
                        layer.alert("保存失败!源单单据状态未为'已审核'状态!", { icon: 5 });
                        return;
                    }
                } else {
                    return;
                }
                //#endregion
                if (AllowLoadData(data)) {
                    set_AddNew(data);
                }
@@ -667,6 +699,11 @@
                        $("#HSeOrderBillNo").val(checkStatus.data[0].单据号);
                        $("#HSeOrderEntryID").val(checkStatus.data[0].hsubid);
                        $("#HSourceInterID").val(checkStatus.data[0].hmainid);
                        $("#HSourceEntryID").val(checkStatus.data[0].hsubid);
                        $("#HSourceBillNo").val(checkStatus.data[0].单据号);
                        $("#HSourceBillType").val("1401");
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
@@ -707,7 +744,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '客户'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/销售基础资料/Gy_Customer.html', 'yes']
                    , content: ['../../BaseSet/基础资料/Gy_CustomerList.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -716,8 +753,10 @@
                            return layer.msg('请选择数据');
                        }
                        //获取数据
                        $("#HCusID").val(checkStatus.data[0].HItemID);
                        $("#HCusName").val(checkStatus.data[0].客户名称);
                        //$("#HCusID").val(checkStatus.data[0].HItemID);
                        //$("#HCusName").val(checkStatus.data[0].客户名称);
                        getCustomerByCusID(checkStatus.data[0].HItemID);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
@@ -945,6 +984,12 @@
                                "HSeOrderBillNo": data.单据号
                                , "HSeOrderInterID": data.hmainid
                                , "HSeOrderEntryID": data.hsubid
                                , "HSourceInterID": data.hmainid
                                , "HSourceEntryID": data.hsubid
                                , "HSourceBillNo": data.单据号
                                , "HSourceBillType": "1401"
                                , "HEmpID": data.HEmpID
                                , "HEmpName": data.业务员
                                , "HCusID": data.HCusID
@@ -1061,6 +1106,12 @@
                            , "HSeOrderBillNo": d.data[0].源单单号
                            , "HSeOrderInterID": d.data[0].源单主内码
                            , "HSeOrderEntryID": d.data[0].源单子内码
                            , "HSourceInterID": d.data[0].HSourceInterID
                            , "HSourceEntryID": d.data[0].HSourceEntryID
                            , "HSourceBillNo": d.data[0].HSourceBillNo
                            , "HSourceBillType": d.data[0].HSourceBillType
                            , "HEmpID": d.data[0].HEmpID
                            , "HEmpName": d.data[0].业务员
                            , "HCusID": d.data[0].HEntryCusID
@@ -1338,6 +1389,11 @@
                    return false;
                }
                if ($("#HCusID").val() == "0" || $("#HCusName").val() == "") {
                    layer.msg("客户不能为空!");
                    return false;
                }
                if ($("#HMaterNumber").val() == "") {
                    layer.msg("物料编码没有选择");
                    return false;
@@ -1418,10 +1474,76 @@
                return vars;
            }
            //#region èŽ·å–æºå•-销售订单单据状态
            function getSourceBillStatus_SeOrderBill() {
                var HSourceBillData = "none";
                var sWhere = " and hmainid = " + $("#HSourceInterID").val();
                $.ajax({
                    url: GetWEBURL() + '/Xs_SeOrderBill/list',
                    async: false,
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            HSourceBillData = data1.data;
                        } else {
                            layer.alert(data1.code + "源单单据状态判断失败!", { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                return HSourceBillData;
            }
            //#endregion
            //#endregion
        });
        function GetHSupValue(obj)  //返回客户
        {
            //$("#HCusName").val(obj[0].HName);
            //$("#HCusID").val(obj[0].HItemID);
            //根据客户获取相关信息
            getCustomerByCusID(obj[0].HItemID);
        }
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å¸åˆ«ã€æ±‡çŽ‡ã€ç»“ç®—æ–¹å¼ã€å®¢æˆ·ä¿¡ç”¨é¢åº¦ã€è”ç³»äººã€è”ç³»ç”µè¯
        function getCustomerByCusID(HCusID) {
            $.ajax({
                url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
                async: false,
                type: "GET",
                data: {
                    "HCusID": HCusID
                },
                success: function (result) {
                    if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data[0];
                        $("#HCusID").val(data.HCusID);
                        $("#HCusName").val(data.HCusName);
                        //$("#HCurID").val(data.HCurID);
                        //$("#HCurName").val(data.HCurName);
                        //$("#HExRate").val(data.HExRate);
                        //$("#HSSID").val(data.HSSID);
                        //$("#HSSName").val(data.HSSName);
                        //$("#HCreditRating_Now").val(data.HCreditRating_Now);
                        //$("#HLinkMan").val(data.HLinkMan);
                        //$("#HLinkPhone").val(data.HLinkPhone);
                        //subHTaxRate = data.HTaxRate;
                    } else {
                        layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    }
                }, error: function () {
                    layer.alert("发生错误!", { icon: 5 });
                }
            });
        }
        //#endregion
    </script>
</body>