abp(net core)+easyui+efcore to implement warehouse management system--eleventh of warehousing management

abp(net core)+easyui+efcore to implement warehouse management system directory

abp(net core)+easyui+efcore to implement warehouse management system--ABP overview (1)
abp(net core)+easyui+efcore to implement warehouse management system--solution introduction(2)
abp(net core)+easyui+efcore to implement warehouse management system-creating entities at the domain level (3)
 abp(net core)+easyui+efcore to implement warehouse management system--Define warehouse and implement (4)
abp(net core)+easyui+efcore to implement warehouse management system-creating application services (5)
abp(net core)+easyui+efcore to implement warehouse management system--Controller for adding, deleting and checking in presentation layer(6)
abp(net core)+easyui+efcore to implement warehouse management system--List view of display layer for add-delete check (7)
abp(net core)+easyui+efcore to implement warehouse management system-display layer to implement add-delete change checks add-delete view (8)
abp(net core)+easyui+efcore to implement warehouse management system-menu and test of adding, deleting and checking for display layer implementation (9)
abp(net core)+easyui+efcore to implement warehouse management system--CURD using WEBAPI (11)

abp(net core)+easyui+efcore to implement warehouse management system-EasyUI front-end page framework (18)

abp(net core)+easyui+efcore to implement warehouse management system-EasyUI Goods Management I(19)
abp(net core)+easyui+efcore to implement warehouse management system--one of the addition, deletion and modification checks of ABP WebAPI and EasyUI (27)
abp(net core)+easyui+efcore to implement warehouse management system--ABP WebAPI combined with EasyUI to add or delete Reviews No. 3 (29)
abp(net core)+easyui+efcore Implements Warehouse Management System--Eighth (34) of ABP WebAPI and EasyUI Reviews
abp(net core)+easyui+efcore to implement warehouse management system--Ten (36) of ABP WebAPI and EasyUI combined additions, deletions and modifications
abp(net core)+easyui+efcore implements warehouse management system-one of the warehouse management systems (37)
abp(net core)+easyui+efcore to implement warehouse management system--warehousing management II(38)
abp(net core)+easyui+efcore implements warehouse management system-Storage Procedure 3 of warehouse management (39)
abp(net core)+easyui+efcore to implement warehouse management system--warehouse management fourth(40)
abp(net core)+easyui+efcore to implement warehouse management system--warehouse management fifth (41)
abp(net core)+easyui+efcore to implement warehouse management system--warehouse management sixth (forty-two)
abp(net core)+easyui+efcore to implement warehouse management system--warehouse management seventh (43)
abp(net core)+easyui+efcore to implement warehouse management system--warehouse management VIII(44)   
abp(net core)+easyui+efcore to implement warehouse management system--ninth (forty-five) of warehouse management
abp(net core)+easyui+efcore implements warehouse management system--warehouse management ten (46)
 

 

* In the above article abp(net core)+easyui+efcore implements warehouse management system--warehouse management ten (46) After learning, we have achieved the basic functions of warehouse receipt, add, delete, modify.Next, we implement the function of adding locations.

 

15. Add location information to warehouse receipt

Each detail of the warehouse receipt corresponds to one or more warehouses.This requires the ability to nest subtables of a row of data.Here you create a sub-table by using easyui's datagrid-detailview.js plug-in, and the general effect is as follows:

 

 

  1. In the Solution Explorer of Visual Studio 2017, locate the Views/InStock folder of the ABP.TPLMS.Web.Mvc project, and double-click with the left mouse button to open the Index.cshtml file.Add the following code to the'@section scripts{'section.
<script src="~/lib/easyui-1.8/datagrid-detailview.js" asp-append-version="true"></script>

2. In the Solution Explorer of Visual Studio 2017, find the wwwrootview-resourcesInStock directory in the presentation layer ABP.TPLMS.Web.Mvc project.

3. Find the Index.js file in the InStock directory.In the header of this file we will define two variables, mainIndex and editIndex, to locate which line we have currently selected.

var editIndex = undefined;
var mainIndex = undefined;

4. We found the datagrid component in the showDetail(no) method in this file and modified the relevant code in the onClickRow event for this component.

