14 Commits 79e1398e83 ... 91eb121b61

Autor SHA1 Mensaje Fecha
  wufeng 91eb121b61 Merge branch 'master-new' into master-new-dev-wf hace 1 año
  wufeng d6534c66b8 报表细节优化 hace 1 año
  wufeng fcfed0f8e0 Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new hace 1 año
  wufeng bda08e0c5b Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new hace 1 año
  wugg eb03855ee1 Merge branch 'master-new-wgg' of wugg/phpstock into master-new hace 1 año
  wugg 79bbb1b335 ad hace 1 año
  wugg 2d3ce61468 Merge branch 'master-new-wgg' of wugg/phpstock into master-new hace 1 año
  wugg 7978387814 ad hace 1 año
  wufeng 5c8fe6045b Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new hace 1 año
  wufeng f4c6000c4e Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new hace 1 año
  wugg 1d7f05305f Merge branch 'master-new-wgg' of wugg/phpstock into master-new hace 1 año
  wugg 49565d48f2 ad hace 1 año
  wufeng fcd07abf48 Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new hace 1 año
  wugg 02d0e229f3 ad hace 1 año

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

@@ -288,7 +288,7 @@ class After extends Base
                     ->name('supplier')
                     ->where(['is_del' => 0, 'personid' => $arr])
                     ->column('code');
-                $where[] = ["a.supplierNo", "in", $supplierNos];//这个地方不应该使用condition,应该使用where与其他条件并列
+                $condition[] = ["a.supplierNo", "in", $supplierNos];//这个地方不应该使用condition,应该使用where与其他条件并列
             }
         }
 

+ 8 - 8
app/admin/controller/GoodOfflineLog.php

@@ -27,14 +27,14 @@ class GoodOfflineLog extends Base
 //        if (!empty($role[DataGroupModel::$type_全部])) $where[] = ["createrid", "in", $role[DataGroupModel::$type_全部]];
 
         //只有level2的账号过滤数据权限
-        if ($this->level == 2) {
-            $role = $this->checkDataShare();
-            $hand = resign_hand_user($this->uid, 0);
-            if (!empty($role[DataGroupModel::$type_全部])) {
-                $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
-                $where[] = ['a.createrid', 'in', $arr];
-            }
-        }
+//        if ($this->level == 2) {
+//            $role = $this->checkDataShare();
+//            $hand = resign_hand_user($this->uid, 0);
+//            if (!empty($role[DataGroupModel::$type_全部])) {
+//                $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
+//                $where[] = ['a.createrid', 'in', $arr];
+//            }
+//        }
 
         $count = Db::name('good_offline_log')
             ->alias("a")

+ 1 - 0
app/admin/controller/Goodup.php

@@ -2254,6 +2254,7 @@ class Goodup extends Base
         if (($this->level == 2) && ($supplierNo != $data['supplierNo'])) {
             $supplier_account = checkHasAccountBySupplierNos([$supplierNo]);
             if (isset($supplier_account[$supplierNo])) return json_show(1004, '该供应商已开通账号,不允许操作');
+            if (isset($supplier_account[$data['supplierNo']])) return json_show(1004, '原供应商已开通账号,不允许操作');
         }
 
         $userCommon= \app\admin\common\User::getIns();

+ 16 - 3
app/admin/controller/OrderOutChild.php

@@ -409,7 +409,7 @@ class OrderOutChild extends Base
 
         $order_out = Db::name('order_out')
             ->where(['is_del' => 0, 'outCode' => array_unique(array_column($child, 'outCode'))])
-            ->column('id,send_num,send_status,0 already_send_num,status,apply_id', 'outCode');
+            ->column('id,send_num,send_status,0 already_send_num,post_name,post_code,post_fee,status,apply_id', 'outCode');
 
         $sale = Db::name('sale')
             ->where(['is_del' => 0, 'orderCode' => array_unique(array_column($child, 'orderCode'))])
@@ -516,12 +516,25 @@ class OrderOutChild extends Base
                 ]);
 
                 $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] += $child[$value['outChildCode']]['num'];
