|
|
@@ -50,11 +50,11 @@ class NewQcodeController extends AddonController
|
|
|
public function get_bach_info(){
|
|
|
//获取批次相关信息
|
|
|
$addtobach=M('qcode_bach')->alias('a')
|
|
|
- ->join('qr_qcode_large b on a.id=b.bach_id')
|
|
|
- ->join('qr_qcode_small c on b.id=c.large.id ')
|
|
|
- ->field('bach_num,large_endnum')
|
|
|
- ->where('id='.I('get.id'))
|
|
|
- ->find();
|
|
|
+ ->join('qr_qcode_large b on a.id=b.bach_id')
|
|
|
+ ->join('qr_qcode_small c on b.id=c.large.id ')
|
|
|
+ ->field('bach_num,large_endnum')
|
|
|
+ ->where('id='.I('get.id'))
|
|
|
+ ->find();
|
|
|
}
|
|
|
//批次新增
|
|
|
public function add_bath(){
|
|
|
@@ -266,12 +266,12 @@ class NewQcodeController extends AddonController
|
|
|
}
|
|
|
|
|
|
if($_GET['startDate']){//有开始打印日期
|
|
|
- $statrtime=((int)date('Ymd',(strtotime($_GET['startDate'])))-20000000);
|
|
|
- $endtime=((int)date('Ymd',(strtotime($_GET['endDate'])))-20000000);
|
|
|
- $where['a.print_date']=array(array('egt',$statrtime),array('elt',$endtime),'AND');
|
|
|
+ $statrtime=((int)date('Ymd',(strtotime($_GET['startDate'])))-20000000);
|
|
|
+ $endtime=((int)date('Ymd',(strtotime($_GET['endDate'])))-20000000);
|
|
|
+ $where['a.print_date']=array(array('egt',$statrtime),array('elt',$endtime),'AND');
|
|
|
}
|
|
|
if($session_config['user_auth']['addtype']==1){
|
|
|
- $where['a.userid']=$session_config['user_auth']['uid'];
|
|
|
+ $where['a.userid']=$session_config['user_auth']['uid'];
|
|
|
}
|
|
|
$where['a.bach_status']=0;
|
|
|
|
|
|
@@ -319,7 +319,7 @@ class NewQcodeController extends AddonController
|
|
|
echo $bachlist;
|
|
|
//echo json_encode($BatchList);
|
|
|
}
|
|
|
- public function BachListApiTwo(){//补打界面获取补打批次列表
|
|
|
+ public function BachListApiTwo(){//补打界面获取补打批次列表
|
|
|
|
|
|
// $session_config=I('session.ly_admin_');//获取登陆的session值
|
|
|
if($_GET['sysCdNm']){//有搜索产品名称
|
|
|
@@ -334,9 +334,9 @@ class NewQcodeController extends AddonController
|
|
|
$where['a.bach_num']=$_GET['prodBth'];
|
|
|
}
|
|
|
|
|
|
- if($_GET['matter_no']){//有搜索产品批次
|
|
|
- $where['a.matter_no']=array('like','%'.$_GET['matter_no'].'%');
|
|
|
- }
|
|
|
+ if($_GET['matter_no']){//有搜索产品批次
|
|
|
+ $where['a.matter_no']=array('like','%'.$_GET['matter_no'].'%');
|
|
|
+ }
|
|
|
|
|
|
if($_GET['startDate']){//有开始打印日期
|
|
|
$statrtime=((int)date('Ymd',(strtotime($_GET['startDate'])))-20000000);
|
|
|
@@ -406,7 +406,7 @@ class NewQcodeController extends AddonController
|
|
|
public function GetLargeLabelApi(){//获取关联批次的大件标签列表
|
|
|
$field = "code,print_date,p_nums,id,code_cp1,l_print,l_status,archive,l_weight,l_num";
|
|
|
$LargeLabelList = M('qcode_large')->field($field)->where('bach_id='.I('get.product_id'))->select();
|
|
|
- // var_dump($LargeLabelList);
|
|
|
+ // var_dump($LargeLabelList);
|
|
|
foreach($LargeLabelList as $key=>$val){
|
|
|
$qcode_small=$val['archive']?"qcode_small_".$val['archive']:"qcode_small";
|
|
|
$smalltotal=M('qcode_small')->field('count(large_id)')->where('large_id='.$val['id'])->find();
|
|
|
@@ -425,42 +425,42 @@ class NewQcodeController extends AddonController
|
|
|
}
|
|
|
|
|
|
public function GetSmallLabelApi(){//获取关联大标签的的小标签列表
|
|
|
- if(I('get.large_id')){//获取小标签列表
|
|
|
- $field="id,code,code_cp1,status,l_flow,p_nums";
|
|
|
- $smalllist=M('qcode_small')
|
|
|
- ->field($field)
|
|
|
- ->where('large_id='.I('get.large_id'))
|
|
|
- ->select();
|
|
|
- $large_data = M('qcode_large')
|
|
|
- ->field('code_cp1')
|
|
|
- ->where('id='.I('get.large_id'))
|
|
|
- ->find();
|
|
|
- $large_flow = ltrim(substr($large_data['code_cp1'],6,10),'0');
|
|
|
- foreach($smalllist as $key=>$val){
|
|
|
- $smalllist[$key]['l_flow']= $large_flow.'-'.$smalllist[$key]['l_flow'];
|
|
|
+ if(I('get.large_id')){//获取小标签列表
|
|
|
+ $field="id,code,code_cp1,status,l_flow,p_nums";
|
|
|
+ $smalllist=M('qcode_small')
|
|
|
+ ->field($field)
|
|
|
+ ->where('large_id='.I('get.large_id'))
|
|
|
+ ->select();
|
|
|
+ $large_data = M('qcode_large')
|
|
|
+ ->field('code_cp1')
|
|
|
+ ->where('id='.I('get.large_id'))
|
|
|
+ ->find();
|
|
|
+ $large_flow = ltrim(substr($large_data['code_cp1'],6,10),'0');
|
|
|
+ foreach($smalllist as $key=>$val){
|
|
|
+ $smalllist[$key]['l_flow']= $large_flow.'-'.$smalllist[$key]['l_flow'];
|
|
|
// if($val['id']>44091){
|
|
|
// $smalllist[$key]['code_cp1']=I('get.large_tuopan').'-'.ltrim(substr($smalllist[$key]['code_cp2'],12,6),'0');}
|
|
|
// else{
|
|
|
// $smalllist[$key]['code_cp1']=I('get.large_tuopan').'-'.ltrim(substr($smalllist[$key]['code_cp1'],6,6),'0');
|
|
|
// };
|
|
|
- }
|
|
|
- $this->ajaxReturn($smalllist);
|
|
|
- }
|
|
|
- if(I('get.code') ){//单个删除
|
|
|
- $field="id,code,status";
|
|
|
- $code=I('get.code');
|
|
|
- $data['status']=1;
|
|
|
- if( M('qcode_small')->where("code='$code'")->save($data)){
|
|
|
- $smalllist['status']=200;
|
|
|
- $smalllist['error']="操作成功";
|
|
|
- }else{
|
|
|
- $smalllist['status']=100;
|
|
|
- $smalllist['error']="操作失败";
|
|
|
- };
|
|
|
- $smalllist['list']=M('qcode_small')->field($field)->where("code='$code'")->select();
|
|
|
+ }
|
|
|
+ $this->ajaxReturn($smalllist);
|
|
|
+ }
|
|
|
+ if(I('get.code') ){//单个删除
|
|
|
+ $field="id,code,status";
|
|
|
+ $code=I('get.code');
|
|
|
+ $data['status']=1;
|
|
|
+ if( M('qcode_small')->where("code='$code'")->save($data)){
|
|
|
+ $smalllist['status']=200;
|
|
|
+ $smalllist['error']="操作成功";
|
|
|
+ }else{
|
|
|
+ $smalllist['status']=100;
|
|
|
+ $smalllist['error']="操作失败";
|
|
|
+ };
|
|
|
+ $smalllist['list']=M('qcode_small')->field($field)->where("code='$code'")->select();
|
|
|
|
|
|
- $this->ajaxReturn($smalllist);
|
|
|
- }
|
|
|
+ $this->ajaxReturn($smalllist);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
public function OneSmallPrint(){//单个打印小标签
|
|
|
@@ -598,7 +598,6 @@ class NewQcodeController extends AddonController
|
|
|
->join('qr_qcode_unit u on u.code=d.matter_no')
|
|
|
->where('c.id='.$val)
|
|
|
->select();
|
|
|
-
|
|
|
if(!$largelabel[$key]){
|
|
|
//转换关系不存在
|
|
|
$this->ajaxReturn(['code'=>1,'msg'=>'该产品转换关系缺失,请联系技术人员']);
|
|
|
@@ -612,7 +611,11 @@ class NewQcodeController extends AddonController
|
|
|
if(in_array($largelabel[$key][0]['matter_no'],$arr)){
|
|
|
$largelabel[$key][0]['is_proportion'] = 1;
|
|
|
}
|
|
|
- $numn = M('qcode_small')->where('large_id='.$val)->count();
|
|
|
+ // $numn = M('qcode_small')->where('large_id='.$val)->count();
|
|
|
+ $numn = M('qcode_small')->where([
|
|
|
+ 'large_id' => $val,
|
|
|
+ 'status' => 0
|
|
|
+ ])->count();
|
|
|
$largelabel[$key][0]['numn']=$numn;
|
|
|
}
|
|
|
if(I('post.sign_type')==2){//打印的为小件标签
|
|
|
@@ -721,40 +724,40 @@ class NewQcodeController extends AddonController
|
|
|
ob_end_clean();
|
|
|
//把生成的base64字符串返回给前端
|
|
|
return 'data:image/png;base64,'.$imageString;
|
|
|
- /* $data = array(
|
|
|
- 'labelcode'=>$url,
|
|
|
- 'code'=>200,
|
|
|
- 'data'=>$imageString,
|
|
|
- 'product_code'=>$url
|
|
|
- );
|
|
|
- $this->ajaxReturn($data);*/
|
|
|
+ /* $data = array(
|
|
|
+ 'labelcode'=>$url,
|
|
|
+ 'code'=>200,
|
|
|
+ 'data'=>$imageString,
|
|
|
+ 'product_code'=>$url
|
|
|
+ );
|
|
|
+ $this->ajaxReturn($data);*/
|
|
|
}
|
|
|
|
|
|
public function changestatus(){//动态改变小标签的状态
|
|
|
- $data['status']=I('get.status');
|
|
|
- if(M('qcode_small')->where('id='.I('get.id'))->save($data)){
|
|
|
- $bach_id=M('qcode_large')->field('bach_id')->where('id='.I('get.large_id'))->find();//获取批次id
|
|
|
- $small_num=M('qcode_bach')->field('small_num')->where('id='.$bach_id['bach_id'])->find();//获取批次原有的小标签数量
|
|
|
- if(I('get.status')=='0'){
|
|
|
- //表示已删除的标签变为正常,批次小件数量加一
|
|
|
- $infos['small_num']=$small_num['small_num']+1;
|
|
|
- M('qcode_bach')->where('id='.$bach_id['bach_id'])->save($infos);//更新批次的小标签数量
|
|
|
- // echo M('qcode_bach')->getLastSql();
|
|
|
- }
|
|
|
- if(I('get.status')=='1'){
|
|
|
- //表示正常的标签变为已删除,批次小件数量减一
|
|
|
- $infos['small_num']=$small_num['small_num']-1;
|
|
|
- M('qcode_bach')->where('id='.$bach_id['bach_id'])->save($infos);//更新批次的小标签数量
|
|
|
- //echo M('qcode_bach')->getLastSql();
|
|
|
- }
|
|
|
- $info['code']=200;
|
|
|
- $info['error']="操作成功";
|
|
|
- }else{
|
|
|
- $info['code']=100;
|
|
|
- $info['error']="操作失败";
|
|
|
- };
|
|
|
-
|
|
|
- $this->ajaxReturn($info);
|
|
|
+ $data['status']=I('get.status');
|
|
|
+ if(M('qcode_small')->where('id='.I('get.id'))->save($data)){
|
|
|
+ $bach_id=M('qcode_large')->field('bach_id')->where('id='.I('get.large_id'))->find();//获取批次id
|
|
|
+ $small_num=M('qcode_bach')->field('small_num')->where('id='.$bach_id['bach_id'])->find();//获取批次原有的小标签数量
|
|
|
+ if(I('get.status')=='0'){
|
|
|
+ //表示已删除的标签变为正常,批次小件数量加一
|
|
|
+ $infos['small_num']=$small_num['small_num']+1;
|
|
|
+ M('qcode_bach')->where('id='.$bach_id['bach_id'])->save($infos);//更新批次的小标签数量
|
|
|
+ // echo M('qcode_bach')->getLastSql();
|
|
|
+ }
|
|
|
+ if(I('get.status')=='1'){
|
|
|
+ //表示正常的标签变为已删除,批次小件数量减一
|
|
|
+ $infos['small_num']=$small_num['small_num']-1;
|
|
|
+ M('qcode_bach')->where('id='.$bach_id['bach_id'])->save($infos);//更新批次的小标签数量
|
|
|
+ //echo M('qcode_bach')->getLastSql();
|
|
|
+ }
|
|
|
+ $info['code']=200;
|
|
|
+ $info['error']="操作成功";
|
|
|
+ }else{
|
|
|
+ $info['code']=100;
|
|
|
+ $info['error']="操作失败";
|
|
|
+ };
|
|
|
+
|
|
|
+ $this->ajaxReturn($info);
|
|
|
}
|
|
|
|
|
|
|