|
@@ -76,7 +76,7 @@ public function create(){
|
|
$iten['stock_id']="";
|
|
$iten['stock_id']="";
|
|
$iten['num']=$ion['num'];
|
|
$iten['num']=$ion['num'];
|
|
$iten['status']=0;
|
|
$iten['status']=0;
|
|
- $iten['sale_price']=0;
|
|
|
|
|
|
+ $iten['sale_price']=$sale_price;
|
|
$iten['addtime'] =date("Y-m-d H:i:s");
|
|
$iten['addtime'] =date("Y-m-d H:i:s");
|
|
$iten['updatetime'] =date("Y-m-d H:i:s");
|
|
$iten['updatetime'] =date("Y-m-d H:i:s");
|
|
$inn[]=$iten;
|
|
$inn[]=$iten;
|
|
@@ -86,6 +86,10 @@ public function create(){
|
|
// return error_show(1002,"超出库存数量");
|
|
// return error_show(1002,"超出库存数量");
|
|
// }
|
|
// }
|
|
$vp= Db::name('sale_info')->insertAll($inn);
|
|
$vp= Db::name('sale_info')->insertAll($inn);
|
|
|
|
+ if($vp==""){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1002,"添加失败");
|
|
|
|
+ }
|
|
foreach ($va as $value){
|
|
foreach ($va as $value){
|
|
$temp=[];
|
|
$temp=[];
|
|
$temp['orderCode']=$orderCode;
|
|
$temp['orderCode']=$orderCode;
|
|
@@ -253,14 +257,47 @@ public function info(){
|
|
if($id==""){
|
|
if($id==""){
|
|
return error_show(1002,"参数id不能为空");
|
|
return error_show(1002,"参数id不能为空");
|
|
}
|
|
}
|
|
- $einfo = Db::name('sale')->where(['id'=>$id,'is_del'=>0])->field('good_code,good_name,good_num,customer_code,orderCode')->find();
|
|
|
|
|
|
+ //->field('good_code,good_name,good_num,customer_code,orderCode')
|
|
|
|
+ $einfo = Db::name('sale')->where(['id'=>$id,'is_del'=>0])->find();
|
|
if(empty($einfo)){
|
|
if(empty($einfo)){
|
|
return error_show(1002,"未找到销售订单数据");
|
|
return error_show(1002,"未找到销售订单数据");
|
|
}
|
|
}
|
|
- $fo = Db::name('order_addr')->where(['orderCode'=>$einfo['orderCode'],'is_del'=>0])->field('addr,contactor,mobile,receipt_quantity,arrive_time')->select();
|
|
|
|
- $st = Db::name('sale_info')->where(['orderCode'=>$einfo['orderCode']])->field('wsm_code,num,sale_price,wsm_code')->select();
|
|
|
|
- $einfo['item']=$fo;
|
|
|
|
- $einfo['iten']=$st;
|
|
|
|
|
|
+ $in= Db::name('customer_info')->where(['companyNo'=>$einfo['customer_code']])->field('companyName')->find();
|
|
|
|
+ // ->field('addr,contactor,mobile,receipt_quantity,arrive_time')
|
|
|
|
+ $fo = Db::name('order_addr')->where(['orderCode'=>$einfo['orderCode'],'is_del'=>0])->select();
|
|
|
|
+
|
|
|
|
+ $addrs=[];
|
|
|
|
+ foreach ($fo as $value){
|
|
|
|
+ $value['addr_info']="";
|
|
|
|
+ if($value['addr_code']!=""){
|
|
|
|
+ $addr=GetAddr($value['addr_code']);
|
|
|
|
+ $value['addr_info'] = $addr.$value['addr'];
|
|
|
|
+ }
|
|
|
|
+ $addrs[]=$value;
|
|
|
|
+ }
|
|
|
|
+ //->field('num,sale_price,wsm_code,stock_id')
|
|
|
|
+ $st = Db::name('sale_info')->where(['orderCode'=>$einfo['orderCode']])->select();
|
|
|
|
+ $data=[];
|
|
|
|
+ foreach ($st as $value){
|
|
|
|
+ $value['wsm_name']="";
|
|
|
|
+ $value['wsm_supplier']="";
|
|
|
|
+ $value['wsm_supplierNo']="";
|
|
|
|
+ $value['usable_stock']=0;
|
|
|
|
+ if($value['wsm_code']!=""){
|
|
|
|
+ $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
|
|
|
|
+ ->where(["a.wsm_code"=>$value['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
|
|
|
|
+ $value['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
|
|
|
|
+ $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
|
|
|
|
+ $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
|
|
|
|
+ $dn = Db::name('good_stock')->where(['wsm_code'=>$value['wsm_code'],'good_type_code'=>$einfo['good_code']])->find();
|
|
|
|
+ $value['usable_stock'] =isset($dn['usable_stock']) ?$dn['usable_stock']:"0";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ $data[]=$value;
|
|
|
|
+ }
|
|
|
|
+ $einfo['info']=$data;
|
|
|
|
+ $einfo['companyName']=isset($in['companyName']) ? $in['companyName']:"";
|
|
|
|
+ $einfo['addrs']=$addrs;
|
|
if(empty($einfo)){
|
|
if(empty($einfo)){
|
|
return error_show(1002,"未找到销售订单数据");
|
|
return error_show(1002,"未找到销售订单数据");
|
|
}else{
|
|
}else{
|
|
@@ -283,6 +320,10 @@ public function del(){
|
|
return error_show(1002,"删除失败");
|
|
return error_show(1002,"删除失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+//$stock['usable_stock']-=$value['allot_num'];
|
|
|
|
+//$stock['wait_out_stock']+=$value['allot_num'];
|
|
|
|
+//$stock['total_stock']=$stock['wait_out_stock']+$stock['usable_stock'];
|
|
|
|
+//$stock['updatetime']= date('Y-m-d H:i:s');
|
|
public function status(){
|
|
public function status(){
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
if($id==""){
|
|
if($id==""){
|
|
@@ -299,6 +340,9 @@ public function status(){
|
|
$dio['status']=$status;
|
|
$dio['status']=$status;
|
|
$dio['updatetime']=date("Y-m-d H:i:s");
|
|
$dio['updatetime']=date("Y-m-d H:i:s");
|
|
$st = Db::name('sale')->save($dio);
|
|
$st = Db::name('sale')->save($dio);
|
|
|
|
+ if($status==3){
|
|
|
|
+
|
|
|
|
+ }
|
|
return error_show(0,"订单状态更新成功");
|
|
return error_show(0,"订单状态更新成功");
|
|
}
|
|
}
|
|
public function fee(){
|
|
public function fee(){
|