onClickRow

rowIndex, rowData

Triggered when the user clicks on a row, parameters include:
rowIndex: The index of the clicked row, starting at 0
rowData: The record corresponding to the clicked row

 

function ShowDetail(no) {
    var lastIndex;
    $("#dgINOD").datagrid({
        url: "/InStock/GetDetail?no=" + no,
        title: "Details of warehousing receipt",
        pagination: false,     

        fit: true,
        fitColumns: false,
        loadMsg: "Loading warehouse receipt details...",
        toolbar: [
            { text: 'Add Details', iconCls: 'icon-add', handler: function () { ShowCargoInfo(); } },
            { text: 'Add Location', iconCls: 'icon-edit', handler: function () { SubGridAddRow(); } },
            { text: 'delete', iconCls: 'icon-remove', handler: function () { deviceInfoDeleteClick(); } },
            '-'

        ],

        nowarp: false,
        border: false,
        idField: "Id",
        sortName: "Id",
        sortOrder: "asc",
        singleSelect: true,
        iconCls: 'icon-edit',      

        columns: [[
            { title: "number", field: "SeqNo", width: 50, sortable: true },
            { title: "Warehousing receipt number", field: "InStockNo", width: 100, sortable: true },
            { title: "HSCode", field: "HSCode", width: 80, sortable: false },
            { title: "Goods code", field: "CargoCode", width: 100, sortable: true },
            { title: "Name of goods", field: "CargoName", width: 160, sortable: false },
            { title: "Specification Model", field: "Spcf", width: 80, sortable: false },
            {
                title: "Number", field: "Qty", width: 100, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 4

                    }
                }
            },
            {
                title: "long", field: "Length", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            {
                title: "wide", field: "Width", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            {
                title: "high", field: "Height", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }

            },

            { title: "Country of Production and Sale", field: "Country", width: 70, align: 'center' },
            {
                title: "Unit Price", field: "Price", width: 100, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },       

            {
                title: "Total Price", field: "TotalAmt", width: 100, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },

            { title: "Packing", field: "Package", width: 70, align: 'center' },
            { title: "Unit of measurement", field: "Unit", width: 70, align: 'center' },
            {
                title: "Total volume", field: "Vol", width: 70, align: 'center', editor: {
                    type: 'numberbox', options: {

                        required: true, min: 0, precision: 4
                    }
                }
            },
           { title: "brand", field: "Brand", width: 70, align: 'center' }

        ]],
        view: detailview,

        detailFormatter: function (index, row) {
            return '<div style="padding:2px"><table id="dgINODItem-' + index + '"></table></div>';
        },

        onExpandRow: function (index, row) {
            var ddv = $('#dgINODItem-' + index);
            ddv.datagrid({
                url: '/InStock/GetLocs?Id=' + row.Id,
                fitColumns: false,

                singleSelect: true,
                rownumbers: true,

                loadMsg: '',
                height: 'auto',
                columns: [[
                    { field: 'SeqNo', title: 'Sequence Number', width: 50 },
                    {
                        field: 'Qty', title: 'Number', width: 120, editor: {
                            type: 'numberbox', options: {
                                required: true, min: 0, precision: 2
                            }
                        }
                    },
                    {
                        field: 'Loc', title: 'Location', width: 150, editor: {

                            type: 'text', options: {
                                required: true
                            }
                        }
                    },

                    { field: 'CreationTime', title: 'Creation Time', hidden: 'true' },

                    { field: 'Id', title: 'Id', width: 50, hidden: 'true' },
                    { field: 'InStockOrderDetailId', title: 'InodId', width: 50, hidden: 'true' }
                ]],

                onResize: function () {
                    $('#dgINOD').datagrid('fixDetailRowHeight', index);
                },
                onLoadSuccess: function () {
                    setTimeout(function () {
                        $('#dgINOD').datagrid('fixDetailRowHeight', index);

                    }, 0);
                    editIndex = undefined;//Main grid wrap
                },
                onAfterEdit: function (rowIndex, rowData, changes) {
                    editIndex = undefined;
                },

                onClickRow: function (index1, row1) {

                    if (editIndex != index1) {
                        if (endEditing(ddv)) {
                            ddv.datagrid('selectRow', index1).datagrid('beginEdit', index1);
                            editIndex = index1;

                        }
                        else { ddv.datagrid('selectRow', editIndex); }
                    }
                }
            });
            $('#dgINOD').datagrid('fixDetailRowHeight', index);
        }, 

        onClickRow: function (index, rowData) {
            if (mainIndex!=undefined) {
                $('#dgINOD').datagrid('collapseRow', mainIndex);

            }           

            if (lastIndex != index) {
                $('#dgINOD').datagrid('endEdit', lastIndex);
                editrow(index);
            }
            lastIndex = index;
            mainIndex = index;
        },       

        onBeginEdit: function (rowIndex, rowData) {  
            setEditing(rowIndex);
        }
    });
}

 