-
+                $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] += $child[$value['outChildCode']]['num'];
+                $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] += $child[$value['outChildCode']]['num'];
+				if($order_out[$child[$value['outChildCode']]['outCode']]['post_name']==''||$order_out[$child[$value['outChildCode']]['outCode']]['post_code']=='' ){
+					$order_out[$child[$value['outChildCode']]['outCode']]['post_name']=  $value['post_name'];
+					$order_out[$child[$value['outChildCode']]['outCode']]['post_code']=  $value['post_code'];
+					$order_out[$child[$value['outChildCode']]['outCode']]['post_fee']=  $value['post_fee'];
+				}
                 //发货单
                 //send_status 3部分发货,4全部发货
                 Db::name('order_out')
                     ->where(['id' => $order_out[$child[$value['outChildCode']]['outCode']]['id']])
-                    ->update(['send_status' => $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] >= $order_out[$child[$value['outChildCode']]['outCode']]['send_num'] ? 4 : 3, 'status' => 2, 'updatetime' => $date]);
+                    ->update([
+                    	'send_status' => $order_out[$child[$value['outChildCode']]['outCode']]['already_send_num'] >= $order_out[$child[$value['outChildCode']]['outCode']]['send_num'] ? 4 : 3,
+                    	'status' => 2,
+                    	'post_name' => $order_out[$child[$value['outChildCode']]['outCode']]['post_name'],
+                        'post_code' => $order_out[$child[$value['outChildCode']]['outCode']]['post_code'],
+                        'post_fee' => $order_out[$child[$value['outChildCode']]['outCode']]['post_fee'],
+                    	'updatetime' => $date
+                    	 ]);
 
                 $sale[$child[$value['outChildCode']]['orderCode']]['send_num'] += $child[$value['outChildCode']]['num'];
                 $sale[$child[$value['outChildCode']]['orderCode']]['wsend_num'] -= $child[$value['outChildCode']]['num'];

+ 4 - 2
app/admin/controller/ReorderChild.php

@@ -137,8 +137,8 @@ class ReorderChild extends Base
                     "before_status" => 0,
                     'holder_id' => $this->uid
                 ]);
-
-                //维护发货工单
+				if(isset($value['outChildCode'])){
+					 //维护发货工单
                 $orderOutChild[$value['outChildCode']]['num'] -= $value['return_num'];
                 if ($orderOutChild[$value['outChildCode']]['num'] <= 0) {
                     $orderOutChild[$value['outChildCode']]['status'] = 4;
@@ -153,6 +153,8 @@ class ReorderChild extends Base
                         'status' => $orderOutChild[$value['outChildCode']]['status'],
                         'is_del' => $orderOutChild[$value['outChildCode']]['is_del'],
                     ]);
