<?php session_start();$session=session_id();?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<?php include("image/conn.php");
//计算batch号
$q5=$m->query("select max(batch) as batch from pick");
$r5=($q5->fetch_array(MYSQLI_USE_RESULT));
$batch=$r5['batch']+1;
//end 计算batch号
$q=$m->query("select I.name,I.number,I.style,I.color,I.size,sum(C.qty) as qty,C.input from cart C left join caseinfo I on C.number=I.number where C.status='0' and C.session='".$session."' group by I.style,I.size");//购物车需要的数量
while($r=$q->fetch_array(MYSQLI_USE_RESULT)){
$qtyTemp=$r['qty'];
$q2=$m->query("select I.number,I.pcs from inventory I left join caseinfo C on I.number=C.number where C.name=(select name from caseinfo where number='".$r[number]."') and C.style=(select style from caseinfo where number='".$r[number]."') and C.color=(select color from caseinfo where number='".$r[number]."') and C.size=(select size from caseInfo where number='".$r[number]."') and I.status='0' order by I.id");//库存里的数量
while($r2=$q2->fetch_array(MYSQLI_USE_RESULT)){
if($qtyTemp>=$r2['pcs']){
$qtyTemp-=(int)$r2['pcs'];
$m->query("insert into pick (batch,number,input) values ('".$batch."','".$r2['number']."','".$input."')");
$m->query("update inventory set status='1' where number='".$r2['number']."'");
$m->query("update caseinfo set status='2' where number='".$r2['number']."'");
echo 'case pcs:'.$qtyTemp.'<br>';
}
else{
$k=abs($qtyTemp);
$qtyTemp-=(int)$r2['pcs'];
$m->query("insert into pick (batch,number,pcs,input) values ('".$batch."','".$r2['number']."','".$k."','".$input."')");//放在拣货单
$m->query("update inventory set status='1',batch='".$batch."',pick='".$k."' where number='".$r2['number']."'");//把原始的更新
$m->query("update caseinfo set status='2' where number='".$r2['number']."'");
//计算出剩下的数量与原库位
$q7=$m->query("select weight,vol,pcs,location from inventory where number='".$r2['number']."' and id=(select min(id) from inventory where number='".$r2['number']."')");
$r7=$q7->fetch_array(MYSQLI_USE_RESULT);
$left=$r7[pcs]-$k;//把剩下的数量,变成新的箱子
//end 数量与原为库位
$m->query("insert into inventory (number,weight,vol,pcs,batch,location,op,input) values ('".$r2['number']."','".$r7[weight]."','".$r7[vol]."','".$left."','".$batch."','".$r7[location]."','".$_SESSION['auth']."','".$input."')");
echo "insert into inventory (number,weight,vol,pcs,batch,location,op,input) values ('".$r2['number']."','".$r7[weight]."','".$r7[vol]."','".$left."','".$batch."','".$r7[location]."','".$_SESSION['auth']."','".$input."')<br>";
echo 'rep-pick:'.$qtyTemp.'<br>';
}
if($qtyTemp<=0){
$m->query("update cart set status='1' where session='".$session."'");
break;}
}
}
分享到:
相关推荐
the process that opened the ports, and save the TCP/UDP ports information to HTML file , XML file, or to tab-delimited text file. CurrPorts also automatically mark with pink color suspicious TCP/UDP ...
ON_COMMAND(IDC_FILE_SAVE, OnFileSave) ON_COMMAND(IDC_FILE_SAVEAS, OnFileSaveas) ON_UPDATE_COMMAND_UI(IDC_FILE_SAVE, OnUpdateFileSave) ON_CBN_SELCHANGE(IDC_PICTYPE, OnSelchangePictype) ON_WM_TIMER...
Sample:@Rem Here is the description. 5.Pause 命令 运行 Pause 命令时,将显示下面的消息: Press any key to continue . . . Sample: @echo off :begin copy a:*.* d:back echo Please put a new disk...
tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save(System.Environment.GetEnvironmentVariable("TEMP") + "\\" + Guid.NewGuid().ToString() + ".bmp"); // Tessdata directory must be in the directory ...
'Don't delete temp files (compressed script)' this will keep *.pak files you may try to unpack manually with'LZSS.exe' as well as *.tok DeTokeniser files, tidy backups and *.tbl (). If enable it ...
// TODO: Add your control notification handler code here UpdateData(TRUE); if(!m_strUserName.IsEmpty()&&!m_strUserNative.IsEmpty() &&!m_strUserAdddress.IsEmpty() &&!m_strUserPwd.IsEmpty()&& !m_...
- Save a full given folder to local harddisk. - Multi-selection of files to download in the files list. - Handle access to protected website needing an user name and password. ---
Here you can either select one or more locations from the File Browser, select one or more previously defined custom selections, or enter the file selection directly. Window List enhancements ...
Here is a summary of all changes that have been made in each version of BurnInTest. Release 5.3 build 1035 revision 4 WIN32 release 10 November 2008 - Lenovo China specific build. Lenovo system ...
There are two mini projects included here. The first is called SlotDemo and allows you to send messages or data in a client/server type role. Its uses some very clever programming.<END><br>60 , ...
- **例句**:All efforts to save the tree were in vain. 38. **extinct** [ɪkˈstɪŋkt] - **含义**:a. 绝灭的,熄灭的 - **例句**:Dinosaurs became extinct millions of years ago. 39. **...
Here are some things to be aware of though... 1) If your app currently creates mmBlock archives (spanned directly to hard drive) and you define your own OnGetNextDisk in VCLZip 2.X, you should move ...
C----------------------------------------------------------------------- program runocc C----------------------------------------------------------------------- c C OCCAM 2.0: Steven Constable IGPP/...