$v1){ $arr1[$k2]=$v1; $k2++; } return $arr1; } require "../config.php"; include "../../tmpl/config.php"; require THIS_FILE_ROOT."/include/function.php"; require THIS_FILE_ROOT."/include/db_mysql.php"; error_reporting(E_ERROR | E_WARNING | E_PARSE); //-------------------------------mysql connect $msg=""; $db=new DB_Sql; $db->connect($dbhost,$dbuser,$dbpw,$dbname,"p"); $is_submit=$_POST["is_submit"]; $is_multi_price=get_set("is_multi_price"); //文胸 if($bx_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1"); $bx_sizegroup_id=$tmp["id"]; }else{ $bx_sizegroup_id=0; } //童装 if($child_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1"); $child_sizegroup_id=$tmp["id"]; }else{ $child_sizegroup_id=0; } if($is_submit=="y"){ $content=$_POST["content"]; $arr=explode("\n",$content); $arr_kh=array(); $error_kh=$error_kh=array(); // for($i=0;$i"; } } //清空不予下单表 //$db->query("truncate table ".$table_pre."size_not;"); //计算尺码 foreach($arr_kh as $kh => $arr1){ $m_kh=get_db_msg("select id,no,size_group from ".$table_pre."kh where no='".$kh."'"); $khid=$m_kh["id"]; if($khid>0){ $db->query("delete from ".$table_pre."size_not where kh='".$kh."'");//清空该款的不予下单表 $j=count($arr1); $arr_color=$arr_bx=$arr_size_group=$arr_size=array(); for($k=0;$k<$j;$k++){ // $arr_color[$k]=$arr1[$k][0]; $arr_bx[$k]=$arr1[$k][1]; $arr_size_group[$k]=$arr1[$k][2]; $arr_size[$k]=$arr1[$k][3]; } if($bx_sizegroup_id==$m_kh["size_group"] || $child_sizegroup_id==$m_kh["size_group"]){ //---------------------文胸或者童装 if($j>1){ $size_all_bx=array();//到杯型的全尺码 $kh_bx=array();//该款的所有杯型 $arr_size_no=array(); for($i1=0;$i1 $arr_s){ $size_all_bx[$bx]=arr_px1($arr_s); } //print_r($size_all_bx); foreach($size_all_bx as $bx => $arr_s){ $check=get_db_msg("select id from ".$table_pre."size_bx where no='".$m_kh["no"]."' and bx='".$bx."'"); if($check["id"]>0){ $q="update ".$table_pre."size_bx set size='".arr_to_str($arr_s)."' where no='".$m_kh["no"]."' and bx='".$bx."'"; }else{ $q="insert ".$table_pre."size_bx (no,bx,size) values ('".$m_kh["no"]."','".$bx."','".arr_to_str($arr_s)."')"; } $db->query($q);//更新size_bx表的尺码 } //------检查是否存在遗漏的杯型 $arr_color_bx=array(); for($i3=0;$i3 $arr_bx1){ for($i4=0;$i4query($q); //echo $q."
"; $right_kh[]=$kh."-".$color1."-".$kh_bx[$i4]; } } } //print_r($kh_bx); //echo "
"; //print_r($arr_color_bx); for($i3=0;$i30){ $q="update ".$table_pre."size_not set size='".$size_not."' where id='".$check["id"]."'"; }else{ $q="insert ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$arr_color[$i3]."','".$arr_bx[$i3]."','".$size_not."')"; } //echo $q."
"; $db->query($q);//设置不予下单尺码 $right_kh[]=$kh."-".$arr_color[$i3]."-".$arr_bx[$i3]; } } } }else{ //---------------------非文胸 if($j>1){ // $arr_size1=array_unique($arr_size); if(count($arr_size1)>1){ //需要设置不予下单 $size_all=array();//到款的全尺码 $arr_size_no=array(); for($i1=0;$i1query($q);//更新款号表的尺码 for($i3=0;$i30){ $q="update ".$table_pre."size_not set size='".$size_not."' where id='".$check["id"]."'"; }else{ $q="insert ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$arr_color[$i3]."','".$arr_bx[$i3]."','".$size_not."')"; } //echo $q."
"; $db->query($q);//设置不予下单尺码 $right_kh[]=$kh."-".$arr_color[$i3]; } } //echo $kh.":"; //print_r($size_all); } } } }else{ $error_kh[]=$kh;//款号有误 } } $msg=""; if(count($error_kh)>0){ $msg.="以下款号有误:".arr_to_str($error_kh).";
"; } if(count($right_kh)>0){ $msg.="以下款设置成功:".arr_to_str($right_kh).";
"; } } ?> 自动计算不予下单尺码
"; } ?>
自动计算不予下单尺码(按款计算)
格式说明(字段间用制表符分割):款号,颜色代码,规格或杯型(没有留空),尺码组名称,尺码名称(逗号分隔);多条记录请回车。
".$msg."