+				}
+
 
                 if ($param['outCode'] != '') {
                     //维护发货单

+ 34 - 26
app/admin/controller/ReportByRelaComNo.php

@@ -430,8 +430,7 @@ class ReportByRelaComNo extends Base
 
         if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
 
-        //@todo  此处无法添加业务公司筛选
-        $where = [['cb.is_del', '=', 0]];
+        $where = [['cb.is_del', '=', 0], ['d.companyNo', '=', $this->relaComNo]];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['cb.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
 //        if ($param['supplier'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier'] . '%'];
 
@@ -452,33 +451,34 @@ class ReportByRelaComNo extends Base
 //            ->field('DATE_FORMAT(cb.addtime,"%Y-%m-%d") addtime,du.itemid,cb.createrid,SUM(c.num) num,COUNT(cb.id) total,IF(ISNULL(`du`.`nickname`),`s`.`name`,`du`.`nickname`) nickname,IF(ISNULL(`ci`.`name`),"供应商",`ci`.`name`) name,cb.supplierName')
             ->field('DATE_FORMAT(cb.addtime,"%Y-%m-%d") addtime,cb.createrid,SUM(c.num) num,COUNT(cb.id) total,"" nickname,"" name,cb.supplierName')
             ->leftJoin('consult_info c', 'c.infoNo=cb.infoNo')
+            ->leftJoin('consult_order d', 'd.zxNo=cb.zxNo')
 //            ->leftJoin('depart_user du', 'du.uid=cb.createrid AND du.is_del=0')
 //            ->leftJoin('company_item ci', 'ci.id=du.itemid')
 //            ->leftJoin('supplier s', 's.code=cb.supplierNo')
             ->where($where)
 //            ->group('addtime,du.itemid,ci.name ,cb.createrid,du.nickname,cb.supplierName')
-            ->group('addtime,cb.createrid,cb.supplierNo')
-            ->order('addtime desc,du.itemid,ci.name ,cb.createrid,du.nickname')
+            ->group('addtime,cb.createrid,cb.supplierName')
+            ->order('addtime desc,cb.createrid')
 //            ->page($param['page'], $param['size'])
             ->cursor();
 
         //所有账号
-        $user=Db::connect('mysql_sys')
+        $user = Db::connect('mysql_sys')
             ->name('user')
             ->alias('a')
-            ->leftJoin('account_item b','b.account_id=a.account_id')
-            ->leftJoin('company_item c','c.id=b.itemid')
-            ->column('a.nickname,c.name','a.account_id');
+            ->leftJoin('account_item b', 'b.account_id=a.account_id')
+            ->leftJoin('company_item c', 'c.id=b.itemid')
+            ->column('a.nickname,c.name', 'a.account_id');
 
         $data = [];
         foreach ($list as $value) {
 
-            if(isset($user[$value['createrid']])){
-                $value['nickname']=$user[$value['createrid']]['nickname'];
-                $value['name']=$user[$value['createrid']]['name'];
-            }else{
-                $value['nickname']=$value['supplierName'];
-                $value['name']='供应商';
+            if (isset($user[$value['createrid']])) {
+                $value['nickname'] = $user[$value['createrid']]['nickname'];
+                $value['name'] = $user[$value['createrid']]['name'];
+            } else {
+                $value['nickname'] = $value['supplierName'];
+                $value['name'] = '供应商';
             }
 
             if ($value['name'] == '供应商') {
@@ -493,6 +493,8 @@ class ReportByRelaComNo extends Base
                     'nickname' => $value['nickname'],
                     'num' => '0',
                     'total' => '0',
+                    'relaComNo' => $this->relaComNo,
+                    'relaComName' => $this->relaComName,
                 ];
             }
 
@@ -514,7 +516,7 @@ class ReportByRelaComNo extends Base
             }
         }
 
-        $da[] = ['addtime' => '汇总', 'itemid' => 0, 'createrid' => 0, 'num' => array_sum(array_column($da, 'num')), 'total' => array_sum(array_column($da, 'total')), 'nickname' => '', 'name' => ''];
+        $da[] = ['addtime' => '汇总', 'itemid' => 0, 'createrid' => 0, 'num' => array_sum(array_column($da, 'num')), 'total' => array_sum(array_column($da, 'total')), 'nickname' => '', 'name' => '', 'relaComNo' => $this->relaComNo, 'relaComName' => $this->relaComName];
         return json_show(0, '请求成功', $da);
 
     }
@@ -644,7 +646,6 @@ class ReportByRelaComNo extends Base
         if ($param['creater'] != '') $where[] = ['cb.creater', 'like', '%' . $param['creater'] . '%'];
         if ($param['zxNo'] != '') $where[] = ['cb.infoNo', 'like', '%' . $param['zxNo'] . '%'];
 
-
         $count = Db::name('consult_bids')
             ->alias('cb')
             ->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
@@ -656,7 +657,7 @@ class ReportByRelaComNo extends Base
 
         $data = Db::name('consult_bids')
             ->alias('cb')
