lvhao 12 godzin temu
rodzic
commit
f8be539796

+ 2 - 2
core/CoreApp/controllers/Transfer.php

@@ -3350,8 +3350,8 @@ class Transfer extends Start_Controller {
 		if(empty($info)){
 		if(empty($info)){
 			echo json_encode(array('msg'=>'数据不存在','success'=>false));exit;
 			echo json_encode(array('msg'=>'数据不存在','success'=>false));exit;
 		}
 		}
-		if($info['ycrk_type'] == 1){
-			echo json_encode(array('msg'=>'已添加异常入库','success'=>false));exit;
+		if(!empty($info['ycrk_type'])){
+			echo json_encode(array('msg'=>'已添加异常入库,不要重复添加','success'=>false));exit;
 		}
 		}
 
 
 		//更新数据 
 		//更新数据 

+ 159 - 1
core/CoreApp/controllers/Whlabel_bh.php

@@ -158,6 +158,9 @@ class Whlabel_bh extends Start_Controller {
 		else if($arg == 'czbmsfcz'){
 		else if($arg == 'czbmsfcz'){
 			$this->_czbmIsOutExcel();
 			$this->_czbmIsOutExcel();
 		}
 		}
+		else if($arg == 'ycrk'){
+			$this->_ycrk();
+		}
 		else
 		else
 		{
 		{
 			 $this->_index();
 			 $this->_index();
@@ -2140,7 +2143,126 @@ class Whlabel_bh extends Start_Controller {
 		$post = $this->input->post(NULL, TRUE);
 		$post = $this->input->post(NULL, TRUE);
 	    if(isset($post['page']))  
 	    if(isset($post['page']))  
 		{
 		{
-			$rows = $this->getOperateList();
+			
+			$api = $this->input->post('api',true);
+		    $page = $this->input->post('page',true);
+		    $perpage = $this->input->post('perpage',true);
+			$orderinfo = $this->input->post('number',true);
+			$color = $this->input->post('color',true);
+			$pm = $this->input->post('pm',true);
+			$purchase = $this->input->post('purchase',true);
+			$transfer = $this->input->post('transfer',true);
+			$lx = $this->input->post('lx',true);
+			$crk_select = $this->input->post('crk',true);
+			$timetk = $this->input->post('timetk',true);
+			$timetj = $this->input->post('timetj',true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			$where = "1=1";
+			if($transfer)
+			{
+				$ctime = 'ctime'.$transfer;
+			    $where  .= " and $ctime > '$timetk' and $ctime < '$timetj'";
+			}
+			else
+			{
+				$where  .= " and time > '$timetk' and time < '$timetj'";
+			}
+			if($orderinfo)
+            {
+                $where  .= " and orderinfo like '%$orderinfo%'";
+            }
+			if($transfer)
+            {
+                $where  .= " and rk like '%|".$transfer."|%'";
+            }
+			if($purchase)
+            {
+                $where  .= " and purchase = '$purchase'";
+            }
+			if($pm)
+            {
+                $where  .= " and pm like '%$pm%'";
+            }
+			if($color)
+            {
+                $where  .= " and features like '%-".$color."-%'";
+            }
+			if(!empty($crk_select)){
+				$where_arr = [];
+				$where_arr['time >='] =$timetk;
+				$where_arr['time <='] = $timetj;
+				if($transfer > 0){
+					$where_arr['lx'] =$transfer;
+				}
+			
+				$cr_model = $this->db->from('whlabel_bh_transfer_cr')->select('id,fid,is_over,lx,time,type,ycrk_type');
+
+				
+				if($crk_select == 1){
+					$where_arr['type'] =1;
+					$cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
+				}else{
+					$where_arr['type'] = 2;
+					$cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
+				}
+				$fids = array_column($cr_tmp_list,'fid');
+				$ids = array_unique($fids);
+				if(empty($ids)){
+					$where  .= " and id = 0 ";
+				}else{
+					$where  .= " and id in (".implode(",",$ids).")";
+				}
+				
+			}
+            //数据排序
+            $order_str = "id desc";
+            if(empty($page))
+		    {
+                $start = 0;
+		    	$perpage = 1;
+            }
+		    else
+		    {
+                $start = ($page - 1)*$perpage;
+            }
+            //取得信息列表
+            $info_list = $this->whlabel_bh_transfer->find_all($where,'id,orderinfo,pm,shipremarks,ts,printtime,time',$order_str,$start,$perpage);
+			$transfer = $this->transfer->find_all();
+			$t = array();$ot = array();
+			foreach ($transfer as $v)
+		    {
+				$t[$v['id']] = $v['title'];
+				$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
+			}
+			 //格式化数据
+            foreach ($info_list as $key=>$value)
+		    {
+				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
+				$log_list= $this->whlabel_bh_transfer_cr->find_all("fid = ".$value['id']);
+				$tmp_operate_str = "";
+				foreach($log_list as $k=>$v){
+					if(empty($v['lx']) && !empty($v['ycrk_type'])){
+						$tmp_operate_str.= "订单已完成:".date('Y-m-d H:i:s',$v['time'])."<br>";
+					}else{
+						$tmp_operate_str.= $t[$v['lx']]."".($v['type']==1?'入库':'出库').":".date('Y-m-d H:i:s',$v['time'])."<br>";
+					}
+					
+				}
+
+				$info_list[$key]['time'] = trim($tmp_operate_str,'<br>');
+				if(empty($value['ycrk_type'])){
+					$info_list[$key]['ycrk_type'] = "<p style='background-color: #f0f0f0 !important;color:#000 !important' onclick='addYcrk(".$value['id'].")'>异常入库</p>";
+				}else{
+					$info_list[$key]['ycrk_type'] = "";
+				}
+            }
+		    $total = $this->whlabel_bh_transfer->find_count($where);
+		    $pagenum = ceil($total/$perpage);
+		    $over = $total-($start+$perpage);
+		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'where'=>$where);
+
+
 		    echo json_encode($rows);exit;
 		    echo json_encode($rows);exit;
 		}
 		}
 		if(isset($_SESSION['api']))
 		if(isset($_SESSION['api']))
@@ -3559,4 +3681,40 @@ class Whlabel_bh extends Start_Controller {
 
 
 		return $tran_list;
 		return $tran_list;
 	}
 	}
+
+
+	public function _ycrk(){
+		if($this->input->method() == 'get'){
+			echo json_encode(array('msg'=>'请求方式不正确','success'=>false));exit;
+		}
+		$id = $this->input->post('id',true);
+		$type = $this->input->post('type',true);
+		if(!in_array($type,[1,2,3])){
+			echo json_encode(array('msg'=>'入库类别异常,联系技术','success'=>false));exit;
+		}
+		$info = $this->whlabel_bh_transfer->read($id);
+		if(empty($info)){
+			echo json_encode(array('msg'=>'数据不存在','success'=>false));exit;
+		}
+		if(!empty($info['ycrk_type'])){
+			echo json_encode(array('msg'=>'已添加异常入库,不要重复添加','success'=>false));exit;
+		}
+
+		//更新数据 
+		$this->whlabel_bh_transfer->save([
+			'ycrk_type'=>$type,
+		],$id);
+		$list = $this->whlabel_bh_transfer_cr->find_all('fid = '.$id,'*','id desc');
+		foreach ($list as $key=>$value) {
+			$this->whlabel_bh_transfer_cr->save([
+				'ycrk_type'=>$type,
+			],$value['id']);
+		}
+		$this->whlabel_bh_transfer_cr->insert([
+			'fid'=>$id,'lx'=>0,'type'=>$type,'time'=>time(),'is_over'=>0,'over_flag'=>0,
+			'extra_status'=>0,'ycrk_type'=>$type,
+		]);
+		echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
+
+	}
 }
 }

+ 46 - 0
template/erp/whlabel_bh_operate.html

@@ -78,6 +78,7 @@
 <td>数量</td>
 <td>数量</td>
 <td>打印时间</td>
 <td>打印时间</td>
 <td>操作时间</td>
 <td>操作时间</td>
+<td>操作</td>
 </tr>
 </tr>
 </table>
 </table>
 </div>
 </div>
@@ -373,6 +374,51 @@ $(".tjsx_xz").click(function() {
    }
    }
    window.location.href = "/whlabel_bh/excelbhdc?"+f;
    window.location.href = "/whlabel_bh/excelbhdc?"+f;
 });
 });
+
+
+
+function addYcrk(id){
+    $(".boundtj div p:eq(0)").html('<label>类 型:<select name="type" class="select"><option value="1">配货入库</option><option value="2">成品库入库</option><option value="3">外销单入库</option></select></label> <input type="hidden" name="id" value="'+id+'" />');
+    $(".boundtj div p:eq(1)").html("<font class='obaddgo' onclick='doAddYcrk()'>确 定</font><font class='esc' onclick='escDo()'>取 消</font>");
+    $(".boundtj").show();
+   }
+   function doAddYcrk(){
+     let obj = {}
+     obj.id = $(".boundtj input[name='id']").val();
+     obj.type = $(".boundtj select[name='type']").val();
+     escDo();
+     $.post("/whlabel_bh/ycrk", obj, function(a){
+        if(a.success){
+            layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+                           
+                            $(".search span").click();
+						}
+					}
+				],dialogIcon:'error',shadable:0.6
+			})
+        }else{
+           layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+						}
+					}
+				],dialogIcon:'error',shadable:0.6
+			})
+        }
+     }, "json")
+   }
+   function escDo(){
+    $(".boundtj p").html("");
+    $(".boundtj").hide();
+   }
 </script>
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
 {Template footer}
 {Template footer}