Browse Source

Merge branch 'version1.5' into dev_wf

wufeng 2 years ago
parent
commit
471780290c

+ 11 - 3
app/abutment/controller/Order.php

@@ -407,8 +407,13 @@ class Order extends HomeBaseController
                     ->whereIn('code', array_column($info, 'supplierNo'))
                     ->column('personid', 'code');
 
-                foreach ($cgdNo as $vlue) {
-//                    if ($status == 1 || $status == 2) {
+
+            foreach ($cgdNo as $vlue) {
+            	$isreturn = cgd_sale_return($vlue);
+		        if($isreturn){
+		        	throw new Exception("{$vlue}关联销售单存在退货单正在进行");
+		        }
+               // if($status==1 || $status==2){
 //                    $orderinfo = Db::name('sale')
 //                        ->alias('a')
 //                        ->field('a.id,a.orderCode,a.is_stock,a.order_type,a.cgderid')
@@ -503,7 +508,10 @@ class Order extends HomeBaseController
             $i = 0;
             $status = 4;//4入库完成
             foreach ($param['cgdNo'] as $cgdNo) {
-
+				$isreturn = cgd_sale_return($cgdNo);
+		        if($isreturn){
+		        	throw new Exception("{$cgdNo}关联销售单存在退货单正在进行");
+		        }
                 if (empty($cgdinfo[$cgdNo])) throw new Exception('未找到采购单数据或采购单未发货');
 
                 $wsm_in_code = makeNo("CF");

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

@@ -78,7 +78,7 @@ class Exec extends Base
             return error_show(1004, "未找到下载数据");
         }
      if($info['type']==1){
-	        $num = Db::name("exec")->where(["type" =>1,"status"=>1])->count();
+	        $num = Db::name("exec")->where(["type" =>1,"status"=>1])->where("id","<>",$id)->count();
 	        if($num>0){
 		        return error_show(1004, "已有脚本在运行");
 	        }

+ 4 - 5
app/admin/controller/Purch.php

@@ -637,10 +637,6 @@ class Purch extends Base
 
         if (empty($cgdNo)) {
             return error_show(1004, "参数cgdNo 不能为空");
-        }
-		$isreturn = cgd_sale_return($cgdNo);
-        if($isreturn){
-        	return error_show(1005, "销售单存在退货单正在进行");
         }
         $remark = isset($this->post['remark']) && $this->post['remark'] != "" ? trim($this->post['remark']) : "";
         $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
@@ -697,7 +693,10 @@ class Purch extends Base
 
 
                 foreach ($cgdNo as $vlue) {
-
+					$isreturn = cgd_sale_return($cgdNo);
+			        if($isreturn){
+			          throw new Exception("{$cgdNo}关联销售单存在退货单正在进行");
+			        }
                     if($status == 1 && $uid != $supplier_cgderid[$info[$vlue]['supplierNo']]) throw new Exception('只能由供应商负责人来操作');//与供应商确认的这个操作,只能由供应商负责人来操作
 
                     if ($status == 1 || $status == 2) {

+ 65 - 2
app/command/NowReportHandle.php

@@ -95,6 +95,9 @@ class NowReportHandle extends Command
                      case 'P':
                         $res = $this->GetGoodLadder();
                         break;
+                    case 'Q':
+                        $res = $this->GetBid($info['start'], $info['end']);
+                        break;
                     default:
                         throw new Exception('暂不支持这个报表');
                 }
@@ -1027,11 +1030,71 @@ class NowReportHandle extends Command
 				    "2"=>"24K",
 				    "3"=>"白银"];
 		 $value['贵金属信息']=$noble[$value['贵金属信息']];
-
-
 		 $value['供应商名称']=Db::name("supplier")->where("code",$value['供应商名称'])->value("name",'');
     		yield $value;
     	}
     }
 
+    private function GetBid(string $start,string $end){
+    	$list=Db::name("consult_info")->alias("a")
+    	->leftJoin("consult_bids d","a.infoNo=d.infoNo")
+    	->leftJoin("consult_order c","a.zxNo=c.zxNo")
+    	->leftJoin("bargain_order b","d.bidNo=b.bidsNo and b.is_del=0")
+    	->field("c.companyNo '业务公司',
+					d.addtime '竞价时间',
+					d.infoNo '竞价单编号',
+					a.`status` '状态',
+					c.creater '申请人',
+					c.createrid '申请人部门',
+					c.khNo '客户名称',
+					c.platform_code '所属平台',
+					if(a.pgNo='','咨询','项目') as '竞价类型',
+					a.cat_id '商品分类',
+					a.good_name '商品名称',
+					a.budget_price '预算单价',
+					a.unit '单位',
+					a.num '数量',
+					a.budget_price*a.num '竞价单总额',
+					d.remark '商品备注',
+					b.addtime '反馈时间',
+					b.creater '反馈人',
+					d.spuCode '反馈商品编码',
+					d.status '反馈商品状态',
+					d.good_name '反馈商品名称',
+					d.cat_id '反馈商品分类',
+					d.unit_id '反馈商品单位',
+					d.tax '反馈商品税点',
+					c.endtime '竞价有效期',
+					b.bargainNo '议价单编号',
+					b.sale_price '议价前售价',
+					b.after_price '议价后售价',
+					b.before_rate '议价前毛利率',
+					b.after_rate '议价后毛利率',
+					b.`status` '议价状态',
+					b.bargain_remark '议价备注',
+					b.result_info_id '议价原因'")
+					->where("a.is_del",0)
+					->whereBetween("a.addtime",[$start,$end])
+					->cursor();
+    	foreach ( $list as $value){
+//		$value["品牌"]=Db::name("brand")->where("id",$value["品牌"])->value("brand_name",'');
+	    $value["分类"]=Db::name("cat")->where("id",$value["分类"])->value("cat_name",'');
+	    $value["业务公司"]=Db::name("business")->where("companyNo",$value["业务公司"])->value("company","");
+		$value["所属平台"]=Db::name("platform")->where("id", $value["上线平台"])->value("platform_name","");
+		$value['申请人部门'] = Db::name("depart_user")->alias("a")->leftJoin("company_item ci", "a.itemid=ci.id")->where(["a.uid" => $value['申请人部门'], "a.status" => 1, "a.is_del" => 0])->value('ci.name', '');
+		//状态 ;1招标进行中 2 招标已结束  3 等待议价结果   4.确认商品  5成功转单 6 取消转单 7 招标已暂
+		$arr=["待提交",'招标进行中','招标已结束','等待议价结果','确认商品','成功转单','取消转单','招标已暂停'];
+		$value["状态"]=$arr[$value["状态"]];
+		//状态0 待提交 1 提交待确认 2 发起议价 3 财务定价4 主管定价5 确认采购
+		$arr=['待提交','待反馈','待选择商品','已选择商品'];
+		$value["反馈商品状态"]=$arr[$value["反馈商品状态"]];
+		//状态  1 待主管审批   2.待财务专员审批  3. 待财务主管审批  4 审批通过 5 主管驳回  6 财务主管驳回  7 已取消议价
+		$arr= ['待业务主管审核', '业务主管通过', '待财务专员审核', '业务驳回', '财务专员通过','财务专员驳回','财务主管通过','待boss审核','财务主管驳回','boss审核通过','boss越线通过','boss驳回'];
+		$value["议价状态"]=$arr[$value["议价状态"]];
+		$value['单位']=Db::name("unit")->where("id",$value['单位'])->value("unit",'');
+		$value['议价原因']=Db::name("result_info")->where("id",$value['议价原因'])->value("result_desc",'');
+		 $value['客户名称']=Db::name("customer_info")->where("companyNo",$value['客户名称'])->value("companyName",'');
+    		yield $value;
+    	}
+    }
 }

+ 5 - 5
app/common.php

@@ -1387,7 +1387,7 @@ if (!function_exists('getUserIdsByShare')) {
     }
 }
 //采购单未操作确认或入库时判断销售单是否存在正进行中的退货
-if(function_exists("cgd_sale_return")){
+if(!function_exists("cgd_sale_return")){
 	/**
 	* @param $cgdNo
 	 * @return bool
@@ -1398,9 +1398,9 @@ if(function_exists("cgd_sale_return")){
 	function cgd_sale_return($cgdNo){
 		$order =Db::name("order_num")->alias("a")
 		->leftJoin("sale_return b","a.orderCode=b.orderCode and b.is_del=0")
-		->where("a.cgdNo",$cgdNo)
-		->whereIn("b.status",[1,2,3,4,7])
-		->find()->isExists();
-		return $order;
+		->where(["a.cgdNo"=>$cgdNo])
+		->whereIn("b.status",[1,2,3,7])
+		->findOrEmpty();
+		return !empty($order);
 	}
 }