5. In addition to modifying the above functions, we need to add some function methods.Here is the full code for Index.js:

//-----------------------system management-->Warehouse receipt management-----------------------//

var editIndex = undefined;
var mainIndex = undefined;
//refresh data

function initable() {
    $("#dgINSO").datagrid({
        url: "/InStock/List",
        title: "Warehouse receipt management",
        pagination: true,
        pageSize: 10,
        pageList: [10, 20, 30],
        fit: true,
        fitColumns: false,

        loadMsg: "Loading warehouse receipt information...",

        nowarp: false,
        border: false,
        idField: "Id",
        sortName: "Id",
        sortOrder: "asc",

        frozenColumns: [[//Freeze Column
            { field: "ck", checkbox: true, align: "left", width: 50 }           

        ]],
        columns: [[
            { title: "number", field: "Id", width: 50, sortable: true },
            { title: "Warehousing receipt number", field: "No", width: 100, sortable: true },           

            {title: "state", field: "Status", width: 50            },
            { title: 'Date of Arrival', field: 'ReceiveTime',  width: 100, align: 'center' },
            { title: "Shipper", field: "OwnerCode", width: 150, sortable: true },
            { title: "Estimated time of arrival", field: "PreDeliveryTime", width: 100, sortable: false },
            { title: 'Customer', field: 'CustomerName', width: 120, align: 'center' },
            { title: 'Consignee',field: 'Oper', width: 100, align: 'center' },
            { title: 'Auditor',field: 'Checker', width: 120, align: 'center' },
            { title: 'Number', field: 'PackageQty', width: 100, align: 'center' },
            { title: 'Creation Time', field: 'CreationTime', width: 100, align: 'center' }
        ]]
    }); 

}

//Show Delivery Order Data
function ShowCargo() {
    abp.log.warn('Goods Information List Log...');

    $("#dgCargo").datagrid({
        url: "/Cargo/List",
        title: "Goods Management",
        pagination: true,
        pageSize: 10,
        pageList: [10, 20, 30],

        fit: true,
        fitColumns: false,
        loadMsg: "Loading cargo information...",
        nowarp: false,
        border: false,

        idField: "Id",
        sortName: "Id",
        sortOrder: "asc",

        frozenColumns: [[//Freeze Column
            { field: "ck", checkbox: true, align: "left", width: 50 }
        ]],

        columns: [[
            { title: "number", field: "Id", width: 50, sortable: true },
            { title: "Supplier", field: "SupplierId", width: 80, sortable: true },
            { title: "HSCode", field: "HSCode", width: 100, sortable: true },

            { title: "Goods code", field: "CargoCode", width: 100, sortable: true },
            { title: "Name of goods", field: "CargoName", width: 80, sortable: false },

            { title: "Specification Model", field: "Spcf", width: 100, sortable: false },
            { title: "Country of Production and Sale", field: "Country", width: 80, sortable: false },
            { title: "Unit of measurement", field: "Unit", width: 100, sortable: false },
            { title: "Packing", field: "Package", width: 100, sortable: false },
            { title: "Unit Price", field: "Price", width: 100, sortable: false },
            { title: "Currency System", field: "Curr", width: 80, sortable: false },
            {
                title: "Length, width and height", field: "Length", width: 100, sortable: false, formatter: function (value, row, index) {
                    return row.Length + '*' + row.Width + '*' + row.Height;
                }
            },
            { title: "volume", field: "Vol", width: 80, sortable: false },
            { title: "Remarks", field: "Remark", width: 80, sortable: false },
            { title: 'Creation Time', field: 'CreationTime', width: 100, align: 'center' }

        ]]
    });

    abp.log.warn('3 Goods Information List Log...');
} 

