wufeng vor 2 Jahren
Ursprung
Commit
102bf20aee

+ 1 - 1
app/admin/controller/AfterChild.php

@@ -542,7 +542,7 @@ class AfterChild extends Base
 
         $info = Db::name('order_return_child')
             ->alias('a')
-            ->field('a.*,b.supplierName send_supplierName,b.supplierNo send_supplierNo,b.name send_wsm_name,c.supplierName return_supplierName,c.supplierNo return_supplierNo,c.name return_wsm_name,d.companyNo,d.companyName,d.customer_code,d.customer_name')
+            ->field('a.*,b.supplierName send_supplierName,b.supplierNo send_supplierNo,b.name send_wsm_name,b.contactor_name send_contactor_name,c.supplierName return_supplierName,c.supplierNo return_supplierNo,c.name return_wsm_name,c.contactor_name return_contactor_name,d.companyNo,d.companyName,d.customer_code,d.customer_name')
             ->leftJoin('warehouse_info b', 'b.wsm_code=a.send_wsm_code')
             ->leftJoin('warehouse_info c', 'c.wsm_code=a.return_wsm_code')
             ->leftJoin('order_return d', 'd.returnCode=a.returnCode and d.is_del=0')

+ 1 - 1
app/admin/controller/Base.php

@@ -18,7 +18,7 @@ class Base extends \app\BaseController
     public $uname = '';//账户名称
     public $roleid = 0;//角色id
     public $level = 0;//角色等级,1.系统超级管理员,2.企业管理员,3.企业人员
-    private $white = ['login'];
+    private $white = ['login','child_out_list'];
 
     public function __construct(App $app)
     {

+ 17 - 0
app/admin/controller/OrderOutChild.php

@@ -599,5 +599,22 @@ class OrderOutChild extends Base
 
     }
 
+    //根据发货单号查询发货工单(不控制权限,不分页,无token,该方法加入白名单)
+    public function getListByOutCode(){
+
+        $outCode=$this->request->post('outCode','','trim');
+        if($outCode=='') return json_show(1004,'发货单号不能为空');
+
+        $data=Db::name('order_out_child')
+            ->alias('a')
+            ->field('a.*,c.contactor_name')
+            ->leftJoin('warehouse_info c', 'c.wsm_code=a.wsm_code AND c.is_del=0')
+            ->where(['a.is_del'=>0,'a.outCode'=>$outCode])
+            ->order(['a.addtime'=>'desc','a.id'=>'desc'])
+            ->select()
+            ->toArray();
+        return json_show(0,'获取列表成功',$data);
+    }
+
 
 }

+ 12 - 6
app/admin/controller/Reorder.php

@@ -769,6 +769,7 @@ class Reorder extends Base
      * 10业务公司修改待供应商确认
      * 11待设置退货工单
      * 12待库管发货
