|
@@ -21,7 +21,7 @@ class FinishedProductWarehousing extends Api
|
|
|
*成品入仓测试
|
|
*成品入仓测试
|
|
|
*/
|
|
*/
|
|
|
public function index()
|
|
public function index()
|
|
|
- {
|
|
|
|
|
|
|
+ {
|
|
|
$this->success('请求成功');
|
|
$this->success('请求成功');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -370,7 +370,7 @@ class FinishedProductWarehousing extends Api
|
|
|
->select();
|
|
->select();
|
|
|
|
|
|
|
|
// $rows = db()->table('工单_印件资料')->alias('j')
|
|
// $rows = db()->table('工单_印件资料')->alias('j')
|
|
|
- // ->field('g.Gd_gdbh, j.yj_Yjno as yj_yjno, rtrim(g.销售订单号) as 销售订单号, rtrim(j.yj_Yjdh) as yj_Yjdh,
|
|
|
|
|
|
|
+ // ->field('g.Gd_gdbh, j.yj_Yjno as 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 客户料号')
|
|
// rtrim(j.yj_yjmc) as yj_yjmc, rtrim(g.成品代号) as 成品代号, rtrim(g.成品名称) as 成品名称, rtrim(g.客户料号) as 客户料号')
|
|
|
// ->where(['g.Gd_gdbh'=>$gdbh])
|
|
// ->where(['g.Gd_gdbh'=>$gdbh])
|
|
|
// ->join(['工单_基本资料'=>'g'],'g.Gd_gdbh=j.Yj_Gdbh')
|
|
// ->join(['工单_基本资料'=>'g'],'g.Gd_gdbh=j.Yj_Gdbh')
|
|
@@ -468,6 +468,16 @@ class FinishedProductWarehousing extends Api
|
|
|
$UniqId = db('成品入仓')->max('UniqId');
|
|
$UniqId = db('成品入仓')->max('UniqId');
|
|
|
$data['UniqId'] = $UniqId < 10000000 ? 10000000 : $UniqId + 1;
|
|
$data['UniqId'] = $UniqId < 10000000 ? 10000000 : $UniqId + 1;
|
|
|
|
|
|
|
|
|
|
+ //判断当前工单是否存在已提交模版
|
|
|
|
|
+ $existingRecord = db('成品入仓')
|
|
|
|
|
+ ->where('jjcp_gdbh', $data['jjcp_gdbh'])
|
|
|
|
|
+ ->where('jjcp_yjno', $data['jjcp_yjno'])
|
|
|
|
|
+ ->where('jjcp_smb', '<>', '') // 判断 jjcp_smb 不为空
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if ($existingRecord) {
|
|
|
|
|
+ $this->error($existingRecord['jjcp_gdbh'].'工单 -- 印件'.$existingRecord['jjcp_yjno'].'已经进入末版,无法继续操作');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//开启事务
|
|
//开启事务
|
|
|
db()->startTrans();
|
|
db()->startTrans();
|
|
|
try{
|
|
try{
|
|
@@ -536,6 +546,16 @@ class FinishedProductWarehousing extends Api
|
|
|
}
|
|
}
|
|
|
$data['Mod_rq'] = date('Y-m-d H:i:s');
|
|
$data['Mod_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
|
|
+ //判断当前工单是否存在已提交模版
|
|
|
|
|
+ $existingRecord = db('成品入仓')
|
|
|
|
|
+ ->where('jjcp_gdbh', $data['jjcp_gdbh'])
|
|
|
|
|
+ ->where('jjcp_yjno', $data['jjcp_yjno'])
|
|
|
|
|
+ ->where('jjcp_smb', '<>', '') // 判断 jjcp_smb 不为空
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if ($existingRecord) {
|
|
|
|
|
+ $this->error($existingRecord['jjcp_gdbh'].'工单 -- 印件'.$existingRecord['jjcp_yjno'].'已经进入末版,无法继续操作');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//开启事务
|
|
//开启事务
|
|
|
db()->startTrans();
|
|
db()->startTrans();
|
|
|
try{
|
|
try{
|
|
@@ -1115,40 +1135,40 @@ class FinishedProductWarehousing extends Api
|
|
|
$data = [];
|
|
$data = [];
|
|
|
foreach($data1 as $key=>$value){
|
|
foreach($data1 as $key=>$value){
|
|
|
// if(!array_key_exists($key,$rows1)){
|
|
// if(!array_key_exists($key,$rows1)){
|
|
|
- $subArray = [];
|
|
|
|
|
- $gdbh = strtoupper(explode('-',$key)[0]);
|
|
|
|
|
- $yjno = explode('-',$key)[1];
|
|
|
|
|
- $res = db('工单_印件资料')
|
|
|
|
|
- ->where('Yj_Gdbh',$gdbh)
|
|
|
|
|
- ->where('yj_Yjno',$yjno)
|
|
|
|
|
- ->field('Yj_Gdbh, yj_Yjno, yj_yjmc, yj_成品数量, (yj_平张投料 * yj_ks * yj_ls) as 投料')
|
|
|
|
|
- ->find();
|
|
|
|
|
- if(!empty($res)){
|
|
|
|
|
- $subArray['Yj_Gdbh'] = $res['Yj_Gdbh'];
|
|
|
|
|
- $subArray['yj_Yjno'] = $res['yj_Yjno'];
|
|
|
|
|
- $subArray['yj_yjmc'] = trim($res['yj_yjmc']);
|
|
|
|
|
- $subArray['yj_成品数量'] = (string)floatval($res['yj_成品数量']*10000);
|
|
|
|
|
- $subArray['yj_实际投料'] = (string)floatval($res['投料']);
|
|
|
|
|
- }else{
|
|
|
|
|
- $subArray['Yj_Gdbh'] = '';
|
|
|
|
|
- $subArray['yj_Yjno'] = '';
|
|
|
|
|
- $subArray['yj_yjmc'] = '';
|
|
|
|
|
- $subArray['yj_成品数量'] = '';
|
|
|
|
|
- $subArray['yj_实际投料'] = '';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(array_key_exists($key,$rows2)){
|
|
|
|
|
- $subArray['jjcp_smb'] = $rows2[$key]['jjcp_smb'];
|
|
|
|
|
- $subArray['jjcp_sls'] = $rows2[$key]['jjcp_sls'];
|
|
|
|
|
- $subArray['jjcp_sj'] = $rows2[$key]['jjcp_sj'];
|
|
|
|
|
- }else{
|
|
|
|
|
- $subArray['jjcp_smb'] = '';
|
|
|
|
|
- $subArray['jjcp_sls'] = '';
|
|
|
|
|
- $subArray['jjcp_sj'] = '';
|
|
|
|
|
- }
|
|
|
|
|
- $subArray['sczl_cls'] = (string)floatval($value);
|
|
|
|
|
- array_push($data,$subArray);
|
|
|
|
|
|
|
+ $subArray = [];
|
|
|
|
|
+ $gdbh = strtoupper(explode('-',$key)[0]);
|
|
|
|
|
+ $yjno = explode('-',$key)[1];
|
|
|
|
|
+ $res = db('工单_印件资料')
|
|
|
|
|
+ ->where('Yj_Gdbh',$gdbh)
|
|
|
|
|
+ ->where('yj_Yjno',$yjno)
|
|
|
|
|
+ ->field('Yj_Gdbh, yj_Yjno, yj_yjmc, yj_成品数量, (yj_平张投料 * yj_ks * yj_ls) as 投料')
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if(!empty($res)){
|
|
|
|
|
+ $subArray['Yj_Gdbh'] = $res['Yj_Gdbh'];
|
|
|
|
|
+ $subArray['yj_Yjno'] = $res['yj_Yjno'];
|
|
|
|
|
+ $subArray['yj_yjmc'] = trim($res['yj_yjmc']);
|
|
|
|
|
+ $subArray['yj_成品数量'] = (string)floatval($res['yj_成品数量']*10000);
|
|
|
|
|
+ $subArray['yj_实际投料'] = (string)floatval($res['投料']);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $subArray['Yj_Gdbh'] = '';
|
|
|
|
|
+ $subArray['yj_Yjno'] = '';
|
|
|
|
|
+ $subArray['yj_yjmc'] = '';
|
|
|
|
|
+ $subArray['yj_成品数量'] = '';
|
|
|
|
|
+ $subArray['yj_实际投料'] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(array_key_exists($key,$rows2)){
|
|
|
|
|
+ $subArray['jjcp_smb'] = $rows2[$key]['jjcp_smb'];
|
|
|
|
|
+ $subArray['jjcp_sls'] = $rows2[$key]['jjcp_sls'];
|
|
|
|
|
+ $subArray['jjcp_sj'] = $rows2[$key]['jjcp_sj'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $subArray['jjcp_smb'] = '';
|
|
|
|
|
+ $subArray['jjcp_sls'] = '';
|
|
|
|
|
+ $subArray['jjcp_sj'] = '';
|
|
|
}
|
|
}
|
|
|
|
|
+ $subArray['sczl_cls'] = (string)floatval($value);
|
|
|
|
|
+ array_push($data,$subArray);
|
|
|
|
|
+ }
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1188,15 +1208,15 @@ class FinishedProductWarehousing extends Api
|
|
|
|
|
|
|
|
// $num = db('db_包装产量预报')->count();
|
|
// $num = db('db_包装产量预报')->count();
|
|
|
// $arr1 = db('db_包装产量预报')
|
|
// $arr1 = db('db_包装产量预报')
|
|
|
- // ->field('sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6,
|
|
|
|
|
- // substr(sczl_yjGx1,2,1) as sczl_yjGx1, substr(sczl_yjGx2,2,1) as sczl_yjGx2,
|
|
|
|
|
- // substr(sczl_yjGx3,2,1) as sczl_yjGx3, substr(sczl_yjGx4,2,1) as sczl_yjGx4,
|
|
|
|
|
- // substr(sczl_yjGx5,2,1) as sczl_yjGx5, substr(sczl_yjGx6,2,1) as sczl_yjGx6,
|
|
|
|
|
- // (sczl_cl1*sczl_PgCl1+sczl_clAdd1) as sczl_cls1,
|
|
|
|
|
- // (sczl_cl2*sczl_PgCl2+sczl_clAdd2) as sczl_cls2,
|
|
|
|
|
- // (sczl_cl3*sczl_PgCl3+sczl_clAdd3) as sczl_cls3,
|
|
|
|
|
- // (sczl_cl4*sczl_PgCl4+sczl_clAdd4) as sczl_cls4,
|
|
|
|
|
- // (sczl_cl5*sczl_PgCl5+sczl_clAdd5) as sczl_cls5,
|
|
|
|
|
|
|
+ // ->field('sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6,
|
|
|
|
|
+ // substr(sczl_yjGx1,2,1) as sczl_yjGx1, substr(sczl_yjGx2,2,1) as sczl_yjGx2,
|
|
|
|
|
+ // substr(sczl_yjGx3,2,1) as sczl_yjGx3, substr(sczl_yjGx4,2,1) as sczl_yjGx4,
|
|
|
|
|
+ // substr(sczl_yjGx5,2,1) as sczl_yjGx5, substr(sczl_yjGx6,2,1) as sczl_yjGx6,
|
|
|
|
|
+ // (sczl_cl1*sczl_PgCl1+sczl_clAdd1) as sczl_cls1,
|
|
|
|
|
+ // (sczl_cl2*sczl_PgCl2+sczl_clAdd2) as sczl_cls2,
|
|
|
|
|
+ // (sczl_cl3*sczl_PgCl3+sczl_clAdd3) as sczl_cls3,
|
|
|
|
|
+ // (sczl_cl4*sczl_PgCl4+sczl_clAdd4) as sczl_cls4,
|
|
|
|
|
+ // (sczl_cl5*sczl_PgCl5+sczl_clAdd5) as sczl_cls5,
|
|
|
// (sczl_cl6*sczl_PgCl6+sczl_clAdd6) as sczl_cls6
|
|
// (sczl_cl6*sczl_PgCl6+sczl_clAdd6) as sczl_cls6
|
|
|
// ')
|
|
// ')
|
|
|
// ->limit($num)
|
|
// ->limit($num)
|
|
@@ -1309,7 +1329,7 @@ class FinishedProductWarehousing extends Api
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
krsort($data1);
|
|
krsort($data1);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//成品入仓中jjcp_smb不为空的工单
|
|
//成品入仓中jjcp_smb不为空的工单
|
|
|
$rows1 = db('成品入仓')
|
|
$rows1 = db('成品入仓')
|
|
|
->where('jjcp_smb','<>','')
|
|
->where('jjcp_smb','<>','')
|