MySQL操作程序二十(mscorder1.pl,mscorder1.htm)
返回
- 追加packing时的处理
- 追加shipping时的处理
- ************************************************************
- 修改order1的orderno项目,NO/CANCEL/客户order编号功能=>修改现有数据的程序(没有数字的赋予NO)
- order1的orderno的DEFAULT是NO
- order1.htm画面同时多个OURREF的post输入,自动写入复数个OURREF=>就写一个?
- order1のweight,自动写入复数个OURREF=>就写一个?
- order1のsize,自动写入复数个OURREF=>就写一个?
- order1.htm画面增加,把"入荷時期"と"入荷メモ",arrivaltime/arrivalmemo
- order1.htm画面修改,把"納入先/時期"改为"納入時期,納入先"
- 梱包情報=>packing_info
- order1增加arrivaltime/arrivalmemo
- order1增加重量项目(weight)
- order1增加尺寸项目(size)
- 增加order1的posttime项目(出荷の日付)(放在post的后面)
- ==============没有ORDER;status=0;time=order1该列的创建时间;paytime:2010-00-00;orderno:空白;post=NO
- 未收到货款,未发货的ORDER;status=1;time=orderno输入时的时间;paytime:2010-00-00;orderno:客户order编号;post=NO
- 未收到货款,已发货的ORDER;status=2;time=orderno输入时的时间;paytime:2010-00-00;orderno:客户order编号;post=发货地点
- 已收到货款,未发货的ORDER;status=3;time=orderno输入时的时间;paytime:收款时间;orderno:客户order编号;post=NO
- 已收到货款,已发货的ORDER;status=4;time=orderno输入时的时间;paytime:收款时间;orderno:客户order编号;post=发货地点
追加packing时,同时在738/524的packing栏追加M670,因为738/524一齐packing。
mysql> select id, packing from order1 where length(packing) > 5;
+-------+-------------------------+
| id | packing |
+-------+-------------------------+
| 670 | 738=524 |
| 4815 | 6036=6891 |
| 6203 | 6505=6712=6714 |
| 6421 | 6665=6430=6732 |
| 6970 | 7659=7657 |
| 7028 | 10012=9968 |
| 7111 | 7112=7115 |
| 7283 | 7342=7344 |
| 7522 | 7526=7527=7528=7529 |
| 8185 | 5617=5618 |
| 8487 | 8499=8543 |
| 8630 | 8634=8643 |
| 11069 | 10959=10821=10769=11038 |
+-------+-------------------------+
13 rows in set (0.01 sec)
追加shipping时,同时在11330/11331/11332的shipping栏追加M12110,因为11330/11331/11332和12110一齐shipping。
mysql> select id, shipping,length(shipping) from order1 where id = 12110;
+-------+-------------------+------------------+
| id | shipping | length(shipping) |
+-------+-------------------+------------------+
| 12110 | 11330=11331=11332 | 17 |
+-------+-------------------+------------------+
1 row in set (0.08 sec)
mysql> update order1 set orderno = 'NO' where length(orderno) < 2;
Query OK, 9828 rows affected (0.44 sec)
Rows matched: 9828 Changed: 9828 Warnings: 0
mysql> select id,orderno from order1 where length(orderno) < 2;
Empty set (0.02 sec)
mysql> show columns from order1;
+-----------------+-----------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-----------+------+-----+------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| time | date | YES | | NULL | |
| orderno | char(100) | NO | | NO | |
| ORIGINid | int(11) | YES | | NULL | |
| PRICEid | int(11) | YES | | NULL | |
| PAYMENTid | int(11) | YES | | NULL | |
| DELIVERY | text | YES | | NULL | |
| memo | text | YES | | NULL | |
| consignee | text | YES | | NULL | |
| changeprice | text | YES | | NULL | |
| discount | text | YES | | NULL | |
| total | text | YES | | NULL | |
| LANGUAGEid | int(11) | YES | | NULL | |
| packing_charge | text | YES | | NULL | |
| freight_charges | text | YES | | NULL | |
| delivery_charge | text | YES | | NULL | |
| delivery_place | text | YES | | NULL | |
| disc | text | YES | | NULL | |
| shipping | text | YES | | NULL | |
| packing | text | YES | | NULL | |
| packing_info | text | YES | | NULL | |
| post | char(100) | NO | | NO | |
| posttime | date | NO | | 2011-00-00 | |
| paytime | date | NO | | 0000-00-00 | |
| status | int(11) | NO | | 0 | |
| arrivaltime | date | NO | | 2011-00-00 | |
| arrivalmemo | text | YES | | NULL | |
| size | text | YES | | NULL | |
| weight | text | YES | | NULL | |
+-----------------+-----------+------+-----+------------+----------------+
29 rows in set (1.16 sec)
mysql> ALTER TABLE order1 CHANGE orderno orderno char(100) NOT NULL DEFAULT 'NO'
;
Query OK, 12383 rows affected (1.13 sec)
Records: 12383 Duplicates: 0 Warnings: 0
注意:要先把NULL的orderno都写入NO!
mysql> UPDATE order1 SET orderno = 'NO' WHERE orderno IS NULL;
Query OK, 10 rows affected (0.16 sec)
Rows matched: 10 Changed: 10 Warnings: 0
mysql> select id, orderno from order1 where length(orderno) > 20;
+------+-----------------------+
| id | orderno |
+------+-----------------------+
| 2049 | 330-08,UIR28557-12-08 |
| 7036 | FQN-SP-002.005.006-10 |
+------+-----------------------+
2 rows in set (0.01 sec)
mysql> select id, orderno from order1 where length(orderno) > 30;
Empty set (0.03 sec)
mysql> ALTER TABLE order1 CHANGE orderno orderno char(100) NOT NULL DEFAULT 'NO'
;
ERROR 1265 (01000): Data truncated for column 'orderno' at row 12373
mysql> ALTER TABLE order1 MODIFY orderno TEXT NOT NULL DEFAULT 'NO';
ERROR 1101 (42000): BLOB/TEXT column 'orderno' can't have a default value
mysql> show columns from order1;
+-----------------+-----------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-----------+------+-----+------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| time | date | YES | | NULL | |
| orderno | text | YES | | NULL | |
| ORIGINid | int(11) | YES | | NULL | |
| PRICEid | int(11) | YES | | NULL | |
| PAYMENTid | int(11) | YES | | NULL | |
| DELIVERY | text | YES | | NULL | |
| memo | text | YES | | NULL | |
| consignee | text | YES | | NULL | |
| changeprice | text | YES | | NULL | |
| discount | text | YES | | NULL | |
| total | text | YES | | NULL | |
| LANGUAGEid | int(11) | YES | | NULL | |
| packing_charge | text | YES | | NULL | |
| freight_charges | text | YES | | NULL | |
| delivery_charge | text | YES | | NULL | |
| delivery_place | text | YES | | NULL | |
| disc | text | YES | | NULL | |
| shipping | text | YES | | NULL | |
| packing | text | YES | | NULL | |
| packing_info | text | YES | | NULL | |
| post | char(100) | NO | | NO | |
| posttime | date | NO | | 2011-00-00 | |
| paytime | date | NO | | 0000-00-00 | |
| status | int(11) | NO | | 0 | |
| arrivaltime | date | NO | | 2011-00-00 | |
| arrivalmemo | text | YES | | NULL | |
| size | text | YES | | NULL | |
| weight | text | YES | | NULL | |
+-----------------+-----------+------+-----+------------+----------------+
29 rows in set (0.02 sec)
[Sun Sep 12 12:42:52 2010] [error] [client 127.0.0.1] Use of uninitialized value in array dereference at ./pro/mscorder1.pl line 366, line 11.,
# 输入价格表格
$$pref{id} = $t{order1_id};
($pref,$self) = show_parts3($pref,$self);
366: @loop1 = @{ $$pref{list} };
修改如下(该修改失败!):
if (@{ $$pref{list} })
@loop1 = @{ $$pref{list} };
} else {
@loop1 = ();
}
增加如下(该修改成功!):
sub show_parts3 {
my ($pref,$self) = @_;
my(%t,$n,$n1,%seen,$item);
@{ $$pref{list} } = ();
[Sun Sep 12 12:53:39 2010] [error] [client 127.0.0.1] Argument "P2" isn't numeric in multiplication (*) at ./pro/mscorder1.pl line 652, line 11., referer: http://localhost/cgi-bin/msc_start.cgi
[Sun Sep 12 12:53:39 2010] [error] [client 127.0.0.1] Use of uninitialized value in multiplication (*) at ./pro/mscorder1.pl line 652, line 11., referer: http://localhost/cgi-bin/msc_start.cgi
652: $t{price2} = $t{prices}[$t{NO}-1]*$t{Q1};
修改如下:
if ( $t{price1} && $t{price1} ne 'P2') {
$t{price2} = $t{prices}[$t{NO}-1]*$t{Q1};
} else {
$t{price2} = 0;
}
----------------------------------------------------------------
$t{content} = $t{q}->param("content");
$t{content} =~ s/\s+$//; # 把后面的空格去掉
返回