Forráskód Böngészése

处理仓库扫码出库时,如果扫描的是订单编码 并且是多次打印 会提示扫码出库员工一些信息, 如果员工确定 更新订单出库信息 并同时更新已经占单的库存信息

lvhao 1 hónapja
szülő
commit
677ad98cea

+ 52 - 18
core/CoreApp/controllers/Systemfout.php

@@ -1066,31 +1066,65 @@ class Systemfout extends Start_Controller {
 			$fullorder_name = $this->input->post('fullorder_name',true);
 			$outnumber = $this->input->post('outnumber',true);
 			$post = json_decode($post,true);
-			$this->$fullorder_name->save($post,$outnumber);
-			
-			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);
+			$y = $this->$fullorder_name->read($outnumber);
+			if(empty($y)){
+				echo json_encode(array('msg'=>'订单异常不能出库','success'=>false));exit;
+			}
+			$warehouse = $this->warehouse->read($y['type']);
+			if(empty($warehouse)){
+				echo json_encode(array('msg'=>'仓库异常不能出库','success'=>false));exit;
+			}
+			if($y['library']== 2){
+				echo json_encode(array('msg'=>'订单已出库,请勿重复出库','success'=>false));exit;
+			}
+			if($y['library']== 3){
+				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($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));
 			}
 			
+			
+			
 		}
 	}
 	public function _fout_db($y,$warehouse,$bdck)//对比占单是否正确
 	{
+	
 		$wh = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
 		$cpsl = 0;
 		$pp = explode('|',trim($y['whlabel'],'|'));

+ 3 - 1
template/erp/js/print.js

@@ -430,7 +430,9 @@ $(document).keyup(function(event) {
                     $(".systemwindow").hide();
 					$("#orderinfo").focus();
                     if (a && a.success) {
-					}
+					}else{
+                        alert(a.msg);
+                    }
 				}
 				});
 				 $("#orderinfo").val("");

+ 1 - 1
template/erp/systemfout.html

@@ -183,5 +183,5 @@ $(".exceltwo").click(function() {
 
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
-<script type="text/javascript" src="{$theme}js/print.js?v=202406260002"></script>
+<script type="text/javascript" src="{$theme}js/print.js?v=20190625"></script>
 {Template footer}