|
|
@@ -1022,7 +1022,7 @@ class WorkOrder extends Api
|
|
|
if (empty($param) || isset($param['UniqId']) === false){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- if (empty($param['shdh'])){
|
|
|
+ if (empty($param['Gy0_shdh'])){
|
|
|
$rate['rate0'] = 0;
|
|
|
$rate['rate1'] = 0;
|
|
|
}else{
|
|
|
@@ -1039,13 +1039,13 @@ class WorkOrder extends Api
|
|
|
//获取工艺资料数据
|
|
|
$list = \db('工单_工艺资料')->where('UniqId',$UniqId)->field('Gy0_yjno,Gy0_gxh,rtrim(Gy0_计划接货数) as 计划接货数')->find();
|
|
|
//修改工单状态
|
|
|
- $status = \db('工单_基本资料')->where('Gd_gdbh',$param['workOrder'])->field('rtrim(gd_statu) as status')->find();
|
|
|
+ $status = \db('工单_基本资料')->where('Gd_gdbh',$param['Gy0_gdbh'])->field('rtrim(gd_statu) as status')->find();
|
|
|
if ($status['status'] !== '2-生产中'){
|
|
|
- $statusSql = \db('工单_基本资料')->where('Gd_gdbh',$param['workOrder'])->fetchSql(true)->update(['gd_statu'=>'2-生产中']);
|
|
|
+ $statusSql = \db('工单_基本资料')->where('Gd_gdbh',$param['Gy0_gdbh'])->fetchSql(true)->update(['gd_statu'=>'2-生产中']);
|
|
|
Db::query($statusSql);
|
|
|
}
|
|
|
//重新分配工序计划产量
|
|
|
- $result = $this->PlannedProcessYield($param['workOrder'],$list['Gy0_yjno'],$list['Gy0_gxh'],$list['计划接货数']);
|
|
|
+ $result = $this->PlannedProcessYield($param['Gy0_gdbh'],$list['Gy0_yjno'],$list['Gy0_gxh'],$list['计划接货数']);
|
|
|
if ($res !== false){
|
|
|
$this->success('成功');
|
|
|
}else{
|
|
|
@@ -2060,6 +2060,39 @@ class WorkOrder extends Api
|
|
|
if (empty($param['workorder']) || empty($param['productCode']) || empty($param['option'])){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
+ $list = \db('工单_基本资料')
|
|
|
+ ->where('Gd_gdbh',$param['workorder'])
|
|
|
+ ->where('成品代号',$param['productCode'])
|
|
|
+ ->field('行号,Gd_cpdh')
|
|
|
+ ->select();
|
|
|
+ //引用印件资料
|
|
|
+ $PrintList = \db('产品_印件资料')
|
|
|
+ ->where('yj_cpdh',$param['productCode'])
|
|
|
+ ->select();
|
|
|
+ if (empty($PrintList)){
|
|
|
+ $this->error('未找到印件资料');
|
|
|
+ }
|
|
|
+ $PrintLastId = \db('工单_印件资料')->order('Uniqid desc')->value('rtrim(Uniqid)');
|
|
|
+ $number = \db('工单_基本资料')
|
|
|
+ ->where('Gd_gdbh',$param['workorder'])
|
|
|
+ ->where('成品代号',$param['productCode'])
|
|
|
+ ->value('rtrim(计划投料)');
|
|
|
+ foreach ($PrintList as $key => $value){
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+// if ($value['yj_Yjno'] === )
|
|
|
+ $PrintList[$key]['Yj_Gdbh'] = $param['workorder'];
|
|
|
+ $PrintList[$key]['yj_Yjno'] = $value['yj_yjno'];
|
|
|
+ $PrintList[$key]['yj_Yjdh'] = $value['yj_yjdh'];
|
|
|
+ $PrintList[$key]['yj_ks'] = $value['yj_ks'];
|
|
|
+ $PrintList[$key]['yj_ls'] = $value['yj_ls'];
|
|
|
+ $PrintList[$key]['yj_平张投料'] = $number;
|
|
|
+ $PrintList[$key]['Sys_id'] = $value['sys_id'];
|
|
|
+ $PrintList[$key]['Uniqid'] = $PrintLastId + $key + 1;
|
|
|
+ $PrintList[$key]['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ $PrintList[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ }
|
|
|
+ unset($PrintList[$key]['mod_rq'],$PrintList[$key]['sys_rq'],$PrintList[$key]['sys_id'],$PrintList[$key]['KgToPages'],$PrintList[$key]['yj_tll'],$PrintList[$key]['yj_yjdh'],$PrintList[$key]['yj_yjno'],$PrintList[$key]['UniqId']);
|
|
|
+ }
|
|
|
//引用工艺资料
|
|
|
$processWhere = [
|
|
|
'Gy0_方案' => $param['option'],
|
|
|
@@ -2092,31 +2125,7 @@ class WorkOrder extends Api
|
|
|
$ProcessList[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
unset($ProcessList[$key]['Gy0_Oil'],$ProcessList[$key]['Gy0_Ms'],$ProcessList[$key]['Gy0_Ks'],$ProcessList[$key]['UniqID'],$ProcessList[$key]['Gy0_cpdh'],$ProcessList[$key]['gy0_gxmc'],$ProcessList[$key]['Gy0_site']);
|
|
|
}
|
|
|
- //引用印件资料
|
|
|
- $PrintList = \db('产品_印件资料')
|
|
|
- ->where('yj_cpdh',$param['productCode'])
|
|
|
- ->select();
|
|
|
- if (empty($PrintList)){
|
|
|
- $this->error('未找到印件资料');
|
|
|
- }
|
|
|
- $PrintLastId = \db('工单_印件资料')->order('Uniqid desc')->value('rtrim(Uniqid)');
|
|
|
- $number = \db('工单_基本资料')
|
|
|
- ->where('Gd_gdbh',$param['workorder'])
|
|
|
- ->where('成品代号',$param['productCode'])
|
|
|
- ->value('rtrim(计划投料)');
|
|
|
- foreach ($PrintList as $key => $value){
|
|
|
- $PrintList[$key]['Yj_Gdbh'] = $param['workorder'];
|
|
|
- $PrintList[$key]['yj_Yjno'] = $value['yj_yjno'];
|
|
|
- $PrintList[$key]['yj_Yjdh'] = $value['yj_yjdh'];
|
|
|
- $PrintList[$key]['yj_ks'] = $value['yj_ks'];
|
|
|
- $PrintList[$key]['yj_ls'] = $value['yj_ls'];
|
|
|
- $PrintList[$key]['yj_平张投料'] = $number;
|
|
|
- $PrintList[$key]['Sys_id'] = $value['sys_id'];
|
|
|
- $PrintList[$key]['Uniqid'] = $PrintLastId + $key + 1;
|
|
|
- $PrintList[$key]['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
- $PrintList[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
- unset($PrintList[$key]['mod_rq'],$PrintList[$key]['sys_rq'],$PrintList[$key]['sys_id'],$PrintList[$key]['KgToPages'],$PrintList[$key]['yj_tll'],$PrintList[$key]['yj_yjdh'],$PrintList[$key]['yj_yjno'],$PrintList[$key]['UniqId']);
|
|
|
- }
|
|
|
+
|
|
|
//插入数据
|
|
|
$processSql = \db('工单_工艺资料')->fetchSql(true)->insertAll($ProcessList);
|
|
|
$processRes = \db()->query($processSql);
|