According to the warehouse picking requirements, the batch information of the warehouse receiving will be matched by lazygc520 at 2013-08-0709: 39: 09. the edited database is divided into three tables, kw, vp, three tables starting with st. The first two tables represent warehouse receiving, and those starting with st represent warehouse picking requirements. The first two tables are checked in combination to match the batch information in the warehouse according to the warehouse picking requirements.
At the end of this post, lazygc520 edited the database at 09:39:09 on. The database is divided into three tables starting with kw, vp, and st. The first two tables represent warehouse receiving, and those starting with st represent warehouse picking requirements. If the first two tables are added to the database, perform a joint query to obtain the cust_no and lotno that have been added to the database. the stockno information and the corresponding cust_no are known in the database picking table. the stockno sorting relationship exists. the c1_time field in the table st, c_type and adress are sorted. stockno is sorted in order. lotno matches the number of stockno instances according to the first-in-first-out sorting rules. if it is equal, the matched lotno instances are excluded, the new lotno matches with the next stockno until the quantity meets the requirements, and so on. The result of the number is the result of the mount * snp in the st table. Can I do this by traversing the information of the input table?
Upload attachment address: http://download.csdn.net/detail/lazygc520/5882535
The data warehouse receiving and warehouse picking requirements are known, and the batch data warehouse receiving is matched according to the warehouse picking requirements.
For example, on the ch_result page, ch_result.php? Stockno = SU13061301010 to implement the data in the column of the shipment batch.
Results of cust_no and lotno obtained from the combined query of kw and vp tables:
$ SQL = "select CONCAT (SUBSTRING_INDEX (a. cust_no,'', 1 ),
SUBSTRING_INDEX (a. cust_no, '',-1) as cust_no, B. lotno as lotno,
Count (B. lotno) as lotno_count from 'kw _ manage' as,
'VP _ barcode_2d_y 'as B where a. packageno = B. packageno
Group by lotno order by lotno asc ";
$ Result = mysql_query ($ SQL );
$ Ars = array ();
While ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC ))
{
$ Ars [] = $ row;
}
Var_dump ($ ars );
Result:
Array (1) {[0] => array (3) {["cust_no"] => string (10) "237033AW0A" ["lotno"] => string (4) "3207" ["lotno_count"] => string (3) "480 "}}
Share:
------ Solution --------------------
Add a warehouse field to the database table
The input field is 0.
This field indicates the number of warehouse picking items.
Warehouse receiving quantity-warehouse picking quantity = remaining quantity of the batch
Again
Set select * from tbl_name
id num
1 20
2 20
3 30
SELECT *, (SELECT sum (num) FROM tbl_name WHERE id <= a. id) as c FROM tbl_name
id num c
1 20 20
2 20 40
3 30 70
Column c can be used as the basis for warehouse picking source.
If the size of outbound packaging is 30
The corresponding id is:
Packing 1, 2
Packaging 2, 3
Package 3 3, subsequent id