瀏覽代碼

提交测试

lvhao 5 月之前
父節點
當前提交
082eda95ac
共有 1 個文件被更改,包括 79 次插入325 次删除
  1. 79 325
      core/CoreApp/controllers/Aac.php

+ 79 - 325
core/CoreApp/controllers/Aac.php

@@ -19,347 +19,101 @@ class Aac extends Start_Controller {
 		$this->load->_model('Model_shop','shop');
 		$this->load->_model('Model_systemtransfer_cr','systemtransfer_cr');
 		$this->load->_model("Model_logic_ding","logic_ding");
+		$this->load->_model("Model_logic_u9tools","logic_u9tools");
+		$this->load->_model("Model_logic_order","logic_order");
+		$this->load->_model("Model_zzrecord_logs","zzrecord_logs");
 	}
 	//定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
     {
-		var_dump(123);
-		die;
-	
-// 		if($arg == 'out')
-//         {
-//              $this->_out($arg_array);
-//         }
+		//$this->dosku();
+		$this->tj();
     }
-    public function _out($arg_array)
-	{
-		$label = $arg_array[1];
-		$cz = $arg_array[0];
-        $transfer = 13;
-		if(isset($label))
+
+	public function dosku(){
+		$sku = "9A-LY031-#PT1B/27-OW-13*4W-18-180%-M-RTG-SideP";
+		$tc = $this->typeclass->find_all();
+		$typeclass = [];
+		foreach ($tc as $v)
 		{
-			$time = time();
-			// $label = $this->input->post('label',true);
-			// $cz = $this->input->post('cz',true);
-			if(!$label)
-			{
-				echo json_encode(array('msg'=>'未扫入数据!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			}
-			if(!$transfer)
-			{
-				echo json_encode(array('msg'=>'请选择需对应的部门!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			}
-			$lb = $this->systemtransfer->get_label($label);
-			if(!$lb)
-			{
-				echo json_encode(array('msg'=>'错误!未找到此条码','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			}
-			if($lb['number']!='')
-			{
-				$nu = $this->fullorder->get_number($lb['number']);
-				if(!$nu)
-				{
-					$nu = $this->fullordersmt->get_number($lb['number']);
-				    if(!$nu)
-				    {
-						$nu = $this->fullordertt->get_number($lb['number']);
-					}
-				}
-				//取消的订单还是要继续生产的 所以还允许继续扫入扫出 只是后续的出入库中不在限定时间
-				// if($nu['state'] == '214' || $nu['state'] == '217')
-				// {
-				// 	echo json_encode(array('msg'=>'错误,此单已取消!请联系店员核实','success'=>false));exit;
-				// }
-			}
-			
-			$tdata = $this->transfer->find_all();
-			$t = array();
-			foreach ($tdata as $v)
-		    {
-				$t[$v['id']] = $v['title'];
-			}
-			/**
-			if($cz == 1 && stripos($lb['rk'],'|'.$transfer.'|') !== false)
-			{
-				echo json_encode(array('msg'=>'此条码已有入库操作!','success'=>false));exit;
-			}
-			if($cz == 2 && stripos($lb['ck'],'|'.$transfer.'|') !== false)
-			{
-				echo json_encode(array('msg'=>'此条码已有出库操作!','success'=>false));exit;
-			}
-			**/
-// 			if(stripos($lb['ck'],'|1|') === false && $transfer != 1 && stripos($nu['fpdata'],'-128-') !== false)
-// 			{
-// 				echo json_encode(array('msg'=>'必须有配货出库才可后续操作!','success'=>false));exit;
-// 			}
+			$typeclass[$v['jm']] = array('id'=>$v['id'],'zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm'],'bqsku'=>$v['bqsku']);
+		}
+		$typeclassid = [];
+		foreach($tc as $v){
+			$typeclassid[$v['id']] = array('id'=>$v['id'],'zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm'],'bqsku'=>$v['bqsku']);
+		}
+		$classid = $this->classid->sku();
+		echo "<pre>";
+		$r = $this->logic_u9tools->getGoodInfoByErpSku("头套",$sku,$typeclass,$typeclassid,$classid);
+		var_dump($r);
+	}
 
-           
-			
-			//重新定义配货的原则问题
-			//先检测订单是否含有 128 头套 或者配件 如果有 133 进行下一步检测
- 			$sku_arr = explode("-",$lb['features']);
-			if(in_array(128,$sku_arr)||in_array(133,$sku_arr)){
-				// 145  Full Lace Wig
-				// 1170 HDFullLaceWig
-				// 1249 FullLaceBobwithBang
-				// 1484 FullLaceBob
-				//如果是这4中全蕾丝那么配货就不处理
-				if(in_array(145,$sku_arr) || in_array(1170,$sku_arr) || in_array(1249,$sku_arr) || in_array(1484,$sku_arr)){
+	public function orderCheck(){
+		echo "<pre>";
+		$fpdata = "89,-128-80-57-101-331-30-74-|Wigs 9A #Natural Black Straight HD 13*4 Frontal Wig Medium 250% 22inch |1|0|0|22|0|0|0|6686657u;-131-2186-|Gift PackQQS |1|0|0||0|0|0|6710875u;";
+		$shipremarks=" STW 半蕾丝头套(HD) 22寸 (250%密度) (需要剪掉蕾丝) ; (QQS独立站赠品包) ";
+		$r = $this->logic_order->checkCkpmAndSku($fpdata,$shipremarks);
+		var_dump($r);
+		print_r($r);
+	}
 
+	public function tj(){
+		$info = $this->zzrecord_logs->read(1);
+		if($info['sku'] == 1){
+			return ;
+		}
+		$qty = $info['qty'];
+		$start = (int)$info['number'];
+		$pre_num = 100;
+		$list = $this->fullorder->find_all(" 1 = 1 ","*",'id asc',$start,$pre_num);
+		if(empty($list)){
+			$this->zzrecord_logs->save([
+				'sku'=>1,
+			],1);
+			return;
+		}
+		$tmp_num = 0;
+		foreach($list as $k=>$v){
+			$tmp_q = 0; 
+			$v['issku'] = strtolower($v['issku']);
+			if(stripos($v['issku'],',') !== false){
+				$issku = explode(",",$v['issku']);
+			}else{
+				$issku = [$v['issku']];
+			}
+			if(stripos($v['quantity'],';') !== false){
+				$quantity = explode(";",$v['quantity']);
+			}else{
+				$quantity = [$v['quantity']];
+			}
+			foreach($issku as $index=>$item){
+				if(stripos($v['issku'],'gift') === false){
+					
 				}else{
-					if(stripos($lb['ck'],'|1|') === false && $transfer != 1 )
-					{
-						echo json_encode(array('msg'=>'头套和配件除了全蕾丝外必须走配货!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-					}
-				}
-			}
-			if($cz == 2 && stripos($lb['rk'],'|'.$transfer.'|') === false)
-			{
-				echo json_encode(array('msg'=>'此条码还未入库!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			}
-			$lbrk = array_reverse(explode('|',trim($lb['rk'],'|')));
-			$lbck = array_reverse(explode('|',trim($lb['ck'],'|')));
-			if($transfer != 3 && $transfer != 11 && $transfer != 2)
-			{
-				if($cz == 1)
-				{
-			        if($lb['rk'] != $lb['ck'])//判断是否没走完流程就拿到下一步奏
-			        {
-				        echo json_encode(array('msg'=>$t[$lbrk[0]].'还未出库,无法入库!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			        }
-				}
-				if($cz == 2 && $lbrk[0] != $transfer)//判断是否没走完流程就拿到下一步奏
-			    {
-				    echo json_encode(array('msg'=>$t[$transfer].'还未入库,无法出库!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-			    }
-			}
-			if($cz == 1)
-			{
-				$lb['rk'] .= $transfer.'|';
-				$lb['rktime'] .= $time.'|';
-				if($lbrk[0] == $transfer)
-				{
-					echo json_encode(array('msg'=>'已有入库记录,不可连续重复录入!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-				}
-			}
-			else if($cz == 2)
-			{
-				$lb['ck'] .= $transfer.'|';
-				$lb['cktime'] .= $time.'|';
-				if($lbck[0] == $transfer)
-				{
-					echo json_encode(array('msg'=>'已有出库记录,不可连续重复录入!','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-				}
-			}
-			$cztime = 'ctime'.$transfer;
-			$this->logic_ding->sendToDing("检测货物流转打印情况".$transfer."|".$cz."|".$lb['number']."|".$lb['id']);
-			if(($transfer == 3 && $lb['dbapi'] < 99 && $cz == 2) || ($transfer == 13 && $lb['dbapi'] < 99 && $cz == 1))//出入库用这个
-			//if(($transfer == 8 || $transfer == 13) && $lb['dbapi'] < 99 && $cz == 1)//单入库
-			{
-				if($lb['type'] == 0)
-				{
-				    $s = $this->shop->read($nu['shop']);
-			        $lb['kh'] = $s['yyid'];
-				    $lb['ts'] = 1;
-			        //$rk = $this->apiyy->_newrk($lb);
-                    $rk = [
-                        'c'=>0,
-                        'scid'=>"",
-                    ];
-				    if($rk['c'] == 0)
-				    {
-						$this->db->trans_begin();
-						$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),'dbapi'=>99,'scid'=>$rk['scid'].time(),$cztime=>$time),$lb['id']);
-				 	    $this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
-				 	    //处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
-            			if($cz == 2){
-            				$this->_doCheckIsOverTime($lb['id'],$transfer);
-            			}
-						if ($this->db->trans_status() === TRUE)
-        				{
-							$this->db->trans_commit();
-							if($nu['state'] == '216')
-				 	  	    {
-				     	  	    echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-				 	  	    }
-				 	  	    elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
-            					//标记订单已经取消
-            					$this->_doCheckCancelFlag($lb['id']);
-            					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false),JSON_UNESCAPED_UNICODE);exit;
-            				}
-				 	  	    else
-				 	  	    {
-								if($lb['is_jiaji'] == 2){
-									echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
-								}else{
-									echo json_encode(array('music'=>'1','success'=>true));exit;
-								}
-				     	  	    
-				 	  	    }
-						}
-						else
-						{
-							$this->db->trans_rollback();
-							echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
-						}
-				    }
-				    else
-				    {
-						if(stripos($rk['error'],'DocNo') !== false)
-						{
-							$rk['error'] = '未找到对应的生产订单 '.$lb['scid'];
-						}
-						$this->systemtransfer->save(array('dbapi'=>$rk['dbapi'],'scid'=>$rk['scid']),$lb['id']);
-					    echo json_encode(array('msg'=>'订单号:'.$lb['number'].' 用友报错:'.$rk['error'],'success'=>false));exit;
-				    }
-				}
-				else
-				{
-					$scid = explode('~',$lb['scid']);
-					$rkdata = array('od'=>$scid[1],'ts'=>1,'title'=>$lb['title']);
-                    $rk = [
-                        'Data'=>[
-                            [
-                                'IsSucess'=>1,
-                                'Code'=>1,
-                            ]
-                        ]
-                    ] ;
-					if(isset($rk['Data'][0]))
-		        	{
-						if($rk['Data'][0]['IsSucess'] == 1)
-				        {
-							$this->db->trans_begin();
-							$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),'dbapi'=>99,'scid'=>$lb['scid'].'~'.$rk['Data'][0]['Code'],$cztime=>$time),$lb['id']);
-				 	    	$this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
-				 	    	//处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
-                			if($cz == 2){
-                				$this->_doCheckIsOverTime($lb['id'],$transfer);
-                			}
-							if ($this->db->trans_status() === TRUE)
-        					{
-								$this->db->trans_commit();
-								if($nu['state'] == '216')
-				 	  	    	{
-				     	  	    	echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false));exit;
-				 	  	    	}
-				 	  	    	elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
-                					//标记订单已经取消
-                					$this->_doCheckCancelFlag($lb['id']);
-                					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false));exit;
-                				}
-				 	  	    	else
-				 	  	    	{
-									if($lb['is_jiaji'] == 2){
-										echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
-									}else{
-										echo json_encode(array('music'=>'1','success'=>true));exit;
-									}
-				 	  	   		}
-							}
-							else
-							{
-								$this->db->trans_rollback();
-								echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
-							}
-			 	  	    }
-						else
-						{
-							echo json_encode(array('msg'=>$rk['Data'][0]['ErrorMsg'],'success'=>false));exit;
-						}
-			 	  	    
-					}
-					else
-				    {
-					    echo json_encode(array('msg'=>$rk,'success'=>false));exit;
-				    }
-						
-				 }
-			}
-			//if($transfer == 11 && stripos($lb['rk'],'|8|') === false && stripos($lb['ck'],'|3|') === false &&  stripos($lb['rk'],'|13|') === false)//只入库
-			if($transfer == 11 && stripos($lb['ck'],'|3|') === false &&  stripos($lb['rk'],'|13|') === false)//改出入库
-			{
-				echo json_encode(array('msg'=>'工厂未出库,请退回工厂!','success'=>false));exit;
-			}
-			$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),$cztime=>$time),$lb['id']);
-			$this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
-			//处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
-			if($cz == 2){
-				$this->_doCheckIsOverTime($lb['id'],$transfer);
-			}
-			if ($this->db->trans_status() === TRUE)
-        	{
-				$this->db->trans_commit();
-				
-				
-			    if($nu['state'] == '216')
-				{
-					echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false));exit;
-				}
-				elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
-					//标记订单已经取消
-					$this->_doCheckCancelFlag($lb['id']);
-					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false));exit;
-				}
-				else
-				{
-					if($lb['is_jiaji'] == 2){
-						echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
+					
+					if(isset($quantity[$index])){
+						$tmp_q += $quantity[$index];
 					}else{
-						echo json_encode(array('music'=>'1','success'=>true));exit;
+						$tmp_q += 1;
 					}
+					var_dump($tmp_q);
 				}
+
 			}
-			else
-			{
-				$this->db->trans_rollback();
-				echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
+			if($tmp_q >= 3){
+				$tmp_num = $tmp_num+1;
 			}
+			 
 		}
-	}
+		//var_dump($tmp_num);
+		$qty = $qty*1 + $tmp_num;
+
+		$this->zzrecord_logs->save([
+			'number'=>$pre_num+$start,
+			'qty'=>$qty
+		],1);
 
-    //检测取消标记是否添加 同时也检查下 该流转单是否被标记为取消单
-	private function _doCheckCancelFlag($fid){
-		
-		$info = $this->systemtransfer->read($fid);
-		if($info['status'] != 11){
-			$this->systemtransfer->save(['status'=>11],$fid);
-		}
-		$list = $this->systemtransfer_cr->find_all("fid = ".$fid,'*','id desc');
-		if(empty($list)){
-			return;
-		}
-		$is_cancel = false;
-		foreach($list as $val){
-			if($val['orver_flag'] == 3){
-				$is_cancel = true;
-			}
-		}
-		if($is_cancel){
-			return ;
-		}
-		$this->systemtransfer_cr->save(['orver_flag'=>3],$list[0]['id']);
-		
 	}
-	
-	//检测是否超时  车间流转环节 
-	private function  _doCheckIsOverTime($fid,$transfer){
-		$list = $this->systemtransfer_cr->find_all("fid = ".$fid." and lx = ".$transfer." and is_over = 0","*",'id desc',0,2);
-		if(count($list) < 2){
-			return ;
-		}
-		if($list[0]['type'] != 2){
-			return;
-		}
-		if($list[1]['type'] != 1){
-			return;
-		}
-		if($list[1]['orver_flag'] == 2){
-			$this->systemtransfer_cr->save(array('is_over'=>1,'orver_flag'=>2),$list[0]['id']);
-		}else{
-			$this->systemtransfer_cr->save(array('is_over'=>1),$list[0]['id']);
-		}
-		$this->systemtransfer_cr->save(array('is_over'=>1),$list[1]['id']);
-	}	
+   
 	
 }