+     * 13取消
      */
     public function exam()
     {
@@ -1837,16 +1838,22 @@ class Reorder extends Base
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
 
-        $where = ['a.is_del' => 0, 'a.returnCode' => $param['returnCode']];
-        $count = Db::name('sale_returnaddr')
+        $sale_return = Db::name('sale_return')
+            ->field('id,orderCode')
+            ->where(['is_del' => 0, 'returnCode' => $param['returnCode']])
+            ->findOrEmpty();
+        if (empty($sale_return)) return json_show(1004, '该售后申请单不存在');
+
+        $where = ['a.is_del' => 0, 'a.orderCode' => $sale_return['orderCode']];
+        $count = Db::name('order_out')
             ->alias('a')
             ->leftJoin('order_addr b', 'b.id=a.addrid and b.is_del=0')
             ->where($where)
             ->count('a.id');
 
-        $list = Db::name('sale_returnaddr')
+        $list = Db::name('order_out')
             ->alias('a')
-            ->field('a.id,a.outCode,a.send_num,a.return_num,b.contactor,b.mobile,b.addr_code,b.addr,"" addr_code_cn')
+            ->field('a.id,a.outCode,a.send_num,b.contactor,b.mobile,b.addr_code,b.addr,"" addr_code_cn')
             ->leftJoin('order_addr b', 'b.id=a.addrid and b.is_del=0')
             ->where($where)
             ->order(['a.addtime' => 'desc', 'a.id' => 'desc'])
@@ -1856,8 +1863,7 @@ class Reorder extends Base
 
         foreach ($list as &$value) {
             if ($value['addr_code'] != '') {
-                $temp = explode(',', $value['addr_code']);
-                $value['addr_code_cn'] = GetAddr(json_encode(['provice_code' => $temp[0], 'city_code' => $temp[1], 'area_code' => $temp[2]]));
+                $value['addr_code_cn'] = GetAddr($value['addr_code']);
             }
         }
 

+ 1 - 1
app/admin/controller/ReorderChild.php

@@ -339,7 +339,7 @@ class ReorderChild extends Base
 
         $info = Db::name('sale_return_child')
             ->alias('a')
-            ->field('a.*,b.supplierNo,b.supplierName,c.name return_wsm_name')
+            ->field('a.*,b.supplierNo,b.supplierName,c.name return_wsm_name,c.supplierNo return_supplierNo,c.supplierName return_supplierName,c.contactor_name return_contactor_name')
             ->leftJoin('sale_return b', 'b.returnCode=a.returnCode and b.is_del=0')
             ->leftJoin('warehouse_info c', 'c.wsm_code=a.return_wsm_code and c.is_del=0')
             ->where(['a.is_del' => 0, 'a.id' => $param['id']])

+ 33 - 12
app/admin/controller/SaleReport.php

@@ -1114,24 +1114,34 @@ class SaleReport extends Base
             ->alias('s')
 //            ->leftJoin('customer_info csi', 'csi.companyNo=s.customer_code')
             ->where($where)
-            ->group('s.good_code,s.good_name,s.cat_id')//存疑,此处原本是根据csi.itemid分组的
+            ->group('s.good_code')
             ->count('s.id');
 
         $data = Db::name('sale')
             ->alias('s')
-            ->field('s.good_code,s.good_name,SUM(s.good_num) total_num,SUM(s.total_price) total_price,s.cat_id,s.customer_code')
+//            ->field('s.good_code,s.good_name,SUM(s.good_num) total_num,SUM(s.total_price) total_price,s.cat_id,s.customer_code')
+            ->field('s.good_code,SUM(s.good_num) total_num,SUM(s.total_price) total_price')
 //            ->leftJoin('customer_info csi', 'csi.companyNo=s.customer_code')
             ->where($where)
-            ->group('s.good_code,s.good_name,s.cat_id')//存疑,此处原本是根据csi.itemid分组的
+            ->group('s.good_code')//存疑,此处原本是根据csi.itemid分组的
             ->page($param['page'], $param['size'])
             ->order('total_num', 'desc')
-            ->cursor();
+            ->select()
+            ->toArray();
+
+        $replenish = Db::name('sale')
+            ->where(['is_del' => 0, 'good_code' => array_unique(array_column($data, 'good_code'))])
+            ->column('good_name,cat_id,customer_code', 'good_code');
 
         $userCommon = \app\admin\common\User::getIns();
         $list = $customer2_tmp = [];
 
         foreach ($data as $value) {
 
+            $value['good_name'] = $replenish[$value['good_code']]['good_name'] ?? '';
+            $value['cat_id'] = $replenish[$value['good_code']]['cat_id'] ?? '';
+            $value['customer_code'] = $replenish[$value['good_code']]['customer_code'] ?? '';
+
             if (!isset($customer2_tmp[$value['customer_code']])) {
                 $temp = $userCommon->handle('cInfo', ['companyNo' => $value['customer_code']]);
                 $customer2_tmp[$value['customer_code']] = [
@@ -1169,18 +1179,28 @@ class SaleReport extends Base
 
         $data = Db::name('sale')
             ->alias('s')
-            ->field('s.good_code,"" 产品品类,s.good_name 产品名称,SUM(s.good_num) total_num,"" 数量,SUM(s.total_price) 金额,s.cat_id,s.customer_code')
-//            ->leftJoin('customer_info csi', 'csi.companyNo=s.customer_code')
+            ->field('s.good_code,"" 产品品类,"" 产品名称,SUM(s.good_num) total_num,"" 数量,SUM(s.total_price) 金额,0 cat_id,"" customer_code,"" 一级企业,"" 二级企业')
             ->where($where)
-            ->group('s.good_code,s.good_name,s.cat_id')//存疑,此处原本是根据csi.itemid分组的
+            ->group('s.good_code')//存疑,此处原本是根据csi.itemid分组的
             ->order('total_num', 'desc')
             ->cursor();
 
+        $replenish = Db::name('sale')
+            ->alias('s')
+            ->where($where)
+            ->column('good_name 产品名称,cat_id,customer_code', 'good_code');
+
         $userCommon = \app\admin\common\User::getIns();
         $list = $customer2_tmp = [];
 
         foreach ($data as $value) {
 
+//            $tmp=Db::name('sale')
+//                ->field('good_name 产品名称,cat_id,customer_code')
+//                ->where(['is_del'=>0,'good_code'=>$value['good_code']])
+//                ->findOrEmpty();
+            $value = array_merge($value, $replenish[$value['good_code']]);
+
             if (!isset($customer2_tmp[$value['customer_code']])) {
                 $temp = $userCommon->handle('cInfo', ['companyNo' => $value['customer_code']]);
                 $customer2_tmp[$value['customer_code']] = [
@@ -1188,11 +1208,12 @@ class SaleReport extends Base
                     'companyName' => $temp['data']['companyName'],
                 ];
             }
+
             $value['itemid'] = $customer2_tmp[$value['customer_code']]['itemid'];
 //            $value['客户名称'] = $customer2_tmp[$value['customer_code']]['companyName'];
 
             if (!empty($value['itemid'])) {
-                $customer_org1 = array_column(get_top_customer_org($value['itemid']), 'name', 'level');
+                $customer_org1 = array_column(get_top_customer_org($value['itemid']) ?? [], 'name', 'level');
                 $value['一级企业'] = isset($customer_org1[1]) ? $customer_org1[1] : '';
                 $value['二级企业'] = isset($customer_org1[2]) ? $customer_org1[2] : '';
             }
@@ -1263,8 +1284,8 @@ class SaleReport extends Base
             if (!isset($customer2_tmp[$value['khNo']])) {
                 $temp = $userCommon->handle('cInfo', ['companyNo' => $value['khNo']]);
                 $customer2_tmp[$value['khNo']] = [
-                    'itemid' => $temp['data']['itemid'],
-                    'companyName' => $temp['data']['companyName'],
+                    'itemid' => $temp['data']['itemid']??0,
+                    'companyName' => $temp['data']['companyName']??'',
                 ];
             }
             $value['itemid'] = $customer2_tmp[$value['khNo']]['itemid'];
@@ -1324,8 +1345,8 @@ class SaleReport extends Base
             if (!isset($customer2_tmp[$value['khNo']])) {
                 $temp = $userCommon->handle('cInfo', ['companyNo' => $value['khNo']]);
                 $customer2_tmp[$value['khNo']] = [
-                    'itemid' => $temp['data']['itemid'],
-                    'companyName' => $temp['data']['companyName'],
+                    'itemid' => $temp['data']['itemid']??0,
+                    'companyName' => $temp['data']['companyName']??'',
                 ];
             }
             $value['itemid'] = $customer2_tmp[$value['khNo']]['itemid'];

+ 1 - 0
app/admin/route/app.php

@@ -773,6 +773,7 @@ route::rule('child_export', 'admin/OrderOutChild/export');//导出
 route::rule('child_add', 'admin/OrderOutChild/add');//拆单
 route::rule('child_info', 'admin/OrderOutChild/info');//详情
 route::rule('child_send', 'admin/OrderOutChild/send');//发货
+route::rule('child_out_list', 'admin/OrderOutChild/getListByOutCode');//根据发货单号查询发货工单
 
 
 route::rule('order_cancel', 'admin/Sale/orderCancel');//订单取消