Table des matières
回复讨论(解决方案)
Maison développement back-end tutoriel php 按照出库要求信息匹配入库的批次信息

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

Jun 23, 2016 pm 02:18 PM

本帖最后由 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得到的结果:
$sql = "select CONCAT(SUBSTRING_INDEX(a.cust_no,' ',1),SUBSTRING_INDEX(a.cust_no,' ',-1)) as cust_no,b.lotno as lotno,count(b.lotno) as lotno_count from `kw_manage` as a,`vp_barcode_2d_y` as b where a.packageno = b.packageno group by lotno order by lotno asc";$result = mysql_query($sql);$ars =array();while($row = mysql_fetch_array($result,MYSQL_ASSOC)){	$ars[] = $row;}var_dump($ars);得到的结果:array(1) { [0]=> array(3) { ["cust_no"]=> string(10) "237033AW0A" ["lotno"]=> string(4) "3207" ["lotno_count"]=> string(3) "480" } }
Copier après la connexion





回复讨论(解决方案)

如果你不能简化你的问题(抽取出问题的核心,只保留核心数据)
估计没有人有时间去看的

如果你不能简化你的问题(抽取出问题的核心,只保留核心数据)
估计没有人有时间去看的
整理了一下:

//按照先入先出得到已入库的零件号码及产品批次$sql = "SELECT a.cust_no, a.lotno, count( a.lotno ) FROM vp_barcode_2d_y AS a RIGHT JOIN kw_manage AS b ON a.packageno = b.packageno GROUP BY a.lotno ORDER BY a.lotno, a.cust_no ASC";$result = mysql_query($sql);while($v1 = mysql_fetch_array($result,MYSQL_ASSOC)){	var_dump($v1);}/*array(3) {  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count( a.lotno )"]=>  string(3) "480"}array(3) {  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count( a.lotno )"]=>  string(3) "180"}*///按照先纳时,再到运地,再车型的顺序求得出库依赖的结果:$sql2 = "SELECT stock_no, cust_no, mount * snp AS total FROM `stock_detail` ORDER BY arr_time, adress, c_type ASC";$result2 = mysql_query($sql2);while($v2 = mysql_fetch_array($result2,MYSQL_ASSOC)){	var_dump($v2);}/*array(3) {  ["stock_no"]=  string(13) "SU13061301011"  ["cust_no"]=  string(10) "237033AW0A"  ["total"]=  string(3) "195"}array(3) {  ["stock_no"]=  string(13) "SU13061301011"  ["cust_no"]=  string(10) "237033AW0A"  ["total"]=  string(3) "195"}array(3) {  ["stock_no"]=  string(13) "SU13061301016"  ["cust_no"]=  string(10) "23703JX30A"  ["total"]=  string(2) "15"}array(3) {  ["stock_no"]=  string(13) "SU13061301016"  ["cust_no"]=  string(10) "23703JX30A"  ["total"]=  string(2) "30"}array(3) {  ["stock_no"]=  string(13) "SU13061301016"  ["cust_no"]=  string(10) "23703EX80A"  ["total"]=  string(3) "105"}array(3) {  ["stock_no"]=  string(13) "SU13061301016"  ["cust_no"]=  string(10) "23703EX80A"  ["total"]=  string(3) "120"}array(3) {  ["stock_no"]=  string(13) "SU13061301033"  ["cust_no"]=  string(10) "237033AW0A"  ["total"]=  string(3) "210"}array(3) {  ["stock_no"]=  string(13) "SU13061301032"  ["cust_no"]=  string(10) "237033AW0A"  ["total"]=  string(3) "255"}*/
Copier après la connexion

求按照先入先出的规则,入库信息对应出库要求的结果。 注:字段total是已知对应的lotno的数量。

这不还是一样吗?
就你给出的两组数据,除了你以外,谁能知道谁是谁?

这不还是一样吗?
就你给出的两组数据,除了你以外,谁能知道谁是谁?
如果用数据库的联合查询,能匹配其关系,但是不能指定数量,这样写行吗?

