浏览代码

修改信息确认出库

lvhao 1 月之前
父节点
当前提交
194d3b49ac
共有 1 个文件被更改,包括 47 次插入16 次删除
  1. 47 16
      core/CoreApp/controllers/Systemfout.php

+ 47 - 16
core/CoreApp/controllers/Systemfout.php

@@ -1082,17 +1082,51 @@ class Systemfout extends Start_Controller {
 				echo json_encode(array('msg'=>'订单已退库,请勿重复出库','success'=>false));exit;
 			}
 			$bdck = $warehouse['bdck'];
-			// $warehouse = $this->warehouse->read($y['type']);
-			$list = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
-			$this->db->trans_begin();
-			foreach ($list as $v)
-			{
-				$this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$post['librarytime'],'time'=>$post['librarytime']),$v['id']);
-			}
-			$this->$fullorder_name->save($post,$y['id']);
-			if ($this->db->trans_status() === TRUE)
-        	{
-				$this->db->trans_commit();
+
+			if(!empty($bdck)){
+				
+				// $warehouse = $this->warehouse->read($y['type']);
+				$list = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
+				$this->db->trans_begin();
+				foreach ($list as $v)
+				{
+					$this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$post['librarytime'],'time'=>$post['librarytime']),$v['id']);
+				}
+				$this->$fullorder_name->save($post,$y['id']);
+				if ($this->db->trans_status() === TRUE)
+				{
+					$this->db->trans_commit();
+					if($fullorder_name != 'fullorderxw'){
+						// if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
+						//     $this->zzquque_u9->insert($item);
+						// }
+						$y = $this->$fullorder_name->read($outnumber);
+						if( !in_array($y['type'],[5,7,8,9]) ){
+							$data = [
+								'platform'=>$fullorder_name,
+								'warehouse'=>$y['type'],
+								'type'=>($y['type'] == 5)?11:10,   //5代表美仓  
+								'order_no'=>$y['number'],
+								'status'=>0,
+								'create_time'=>time(),
+								'update_time'=>time(),
+							];
+							$this->zzquque_u9->insert($data);
+						}
+					}
+					echo json_encode(array('success'=>true));
+				}
+				else
+				{
+					$this->db->trans_rollback();
+					echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));
+				}
+
+
+
+			}else{
+				$this->$fullorder_name->save($post,$y['id']);
+				
 				if($fullorder_name != 'fullorderxw'){
 					// if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
 					//     $this->zzquque_u9->insert($item);
@@ -1112,12 +1146,9 @@ class Systemfout extends Start_Controller {
 					}
 				}
 				echo json_encode(array('success'=>true));
+				
 			}
-			else
-			{
-				$this->db->trans_rollback();
-				echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));
-			}
+