|
|
@@ -1642,100 +1642,13 @@ class OrderSuperLoss extends Api
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- //超节损列表
|
|
|
-// public function getList()
|
|
|
-// {
|
|
|
-// if (Request::instance()->isGet() == false) {
|
|
|
-// $this->error('非法请求');
|
|
|
-// }
|
|
|
-// $params = Request::instance()->param();
|
|
|
-// $where = [];
|
|
|
-// if (!empty($params['code'])) {
|
|
|
-// if (!empty($params['search'])) {
|
|
|
-// $this->error('参数错误');
|
|
|
-// }
|
|
|
-// $where['产品代号'] = $params['code'];
|
|
|
-// }
|
|
|
-// if (!empty($params['date'])) {
|
|
|
-// if (!empty($params['search'])) {
|
|
|
-// $this->error('参数错误');
|
|
|
-// }
|
|
|
-// $where['sys_ny' ] = $params['date'];
|
|
|
-// }
|
|
|
-// if (!empty($params['search'])) {
|
|
|
-// if (!empty($params['date']) || !empty($params['code'])) {
|
|
|
-// $this->error('参数错误');
|
|
|
-// }
|
|
|
-// $where['Gy0_gdbh|产品名称|产品代号'] = array('like','%'.$params['search'].'%');
|
|
|
-// }
|
|
|
-// $limit = $params['limit'];
|
|
|
-// if (empty($limit)){
|
|
|
-// $limit = 15;
|
|
|
-// }
|
|
|
-// $pages = $params['page'];
|
|
|
-// if (empty($pages)){
|
|
|
-// $pages = 1;
|
|
|
-// }
|
|
|
-// // 定义字段
|
|
|
-// $field = '
|
|
|
-// sys_ny,
|
|
|
-// Gy0_gdbh as Gd_gdbh,
|
|
|
-// `印件及工序` as jjcp_yjno,
|
|
|
-// `印件及工序` as yj_Yjno,
|
|
|
-// `联数` as yj_ls,
|
|
|
-// `产品代号` as 成品编码,
|
|
|
-// `产品名称` as 成品名称,
|
|
|
-// `实际投料`,
|
|
|
-// `计量单位`,
|
|
|
-// DATE(`入仓日期`) AS warehousing_date,
|
|
|
-// `入仓数量` as warehousing_num,
|
|
|
-// SUM(DISTINCT `计划损耗`) AS `工单计划损耗`,
|
|
|
-// `废品合计`,
|
|
|
-// SUM(`CjsJe`) AS reward_money,
|
|
|
-// `印件无形损` as 工单无形损,
|
|
|
-// `材料废`,
|
|
|
-// `零头处理`,
|
|
|
-// `外发废`,
|
|
|
-// SUM(`班组制程废品`) AS zcfp,
|
|
|
-// `班组分摊质检废品` as 工单质检废
|
|
|
-// ';
|
|
|
-// $list = \db('工单_质量考核汇总')
|
|
|
-// ->field($field)
|
|
|
-// ->where($where)
|
|
|
-// ->group('Gy0_gdbh, `印件及工序`')
|
|
|
-// ->order('sys_rq DESC')
|
|
|
-// ->page($pages)
|
|
|
-// ->limit($limit)
|
|
|
-// ->select();
|
|
|
-// foreach ($list as $key=>$value){
|
|
|
-// $status = \db('工单_印件资料')
|
|
|
-// ->where('Yj_Gdbh',$value['Gd_gdbh'])
|
|
|
-// ->where('yj_Yjno',$value['jjcp_yjno'])
|
|
|
-// ->value('质量考核');
|
|
|
-// $list[$key]['质量考核'] = $status;
|
|
|
-// if ($status == 1){
|
|
|
-// $list[$key]['考核'] = '否';
|
|
|
-// }else{
|
|
|
-// $list[$key]['考核'] = '是';
|
|
|
-// }
|
|
|
-// $value['实际投料'] = $value['实际投料']*10000;
|
|
|
-// //目标合格率
|
|
|
-// $list[$key]['target_rate'] = ($value['实际投料']-$value['工单计划损耗'])/$value['实际投料']*100;
|
|
|
-// $list[$key]['target_rate'] = number_format($list[$key]['target_rate'],2);
|
|
|
-// $list[$key]['target_rate'] = $list[$key]['target_rate'].'%';
|
|
|
-// //实际合格率
|
|
|
-// $list[$key]['real_rate'] = ($value['实际投料']-$value['废品合计'])/$value['实际投料']*100;
|
|
|
-// $list[$key]['real_rate'] = number_format($list[$key]['real_rate'],2);
|
|
|
-// $list[$key]['real_rate'] = $list[$key]['real_rate'].'%';
|
|
|
-// $list[$key]['reward_rate'] = '1';
|
|
|
-// }
|
|
|
-// if (!empty($list)){
|
|
|
-// $this->success('成功',$list);
|
|
|
-// }else{
|
|
|
-// $this->error('未找到数据');
|
|
|
-// }
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 超节损列表
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
public function getList()
|
|
|
{
|
|
|
if (!Request::instance()->isGet()) {
|
|
|
@@ -1833,7 +1746,14 @@ class OrderSuperLoss extends Api
|
|
|
$rate = ($actual - $loss) / $actual * 100;
|
|
|
return number_format($rate, 2) . '%';
|
|
|
}
|
|
|
- //工序超节损
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工序超节损
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
public function ProcessLoss()
|
|
|
{
|
|
|
if ($this->request->isGet() === false){
|
|
|
@@ -1933,7 +1853,29 @@ class OrderSuperLoss extends Api
|
|
|
->where($where)
|
|
|
->field($total_field)
|
|
|
->find();
|
|
|
- $list['机检废'] = $total['total_waste'] - $total['材料废'] - $total['total_zjfp'];
|
|
|
+ //查询废品数量
|
|
|
+ $out_sql = "SELECT qczl_num,fp_sl1,fp_sl2,fp_sl3,fp_sl4,fp_sl5,fp_sl6,fp_sl7,fp_sl8,fp_sl9,fp_sl10,fp_sl11,fp_sl12,fp_sl13,
|
|
|
+ fp_lb1,fp_lb2,fp_lb3,fp_lb4,fp_lb5,fp_lb6,fp_lb7,fp_lb8,fp_lb9,fp_lb10,fp_lb11,fp_lb12,fp_lb13,
|
|
|
+ fp_bh1,fp_bh2,fp_bh3,fp_bh4,fp_bh5,fp_bh6,fp_bh7,fp_bh8,fp_bh9,fp_bh10,fp_bh11,fp_bh12,fp_bh13,
|
|
|
+ fp_gxmc1,fp_gxmc2,fp_gxmc3,fp_gxmc4,fp_gxmc5,fp_gxmc6,fp_gxmc7,fp_gxmc8,fp_gxmc9,fp_gxmc10,fp_gxmc11,fp_gxmc12,fp_gxmc13,UniqId
|
|
|
+ FROM db_qczl WHERE qczl_gdbh = '{$param['order']}' AND qczl_yjno = '{$param['yjno']}'";
|
|
|
+ $waste_out = Db::query($out_sql);
|
|
|
+ $machine = [];//机检废品数组
|
|
|
+ $o = 0;
|
|
|
+ foreach ($waste_out as $entry) {
|
|
|
+ for ($i = 1; $i <= 13; $i++) {
|
|
|
+ $labelKey = "fp_lb" . $i;
|
|
|
+ $slKey = "fp_sl" . $i;
|
|
|
+ if (!empty($entry[$labelKey])) {
|
|
|
+ //机检废品
|
|
|
+ if (substr($entry[$labelKey],0,1) == 'K' ){
|
|
|
+ $machine[$o]= $entry[$slKey];
|
|
|
+ $o++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list['机检废'] = array_sum($machine);//机检废
|
|
|
$list['total'] = $total;
|
|
|
$this->success('成功',$list);
|
|
|
}
|
|
|
@@ -2031,7 +1973,29 @@ class OrderSuperLoss extends Api
|
|
|
->where($where)
|
|
|
->field($total_field)
|
|
|
->find();
|
|
|
- $list['机检废'] = $total['total_waste'] - $total['材料废'] - $total['total_zjfp'];
|
|
|
+ //查询废品数量
|
|
|
+ $out_sql = "SELECT qczl_num,fp_sl1,fp_sl2,fp_sl3,fp_sl4,fp_sl5,fp_sl6,fp_sl7,fp_sl8,fp_sl9,fp_sl10,fp_sl11,fp_sl12,fp_sl13,
|
|
|
+ fp_lb1,fp_lb2,fp_lb3,fp_lb4,fp_lb5,fp_lb6,fp_lb7,fp_lb8,fp_lb9,fp_lb10,fp_lb11,fp_lb12,fp_lb13,
|
|
|
+ fp_bh1,fp_bh2,fp_bh3,fp_bh4,fp_bh5,fp_bh6,fp_bh7,fp_bh8,fp_bh9,fp_bh10,fp_bh11,fp_bh12,fp_bh13,
|
|
|
+ fp_gxmc1,fp_gxmc2,fp_gxmc3,fp_gxmc4,fp_gxmc5,fp_gxmc6,fp_gxmc7,fp_gxmc8,fp_gxmc9,fp_gxmc10,fp_gxmc11,fp_gxmc12,fp_gxmc13,UniqId
|
|
|
+ FROM db_qczl WHERE qczl_gdbh = '{$param['order']}' AND qczl_yjno = '{$param['yjno']}'";
|
|
|
+ $waste_out = Db::query($out_sql);
|
|
|
+ $machine = [];//机检废品数组
|
|
|
+ $o = 0;
|
|
|
+ foreach ($waste_out as $entry) {
|
|
|
+ for ($i = 1; $i <= 13; $i++) {
|
|
|
+ $labelKey = "fp_lb" . $i;
|
|
|
+ $slKey = "fp_sl" . $i;
|
|
|
+ if (!empty($entry[$labelKey])) {
|
|
|
+ //机检废品
|
|
|
+ if (substr($entry[$labelKey],0,1) == 'K' ){
|
|
|
+ $machine[$o]= $entry[$slKey];
|
|
|
+ $o++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list['机检废'] = array_sum($machine);//机检废
|
|
|
$list['total'] = $total;
|
|
|
$this->success('成功',$list);
|
|
|
|