select c.stock_no,a.packageno,a.lotno from vp_barcode_2d_y as a left joinkw_manage as b on a.packageno = b.packageno left join stock_detail as c on b.cust_no = concat(left(c.cust_no,5),' ',right(c.cust_no,5))where c.stock_no = 'SU13061301011' group by a.barcode order by a.lotno,a.packageno asc 样式如下:== 转存表中的数据 vp_barcode_2d_y |SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219001|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219002|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207|SU13061301011|VP3.0 130219003|3207....//得到的结果是:显示行 0 - 29 (540 总计, 查询花费 0.0072 秒)
Copier après la connexion

这不还是一样吗?
就你给出的两组数据,除了你以外,谁能知道谁是谁?
能不能这样处理?我已知stock_no的值,只要求得它对应的数量值(mount*snp的结果),再通过对应的数量值的结果去入库数据里按照先入先出的顺序匹配对应的lotno。按照这个表去匹配:

select a.packageno,a.lotno from vp_barcode_2d_y as a left joinkw_manage as b on a.packageno = b.packageno left join stock_detail as c on b.cust_no = concat(left(c.cust_no,5),' ',right(c.cust_no,5))where c.stock_no = 'SU13061301011' group by a.barcode order by a.lotno,a.packageno asc 样式如下:== 转存表中的数据 vp_barcode_2d_y |VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219001|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219002|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207|VP3.0 130219003|3207....//得到的结果是:显示行 0 - 29 (540 总计, 查询花费 0.0072 秒)
Copier après la connexion

库存表增加一个出库字段
入库时该字段为0
出库时该字段为已出库数量
入库数量 - 出库数量 = 该批次剩余数量


设 select * from tbl_name

id  num  1   20    2   20    3   30   
Copier après la connexion
Copier après la connexion
Copier après la connexion

SELECT * , (SELECT sum( num ) FROM tbl_name WHERE id<=a.id ) as c FROM tbl_name a
id  num  c  1   20   20 2   20   40 3   30   70
Copier après la connexion
Copier après la connexion
Copier après la connexion
则 c 列可做为出库来源的依据
如果出库包装的规模为 30
那么对应的id为:
包装1 1,2
包装2 2,3
包装3 3,后续id

库存表增加一个出库字段
入库时该字段为0
出库时该字段为已出库数量
入库数量 - 出库数量 = 该批次剩余数量


设 select * from tbl_name

id  num  1   20    2   20    3   30   
Copier après la connexion
Copier après la connexion
Copier après la connexion

SELECT * , (SELECT sum( num ) FROM tbl_name WHERE id<=a.id ) as c FROM tbl_name a
id  num  c  1   20   20 2   20   40 3   30   70
Copier après la connexion
Copier après la connexion
Copier après la connexion
则 c 列可做为出库来源的依据
如果出库包装的规模为 30
那么对应的id为:
包装1 1,2
包装2 2,3
包装3 3,后续id
好像有那么个意思了。看来还是数据库的设计问题。
新建的那张表是不是代表出货包装规格?那么C列代表是什么意思?

c列表示的是在以id排序的方向上,累加到当前记录的 num 列的和
id=1 20
id=2 20+20=40
id=3 20+20+30=70

库存表增加一个出库字段
入库时该字段为0
出库时该字段为已出库数量
入库数量 - 出库数量 = 该批次剩余数量


设 select * from tbl_name

id  num  1   20    2   20    3   30   
Copier après la connexion
Copier après la connexion
Copier après la connexion

SELECT * , (SELECT sum( num ) FROM tbl_name WHERE id<=a.id ) as c FROM tbl_name a
id  num  c  1   20   20 2   20   40 3   30   70
Copier après la connexion
Copier après la connexion
Copier après la connexion
则 c 列可做为出库来源的依据
如果出库包装的规模为 30
那么对应的id为:
包装1 1,2
包装2 2,3
包装3 3,后续id
我还有一个问题,虽然增加了这个出库数量字段,我怎么判断是哪个packageno出库?

