|
|
@@ -64,6 +64,8 @@ class PackagingProcessOutput extends Api
|
|
|
* @ApiMethod (GET)
|
|
|
* @param string $date 时间
|
|
|
* @param string $sys_id 用户
|
|
|
+ * @param string $page 页码
|
|
|
+ * @param string $limit 数量
|
|
|
*/
|
|
|
public function getList()
|
|
|
{
|
|
|
@@ -85,6 +87,7 @@ class PackagingProcessOutput extends Api
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
+ if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
|
|
|
$rows = db()->table('db_包装产量预报')
|
|
|
->field('rtrim(sys_id) as sys_id, LEFT(sczl_rq, 10) as sczl_rq,
|
|
|
@@ -111,6 +114,73 @@ class PackagingProcessOutput extends Api
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取包装工序产量列表
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string $gdbh 工单编号
|
|
|
+ * @param string $cpmc 产品名称
|
|
|
+ * @param string $page 页码
|
|
|
+ * @param string $limit 数量
|
|
|
+ */
|
|
|
+ public function locate()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+
|
|
|
+ $page = 1;
|
|
|
+ $limit = 15;
|
|
|
+ if (isset($req['page']) && !empty($req['page'])) $page = $req['page'];
|
|
|
+ if (isset($req['limit']) && !empty($req['limit'])) $limit = $req['limit'];
|
|
|
+
|
|
|
+ if (isset($req['gdbh']) && !empty($req['gdbh'])){
|
|
|
+ $where = [
|
|
|
+ 'sczl_gdbh1|sczl_gdbh2|sczl_gdbh3|sczl_gdbh4|sczl_gdbh5|sczl_gdbh6'=>[ 'like', '%' . $req['gdbh'] . '%']
|
|
|
+ ];
|
|
|
+ $rows = db()->table('db_包装产量预报')
|
|
|
+ ->field('rtrim(sys_id) as sys_id, LEFT(sczl_rq, 10) as sczl_rq,
|
|
|
+ CAST(sczl_cl1 + sczl_cl2 + sczl_cl3 + sczl_cl4 + sczl_cl5 + sczl_cl6 AS SIGNED) as sczl_cl,
|
|
|
+ CAST((sczl_cl1 * sczl_PgCl1 + sczl_clAdd1) + (sczl_cl2 * sczl_PgCl2 + sczl_clAdd2) + (sczl_cl3 * sczl_PgCl3 + sczl_clAdd3) + (sczl_cl4 * sczl_PgCl4 + sczl_clAdd4) + (sczl_cl5 * sczl_PgCl5 + sczl_clAdd5) + (sczl_cl6 * sczl_PgCl6 + sczl_clAdd6) AS SIGNED) as sczl_PgCl,
|
|
|
+ sys_rq, mod_rq, UniqId')
|
|
|
+ ->where($where)
|
|
|
+ ->page($page,$limit)
|
|
|
+ ->select();
|
|
|
+ $total = db()->table('db_包装产量预报')->where($where)->count();
|
|
|
+ }else{
|
|
|
+ if (isset($req['cpmc']) && !empty($req['cpmc'])){
|
|
|
+ //查询工单表
|
|
|
+ $gd = db()->table('工单_基本资料')
|
|
|
+ ->where('Gd_cpmc', 'LIKE', '%'.$req['cpmc'].'%')
|
|
|
+ ->column('Gd_gdbh');
|
|
|
+ $where = [
|
|
|
+ 'sczl_gdbh1|sczl_gdbh2|sczl_gdbh3|sczl_gdbh4|sczl_gdbh5|sczl_gdbh6'=>['in', $gd]
|
|
|
+ ];
|
|
|
+ $rows = db()->table('db_包装产量预报')
|
|
|
+ ->field('rtrim(sys_id) as sys_id, LEFT(sczl_rq, 10) as sczl_rq,
|
|
|
+ CAST(sczl_cl1 + sczl_cl2 + sczl_cl3 + sczl_cl4 + sczl_cl5 + sczl_cl6 AS SIGNED) as sczl_cl,
|
|
|
+ CAST((sczl_cl1 * sczl_PgCl1 + sczl_clAdd1) + (sczl_cl2 * sczl_PgCl2 + sczl_clAdd2) + (sczl_cl3 * sczl_PgCl3 + sczl_clAdd3) + (sczl_cl4 * sczl_PgCl4 + sczl_clAdd4) + (sczl_cl5 * sczl_PgCl5 + sczl_clAdd5) + (sczl_cl6 * sczl_PgCl6 + sczl_clAdd6) AS SIGNED) as sczl_PgCl,
|
|
|
+ sys_rq, mod_rq, UniqId')
|
|
|
+ ->where($where)
|
|
|
+ ->page($page,$limit)
|
|
|
+ ->select();
|
|
|
+ $total = db()->table('db_包装产量预报')->where($where)->count();
|
|
|
+ }else{
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($rows as $key=>$value){
|
|
|
+ $rows[$key]['mod_rq'] = $value['mod_rq']=='1900-01-01 00:00:00' ? '' :$value['mod_rq'];
|
|
|
+ }
|
|
|
+ $data = [
|
|
|
+ 'total' => $total,
|
|
|
+ 'rows' => $rows,
|
|
|
+ ];
|
|
|
+ $this->success('成功',$data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取包装工序产量信息
|
|
|
* @ApiMethod (GET)
|
|
|
@@ -128,18 +198,60 @@ class PackagingProcessOutput extends Api
|
|
|
}else{
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
+ $gd = db()->table('工单_基本资料')->column('Gd_gdbh, Gd_cpmc');
|
|
|
+ $rows = db()->table('db_包装产量预报')
|
|
|
+ ->field('LEFT(sczl_rq, 10) as sczl_rq, sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6,
|
|
|
+ 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,
|
|
|
+ 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_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')
|
|
|
+ ->where('UniqId',$UniqId)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ for ($i=1;$i<=6;$i++){
|
|
|
+ $rows['Gd_cpmc'.$i] = array_key_exists($rows['sczl_gdbh'.$i], $gd) ? trim($gd[$rows['sczl_gdbh'.$i]]) : '';
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('成功',$rows);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取工单信息信息
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string $gdbh 工单编号
|
|
|
+ */
|
|
|
+ public function getWorkOrder()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+ if (isset($req['gdbh']) && !empty($req['gdbh'])){
|
|
|
+ $gdbh = $req['gdbh'];
|
|
|
+ }else{
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $gxmc = '包装';
|
|
|
|
|
|
- $rows = db()->table('db_包装产量预报')->alias('d')
|
|
|
- ->field('d.*, g1.Gd_cpmc, g2.Gd_cpmc, g3.Gd_cpmc, g4.Gd_cpmc, g5.Gd_cpmc, g6.Gd_cpmc')
|
|
|
- ->join(['工单_基本资料'=>'g'], 'd.sczl_gdbh1 = g.Gd_gdbh or '.
|
|
|
- 'd.sczl_gdbh2 = g.Gd_gdbh or '.
|
|
|
- 'd.sczl_gdbh3 = g.Gd_gdbh or '.
|
|
|
- 'd.sczl_gdbh4 = g.Gd_gdbh or '.
|
|
|
- 'd.sczl_gdbh5 = g.Gd_gdbh or '.
|
|
|
- 'd.sczl_gdbh6 = g.Gd_gdbh')
|
|
|
- ->where('d.UniqId',$UniqId)
|
|
|
+ $rows = db()->table('工单_基本资料')
|
|
|
+ ->field('行号, rtrim(Gd_cpmc) as Gd_cpmc, 成品代号')
|
|
|
+ ->where('Gd_gdbh',$gdbh)
|
|
|
->select();
|
|
|
+ foreach ($rows as $key=>$value){
|
|
|
+ $row = db()->table('产品_工艺资料')
|
|
|
+ ->field('Gy0_gxh')
|
|
|
+ ->where(['Gy0_cpdh'=>$value['成品代号'],'Gy0_yjno'=>$value['行号'], 'gy0_gxmc'=>['like','%'.$gxmc.'%']])
|
|
|
+ ->find();
|
|
|
+ $rows[$key]['jyGx'] = sprintf("%02d", $value['行号']).'-'.$row['Gy0_gxh'];
|
|
|
+ unset($rows[$key]['行号']);
|
|
|
+ unset($rows[$key]['成品代号']);
|
|
|
+ }
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|