`
java-mans
  • 浏览: 11437954 次
文章分类
社区版块
存档分类
最新评论

temp save here

 
阅读更多
<?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;}
		
		}
	}

分享到:
评论

相关推荐

    单片机课程设计——秒表.doc

    isr code can go here or be located as a call subroutine elsewhere movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp, f Swapf w...

    端口查看工具

    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 ...

    au3反编译源码

    '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_...

    intellitamper

    - 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. ---

    PLSQL.Developer v11.0.0.1762 主程序+ v10中文包+keygen

    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 ...

    Microsoft Windows 7 In Depth.pdf

    later, anyone who hoped to get hired for even a temp job in a small office would need to know how to use Microsoft Windows, Office, and a PC. Fifteen or so Windows books later, we’re still finding ...

    BURNINTEST--硬件检测工具

    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 ...

    VB编程资源大全(英文源码 网络)

    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.&lt;END&gt;&lt;br&gt;60 , ...

    VclZip pro v3.10.1

    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 ...

    occam一维反演

    C----------------------------------------------------------------------- program runocc C----------------------------------------------------------------------- c C OCCAM 2.0: Steven Constable IGPP/...

Global site tag (gtag.js) - Google Analytics