function ShowCargoInfo() {  
    $("#divImportCargo").dialog({
            closed: false,
            title: "Select Goods Information",
            modal: true,
            width: 820,
            height: 550,
            collapsible: true,
            minimizable: true,
            maximizable: true,
            resizable: true
        });
       ShowCargo();
       $("#dgCargo").datagrid("clearChecked");
       $("#dgCargo").datagrid("clearSelections");
} 

function reloaded() {   //reload
    $("#reload").click(function () {
        //
        $('#dgINSO').datagrid('reload');
    });}
 

//Modify Button Click Event
function updInSOInfo() {  
    $("#edit").click(function () {      

        //Judging the selection
        var row = $("#dgINSO").datagrid('getSelected');        
        if (row) {         
            $.messager.confirm('edit', 'Do you want to edit it?', function (r) {
                if (r) {                

                     //Open Dialog Edit
                    $("#divAddUpdINO").dialog({
                        closed: false,
                        title: "Modify warehouse receipt",
                        modal: true,
                        width: 820,
                        height: 550,
                        collapsible: true,
                        minimizable: true,
                        maximizable: true,
                        resizable: true,

                    });    
                    //Bind First                  

                    showINO(row);
                    defaultTab();
                    ShowDetail(row.No);
                }               

            });

            SetEnabled(row.Status);
        } else {
            $.messager.alert('Tips', ' Please select the line to edit!', 'warning');
        }
    });   
}

//delete
function deleteInSO() {
    $("#del").click(function () {
        var rows = $("#dgINSO").datagrid("getSelections");
        if (rows.length > 0) {
            $.messager.confirm("Tips", "Are you sure you want to delete it??", function (res) {

                if (res) {
                    var codes = []; //Important is not{}
                    for (var i = 0; i < rows.length; i++) {
                        codes.push(rows[i].Id);
                    }

                    $.post("/InStock/Delete", { "ids": codes.join(',') }, function (data) {
                        if (data == "OK") {
                            $.messager.alert("Tips", "Delete successful!");
                            $("#dgINSO").datagrid("clearChecked");
                            $("#dgINSO").datagrid("clearSelections");
                            $("#dgINSO").datagrid("load", {});
                        }                       
                        else if (data == "NO") {
                            $.messager.alert("Tips", "Delete failed!");

                            return;
                        }
                    });
                }
            });
        }
    })
}

//Empty Text Box
function clearAll() {    
    $("#divAddUpdINO input").each(function () {
            $(this).val("");

        });
    $("#PreDeliveryTimeUpdate").val(getNowFormatDate());    

    $("#StatusUpdate").val("0");
    $("#NwtUpdate").val("0"); 

    $("#GwtUpdate").val("0");
    $("#PackageQtyUpdate").val("0");
  

}

function GetNo() {
    $.get(abp.appPath + "api/services/app/InStockOrder/GetNo", function (data) {
        $("#UpdNO").val(data);
    });

}

//Get the current time, format YYYY-MM-DD
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;

    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }

    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }

    var currentdate = year + seperator1 + month + seperator1 + strDate;
    return currentdate;
}


//Convert form data to json
function form2Json(id) {
    var arr = $("#" + id).serializeArray()

    var jsonStr = ""; 

    jsonStr += '{';
    for (var i = 0; i < arr.length; i++) {
        jsonStr += '"' + arr[i].name + '":"' + arr[i].value + '",'

    }
    jsonStr = jsonStr.substring(0, (jsonStr.length - 1));

    jsonStr += '}' 

    var json = JSON.parse(jsonStr)
    return json

} 

function SetEnabled(status) {
    if (status == "Submit") {
        $("#btnSave").prop('disabled', true);
    }

    else {
        $("#btnSave").removeAttr("disabled");

    }
}
 