这就需要编程处理了,毕竟在查询时是无法把一条记录拆成两条记录的

这就需要编程处理了,毕竟在查询时是无法把一条记录拆成两条记录的
像这样,入库的packageno对应的lotno批次及数量,导出了结果:

$sql = "select a.packageno,b.cust_no,b.lotno,count(b.lotno) from `kw_manage` as a left join `vp_barcode_2d_y` as b on a.packageno = b.packageno group by b.lotno,a.packageno order by b.lotno,a.packageno asc";$result = mysql_query($sql);while($row = mysql_fetch_array($result,MYSQL_ASSOC)){    var_dump($row);}结果:array(4) {  ["packageno"]=>  string(15) "VP3.0 130219001"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219002"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219003"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219004"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219005"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219006"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219007"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219008"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219009"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219010"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219011"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219012"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219013"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219014"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219015"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219016"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219017"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219018"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219019"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219020"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219021"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219022"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219023"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219024"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219048"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219049"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219050"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219051"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219052"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219053"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219054"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219055"  ["cust_no"]=>  string(11) "23710 JE22A"  ["lotno"]=>  string(4) "3207"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219107"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219108"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219109"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219110"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219111"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219112"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219113"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219114"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219115"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219116"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219117"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}array(4) {  ["packageno"]=>  string(15) "VP3.0 130219118"  ["cust_no"]=>  string(11) "23703 3AW0A"  ["lotno"]=>  string(4) "3218"  ["count(b.lotno)"]=>  string(2) "15"}
Copier après la connexion

已知stock_no为SU13061301011时的结果为195,195,这样的话怎么处理成为已知出库?
SELECT stock_no, mount*snp as total FROM `stock_detail` where `stock_no` = 'SU13061301011'CREATE TABLE IF NOT EXISTS `stock_detail` (  `ID` int(11) NOT NULL AUTO_INCREMENT,  `stock_no` varchar(20) NOT NULL,  `adress` varchar(10) NOT NULL,  `arr_time` datetime NOT NULL,  `c_type` varchar(20) NOT NULL,  `pu_no` varchar(20) NOT NULL,  `cust_no` varchar(20) NOT NULL,  `mount` int(10) NOT NULL,  `snp` int(10) NOT NULL,  `c1_time` datetime NOT NULL,  `c2_time` datetime NOT NULL,  PRIMARY KEY (`ID`)) ENGINE=InnoDB;---- 转存表中的数据 `stock_detail`--INSERT INTO `stock_detail` (`stock_no`, `snp`) VALUES('SU13061301011', 195),('SU13061301011', 195);
Copier après la connexion

出库信息缺了cust_no,现在补上:

SELECT stock_no, cust_no,mount*snp as total FROM `stock_detail` where `stock_no` = 'SU13061301011'
Copier après la connexion

输出结果:
array(3) {  ["stock_no"]=>  string(13) "SU13061301011"  ["cust_no"]=>  string(10) "237033AW0A"  ["total"]=>  string(3) "195"}array(3) {  ["stock_no"]=>  string(13) "SU13061301011"  ["cust_no"]=>  string(10) "237033AW0A"  ["total"]=>  string(3) "195"}
Copier après la connexion

又在贴只有你自己才能看懂的数据

出库时有一个累加的过程,到达预设值就做断行处理
其实这个过程就是你最初帖子的问题,但你始终都以入库为基准,所以总是做不好
应该以出库为准:从A取n,不够再从B中取m,如此循环直到取够

Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn

Outils d'IA chauds

Undresser.AI Undress

Undresser.AI Undress

Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover

AI Clothes Remover

Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool

Undress AI Tool

Images de déshabillage gratuites

Clothoff.io

Clothoff.io

Dissolvant de vêtements AI

AI Hentai Generator

AI Hentai Generator

Générez AI Hentai gratuitement.

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
2 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Repo: Comment relancer ses coéquipiers
4 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: Comment obtenir des graines géantes
4 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Combien de temps faut-il pour battre Split Fiction?
3 Il y a quelques semaines By DDD

Outils chauds

