wugg 2 years ago
parent
commit
4608e81096
2 changed files with 6 additions and 1 deletions
  1. 4 1
      app/admin/controller/Sale.php
  2. 2 0
      app/command/NowReportHandle.php

+ 4 - 1
app/admin/controller/Sale.php

@@ -3409,7 +3409,7 @@ class Sale extends Base
             // $where[]=["a.apply_id","in",$role['write']];
             $cgdArr =\think\facade\Config::get("app");
         	$cgdids =implode(",",$cgdArr['wsm_cgder_role']);
-            $condition .= " (b.is_stock=1 and {$this->roleid} in ($cgdids)) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',', $role['write']) . ")";
+            $condition .= " (b.is_stock=1 and {$this->roleid} in ($cgdids)) or (b.is_stock=0 and sip.personid = {$this->uid}) or a.apply_id in (" . implode(',', $role['write']) . ")";
         }
 //        if(!empty($role['platform']) ){
 //            $where[]=["b.platform_id","in",$role['platform']];
@@ -3434,6 +3434,7 @@ class Sale extends Base
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("purchease_order wpo", "wpo.cgdNo=os.cgdNo")
+            ->leftJoin('supplier sip', 'sip.code=wpo.supplierNo')
             ->where($where)
             ->where($condition)
             ->count();
@@ -3447,6 +3448,7 @@ class Sale extends Base
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("purchease_order wpo", "wpo.cgdNo=os.cgdNo")
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin('supplier sip', 'sip.code=wpo.supplierNo')
             ->field("a.*,b.order_type,b.order_source,b.good_name,b.good_code,b.skuCode,b.supplierNo,b.customer_code,v.companyName,b.origin_price,b.sale_price,b.total_price,os.cgdNo,u.itemid")
             ->where($where)
             ->where($condition)
@@ -3645,6 +3647,7 @@ class Sale extends Base
             $addrid = Db::name("order_addr")->insert($addrlst, true);
             if ($addrid > 0) {
                 $outCode = makeNo("DF");
+                $order=[];
                 if($der['order_type']!=1){
                 $order = Db::name("order_num")->where(["orderCode" => $orderCode, "status" => 1])->where([["wsend_num", ">=", 0]])
                 ->lock(true)->find();

+ 2 - 0
app/command/NowReportHandle.php

@@ -321,6 +321,7 @@ class NowReportHandle extends Command
             ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
             ->where('woo.status',">=", 2)
             ->where('woo.is_del',"=", 0)
+            ->where('wpo.order_type',"<>", 1)
             ->whereBetween('woo.sendtime', [$start, $end])
             ->field(" year(`a`.`addtime`) AS `年`,
             month(`a`.`addtime`) AS `月`,
@@ -417,6 +418,7 @@ class NowReportHandle extends Command
             ->field("wpo.companyNo '业务公司',
                             bkcode '备库单号',
                             wpi.wsm_in_code '入库单号',
+                             wpi.bnCode 'BN批次单号',
                             wpi.cgdNo '采购单号',
                               wpo.spuCode '商品编号',
                                '' as '一级分类',