Home  >  Article  >  Backend Development  >  依照出库要求信息匹配入库的批次信息

依照出库要求信息匹配入库的批次信息

WBOY
WBOYOriginal
2016-06-13 11:31:271106browse

按照出库要求信息匹配入库的批次信息

本帖最后由 lazygc520 于 2013-08-07 09:39:09 编辑 数据库分为3张表,kw,vp,st开头的三张表,前两张表代表入库,st开头的代表出库要求。入库的话前两张表联合查询求得已入库的cust_no和lotno,出库表已知stockno的信息及对应的cust_no,stockno存在排序关系,按照表st中的字段c1_time,c_type,adress来排序,stockno按照顺序排列,lotno按照先入先出的排序规则和stockno的对应数量匹配,对等的话则排除已匹配的lotno,新的lotno和接下来的stockno相匹配直至数量符合要求,依次类推。数量的结果是st表中,mount*snp的结果。能否用遍历入库表的信息来完成此操作?

上传附件地址:http://download.csdn.net/detail/lazygc520/5882535

已知入库的数据、出库的要求,根据出库要求来匹配入库的批次数据。
例如:在ch_result页面,ch_result.php?stockno=SU13061301010,实现出货批次那一栏的数据。

kw,vp表联合查询得到的cust_no和lotno得到的结果:
<br />$sql = "select CONCAT(SUBSTRING_INDEX(a.cust_no,' ',1),<br />SUBSTRING_INDEX(a.cust_no,' ',-1)) as cust_no,b.lotno as lotno,<br />count(b.lotno) as lotno_count from `kw_manage` as a,<br />`vp_barcode_2d_y` as b where a.packageno = b.packageno <br />group by lotno order by lotno asc";<br />$result = mysql_query($sql);<br />$ars =array();<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC))<br />{<br />	$ars[] = $row;<br />}<br />var_dump($ars);<br /><br />得到的结果:<br />array(1) { [0]=> array(3) { ["cust_no"]=> string(10) "237033AW0A" ["lotno"]=> string(4) "3207" ["lotno_count"]=> string(3) "480" } }




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn