|
|
@@ -68,39 +68,30 @@ class FinishedProductWarehousing extends Api
|
|
|
if(!$this->request->isGet()){
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
-// $sql = 'SELECT DISTINCT Gd_客户代号 FROM `工单_基本资料` ORDER BY Gd_客户代号 DESC';
|
|
|
-// $rows = db()->query($sql);
|
|
|
- $rows = db()->table('成品入仓')->alias('c')
|
|
|
- ->field('g.Gd_khdh')
|
|
|
- ->join('工单_基本资料 g','c.jjcp_gdbh = g.Gd_gdbh')
|
|
|
-// ->distinct('g.Gd_khdh')
|
|
|
- ->order('c.Sys_rq desc')
|
|
|
- ->select();
|
|
|
-halt($rows);
|
|
|
- $arr = db()->table('成品入仓')
|
|
|
- ->field('sczl_gdbh,rtrim(sys_id) as sys_id')
|
|
|
- ->where('sczl_gdbh','>=',$rows[64]['sczl_gdbh'])
|
|
|
+
|
|
|
+ $rows = db()->table('成品入仓')
|
|
|
+ ->field('jjcp_gdbh, rtrim(jjcp_cpdh) as jjcp_cpdh, LEFT(Sys_rq, 10) as Sys_rq')
|
|
|
+ ->order('Sys_rq desc')
|
|
|
->select();
|
|
|
+ $arr = db()->table('工单_基本资料')
|
|
|
+ ->column('CONCAT(Gd_gdbh, "-", rtrim(Gd_cpdh)) AS gdcp, CONCAT(rtrim(Gd_khdh), " 【", rtrim(Gd_khmc)) AS kh');
|
|
|
|
|
|
- $brr = [];
|
|
|
- foreach($arr as $k=>$v){
|
|
|
- if(array_key_exists($v['sczl_gdbh'],$brr)){
|
|
|
- if(array_key_exists($v['sys_id'],$brr[$v['sczl_gdbh']])){
|
|
|
- $brr[$v['sczl_gdbh']][$v['sys_id']] += 1;
|
|
|
- }else{
|
|
|
- $brr[$v['sczl_gdbh']][$v['sys_id']] = 1;
|
|
|
- }
|
|
|
- }else{
|
|
|
- $brr[$v['sczl_gdbh']][$v['sys_id']] = 1;
|
|
|
+ $data = [];
|
|
|
+ foreach ($rows as $value) {
|
|
|
+ $key = $value['jjcp_gdbh'].'-'.$value['jjcp_cpdh'];
|
|
|
+ if (isset($arr[$key]) && !isset($data[$arr[$key]])) {
|
|
|
+ $data[$arr[$key]] = $value['Sys_rq'];
|
|
|
}
|
|
|
}
|
|
|
+ // 对键进行升序排序
|
|
|
+ uksort($data, function($a, $b) use ($data) {
|
|
|
+ if ($data[$a] == $data[$b]) {
|
|
|
+ return ($a > $b) ? 1 : -1; // 在值相同的情况下,根据键进行升序排列
|
|
|
+ }
|
|
|
+ return ($data[$a] < $data[$b]) ? 1 : -1;
|
|
|
+ });
|
|
|
|
|
|
- foreach($rows as $key=>$value){
|
|
|
- $rows[$key]['sys'] = $brr[$value['sczl_gdbh']];
|
|
|
- $rows[$key]['yj_yjmc'] = trim($value['yj_yjmc']);
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('成功',$rows);
|
|
|
+ $this->success('成功',$data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -116,7 +107,7 @@ halt($rows);
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
- if (!isset($req['date']) || empty($req['date'])) $this->error('参数缺失');
|
|
|
+ if (!isset($req['date'])) $this->error('参数缺失');
|
|
|
|
|
|
$page = 1;
|
|
|
$limit = 15;
|
|
|
@@ -127,8 +118,8 @@ halt($rows);
|
|
|
$where = ['c.Sys_rq'=>['like','%'.$req['date'].'%']];
|
|
|
$option = ['Sys_rq'=>['like','%'.$req['date'].'%']];
|
|
|
}else{
|
|
|
- $where = ['c.sczl_gdbh'=>$req['date']];
|
|
|
- $option = ['sczl_gdbh'=>$req['date']];
|
|
|
+ $where = [];
|
|
|
+ $option = [];
|
|
|
}
|
|
|
if (isset($req['sys_id']) && !empty($req['sys_id'])){
|
|
|
$where['c.Sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
@@ -140,15 +131,13 @@ halt($rows);
|
|
|
->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称,
|
|
|
rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh,
|
|
|
c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj,
|
|
|
- rtrim(c.jjcp_smb) as jjcp_smb, rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc,
|
|
|
- rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
- rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, g.Gd_khdh, rtrim(g.Gd_khdh) as Gd_khdh, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
+ rtrim(c.jjcp_smb) as jjcp_smb, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
+ rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称,
|
|
|
+ rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,4) as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
|
|
|
->where($where)
|
|
|
- ->where('y.yj_Yjno=c.jjcp_yjno')
|
|
|
->where('g.Gd_cpdh=c.jjcp_cpdh')
|
|
|
->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
|
|
|
- ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
|
|
|
->order('c.UniqId desc')
|
|
|
->page($page,$limit)
|
|
|
->select();
|
|
|
@@ -157,7 +146,7 @@ halt($rows);
|
|
|
foreach ($rows as $key=>$value) {
|
|
|
$row = db()->table('成品入仓')
|
|
|
->field('LEFT(Sys_rq, 10) as Sys_rq,jjcp_sl')
|
|
|
- ->where('jjcp_gdbh',$value['jjcp_gdbh'])
|
|
|
+ ->where(['jjcp_gdbh'=>$value['jjcp_gdbh'], 'jjcp_cpdh'=>$value['jjcp_cpdh']])
|
|
|
->order('Sys_rq desc')
|
|
|
->select();
|
|
|
$rows[$key]['jjcp_sls'] = 0;
|
|
|
@@ -213,7 +202,7 @@ halt($rows);
|
|
|
c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj,
|
|
|
rtrim(c.jjcp_smb) as jjcp_smb, rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc,
|
|
|
rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
- rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, g.Gd_khdh, rtrim(g.Gd_khdh) as Gd_khdh, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
+ rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,4) as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
|
|
|
->where($where)
|
|
|
->where('y.yj_Yjno=c.jjcp_yjno')
|
|
|
@@ -239,7 +228,7 @@ halt($rows);
|
|
|
c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj,
|
|
|
rtrim(c.jjcp_smb) as jjcp_smb, rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc,
|
|
|
rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
- rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, g.Gd_khdh, rtrim(g.Gd_khdh) as Gd_khdh, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
+ rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,4) as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
|
|
|
->where($where)
|
|
|
->where('y.yj_Yjno=c.jjcp_yjno')
|
|
|
@@ -257,7 +246,7 @@ halt($rows);
|
|
|
foreach ($rows as $key=>$value) {
|
|
|
$row = db()->table('成品入仓')
|
|
|
->field('LEFT(Sys_rq, 10) as Sys_rq,jjcp_sl')
|
|
|
- ->where('jjcp_gdbh',$value['jjcp_gdbh'])
|
|
|
+ ->where(['jjcp_gdbh'=>$value['jjcp_gdbh'], 'jjcp_cpdh'=>$value['jjcp_cpdh']])
|
|
|
->order('Sys_rq desc')
|
|
|
->select();
|
|
|
$rows[$key]['jjcp_sls'] = 0;
|
|
|
@@ -303,35 +292,56 @@ halt($rows);
|
|
|
->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称,
|
|
|
rtrim(c.jjcp_num) as jjcp_num,
|
|
|
c.jjcp_gdbh, c.jjcp_yjno, rtrim(c.订单编号) as 订单编号,
|
|
|
- rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc,
|
|
|
rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
+ rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称,
|
|
|
rtrim(c.客户料号) as 客户料号,
|
|
|
rtrim(c.jjcp_smb) as jjcp_smb, LEFT(c.jjcp_sj, 10) as jjcp_sj,
|
|
|
c.jjcp_sl, rtrim(c.jjcp_dw) as jjcp_dw,
|
|
|
- g.订单数量, rtrim(c.机型备注) as 机型备注, rtrim(c.jjcp_desc) as jjcp_desc,
|
|
|
+ g.订单数量*10000 as 订单数量, rtrim(c.机型备注) as 机型备注, rtrim(c.jjcp_desc) as jjcp_desc,
|
|
|
rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
|
|
|
->where('c.UniqId',$UniqId)
|
|
|
- ->where('y.yj_Yjno=c.jjcp_yjno')
|
|
|
->where('g.Gd_cpdh=c.jjcp_cpdh')
|
|
|
->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
|
|
|
- ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
|
|
|
->find();
|
|
|
+
|
|
|
$rows['jjcp_sls'] = db()->table('成品入仓')
|
|
|
- ->where('jjcp_gdbh',$rows['jjcp_gdbh'])
|
|
|
- ->order('Sys_rq desc')
|
|
|
+ ->where(['jjcp_gdbh'=>$rows['jjcp_gdbh'], 'jjcp_cpdh'=>$rows['jjcp_cpdh']])
|
|
|
->sum('jjcp_sl');
|
|
|
- $rows['订单数量'] = floatval($rows['订单数量']*10000);
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取仓库信息
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string keyword 关键词
|
|
|
+ */
|
|
|
+ public function getCk()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+ $key_word = '';
|
|
|
+ if (isset($req['key_word']) && !empty($req['key_word'])){
|
|
|
+ $key_word = $req['key_word'];
|
|
|
+ }
|
|
|
+ $rs = db()->table('物料_仓库信息')
|
|
|
+ ->field('rtrim(编号) as 编号, rtrim(名称) as 名称')
|
|
|
+ ->where('编号|名称','like','%'.$key_word.'%')
|
|
|
+ ->where('名称','in',['面材仓库','主要产成品'])
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ $this->success('成功',$rs);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询印件工序及产品名称
|
|
|
* @ApiMethod (GET)
|
|
|
* @param string $gdbh 工单编号
|
|
|
- * @param string $gxmc 工序名称
|
|
|
*/
|
|
|
- public function getGxMc()
|
|
|
+ public function getGd()
|
|
|
{
|
|
|
//get请求
|
|
|
if(!$this->request->isGet()){
|
|
|
@@ -343,69 +353,73 @@ halt($rows);
|
|
|
}else{
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $gxmc = ['包装','成品防护'];
|
|
|
-
|
|
|
- $gxmcs = [];
|
|
|
- foreach ($gxmc as $k=>$v){
|
|
|
- array_push($gxmcs,['like','%'.$v.'%']);
|
|
|
- }
|
|
|
- array_push($gxmcs,'OR');
|
|
|
|
|
|
$rows = db()->table('工单_基本资料')->alias('g')
|
|
|
- ->field('rtrim(g.Gd_cpmc) as Gd_cpmc, c.Gy0_yjno, c.Gy0_gxh, rtrim(c.Gy0_gxmc) as Gy0_gxmc')
|
|
|
+ ->field('g.Gd_gdbh, j.yj_yjno, rtrim(g.销售订单号) as 销售订单号, rtrim(j.yj_Yjdh) as yj_Yjdh, rtrim(j.yj_yjmc) as yj_yjmc, rtrim(g.成品代号) as 成品代号, rtrim(g.成品名称) as 成品名称, rtrim(g.客户料号) as 客户料号')
|
|
|
->where(['g.Gd_gdbh'=>$gdbh])
|
|
|
- ->where(['c.Gy0_gxmc'=>$gxmcs])
|
|
|
->join(['产品_印件资料'=>'j'],'g.Gd_cpdh=j.yj_yjdh and g.成品代号=j.yj_cpdh')
|
|
|
- ->join(['工单_工艺资料'=>'c'],'c.Gy0_gdbh=g.Gd_gdbh and c.Gy0_yjno=j.yj_yjno')
|
|
|
+ ->order('j.yj_yjno asc')
|
|
|
->select();
|
|
|
|
|
|
foreach ($rows as $key=>$value){
|
|
|
- $rows[$key]['jyGx'] = sprintf("%02d", $value['Gy0_yjno']).'-'.$value['Gy0_gxh'];
|
|
|
+ $rows[$key]['gdyj'] = $value['Gd_gdbh'].' -'.sprintf("%02d", $value['yj_yjno']).'-'.$value['yj_yjmc'];
|
|
|
}
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 查询员工名称
|
|
|
+ * 查询工单数量
|
|
|
* @ApiMethod (GET)
|
|
|
- * @param string $sczl_bh 员工编号
|
|
|
+ * @param string $gdbh 工单编号
|
|
|
+ * @param string $cpdh 产品代号
|
|
|
+ * @param string $rcsl 入仓数量
|
|
|
*/
|
|
|
- public function getYg()
|
|
|
+ public function getGdsl()
|
|
|
{
|
|
|
//get请求
|
|
|
if(!$this->request->isGet()){
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
- if (isset($req['sczl_bh']) && !empty($req['sczl_bh'])){
|
|
|
- $sczl_bh = $req['sczl_bh'];
|
|
|
+ if (isset($req['gdbh']) && !empty($req['gdbh'])){
|
|
|
+ $gdbh = $req['gdbh'];
|
|
|
}else{
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $rs = db()->table('人事_基本资料')->field('rtrim(员工姓名) as ygxm')->where('员工编号',$sczl_bh)->find();
|
|
|
- if(!$rs){
|
|
|
- $this->error('失败');
|
|
|
+ if (isset($req['cpdh']) && !empty($req['cpdh'])){
|
|
|
+ $cpdh = $req['cpdh'];
|
|
|
+ }else{
|
|
|
+ $this->error('参数错误');
|
|
|
}
|
|
|
- $this->success('成功',$rs);
|
|
|
- }
|
|
|
+// if (isset($req['rcsl'])){
|
|
|
+// $rcsl = $req['rcsl'];
|
|
|
+// }else{
|
|
|
+// $this->error('参数错误');
|
|
|
+// }
|
|
|
+
|
|
|
+ $rows = db()->table('工单_基本资料')->alias('g')
|
|
|
+ ->field('订单数量*10000 as 订单数量, gd_statu')
|
|
|
+ ->where(['Gd_gdbh'=>$gdbh, 'Gd_cpdh'=>$cpdh])
|
|
|
+ ->find();
|
|
|
|
|
|
+ if (!$rows) $this->error('未查询到记录');
|
|
|
+
|
|
|
+ $rows['jjcp_sls'] = db()->table('成品入仓')
|
|
|
+ ->where(['jjcp_gdbh'=>$gdbh, 'jjcp_cpdh'=>$cpdh])
|
|
|
+ ->sum('jjcp_sl');
|
|
|
+
|
|
|
+// if ($rows['订单数量']<($rows['jjcp_sls']+$rcsl) || mb_substr($rows['gd_statu'],-3,3)=='已完工'){
|
|
|
+// $this->error('已完工或入仓数量超过订单数量',$rows);
|
|
|
+// }
|
|
|
+
|
|
|
+ $this->success('成功',$rows);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 新增
|
|
|
* @ApiMethod (POST)
|
|
|
- * @param string 'sys_id','sczl_rq', 'sczl_bh', 'sczl_jsss', 'sczl_冲定额', 'sczl_bzdh',
|
|
|
- 'sczl_gdbh1', 'sczl_gdbh2', 'sczl_gdbh3', 'sczl_gdbh4', 'sczl_gdbh5', 'sczl_gdbh6',
|
|
|
- 'sczl_yjGx1', 'sczl_yjGx2', 'sczl_yjGx3', 'sczl_yjGx4', 'sczl_yjGx5', 'sczl_yjGx6',
|
|
|
- 'sczl_gxmc1', 'sczl_gxmc2', 'sczl_gxmc3', 'sczl_gxmc4', 'sczl_gxmc5', 'sczl_gxmc6',
|
|
|
- 'sczl_cl1', 'sczl_cl2', 'sczl_cl3', 'sczl_cl4', 'sczl_cl5', 'sczl_cl6',
|
|
|
- 'sczl_PgCl1', 'sczl_PgCl2', 'sczl_PgCl3', 'sczl_PgCl4', 'sczl_PgCl5', 'sczl_PgCl6',
|
|
|
- 'sczl_返工产量1', 'sczl_返工产量2', 'sczl_返工产量3', 'sczl_返工产量4', 'sczl_返工产量5', 'sczl_返工产量6',
|
|
|
- 'sczl_计产系数1', 'sczl_计产系数2', 'sczl_计产系数3', 'sczl_计产系数4', 'sczl_计产系数5', 'sczl_计产系数6',
|
|
|
- 'sczl_Jtbh1','sczl_Jtbh2', 'sczl_Jtbh3', 'sczl_Jtbh4', 'sczl_Jtbh5', 'sczl_Jtbh6',
|
|
|
- 'sczl_dedh1', 'sczl_dedh2', 'sczl_dedh3', 'sczl_dedh4', 'sczl_dedh5', 'sczl_dedh6',
|
|
|
- 'sczl_desc'
|
|
|
+ * @param string
|
|
|
*/
|
|
|
public function add()
|
|
|
{
|
|
|
@@ -414,17 +428,17 @@ halt($rows);
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
$arr = [
|
|
|
- 'sys_id','sczl_rq', 'sczl_bh', 'sczl_jsss', 'sczl_冲定额', 'sczl_bzdh',
|
|
|
- 'sczl_gdbh1', 'sczl_gdbh2', 'sczl_gdbh3', 'sczl_gdbh4', 'sczl_gdbh5', 'sczl_gdbh6',
|
|
|
- 'sczl_yjGx1', 'sczl_yjGx2', 'sczl_yjGx3', 'sczl_yjGx4', 'sczl_yjGx5', 'sczl_yjGx6',
|
|
|
- 'sczl_gxmc1', 'sczl_gxmc2', 'sczl_gxmc3', 'sczl_gxmc4', 'sczl_gxmc5', 'sczl_gxmc6',
|
|
|
- 'sczl_cl1', 'sczl_cl2', 'sczl_cl3', 'sczl_cl4', 'sczl_cl5', 'sczl_cl6',
|
|
|
- 'sczl_PgCl1', 'sczl_PgCl2', 'sczl_PgCl3', 'sczl_PgCl4', 'sczl_PgCl5', 'sczl_PgCl6',
|
|
|
- 'sczl_返工产量1', 'sczl_返工产量2', 'sczl_返工产量3', 'sczl_返工产量4', 'sczl_返工产量5', 'sczl_返工产量6',
|
|
|
- 'sczl_计产系数1', 'sczl_计产系数2', 'sczl_计产系数3', 'sczl_计产系数4', 'sczl_计产系数5', 'sczl_计产系数6',
|
|
|
- 'sczl_Jtbh1','sczl_Jtbh2', 'sczl_Jtbh3', 'sczl_Jtbh4', 'sczl_Jtbh5', 'sczl_Jtbh6',
|
|
|
- 'sczl_dedh1', 'sczl_dedh2', 'sczl_dedh3', 'sczl_dedh4', 'sczl_dedh5', 'sczl_dedh6',
|
|
|
- 'sczl_desc'
|
|
|
+ 'Sys_id',
|
|
|
+ '入仓类型', '仓库编号', '仓库名称',
|
|
|
+ 'jjcp_num',
|
|
|
+ 'jjcp_gdbh', 'jjcp_yjno', '订单编号',
|
|
|
+ 'jjcp_cpdh', 'jjcp_cpmc',
|
|
|
+ '成品编码', '成品名称',
|
|
|
+ '客户料号',
|
|
|
+ 'jjcp_smb', 'jjcp_sj',
|
|
|
+ 'jjcp_sl', 'jjcp_dw',
|
|
|
+ '机型备注',
|
|
|
+ 'jjcp_desc'
|
|
|
];
|
|
|
$data = [];
|
|
|
foreach ($arr as $key => $value){
|
|
|
@@ -433,7 +447,7 @@ halt($rows);
|
|
|
}
|
|
|
$data[$value] = $req[$value];
|
|
|
}
|
|
|
- $data['sys_rq'] = date('Y-m-d H:i:s');
|
|
|
+ $data['Sys_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
|
//开启事务
|
|
|
db()->startTrans();
|
|
|
@@ -457,13 +471,6 @@ halt($rows);
|
|
|
/**
|
|
|
* 修改
|
|
|
* @ApiMethod (POST)
|
|
|
- * @param string 'UniqId','sczl_rq',
|
|
|
- 'sczl_gdbh1', 'sczl_gdbh2', 'sczl_gdbh3', 'sczl_gdbh4', 'sczl_gdbh5', 'sczl_gdbh6',
|
|
|
- 'sczl_yjGx1', 'sczl_yjGx2', 'sczl_yjGx3', 'sczl_yjGx4', 'sczl_yjGx5', 'sczl_yjGx6',
|
|
|
- 'sczl_gxmc1', 'sczl_gxmc2', 'sczl_gxmc3', 'sczl_gxmc4', 'sczl_gxmc5', 'sczl_gxmc6',
|
|
|
- 'sczl_cl1', 'sczl_cl2', 'sczl_cl3', 'sczl_cl4', 'sczl_cl5', 'sczl_cl6',
|
|
|
- 'sczl_PgCl1', 'sczl_PgCl2', 'sczl_PgCl3', 'sczl_PgCl4', 'sczl_PgCl5', 'sczl_PgCl6',
|
|
|
- 'sczl_clAdd1', 'sczl_clAdd2', 'sczl_clAdd3', 'sczl_clAdd4', 'sczl_clAdd5', 'sczl_clAdd6'
|
|
|
*/
|
|
|
public function edit()
|
|
|
{
|
|
|
@@ -472,17 +479,16 @@ halt($rows);
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
$arr = [
|
|
|
- 'sys_id','sczl_rq', 'sczl_bh', 'sczl_jsss', 'sczl_冲定额', 'sczl_bzdh',
|
|
|
- 'sczl_gdbh1', 'sczl_gdbh2', 'sczl_gdbh3', 'sczl_gdbh4', 'sczl_gdbh5', 'sczl_gdbh6',
|
|
|
- 'sczl_yjGx1', 'sczl_yjGx2', 'sczl_yjGx3', 'sczl_yjGx4', 'sczl_yjGx5', 'sczl_yjGx6',
|
|
|
- 'sczl_gxmc1', 'sczl_gxmc2', 'sczl_gxmc3', 'sczl_gxmc4', 'sczl_gxmc5', 'sczl_gxmc6',
|
|
|
- 'sczl_cl1', 'sczl_cl2', 'sczl_cl3', 'sczl_cl4', 'sczl_cl5', 'sczl_cl6',
|
|
|
- 'sczl_PgCl1', 'sczl_PgCl2', 'sczl_PgCl3', 'sczl_PgCl4', 'sczl_PgCl5', 'sczl_PgCl6',
|
|
|
- 'sczl_返工产量1', 'sczl_返工产量2', 'sczl_返工产量3', 'sczl_返工产量4', 'sczl_返工产量5', 'sczl_返工产量6',
|
|
|
- 'sczl_计产系数1', 'sczl_计产系数2', 'sczl_计产系数3', 'sczl_计产系数4', 'sczl_计产系数5', 'sczl_计产系数6',
|
|
|
- 'sczl_Jtbh1','sczl_Jtbh2', 'sczl_Jtbh3', 'sczl_Jtbh4', 'sczl_Jtbh5', 'sczl_Jtbh6',
|
|
|
- 'sczl_dedh1', 'sczl_dedh2', 'sczl_dedh3', 'sczl_dedh4', 'sczl_dedh5', 'sczl_dedh6',
|
|
|
- 'sczl_desc'
|
|
|
+ '入仓类型', '仓库编号', '仓库名称',
|
|
|
+ 'jjcp_num',
|
|
|
+ 'jjcp_gdbh', 'jjcp_yjno', '订单编号',
|
|
|
+ 'jjcp_cpdh', 'jjcp_cpmc',
|
|
|
+ '成品编码', '成品名称',
|
|
|
+ '客户料号',
|
|
|
+ 'jjcp_smb', 'jjcp_sj',
|
|
|
+ 'jjcp_sl', 'jjcp_dw',
|
|
|
+ '机型备注',
|
|
|
+ 'jjcp_desc'
|
|
|
];
|
|
|
$data = [];
|
|
|
foreach ($arr as $key => $value){
|
|
|
@@ -497,7 +503,7 @@ halt($rows);
|
|
|
if (count($data)==0){
|
|
|
$this->error('参数错误','',111);
|
|
|
}
|
|
|
- $data['mod_rq'] = date('Y-m-d H:i:s');
|
|
|
+ $data['Mod_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
|
//开启事务
|
|
|
db()->startTrans();
|
|
|
@@ -552,21 +558,20 @@ halt($rows);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出到excel
|
|
|
+ * 月度A
|
|
|
* @ApiMethod (POST)
|
|
|
- * @param string gxmc
|
|
|
* @param string start_time
|
|
|
* @param string end_time
|
|
|
* @param string file_name
|
|
|
* @param array fields
|
|
|
*/
|
|
|
- public function processExport(){
|
|
|
- if(!$this->request->isPost()){
|
|
|
+ public function monthExportA(){
|
|
|
+ if(!$this->request->isGet()){
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
$arr = [
|
|
|
- 'gxmc','start_time', 'end_time', 'file_name'
|
|
|
+ 'start_time', 'end_time', 'file_name'
|
|
|
];
|
|
|
foreach ($arr as $key => $value){
|
|
|
if (!isset($req[$value])){
|
|
|
@@ -576,80 +581,48 @@ halt($rows);
|
|
|
if (!(isset($req['fields']) && count($req['fields'])!=0)){
|
|
|
$this->error('参数错误','fields',100);
|
|
|
}
|
|
|
- $field = '';
|
|
|
+
|
|
|
$arr = [
|
|
|
- 'sczl_rq' =>['日期','LEFT(sczl_rq, 10) as sczl_rq'],
|
|
|
- 'sczl_bh' =>['员工编号','sczl_bh'],
|
|
|
- 'sczl_name' =>['员工姓名','sczl_bh'],
|
|
|
- 'sczl_jsss' =>['计时时数','sczl_jsss'],
|
|
|
- 'sczl_gdbh' =>['工单编号','sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6'],
|
|
|
- 'sczl_yjmc' =>['印件名称','sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6'],
|
|
|
- 'sczl_yjGx' =>['印件工序','rtrim(sczl_yjGx1) as sczl_yjGx1, rtrim(sczl_yjGx2) as sczl_yjGx2, rtrim(sczl_yjGx3) as sczl_yjGx3, rtrim(sczl_yjGx4) as sczl_yjGx4, rtrim(sczl_yjGx5) as sczl_yjGx5, rtrim(sczl_yjGx6) as sczl_yjGx6'],
|
|
|
- 'sczl_gxmc' =>['工序名称','rtrim(sczl_gxmc1) as sczl_gxmc1, rtrim(sczl_gxmc2) as sczl_gxmc2, rtrim(sczl_gxmc3) as sczl_gxmc3, rtrim(sczl_gxmc4) as sczl_gxmc4, rtrim(sczl_gxmc5) as sczl_gxmc5, rtrim(sczl_gxmc6) as sczl_gxmc6'],
|
|
|
- 'sczl_cl' =>['产量','sczl_cl1, sczl_cl2, sczl_cl3, sczl_cl4, sczl_cl5, sczl_cl6'],
|
|
|
- 'sczl_PgCl' =>['每箱产量','sczl_PgCl1, sczl_PgCl2, sczl_PgCl3, sczl_PgCl4, sczl_PgCl5, sczl_PgCl6'],
|
|
|
- 'sczl_计产系数' =>['计产系数','sczl_计产系数1, sczl_计产系数2, sczl_计产系数3, sczl_计产系数4, sczl_计产系数5, sczl_计产系数6'],
|
|
|
- 'sczl_dedh' =>['定额代号','rtrim(sczl_dedh1) as sczl_dedh1, rtrim(sczl_dedh2) as sczl_dedh2, rtrim(sczl_dedh3) as sczl_dedh3, rtrim(sczl_dedh4) as sczl_dedh4, rtrim(sczl_dedh5) as sczl_dedh5, rtrim(sczl_dedh6) as sczl_dedh6']
|
|
|
+ '入仓类型' =>['入仓类型'],
|
|
|
+ '仓库编号' =>['仓库编号'],
|
|
|
+ '仓库名称' =>['仓库名称'],
|
|
|
+ 'jjcp_gdbh' =>['工单编号'],
|
|
|
+ 'jjcp_cpdh' =>['入仓存货编号'],
|
|
|
+ 'jjcp_cpmc' =>['入仓存货名称'],
|
|
|
+ 'jjcp_sl' =>['入仓数量'],
|
|
|
+ 'jjcp_dw' =>['单位'],
|
|
|
+ 'jjcp_sj' =>['入仓时间'],
|
|
|
+ 'jjcp_smb' =>['首末板'],
|
|
|
+ 'jjcp_num' =>['单据编号'],
|
|
|
+ '订单编号' =>['订单编号'],
|
|
|
];
|
|
|
$data[0] = [];
|
|
|
foreach ($req['fields'] as $k=>$v){
|
|
|
if(array_key_exists($v,$arr)){
|
|
|
- if ($k==0){
|
|
|
- $field .= $arr[$v][1];
|
|
|
- }else{
|
|
|
- $field .= ','.$arr[$v][1];
|
|
|
- }
|
|
|
array_push($data[0],$arr[$v][0]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //根据条件查询数据
|
|
|
- $rows = db()->table('成品入仓')
|
|
|
- ->field($field)
|
|
|
- ->where('sczl_rq','between',[$req['start_time'],$req['end_time']])
|
|
|
- ->where(['sczl_gxmc1|sczl_gxmc2|sczl_gxmc3|sczl_gxmc4|sczl_gxmc5|sczl_gxmc6'=>['like','%'.$req['gxmc'].'%']])
|
|
|
+ //客户编号
|
|
|
+ $rows = db()->table('成品入仓')->alias('c')
|
|
|
+ ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称,
|
|
|
+ c.jjcp_gdbh, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
+ c.jjcp_sl, rtrim(c.jjcp_dw) as jjcp_dw, c.jjcp_sj,
|
|
|
+ rtrim(c.jjcp_smb) as jjcp_smb,
|
|
|
+ rtrim(c.jjcp_num) as jjcp_num, rtrim(g.销售订单号) as 订单编号
|
|
|
+ ')
|
|
|
+ ->where('c.jjcp_sj','between time',[$req['start_time'], $req['end_time']])
|
|
|
+ ->order('c.jjcp_sj asc')
|
|
|
+ ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
|
|
|
+ ->where('g.Gd_cpdh=c.jjcp_cpdh')
|
|
|
->select();
|
|
|
- $gd = db()->table('工单_基本资料')->column('Gd_gdbh, Gd_cpmc');
|
|
|
- $rs = db()->table('人事_基本资料')->column('员工编号, 员工姓名');
|
|
|
-
|
|
|
- for ($i = 1; $i <= 6; $i++) {
|
|
|
- foreach ($rows as $key=>$value){
|
|
|
- if (trim($value['sczl_gdbh'.$i])=='') continue;
|
|
|
- if (trim($value['sczl_gxmc'.$i])!=$req['gxmc']) continue;
|
|
|
- $subArray = [];
|
|
|
- foreach ($req['fields'] as $k=>$v){
|
|
|
- if(array_key_exists($v,$arr)){
|
|
|
- if($v=='sczl_rq' || $v=='sczl_jsss' || $v=='sczl_bh'){
|
|
|
- if($value[$v]){
|
|
|
- array_push($subArray,$value[$v]);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
- }
|
|
|
- }else if($v=='sczl_name'){
|
|
|
- $name = array_key_exists($value['sczl_bh'],$rs) ? trim($rs[$value['sczl_bh']]) : '';
|
|
|
- if($name){
|
|
|
- array_push($subArray,$name);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
- }
|
|
|
- }else if($v=='sczl_yjmc'){
|
|
|
- $cpmc = array_key_exists($value['sczl_gdbh'.$i],$gd) ? trim($gd[$value['sczl_gdbh'.$i]]) : '';
|
|
|
- if($cpmc){
|
|
|
- array_push($subArray,$cpmc);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($value[$v.$i]){
|
|
|
- array_push($subArray,$value[$v.$i]);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- array_push($data,$subArray);
|
|
|
+
|
|
|
+ foreach ($rows as $key=>$value) {
|
|
|
+ $subArray = [];
|
|
|
+ foreach ($arr as $k=>$v){
|
|
|
+ $subArray[$k] = $rows[$key][$k];
|
|
|
}
|
|
|
+ array_push($data,$subArray);
|
|
|
}
|
|
|
|
|
|
$this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
|
|
|
@@ -668,71 +641,102 @@ halt($rows);
|
|
|
}
|
|
|
$req = $this->request->param();
|
|
|
|
|
|
- $where = [];
|
|
|
- if (isset($req['date']) && !empty($req['date'])){
|
|
|
- $where['sys_rq'] = ['LIKE',$req['date'].'%'];
|
|
|
- }else{
|
|
|
- $this->error('参数错误');
|
|
|
- }
|
|
|
- if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
+ if (!isset($req['date']) || empty($req['date'])) $this->error('参数缺失');
|
|
|
+
|
|
|
if (!(isset($req['fields']) && count($req['fields'])!=0)){
|
|
|
$this->error('参数错误','fields',100);
|
|
|
}
|
|
|
|
|
|
- $field = '';
|
|
|
+ if(strpos($req['date'],'-')){
|
|
|
+ $where = ['c.Sys_rq'=>['like','%'.$req['date'].'%']];
|
|
|
+ }else{
|
|
|
+ $where = ['c.jjcp_gdbh'=>$req['date']];
|
|
|
+ }
|
|
|
+ if (isset($req['sys_id']) && !empty($req['sys_id'])){
|
|
|
+ $where['c.Sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
+ }
|
|
|
+
|
|
|
$arr = [
|
|
|
- 'sczl_bh' =>['员工编号','sczl_bh'],
|
|
|
- 'sczl_name' =>['员工姓名','sczl_bh'],
|
|
|
- 'sczl_rq' =>['生产日期','LEFT(sczl_rq, 10) as sczl_rq'],
|
|
|
- 'sczl_bzdh' =>['班组','sczl_bzdh'],
|
|
|
- 'sczl_cl' =>['包装产量','sczl_cl1 + sczl_cl2 + sczl_cl3 + sczl_cl4 + sczl_cl5 + sczl_cl6 as sczl_cl'],
|
|
|
- 'sczl_fgcl' =>['返工产量','sczl_返工产量1 + sczl_返工产量2 + sczl_返工产量3 + sczl_返工产量4 + sczl_返工产量5 + sczl_返工产量6 as sczl_fgcl'],
|
|
|
- 'sczl_jjcl' =>['计件产量','sczl_cl1 + sczl_cl2 + sczl_cl3 + sczl_cl4 + sczl_cl5 + sczl_cl6 + sczl_返工产量1 + sczl_返工产量2 + sczl_返工产量3 + sczl_返工产量4 + sczl_返工产量5 + sczl_返工产量6 as sczl_jjcl'],
|
|
|
- 'sczl_gdbh1' =>['相关工单','sczl_gdbh1'],
|
|
|
+ '入仓类型' =>['入仓类型'],
|
|
|
+ '仓库编号' =>['仓库编号'],
|
|
|
+ '仓库名称' =>['仓库名称'],
|
|
|
+ 'jjcp_num' =>['入仓单号'],
|
|
|
+ 'jjcp_gdbh' =>['工单编号'],
|
|
|
+ 'jjcp_yjno' =>['印件号'],
|
|
|
+ 'jjcp_sl' =>['入仓数量'],
|
|
|
+ 'jjcp_sls' =>['累计入仓数量'],
|
|
|
+ '订单数量' =>['订单数量'],
|
|
|
+ '完成率' =>['完成率'],
|
|
|
+ 'jjcp_dw' =>['单位'],
|
|
|
+ 'jjcp_sj' =>['入仓时间'],
|
|
|
+ 'jjcp_smb' =>['首末板'],
|
|
|
+ 'jjcp_cpdh' =>['印件代号'],
|
|
|
+ 'jjcp_cpmc' =>['印件名称'],
|
|
|
+ '成品编码' =>['产品编号'],
|
|
|
+ '成品名称' =>['产品名称'],
|
|
|
+ '客户料号' =>['客户料号'],
|
|
|
+ 'jjcp_desc' =>['备注'],
|
|
|
+ '客户编号' =>['客户编号'],
|
|
|
+ 'Gd_客户名称' =>['客户名称'],
|
|
|
+ '最近入仓日期' =>['最近入仓日期'],
|
|
|
+ '机型备注' =>['机型备注'],
|
|
|
];
|
|
|
$data[0] = [];
|
|
|
foreach ($req['fields'] as $k=>$v){
|
|
|
if(array_key_exists($v,$arr)){
|
|
|
- if ($k==0){
|
|
|
- $field .= $arr[$v][1];
|
|
|
- }else{
|
|
|
- $field .= ','.$arr[$v][1];
|
|
|
- }
|
|
|
array_push($data[0],$arr[$v][0]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $rows = db()->table('成品入仓')
|
|
|
- ->field($field)
|
|
|
+ //客户编号
|
|
|
+ $rows = db()->table('成品入仓')->alias('c')
|
|
|
+ ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称,
|
|
|
+ rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh,
|
|
|
+ c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj,
|
|
|
+ rtrim(c.jjcp_smb) as jjcp_smb, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
|
|
|
+ rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称,
|
|
|
+ rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,4) as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称,
|
|
|
+ rtrim(c.机型备注) as 机型备注')
|
|
|
->where($where)
|
|
|
+ ->where('g.Gd_cpdh=c.jjcp_cpdh')
|
|
|
+ ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
|
|
|
+ ->order('c.UniqId desc')
|
|
|
->select();
|
|
|
|
|
|
- $rs = db()->table('人事_基本资料')->column('员工编号, 员工姓名');
|
|
|
foreach ($rows as $key=>$value) {
|
|
|
- if (isset($value['sczl_cl'])) $value['sczl_cl'] = floatval($value['sczl_cl']);
|
|
|
- if (isset($value['sczl_fgcl'])) $value['sczl_fgcl'] = floatval($value['sczl_fgcl']);
|
|
|
- if (isset($value['sczl_jjcl'])) $value['sczl_jjcl'] = floatval($value['sczl_jjcl']);
|
|
|
+
|
|
|
+ $row = db()->table('成品入仓')
|
|
|
+ ->field('LEFT(Sys_rq, 10) as Sys_rq,jjcp_sl')
|
|
|
+ ->where(['jjcp_gdbh'=>$value['jjcp_gdbh'], 'jjcp_cpdh'=>$value['jjcp_cpdh']])
|
|
|
+ ->order('Sys_rq desc')
|
|
|
+ ->select();
|
|
|
+
|
|
|
$subArray = [];
|
|
|
- foreach ($req['fields'] as $k=>$v){
|
|
|
- if(array_key_exists($v,$arr)){
|
|
|
- if($v=='sczl_name'){
|
|
|
- $name = array_key_exists($value['sczl_bh'],$rs) ? trim($rs[$value['sczl_bh']]) : '';
|
|
|
- if($name){
|
|
|
- array_push($subArray,$name);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
+ foreach ($arr as $k=>$v){
|
|
|
+ if($k=='jjcp_sls'){
|
|
|
+ $subArray[$k] = 0;
|
|
|
+ foreach ($row as $n) {
|
|
|
+ $subArray[$k] += $n['jjcp_sl'];
|
|
|
+ }
|
|
|
+ }else if($k=='完成率'){
|
|
|
+ if ($value['订单数量']!=0){
|
|
|
+ $subArray[$k] = 0;
|
|
|
+ foreach ($row as $n) {
|
|
|
+ $subArray[$k] += $n['jjcp_sl'];
|
|
|
}
|
|
|
+ $subArray[$k] = number_format($subArray[$k]/$value['订单数量']/100,2);
|
|
|
}else{
|
|
|
- if($value[$v]){
|
|
|
- array_push($subArray,$value[$v]);
|
|
|
- }else{
|
|
|
- array_push($subArray,'');
|
|
|
- }
|
|
|
+ $subArray[$k] = '';
|
|
|
}
|
|
|
+ }else if($k=='最近入仓日期'){
|
|
|
+ $subArray[$k] = $row[0]['Sys_rq'];
|
|
|
+ }else{
|
|
|
+ $subArray[$k] = $rows[$key][$k];
|
|
|
}
|
|
|
}
|
|
|
array_push($data,$subArray);
|
|
|
}
|
|
|
+
|
|
|
$this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
|
|
|
}
|
|
|
}
|