Bloc-notes++7.3.1

Bloc-notes++7.3.1

Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise

SublimeText3 version chinoise

Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1

Envoyer Studio 13.0.1

Puissant environnement de développement intégré PHP

Dreamweaver CS6

Dreamweaver CS6

Outils de développement Web visuel

SublimeText3 version Mac

SublimeText3 version Mac

Logiciel d'édition de code au niveau de Dieu (SublimeText3)

11 meilleurs scripts de raccourcissement d'URL PHP (gratuit et premium) 11 meilleurs scripts de raccourcissement d'URL PHP (gratuit et premium) Mar 03, 2025 am 10:49 AM

Les longues URL, souvent encombrées de mots clés et de paramètres de suivi, peuvent dissuader les visiteurs. Un script de raccourcissement d'URL offre une solution, créant des liens concis idéaux pour les médias sociaux et d'autres plateformes. Ces scripts sont utiles pour les sites Web individuels

Introduction à l'API Instagram Introduction à l'API Instagram Mar 02, 2025 am 09:32 AM

À la suite de son acquisition de haut niveau par Facebook en 2012, Instagram a adopté deux ensembles d'API pour une utilisation tierce. Ce sont l'API graphique Instagram et l'API d'affichage de base Instagram. En tant que développeur créant une application qui nécessite des informations à partir d'un

Travailler avec les données de session Flash dans Laravel Travailler avec les données de session Flash dans Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifie la gestion des données de session temporaires à l'aide de ses méthodes de flash intuitives. Ceci est parfait pour afficher de brefs messages, alertes ou notifications dans votre application. Les données ne persistent que pour la demande ultérieure par défaut: $ demande-

Construisez une application React avec un Laravel Back End: Partie 2, React Construisez une application React avec un Laravel Back End: Partie 2, React Mar 04, 2025 am 09:33 AM

Il s'agit de la deuxième et dernière partie de la série sur la construction d'une application React avec un back-end Laravel. Dans la première partie de la série, nous avons créé une API RESTful utilisant Laravel pour une application de liste de base sur le produit. Dans ce tutoriel, nous serons Dev

Misque de réponse HTTP simplifié dans les tests Laravel Misque de réponse HTTP simplifié dans les tests Laravel Mar 12, 2025 pm 05:09 PM

Laravel fournit une syntaxe de simulation de réponse HTTP concise, simplifiant les tests d'interaction HTTP. Cette approche réduit considérablement la redondance du code tout en rendant votre simulation de test plus intuitive. L'implémentation de base fournit une variété de raccourcis de type de réponse: Utiliser illuminate \ support \ faades \ http; Http :: faux ([[ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Curl dans PHP: Comment utiliser l'extension PHP Curl dans les API REST Curl dans PHP: Comment utiliser l'extension PHP Curl dans les API REST Mar 14, 2025 am 11:42 AM

L'extension PHP Client URL (CURL) est un outil puissant pour les développeurs, permettant une interaction transparente avec des serveurs distants et des API REST. En tirant parti de Libcurl, une bibliothèque de transfert de fichiers multi-protocol très respectée, PHP Curl facilite Efficient Execu

12 meilleurs scripts de chat PHP sur Codecanyon 12 meilleurs scripts de chat PHP sur Codecanyon Mar 13, 2025 pm 12:08 PM

Voulez-vous fournir des solutions instantanées en temps réel aux problèmes les plus pressants de vos clients? Le chat en direct vous permet d'avoir des conversations en temps réel avec les clients et de résoudre leurs problèmes instantanément. Il vous permet de fournir un service plus rapide à votre personnalité

Annonce de l'enquête sur la situation en 2025 PHP Annonce de l'enquête sur la situation en 2025 PHP Mar 03, 2025 pm 04:20 PM

L'enquête sur le paysage PHP 2025 étudie les tendances actuelles de développement du PHP. Il explore l'utilisation du cadre, les méthodes de déploiement et les défis, visant à fournir des informations aux développeurs et aux entreprises. L'enquête prévoit la croissance de la PHP moderne versio

See all articles