|
@@ -73,6 +73,8 @@ class WorkOrder extends Api
|
|
|
if ($this->request->isGet() === false){
|
|
if ($this->request->isGet() === false){
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $search = input('search');
|
|
|
|
|
+
|
|
|
$limit = input('limit');
|
|
$limit = input('limit');
|
|
|
// $page = input('page');
|
|
// $page = input('page');
|
|
|
$clientNumber = input('Gd_khdh');
|
|
$clientNumber = input('Gd_khdh');
|
|
@@ -81,6 +83,9 @@ class WorkOrder extends Api
|
|
|
$where = [
|
|
$where = [
|
|
|
'成品代号' => ['like',$clientNumber.'%']
|
|
'成品代号' => ['like',$clientNumber.'%']
|
|
|
];
|
|
];
|
|
|
|
|
+// if (isset($search)){
|
|
|
|
|
+// $where['']
|
|
|
|
|
+// }
|
|
|
if (isset($startTime) && isset($endTime)){
|
|
if (isset($startTime) && isset($endTime)){
|
|
|
$where['接单日期'] = ['between',[$startTime,$endTime]];
|
|
$where['接单日期'] = ['between',[$startTime,$endTime]];
|
|
|
}
|
|
}
|
|
@@ -203,7 +208,7 @@ class WorkOrder extends Api
|
|
|
'印件-工序' => rtrim($value['Gy0_yjno']).'-'.rtrim($value['Gy0_gxh']),
|
|
'印件-工序' => rtrim($value['Gy0_yjno']).'-'.rtrim($value['Gy0_gxh']),
|
|
|
'备选工序' => '',
|
|
'备选工序' => '',
|
|
|
'工序名称' => rtrim($value['Gy0_gxmc']).'【'.rtrim($value['Add_gxmc']).'】',
|
|
'工序名称' => rtrim($value['Gy0_gxmc']).'【'.rtrim($value['Add_gxmc']).'】',
|
|
|
- '计划产量' => '',
|
|
|
|
|
|
|
+ '计划产量' => rtrim($value['Gy0_计划接货数']),
|
|
|
'基础损耗' => rtrim($value['Gy0_Rate0']),
|
|
'基础损耗' => rtrim($value['Gy0_Rate0']),
|
|
|
'损耗率' => rtrim($value['Gy0_Rate1']),
|
|
'损耗率' => rtrim($value['Gy0_Rate1']),
|
|
|
'报废定额' => '',
|
|
'报废定额' => '',
|
|
@@ -326,7 +331,16 @@ class WorkOrder extends Api
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //U8投料试算
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * U8投料试算
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string $processCode 产品编号
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
public function U8Trial()
|
|
public function U8Trial()
|
|
|
{
|
|
{
|
|
@@ -338,8 +352,24 @@ class WorkOrder extends Api
|
|
|
if (empty($productCode)){
|
|
if (empty($productCode)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
-// $field = 'rtrim(Gy0_cpdh) as 产品代号,rtrim(Gy0_yjno) as 印件号,rtrim(Gy0_gxh) as 工序号,rtrim(gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
|
|
|
|
|
-// rtrim(Gy0_Ms) as 墨色数,rtrim(Gy0_shdh) as 损耗代号,rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as 加工联数,'
|
|
|
|
|
|
|
+ $field = 'rtrim(Gy0_cpdh) as 产品代号,rtrim(Gy0_yjno) as 印件号,rtrim(Gy0_gxh) as 工序号,rtrim(gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
|
|
|
|
|
+ rtrim(Gy0_Ms) as 墨色数,rtrim(Gy0_shdh) as 损耗代号,rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as 加工联数';
|
|
|
|
|
+ $list = Db::table('产品_工艺资料')->where('Gy0_cpdh',$productCode)->field($field)->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到该产品工序');
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ $data = Db::table('dic_lzsh')->where('sys_bh',$value['损耗代号'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->cache(true)->find();
|
|
|
|
|
+ $list[$key]['调机损耗'] = isset($data['rate0'])?$data['rate0']:'';
|
|
|
|
|
+ $list[$key]['运行损耗率'] = isset($data['rate1'])?$data['rate1']:'';
|
|
|
|
|
+ if ($value['add_gxmc'] !== ''){
|
|
|
|
|
+ $list[$key]['工序名称'] = $value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['工序名称'] = $value['gxmc'];
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($list[$key]['gxmc'],$list[$key]['add_gxmc']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -544,4 +574,232 @@ class WorkOrder extends Api
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * U8工单资料删除
|
|
|
|
|
+ * @param string $workOrder 工单编号
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function U8DataCorrection()
|
|
|
|
|
+ {
|
|
|
|
|
+ if($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ if (empty($workOrder)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $res = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->delete();
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 产品废检系数调整->质检工艺数据获取
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string $workOrder 工单编号
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function TestCoefficient()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ if (empty($workOrder)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'Gy0_gdbh' => $workOrder,
|
|
|
|
|
+ 'Gy0_gxmc' => ['like','%检%']
|
|
|
|
|
+ ];
|
|
|
|
|
+ $filed = 'rtrim(Gy0_gdbh) as gdbh,rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(人工检_正品板) as 人工正品板,
|
|
|
|
|
+ rtrim(人工检_次品板) as 人工次品板,rtrim(人工检_废检) as 人工废检,rtrim(机检_正品板) as 机检正品板,rtrim(机检_次品板) as 机检次品板,rtrim(机检_废检) as 机检废检,rtrim(Gy0_sbbh) as 设备编号';
|
|
|
|
|
+ $list = Db::table('工单_工艺资料')->where($where)->field($filed)->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到该工单工艺');
|
|
|
|
|
+ }
|
|
|
|
|
+ $name = Db::table('工单_基本资料')
|
|
|
|
|
+ ->where('Gd_gdbh',$workOrder)
|
|
|
|
|
+ ->field('rtrim(Gd_cpdh) as 产品代号,rtrim(Gd_khmc) as 客户名称,rtrim(Gd_cpmc) as 产品名称')
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if (empty($name)){
|
|
|
|
|
+ $this->error('未找到该工单');
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ if ($value['yjno']<10){
|
|
|
|
|
+ $value['yjno'] = '0'.$value['yjno'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($value['gxh']<10){
|
|
|
|
|
+ $value['gxh'] = '0'.$value['gxh'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $list[$key]['印件工序及工艺'] = $value['gdbh'].'-'.$value['yjno'].'-'.$value['gxh'].'-'.$value['gxmc'];
|
|
|
|
|
+ unset($list[$key]['gdbh'],$list[$key]['yjno'],$list[$key]['gxmc']);
|
|
|
|
|
+ $list[$key]['产品编号'] = $name['产品代号'];
|
|
|
|
|
+ $list[$key]['产品名称'] = $name['产品名称'];
|
|
|
|
|
+ $list[$key]['客户名称'] = $name['客户名称'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 产品质检系数调整->系数修改
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string $workorder 工单编号
|
|
|
|
|
+ * @param string $processCode 工序号
|
|
|
|
|
+ * @param float $code1 人工正品板
|
|
|
|
|
+ * @param float $code2 人工次品板
|
|
|
|
|
+ * @param float $code3 人工废检
|
|
|
|
|
+ * @param float $code4 机检正品板
|
|
|
|
|
+ * @param float $code5 机检次品板
|
|
|
|
|
+ * @param float $code6 机检废检
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function TestCoefficientEdit()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isPost() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ $processCode = input('processCode');
|
|
|
|
|
+ $row = [
|
|
|
|
|
+ '人工检_正品板' => input('code1'),
|
|
|
|
|
+ '人工检_次品板' => input('code2'),
|
|
|
|
|
+ '人工检_废检' => input('code3'),
|
|
|
|
|
+ '机检_正品板' => input('code4'),
|
|
|
|
|
+ '机检_次品板' => input('code5'),
|
|
|
|
|
+ '机检_废检' => input('code6'),
|
|
|
|
|
+ ];
|
|
|
|
|
+ if (empty($workOrder) || empty($processCode)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'Gy0_gdbh' => $workOrder,
|
|
|
|
|
+ 'Gy0_gxh' => $processCode
|
|
|
|
|
+ ];
|
|
|
|
|
+ $sql = Db::table('工单_工艺资料')->where($where)->fetchSql(true)->update($row);
|
|
|
|
|
+ $res = Db::query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修正工单核算参数->数据获取
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string $workOrder 工单编号
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function AccountingParameter()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ if (empty($workOrder)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $field = 'rtrim(Gy0_方案) as 方案,rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
|
|
|
|
|
+ rtrim(Gy0_sbbh) as 参照设备,rtrim(工价系数) as 难度系数,rtrim(Gy0_shdh) as 损耗代号,rtrim(Gy0_Rate0) as 基础损耗,rtrim(Gy0_Rate1) as 损耗率,
|
|
|
|
|
+ rtrim(印刷方式) as 印刷方式,rtrim(版距) as 版距,rtrim(Gy0_ms) as 计损色数,rtrim(损耗系数) as 损耗系数';
|
|
|
|
|
+ $list = Db::table('工单_工艺资料')->where('Gy0_gdbh',$workOrder)->field($field)->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到该工单工艺资料');
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ if ($value['yjno']<10){
|
|
|
|
|
+ $value['yjno'] = '0'.$value['yjno'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($value['gxh']<10){
|
|
|
|
|
+ $value['gxh'] = '0'.$value['gxh'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $list[$key]['印件号及工序名称'] = $value['yjno'].'-'.$value['gxh'].$value['gxmc'].'('.$value['add_gxmc'].')';
|
|
|
|
|
+ unset($list[$key]['yjno'],$list[$key]['gxmc'],$list[$key]['add_gxmc']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修正工单核算参数->参数修改
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string workorder 工单编号
|
|
|
|
|
+ * @param string processCode 工序号
|
|
|
|
|
+ * @param float difficulty 难度系数
|
|
|
|
|
+ * @param string loss 损耗代号
|
|
|
|
|
+ * @param string peintMode 印刷方式
|
|
|
|
|
+ * @param float plate 版距
|
|
|
|
|
+ * @param float chromatic 计损色数
|
|
|
|
|
+ * @param float wastage 损耗系数
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function AccountingParameterEdit()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isPost() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ $processCode = input('processCode');
|
|
|
|
|
+ if (empty($workOrder) || empty($processCode)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $row = [
|
|
|
|
|
+ '工价系数' => input('difficulty'),
|
|
|
|
|
+ 'Gy0_shdh' => input('loss'),
|
|
|
|
|
+ '印刷方式' => input('printMode'),
|
|
|
|
|
+ '版距' => input('plate'),
|
|
|
|
|
+ 'Gy0_ms' => input('chromatic'),
|
|
|
|
|
+ '损耗系数' => input('wastage'),
|
|
|
|
|
+ ];
|
|
|
|
|
+ //根据损耗代号获取基础损耗、损耗率
|
|
|
|
|
+ $data = Db::table('dic_lzsh')->where('sys_bh',$row['Gy0_shdh'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->find();
|
|
|
|
|
+ $row['基础损耗'] = $data['rate0'];
|
|
|
|
|
+ $row['损耗率'] = $data['rate1'];
|
|
|
|
|
+ $sql = Db::table('工单_工艺资料')->where(['Gy0_gdbh'=>$workOrder,'Gy0_gxh'=>$processCode])->fetchSql(true)->update($row);
|
|
|
|
|
+ $res = Db::query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //工单工序产量统计
|
|
|
|
|
+
|
|
|
|
|
+ public function OutputStatistics()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $workOrder = input('workOrder');
|
|
|
|
|
+ if (empty($workOrder)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+// $filed = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,rtrim(Gy0_计划接货数) as 工序计划产量,
|
|
|
|
|
+// rtrim(Gy0_ls) as 联数,'
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|