-            ->field('cb.id,ci.addtime,cb.bidNo,cb.infoNo zxNo,cb.addtime cbaddtime,cb.good_name,s.name supplier,cb.total_fee,cb.delivery_day,cb.work_day,cb.expire_day,cb.creater,cb.createrid,"" name,ci.num,ci.arrival_time,co.saleid,co.salesman,"" salesman_name,csi.companyName')
+            ->field('cb.id,ci.addtime,cb.bidNo,cb.infoNo zxNo,cb.addtime cbaddtime,cb.good_name,cb.supplierName supplier,cb.total_fee,cb.delivery_day,cb.work_day,cb.expire_day,cb.creater,cb.createrid,"" name,ci.num,ci.arrival_time,co.saleid,co.salesman,"" salesman_name,"" companyName,co.khNo')
             ->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
             ->leftJoin('consult_order co', 'co.zxNo=cb.zxNo')
 //            ->leftJoin('supplier s', 's.code=cb.supplierNo')
@@ -675,8 +676,10 @@ class ReportByRelaComNo extends Base
 
         //获取所有创建人的部门
         $item_name = get_company_name_by_uid(array_unique(array_merge(array_column($data, 'createrid'), array_column($data, 'saleid'))));
+        $names = get_headquarters_code_and_name(array_unique(array_column($data,'khNo')));
 
         foreach ($data as &$value) {
+            $value['companyName'] = $names[$value['khNo']] ?? '';
             $value['name'] = $item_name[$value['createrid']] ?? '';
             $value['salesman_name'] = $item_name[$value['saleid']] ?? '';
             $value['relaComNo'] = $this->relaComNo;
@@ -748,22 +751,25 @@ class ReportByRelaComNo extends Base
 
 
         $data = $rs
-            ->field('ci.addtime as 咨询时间,cb.bidNo as 采购单反馈单号,cb.infoNo as 咨询订单号,cb.addtime as 回复时间,cb.good_name as 产品名称,s.name as 供应商名称,cb.total_fee 成本合计,cb.delivery_day 物流时间,cb.work_day 产品工期,cb.expire_day 信息有效期,cb.creater 采购员,"" 采购员所属部门,ci.num 需求数量,ci.arrival_time 要求到货日期,co.salesman 业务人员,"" 业务人员所属部门,csi.companyName 客户名称,cb.createrid,co.saleid')
+            ->field('ci.addtime as 咨询时间,cb.bidNo as 采购单反馈单号,cb.infoNo as 咨询订单号,cb.addtime as 回复时间,cb.good_name as 产品名称,cb.supplierName as 供应商名称,cb.total_fee 成本合计,cb.delivery_day 物流时间,cb.work_day 产品工期,cb.expire_day 信息有效期,cb.creater 采购员,"" 采购员所属部门,ci.num 需求数量,ci.arrival_time 要求到货日期,co.salesman 业务人员,"" 业务人员所属部门,"" 客户名称,cb.createrid,co.saleid,co.khNo')
             ->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
             ->leftJoin('consult_order co', 'co.zxNo=cb.zxNo')
-            ->leftJoin('supplier s', 's.code=cb.supplierNo')
-            ->leftJoin('customer_info csi', 'csi.companyNo=co.khNo')
+//            ->leftJoin('supplier s', 's.code=cb.supplierNo')
+//            ->leftJoin('customer_info csi', 'csi.companyNo=co.khNo')
             ->select()
             ->toArray();
 
         $item_name = get_company_name_by_uid(array_unique(array_merge(array_column($data, 'createrid'), array_column($data, 'saleid'))));
+        $names = get_headquarters_code_and_name(array_unique(array_column($data,'khNo')));
 
         $list = [];
         foreach ($data as $value) {
+            $value['客户名称'] = $names[$value['khNo']] ?? '';
             $value['采购员所属部门'] = $item_name[$value['createrid']] ?? '';
             $value['业务人员所属部门'] = $item_name[$value['saleid']] ?? '';
             unset($value['createrid']);
             unset($value['saleid']);
+            unset($value['khNo']);
             $value['业务公司编码'] = $this->relaComNo;
             $value['业务公司名称'] = $this->relaComName;
             $list[] = $value;
@@ -1015,7 +1021,7 @@ class ReportByRelaComNo extends Base
 
         if (!$val_params->check($param)) return json_show(1004, $val_params->getError());
 
-        $where = [['po.is_del', '=', 0], ['po.companyNo', '=', $this->relaComNo]];
+        $where = [['po.is_del', '=', 0], ['po.order_type','<>',1],['po.companyNo', '=', $this->relaComNo]];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['po.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
         if ($param['status'] != '') $where[] = ['po.status', '=', $param['status']];
 
@@ -1320,6 +1326,8 @@ class ReportByRelaComNo extends Base
 //            ->where($where)
 //            ->order('s.addtime desc')
 //            ->cursor();
+        $param['start'] = $param['start_date'];
+        $param['end'] = $param['end_date'];
         $param['size'] = PHP_INT_MAX;
 
         $list = \app\admin\common\User::getIns()->handle('sGetList', $param);
@@ -1489,10 +1497,10 @@ class ReportByRelaComNo extends Base
 
         if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
 
-        $where = [['s.is_del', '=', 0], ['gp.exam_status', '=', 6], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
+        $where = [['gp.is_del', '=', 0], ['gp.exam_status', '=', 6], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.online_time', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];//当上面状态确定为exam_status==6时,上线时间也可以取 updatetime
         if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
-        if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
+//        if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
 
         $count = Db::name('good_platform')
             ->alias('gp')
@@ -2145,7 +2153,7 @@ class ReportByRelaComNo extends Base
 
         if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
 
-        $where = [['s.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]];
+        $where = [['gp.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
         if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
         if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
@@ -2235,14 +2243,14 @@ class ReportByRelaComNo extends Base
 
         if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
 
-        $where = [['s.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
+        $where = [['gp.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
         if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
         if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
 
         $list = Db::name('good_platform')
             ->alias('gp')
-            ->field('gp.skuCode as 商品上线编号,gp.spuCode as 商品成本编号,gp.plat_code as 平台商品编码,gb.good_name as 商品名称,b.brand_name as 品牌名称,gb.cat_id as 分类,gb.gb.companyNo as 业务公司编码,gb.companyName as 业务公司名称,gb.creater as 采购员,p.platform_name as 上线平台,gp.online_time as 上线完成时间,gp.exam_status as 上下线状态,gb.is_stock as 是否库存品,gb.good_type as 是否定制,"" as 规格,"" as 型号,u.unit as 单位,gb.good_remark as 商品备注,gb.craft_desc as 工艺说明,gb.noble_metal as 贵金属信息,gb.cgd_gold_price as 供应商采购金价,gb.demo_fee as 打样费,gb.open_fee as 开模费,gb.sample_fee as 调样费,gb.tax as 税点,gb.supply_area as 供货区域,gb.supplierName as 供应商名称,gp.addtime 申请上线时间')
+            ->field('gp.skuCode as 商品上线编号,gp.spuCode as 商品成本编号,gp.plat_code as 平台商品编码,gb.good_name as 商品名称,b.brand_name as 品牌名称,gb.cat_id as 分类,gb.companyNo as 业务公司编码,gb.companyName as 业务公司名称,gb.creater as 采购员,p.platform_name as 上线平台,gp.online_time as 上线完成时间,gp.exam_status as 上下线状态,gb.is_stock as 是否库存品,gb.good_type as 是否定制,"" as 规格,"" as 型号,u.unit as 单位,gb.good_remark as 商品备注,gb.craft_desc as 工艺说明,gb.noble_metal as 贵金属信息,gb.cgd_gold_price as 供应商采购金价,gb.demo_fee as 打样费,gb.open_fee as 开模费,gb.sample_fee as 调样费,gb.tax as 税点,gb.supply_area as 供货区域,gb.supplierName as 供应商名称,gp.addtime 申请上线时间')
             ->leftJoin('good_basic gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
             ->leftJoin('brand b', 'b.id=gb.brand_id')
             ->leftJoin('unit u', 'u.id=gb.good_unit')

+ 1 - 1
app/common.php

@@ -122,7 +122,7 @@ if(!function_exists("GetFin")){
 	function GetFin($uri,$post){
 		$host =env("fin.hosturl");
 		$data =curl_request($host.$uri,$post);
-		return $data;
+		return json_decode($data,true);
 	}
 }