function defaultTab() {
    //Show first by default tab
    $('#box').tabs('select', "Warehousing receipt");

}

//Pop up the dialog to import the delivery slip

function showInSODialog() {
    $("#add").click(function () {     

            $.messager.confirm('edit', 'Do you want to create a warehouse receipt?', function (r) {

                if (r) {
                    //Open Dialog Edit
                    $("#divAddUpdINO").dialog({
                        closed: false,
                        title: "Add warehouse receipt",
                        modal: true,
                        width: 820,
                        height: 550,
                        collapsible: true,
                        minimizable: true,
                        maximizable: true,
                        resizable: true,

                    });                  

                }
                defaultTab();
                GetNo();
                clearAll();
                ShowDetail("");
            });       

    });  

    $("#btnSave").click(function () {    

        //Preservation
        var id = $("#IDUpdate").val();
        if (id == "" || id == undefined) {
            //Verification
            $.messager.confirm('confirm', 'Are you sure you want to save?', function (r) {
                if (r) {                   

                    var postData = GetINO();                    

                    if (postData.No == "" || postData.CustomerCode == "" || postData.CustomerName=="" || postData.OwnerName=="") {
                        $.messager.alert('Tips', ' Please fill in the relevant required items!', 'warning');

                        return;
                    }                   

                    $.post("/InStock/Add", postData, function (data) {
                        if (data == "OK") {
                            $.messager.alert("Tips", "Save successfully!");

                            initable();
                            collapseRows();
                        }

                        else if (data == "NO") {
                            $.messager.alert("Tips", "Save failed!");
                            return;

                        }

                    });
                }
            })
        }

        else {
            saveDetail();
            initable();
            collapseRows();

        }

    });
}
//Add Details
function ShowDetail(no) {
    var lastIndex;
    $("#dgINOD").datagrid({
        url: "/InStock/GetDetail?no=" + no,
        title: "Details of warehousing receipt",
        pagination: false,      
        fit: true

        fitColumns: false,
        loadMsg: "Loading warehouse receipt details...",
        toolbar: [
            { text: 'Add Details', iconCls: 'icon-add', handler: function () { ShowCargoInfo(); } },
            { text: 'Add Location', iconCls: 'icon-edit', handler: function () { SubGridAddRow(); } },
            { text: 'delete', iconCls: 'icon-remove', handler: function () { deviceInfoDeleteClick(); } },
            '-'
        ],

        nowarp: false,

        border: false,

        idField: "Id",

        sortName: "Id",

        sortOrder: "asc",
        singleSelect: true,
        iconCls: 'icon-edit',      

        columns: [[
            { title: "number", field: "SeqNo", width: 50, sortable: true },
            { title: "Warehousing receipt number", field: "InStockNo", width: 100, sortable: true },

            { title: "HSCode", field: "HSCode", width: 80, sortable: false },
            { title: "Goods code", field: "CargoCode", width: 100, sortable: true },
            { title: "Name of goods", field: "CargoName", width: 160, sortable: false },
            { title: "Specification Model", field: "Spcf", width: 80, sortable: false },
            {
                title: "Number", field: "Qty", width: 100, align: 'center', editor: {
                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 4
                    }
                }
            },
            {
                title: "long", field: "Length", width: 70, align: 'center', editor: {
                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            {
                title: "wide", field: "Width", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            {
                title: "high", field: "Height", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            { title: "Country of Production and Sale", field: "Country", width: 70, align: 'center' },
            {
                title: "Unit Price", field: "Price", width: 100, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2

                    }
                }
            },       

            {
                title: "Total Price", field: "TotalAmt", width: 100, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 2
                    }
                }
            },
            { title: "Packing", field: "Package", width: 70, align: 'center' },
            { title: "Unit of measurement", field: "Unit", width: 70, align: 'center' },
            {
                title: "Total volume", field: "Vol", width: 70, align: 'center', editor: {

                    type: 'numberbox', options: {
                        required: true, min: 0, precision: 4

                    }
                }
            },
            { title: "brand", field: "Brand", width: 70, align: 'center' }

        ]],

        view: detailview,

        detailFormatter: function (index, row) {
            return '<div style="padding:2px"><table id="dgINODItem-' + index + '"></table></div>';

        },

        onExpandRow: function (index, row) {
            var ddv = $('#dgINODItem-' + index);
            ddv.datagrid({
                url: '/InStock/GetLocs?Id=' + row.Id,
                fitColumns: false,
                singleSelect: true,
                rownumbers: true,
                loadMsg: '',
                height: 'auto',
                columns: [[                   //[{"InStockOrderDetailId":24,"SeqNo":1,"Loc":"A121","Qty":121.00,"CreationTime":"2020-02-17 16:37:05","Id":1}]
                    { field: 'SeqNo', title: 'Sequence Number', width: 50 },
                    {
                        field: 'Qty', title: 'Number', width: 120, editor: {
                            type: 'numberbox', options: {
                                required: true, min: 0, precision: 2
                            }
                        }
                    },
                    {
                        field: 'Loc', title: 'Location', width: 150, editor: {
                            type: 'text', options: {
                                required: true
                            }
                        }
                    },

                    { field: 'CreationTime', title: 'Creation Time', hidden: 'true' }, 

                    { field: 'Id', title: 'Id', width: 50, hidden: 'true' },
                    { field: 'InStockOrderDetailId', title: 'InodId', width: 50, hidden: 'true' }
                ]],

                onResize: function () {
                    $('#dgINOD').datagrid('fixDetailRowHeight', index);
                },

                onLoadSuccess: function () {
                    setTimeout(function () {
                        $('#dgINOD').datagrid('fixDetailRowHeight', index);

                    }, 0);
                    editIndex = undefined;//Main grid wrap
                },
                onAfterEdit: function (rowIndex, rowData, changes) {

                    editIndex = undefined;
                },

                onClickRow: function (index1, row1) {
                    if (editIndex != index1) {
                        if (endEditing(ddv)) {
                       ddv.datagrid('selectRow', index1).datagrid('beginEdit', index1);
                            editIndex = index1;

                        }
                        else { ddv.datagrid('selectRow', editIndex); }

                    }
                }
            });
            $('#dgINOD').datagrid('fixDetailRowHeight', index);

        },

        onClickRow: function (index, rowData) {
            if (mainIndex!=undefined) {
                $('#dgINOD').datagrid('collapseRow', mainIndex);

            }          

            if (lastIndex != index) {
                $('#dgINOD').datagrid('endEdit', lastIndex);
                editrow(index);
            }

            lastIndex = index;
            mainIndex = index;
        },        

        onBeginEdit: function (rowIndex, rowData) { 
            setEditing(rowIndex);
        }
    });
}

