进销存系统,当出货量大于第一批库存,不够的时候,再减第二批库存,当第二批库存不够的时候,再减第三批,以此类推
当知道有多少出库量的时候,不知道批次
就写一个方法每次都从第一批开始减,不够的时候采取剪下一个批次的库存
先写一个方法:
public function ck(){
m=1;for(m=1;
for (m=1;for(i=0;i<count(i<count(i<count(name);$i++){
yap=Db::table(′biaoji′)−>where(′biaoji′,yap = Db::table('biaoji')->where('biaoji',yap=Db::table(′biaoji′)−>where(′biaoji′,m)->where(‘yaoname’,name[name[name[i])->order(‘biaoji asc’)->select();
//每次一个批次的只查询一个
foreach($yap as $data){
$mp = data["kc"]−data["kc"]-data["kc"]−shuliang[i];if(i];
if (i];if(mp<0){
$uda = Db::table(‘biaoji’)->where(‘biaoji’, $m)->where(‘yaoname’, name[name[name[i])->update([‘kc’ => 0]);
this−>Shipment(this->Shipment(this−>Shipment(m,mp,mp,mp,name[$i]);
}else{
$uda = Db::table(‘biaoji’)->where(‘biaoji’, $m)->where(‘yaoname’, name[name[name[i])->update([‘kc’ => $mp]);
continue;
}
}
}
$str1 = $user->where(‘id’, $id)->update([‘charge’ => ‘1’, ‘sfgluser’ => KaTeX parse error: Expected 'EOF', got '}' at position 14: name1]);
}̲
}
后面在写…m,mp,mp,mp,name){
$m++;
$bj =Db::table(‘biaoji’)->where(‘biaoji’, $m)->where(‘yaoname’, $name)->find();
$bian = bj[′kc′]+bj['kc']+bj[′kc′]+mp;
if ($bian<0){
$uda = Db::table(‘biaoji’)->where(‘biaoji’, $m)->where(‘yaoname’, $name)->update([‘kc’ => 0]);
this−>Shipment(this->Shipment(this−>Shipment(m,bian,bian,bian,bj[‘yaoname’]);
}else{
uda=Db::table(′biaoji′)−>where(′biaoji′,uda = Db::table('biaoji')->where('biaoji',uda=Db::table(′biaoji′)−>where(′biaoji′,m)->where(‘yaoname’,name)−>update([′kc′=>name)->update(['kc'=>name)−>update([′kc′=>bian]);
return KaTeX parse error: Expected 'EOF', got '}' at position 14: uda;
}̲
}
知道bian 等于0或者大于0结束