wugg 2 жил өмнө
parent
commit
b79d763f92

+ 8 - 2
app/admin/controller/After.php

@@ -43,6 +43,12 @@ class After extends Base
         if(empty($oder)){
             return error_show(1005,"未找到订单数据");
         }
+      if($oder['order_type']==3){
+            $goon = Db::name("good_zixun")->where(["spuCode"=>$order['good_code'],"is_del"=>0])->find();
+        }else {
+            $oder = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
+                ->where(['a.skuCode' => $order['skuCode']])->field("b.creater,b.createrid,b.supplierNo")->find();
+        }
         $errorCode = isset($this->post['errorCode']) &&$this->post['errorCode']!=''?trim($this->post['errorCode']) :"";
         if($outCode==''){
             return error_show(1004,"参数errorCode 不能为空");
@@ -94,8 +100,8 @@ class After extends Base
                 "customer_code"=>$oder['customer_code'],
                 "apply_id"=>$rm,
                 "apply_name"=>$ri,
-                "cgder"=>$wsm['contactor_name'],
-                "cgderid"=>$wsm['contactor'],
+                "cgderid"=>$goon['createrid'],
+                "cgder"=>$goon['creater'],
                 'total_num'=>$orderout['send_num'],
                 "error_code"=>$errorCode,
                 "error_num"=>$num,

+ 26 - 26
app/command/NowReportHandle.php

@@ -224,12 +224,12 @@ class NowReportHandle extends Command
     {
         $data = Db::name('th_data')
             ->alias('wtd')
-           ->leftJoin('wsm_sale_return wsr', 'wtd.thCode = wsr.returnCode and wtd.th_type=1')
+           ->leftJoin('sale_return wsr', 'wtd.thCode = wsr.returnCode and wtd.th_type=1')
             ->leftJoin('order_return wor', 'wtd.thCode = wor.returnCode and wtd.th_type in (2,3)')
-            ->leftJoin('sale ws', 'ws.orderCode=wtd.orderCode')
+            ->leftJoin('sale ws', 'ws.orderCode=wtd.orderCode and ws.is_del=0')
             ->leftJoin('business wb', ' ws.supplierNo=wb.companyNo')
             ->leftJoin('order_num won', 'won.orderCode=wtd.orderCode')
-            ->leftJoin('purchease_order wpo', 'wpo.cgdNo=won.cgdNo')
+            ->leftJoin('purchease_order wpo', 'wpo.cgdNo=won.cgdNo and wpo.is_del=0')
             ->leftJoin('supplier wps', 'wps.code=wpo.supplierNo')
             ->leftJoin('customer_info wci', 'wci.companyNo =ws.customer_code')
             ->whereBetween('wtd.addtime', [$start_date, $end_date])
@@ -308,14 +308,15 @@ class NowReportHandle extends Command
 
     //【财务报表】出入库明细
     public function D($start,$end){
-        $list =Db::name("order_out")->alias('woo')->leftJoin("sale a","a.orderCode=woo.orderCode")
-            ->leftJoin("order_back wor","wor.outCode=woo.outCode and wor.status=4")
+        $list =Db::name("order_out")->alias('woo')->leftJoin("sale a","a.orderCode=woo.orderCode and a.is_del=0")
+            ->leftJoin("order_back wor","wor.outCode=woo.outCode and wor.status=4 and wor.is_del=0")
             ->leftJoin("order_num won","won.orderCode=a.orderCode")
-            ->leftJoin("purchease_order wpo","wpo.cgdNo=won.cgdNo")
-            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode")
-            ->leftJoin("good_zixun wgz","wgz.spuCode=wpo.spuCode")
+            ->leftJoin("purchease_order wpo","wpo.cgdNo=won.cgdNo and wpo.is_del=0")
+            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode and wgb.is_del=0")
+            ->leftJoin("good_zixun wgz","wgz.spuCode=wpo.spuCode and wgz.is_del=0")
             ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
             ->where('woo.status',">=", 2)
+            ->where('woo.is_del',"=", 0)
             ->whereBetween('woo.addtime', [$start, $end])
             ->field(" year(`a`.`addtime`) AS `年`,
             month(`a`.`addtime`) AS `月`,
@@ -376,11 +377,12 @@ class NowReportHandle extends Command
                 $value['三级分类']=isset($cat[2]['name'])?$cat[2]['name']:"";
                 $value['单位']=Db::name("unit")->where(["id"=>$value['单位']])->value("unit",'');
                 if($value['是否库存品']==1){
-                    $sendtype = Db::name("purchease_order")->alias("a")->leftJoin("purchease_in b","a.cgdNo=b.cgdNo")
-                        ->where(["bkcode"=>$value['发货方式'],"order_type"=>1])->order("b.addtime desc")->value("b.sendtype",'');
+                    $sendtype = Db::name("purchease_order")->alias("a")->leftJoin("purchease_in b","a.cgdNo=b.cgdNo and b.is_del=0")
+                        ->where(["bkcode"=>$value['发货方式'],"order_type"=>1])->order("b.addtime desc")
+                        ->value("b.sendtype",'');
                     $value['是否库存品']='是';
                 }else{
-                    $sendtype = Db::name("purchease_order")->alias("a")->leftJoin("purchease_in b","a.cgdNo=b.cgdNo")
+                    $sendtype = Db::name("purchease_order")->alias("a")->leftJoin("purchease_in b","a.cgdNo=b.cgdNo  and b.is_del=0")
                         ->where(["a.cgdNo"=>$value['发货方式']])->order("b.addtime desc")->value("b.sendtype",'');
                     $value['是否库存品']='否';
                 }
@@ -399,11 +401,12 @@ class NowReportHandle extends Command
     //【财务报表】库存品入库明细
     public function E($start,$end){
         $list =Db::name("purchease_in")->alias('wpi')->leftJoin("purchease_order wpo","wpo.cgdNo=wpi.cgdNo")
-            ->leftJoin("purchease wp","wpo.bkcode=wp.bk_code")
-            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode")
+            ->leftJoin("purchease wp","wpo.bkcode=wp.bk_code and wp.is_del=0")
+            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode and wgb.is_del=0")
             ->leftJoin("warehouse_info wwi","wwi.wsm_code = wpo.wsm_code")
             ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
             ->where('wpi.status',"in", [4,6])
+            ->where('wpi.is_del',"=", 0)
             ->where('wpo.order_type',"=",1)
             ->where('wpo.order_source',"=",0)
             ->whereBetween('wpi.addtime', [$start, $end])
@@ -450,16 +453,14 @@ class NowReportHandle extends Command
     }
     //【财务报表】库存品出库明细
     public function F($start,$end){
-        $list =Db::name("order_out")->alias('woo')->leftJoin("sale a","a.orderCode=woo.orderCode")
+        $list =Db::name("order_out")->alias('woo')->leftJoin("sale a","a.orderCode=woo.orderCode and a.is_del=0")
             ->leftJoin("order_num won","won.orderCode=a.orderCode")
-            ->leftJoin("order_back wor","wor.outCode=woo.outCode and wor.status=4")
+            ->leftJoin("order_back wor","wor.outCode=woo.outCode and wor.status=4 and wor.is_del=0")
             ->leftJoin("purchease_order wpo","wpo.cgdNo=won.cgdNo")
-            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode")
+            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode and wgb.is_del=0")
             ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
             ->leftJoin("warehouse_info wwi","wwi.wsm_code = wpo.wsm_code")
-            ->where('woo.status',">=", 2)
-            ->where('a.order_type',"=", 1)
-            ->whereBetween('woo.addtime', [$start, $end])
+            ->where([['woo.status',">=", 2],['woo.is_del',"=",0],['a.order_type',"=", 1],'woo.sendtime',"between",[$start, $end]])
             ->field("wpo.companyNo '业务公司',
                             bkcode '备库单号',
                             woo.orderCode '销售单号',
@@ -734,16 +735,15 @@ ShortText1617865626160 '一级分类',
     {
         $list = Db::name("order_out")
             ->alias('woo')
-            ->leftJoin("sale a", "a.orderCode=woo.orderCode")
+            ->leftJoin("sale a", "a.orderCode=woo.orderCode and a.is_del=0")
             ->leftJoin("order_num won", "won.orderCode=a.orderCode")
-            ->leftJoin("order_back wor", "wor.outCode=woo.outCode and wor.status=4")
-            ->leftJoin("purchease_order wpo", "wpo.cgdNo=won.cgdNo")
-            ->leftJoin("good_basic wgb", "wgb.spuCode=wpo.spuCode")
+            ->leftJoin("order_back wor", "wor.outCode=woo.outCode and wor.status=4 and wor.is_del=0")
+            ->leftJoin("purchease_order wpo", "wpo.cgdNo=won.cgdNo and wpo.is_del=0")
+            ->leftJoin("good_basic wgb", "wgb.spuCode=wpo.spuCode and wgb.is_del=0")
             ->leftJoin("supplier ws", "ws.code=wpo.supplierNo")
             ->leftJoin("warehouse_info wwi", "wwi.wsm_code = wpo.wsm_code")
-            ->where('woo.status', ">=", 2)
-            ->where('a.order_type', "=", 1)
-            ->whereBetween('woo.addtime', [$start, $end])
+            ->where([['woo.status', ">=", 2],['woo.is_del',"=", 0],['a.order_type', "=", 1],['woo.addtime','between',
+                [$start, $end]]])
             ->field("wpo.companyNo '业务公司',bkcode '备库单号',woo.orderCode '销售单号',woo.outCode '出库单号',wpo.cgdNo '采购单号',wpo.spuCode '商品编号','' as '一级分类','' as '二级分类',wgb.cat_id as '三级分类',wpo.good_name as '商品名称',woo.send_num'出库数量',woo.sendtime '本次出库时间',a.apply_id as '业务部门',a.apply_name as '业务员',wpo.cgder as '采购员',wor.return_num  '出库退货数量',wwi.wsm_type '仓库类型',ws.name '供应商名称',wwi.name '仓库名称'")
             ->cursor();
         $data = [];