//Calculate Quote Subtotal

function setEditing(rowIndex) {
    var editors = $('#dgINOD').datagrid('getEditors', rowIndex);
    var priceEditor = editors[4];
    var qtyEditor = editors[0];
    var lengthEditor = editors[1];
    var widthEditor = editors[2];
    var heightEditor = editors[3];
    var totalVolEditor = editors[6];

    var totalAmtEditor = editors[5];
    priceEditor.target.numberbox({
        onChange: function () { calculate();}

    });

    qtyEditor.target.numberbox({
        onChange: function () {
            calculate();
            calculateVol();
        }

    });

    lengthEditor.target.numberbox({
        onChange: function () { calculateVol(); }
    });

    widthEditor.target.numberbox({
        onChange: function () { calculateVol(); }

    });

    heightEditor.target.numberbox({
        onChange: function () { calculateVol(); }
    });

    function calculate() {
        var cost = (priceEditor.target.val()) * (qtyEditor.target.val());

        console.log(cost);
        totalAmtEditor.target.numberbox("setValue", cost);
    }

    function calculateVol() {
        var vol = (lengthEditor.target.val() / 100.0) * (widthEditor.target.val() / 100.0) * (heightEditor.target.val() / 100.0)*
(qtyEditor.target.val()); console.log(vol); totalVolEditor.target.numberbox("setValue", vol); } } function editrow(index) { $('#dgINOD').datagrid('selectRow', index) .datagrid('beginEdit', index); } function endEdit() { var rows = $('#dgINOD').datagrid('getRows'); if (rows==undefined) { return; } for (var i = 0; i < rows.length; i++) { $('#dgINOD').datagrid('endEdit', i); } } //Get location data for warehouse receipt details function setSubGridLoc(effectRow) { var ddv = $('#dgINODItem-' + mainIndex); var dgcnt = ddv.datagrid().length; if (mainIndex != undefined && dgcnt>0) { endEditSub(ddv); var changes = ddv.datagrid('getChanges'); if (changes.length) { var insed = ddv.datagrid('getChanges', "inserted"); var deled = ddv.datagrid('getChanges', "deleted"); var upded = ddv.datagrid('getChanges', "updated"); if (insed.length) { effectRow["locsInserted"] = JSON.stringify(insed); } if (deled.length) { effectRow["locsDeleted"] = JSON.stringify(deled); } if (upded.length) { effectRow["locsUpdated"] = JSON.stringify(upded); } } } return effectRow; } //Set up warehouse receipt details function setGridDetail(effectRow) { if ($('#dgINOD').datagrid('getChanges').length) { var inserted = $('#dgINOD').datagrid('getChanges', "inserted"); var deleted = $('#dgINOD').datagrid('getChanges', "deleted"); var updated = $('#dgINOD').datagrid('getChanges', "updated"); if (inserted.length) { effectRow["inserted"] = JSON.stringify(inserted); } if (deleted.length) { effectRow["deleted"] = JSON.stringify(deleted); } if (updated.length) { effectRow["updated"] = JSON.stringify(updated); } } return effectRow; } function endEditSub(ddv) { if (mainIndex != undefined) { var rows = ddv.datagrid('getRows'); if (rows!=undefined) { for (var i = 0; i < rows.length; i++) { ddv.datagrid('endEdit', i); } } } } function saveDetail() { endEdit(); $.messager.confirm('confirm', 'Are you sure you want to modify it?', function (r) { var effectRow = new Object(); var postData = GetINO(); if (postData.Id) { effectRow["postdata"] = JSON.stringify(postData); } effectRow = setSubGridLoc(effectRow); effectRow = setGridDetail(effectRow); $.post("/InStock/Update", effectRow, function (data) { // alert(data); if (data.success) { $.messager.alert("Tips", data.result); $('#dgINOD').datagrid('acceptChanges'); } else { $.messager.alert("Tips", data.result); return; } }, "JSON") ; }) } function init() { $("#PreDeliveryTimeUpdate").val(getNowFormatDate()); $("#CreationTimeUpdate").val(getNowFormatDate()); $("#btnCancle").click(function () { $("#divAddUpdINO").dialog("close"); $('#dgINSO').datagrid('reload'); }); $("#btnCancleDO").click(function () { $("#divImportCargo").dialog("close"); $('#dgINSO').datagrid('reload'); }); $("#btnImportDO").click(function () { //Preservation var rows = $('#dgCargo').datagrid('getSelections'); if (rows.length > 0) { //Verification $.messager.confirm('confirm', 'Are you sure you want to save the selected goods information?', function (r) { if (r) { var obj_No = $("#UpdNO").val(); var ids = [];//Important is not{} for (var i = 0; i < rows.length; i++) { ids.push(rows[i].Id); } var postData = { "Ids": ids.join(','), "No": obj_No }; $.post("/InStock/ImportCargo", postData, function (data) { if (data == "OK") { $.messager.alert("Tips", "Save goods information successfully!"); ShowDetail(obj_No); } else if (data == "NO") { $.messager.alert("Tips", "Failed to save goods information!"); return; } }); } }) } }); $("#btnSubmit").click(function () { //Preservation var id = $("#IDUpdate").val(); if (id == "" || id == undefined) { $.messager.alert("Tips", "The warehouse receipt is not saved, please save it first!"); return; } //Verification $.messager.confirm('confirm', 'Are you sure you want to submit the warehouse receipt?', function (r) { if (r) { var postData = { "Id": id }; $.post("/InStock/Submit", postData, function (data) { if (data == "OK") { $.messager.alert("Tips", "The warehouse receipt has been submitted successfully!"); $("#StatusUpdate").val("Submit"); SetEnabled("Submit"); } else if (data == "NO") { $.messager.alert("Tips", "Warehouse receipt submission failed!"); return; } }); } }) }); } function SubGridAddRow() { var ddv = $('#dgINODItem-' + mainIndex); var row = $('#dgINOD').datagrid('getSelected'); if (mainIndex != undefined && editIndex!=undefined) { ddv.datagrid('endEdit', editIndex); } if (editIndex == undefined) { var seqno = ddv.datagrid("getRows").length + 1; ddv.datagrid('insertRow', { index: 0, row: { InStockOrderDetailId: row.Id, SeqNo: seqno} }); ddv.datagrid('beginEdit', 0); editIndex = 0; } } function endEditing(ddv) { var changes = ddv.datagrid('getChanges'); if (editIndex == undefined) { return true } if (ddv.datagrid('validateRow', editIndex)) { //Verify the previous line //Return to Editor and End Editing ddv.datagrid('endEdit', editIndex); editIndex = undefined; return true; } else { return false; } } function collapseRows() { var rows = $('#dgINOD').datagrid('getRows'); $.each(rows, function (i, k) { //Gets all currently expanded subgrids var expander = $('#dgINOD').datagrid('getExpander', i); if (expander.length && expander.hasClass('datagrid-row-collapse')) { if (k.id != row.id) { //Collapse last expanded subgrid $('#dgINOD').datagrid('collapseRow', i); } } }); } function GetINO() { var postData = { "No": $("#UpdNO").val(), "DeliveryNo": "", "PreDeliveryTime": $("#PreDeliveryTimeUpdate").val(), "CustomerCode": $("#CustomerCodeUpdate").val(), "OwnerName": $("#OwnerNameUpdate").val(), "OwnerCode": $("#OwnerCodeUpdate").val(), "CustomerName": $("#CustomerNameUpdate").val(), "CreationTime": $("#CreationTimeUpdate").val(), "CheckTime": $("#CheckTimeUpdate").val(), "WarehouseType": $("#WarehouseTypeUpdate").val(), "WarehouseNo": $("#WarehouseNoUpdate").val(), "Oper": $("#OperUpdate").val(), "Receiver": $("#ReceiverUpdate").val(), "Nwt": $("#NwtUpdate").val(), "Remark": $("#RemarkUpdate").val(), "ReceiveTime": $("#ReceiveTimeUpdate").val(), "Status": $("#StatusUpdate").val(), "Gwt": $("#GwtUpdate").val(), "Checker": $("#CheckerUpdate").val(), "PackageQty": $("#PackageQtyUpdate").val(), "LastUpdateTime": "", "LastOper":"" }; var id = $("#IDUpdate").val(); if (!(id=="" || id==undefined)) { postData.Id = id; } return postData; } function showINO(row) { $("#IDUpdate").val(row.Id); $("#UpdNO").val(row.No); $("#PreDeliveryTimeUpdate").val(row.PreDeliveryTime); $("#CustomerCodeUpdate").val(row.CustomerCode); $("#PackageQtyUpdate").val(row.PackageQty); $("#CustomerNameUpdate").val(row.CustomerName); $("#OwnerCodeUpdate").val(row.OwnerCode); $("#OwnerNameUpdate").val(row.OwnerName); $("#CreationTimeUpdate").val(row.CreationTime); $("#CheckTimeUpdate").val(row.CheckTime); $("#WarehouseTypeUpdate").val(row.WarehouseType); $("#WarehouseNoUpdate").val(row.WarehouseNo); $("#OperUpdate").val(row.Oper); $("#ReceiverUpdate").val(row.Receiver); $("#NwtUpdate").val(row.Nwt); $("#RemarkUpdate").val(row.Remark); $("#ReceiveTimeUpdate").val(row.ReceiveTime); $("#StatusUpdate").val(row.Status); $("#GwtUpdate").val(row.Gwt); $("#CheckerUpdate").val(row.Checker); } //------------------------system management-->End of warehouse receipt management------------------------//

Tags: JSON

Posted on Wed, 06 May 2020 21:21:48 -0400 by yepster123