AJAX application in the logistics system

Source: Internet
Author: User
Recently completed a B/S logistics management system, which summarizes some of the new technologies used in it. This document continues with the previous article "Examples of printing the actual use of general WEB reports using XML.
To solve user discomfort caused by Server Page refreshing and reduce the delay of data reloading without modification, the new AJAX refreshing technology is adopted in operations such as document query, data storage, and data modification, A brief introduction is as follows:

(1). aspx page
Contains the page layout, calls the hidden form to execute the operation to return XML and load the javascript code to this form: // according to the input document number, query the document information and display it on the page
Function DisplayNoteInfo (ctlRowId, ctlNoteNo, ctlHidStockId, ctlHidMoveType, tableId ){

// Send it to the background for processing
// Alert ("hidGetNotesMaster. aspx? NoteNo = "+ emNo. value +" & StockId = "+ emStockId. value +" & MoveType = "+ emTypeCode. value );
OHttpReq. open ("POST", "frmhidInOutInform. aspx? GlobalNo = "+ emNoteNo. value +" & stockId = "+ emStockId. value +" & actionType = "+ emTypeCode. value, false );

OHttpReq. send ("");

XmlResult = oHttpReq. responseText;

ODoc. loadXML (xmlResult );

Var dataItems = new Array ();
Var detailItems = new Array ();

DataItems [0] = oDoc. selectNodes ("// InformMaster/CUSTOMER_NAME ");

//

DetailItems [0] = oDoc. selectNodes ("// InformDetail/BILL_NO ");
//


// Master table
If (dataItems [0]. length = 0) // The customer name is empty, indicating that the query document data is empty.
{

HasGet = false;

}
Else // query the data on the ticket
{

// Customer
Var emCustomAddr = document. getElementById ('txtcustomname ');
If (dataItems [0]. length> 0 ){
EmCustomAddr. value = dataItems [14] [0]. text;
}
Else {
EmCustomAddr. value = "";
}

HasGet = true;

}


// List
If (detailItems [0]. length = 0) // PROD_TYPE is empty
{
// HasGet = false;
}
Else {
For (var I = 0; I <= detailItems [0]. length-1; I ++) {// traverse one by one

Var newRowId;

NewRowId = NewRow (tableId); // Add a row at the end of the table
NewRowId = parseInt (newRowId );

Eval ("document. all. item (txtBoxCtl [j], newRowId-1). value = detailItems [j] [I]. text ");
}

HasGet = true;
}

Return hasGet;

}

(2) Hide the form to work in the backend, and return the XML file globalNo = Request. QueryString ("globalNo ")

StockIdStr = Request. QueryString ("stockId ")

Select Case actionType 'select operation based on warehouse receiving type

Case "XIAOSHOUCHUKU" 'sales warehouse picking

Dim SaleOutAction As New OutSaleAction

'Retrieve the sales warehouse master table
Ds = SaleOutAction. GetInformInfo (globalNo, stockIdStr, notFinished)

Dim writer As New System. Xml. XmlTextWriter (Response. OutputStream, New System. Text. UTF8Encoding)

Writer. Formatting = System. Xml. Formatting. Indented
Writer. Indentation = 4
Writer. IndentChar = ""

Ds. WriteXml (writer)
Writer. Flush ()
Writer. Close ()

(3). Notes
1. The parameter value passed between forms through the post method cannot exceed 4 K. Otherwise, javascript Execution will result in an error.
2. I added three hidden forms to the project: hidInform, document information retrieval, and hidAction saving. hidXml retrieves the printed document XML file.
3. The access permission to hide a form must be directed by the system. directly entering a url does not allow access.

If Request. UrlReferrer Is Nothing Then
Response. Write ("<script language = 'javascript '> alert ('invalid access method! '); </Script> ")
Response. Write ("<script language = 'javascript '> parent. location. href = 'default. aspx'; </script> ")
Exit Sub
End If

Now, let's write it here today. The technology used is very simple. The first reason is to provide some help to new entry-level friends, and the second is to improve their own summary. Welcome to the discussion.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.