|
@@ -1253,58 +1253,58 @@ class WorkOrder extends Api
|
|
|
* @throws \think\db\exception\BindParamException
|
|
* @throws \think\db\exception\BindParamException
|
|
|
* @throws \think\exception\PDOException
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
*/
|
|
|
-// public function PrintDetailAdd()
|
|
|
|
|
-// {
|
|
|
|
|
-// if (Request::instance()->isPost() === false){
|
|
|
|
|
-// $this->error('请求错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param = Request::instance()->post();
|
|
|
|
|
-// if (empty($param)){
|
|
|
|
|
-// $this->error('参数错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// $process = [
|
|
|
|
|
-// ['1','仓库出库'],['2','裁切'],['3','车缝'],['4','后道收样'],['5','大烫'],['6','总检'],['7','包装']
|
|
|
|
|
-// ];
|
|
|
|
|
-// $processDetail = [];
|
|
|
|
|
-// foreach ($process as $key=>$value){
|
|
|
|
|
-// $total = null;
|
|
|
|
|
-// if ($key !== 0){
|
|
|
|
|
-// $total = $param['zdtotal'];
|
|
|
|
|
-// }
|
|
|
|
|
-// $processDetail[$key] = [
|
|
|
|
|
-// '订单编号' => $param['订单编号'],
|
|
|
|
|
-// '子订单编号' => $param['子订单编号'],
|
|
|
|
|
-// '款号' => $param['款号'],
|
|
|
|
|
-// '颜色' => $param['颜色'],
|
|
|
|
|
-// '工序编号' => $value[0],
|
|
|
|
|
-// '工序名称' => $value[1],
|
|
|
|
|
-// '计划产量' => $total,
|
|
|
|
|
-// 'Sys_id' => $param['Sys_id'],
|
|
|
|
|
-// 'Sys_rq' => $param['Sys_rq']
|
|
|
|
|
-// ];
|
|
|
|
|
-// }
|
|
|
|
|
-// //开启事务
|
|
|
|
|
-// db()->startTrans();
|
|
|
|
|
-// try{
|
|
|
|
|
-// $priSql = \db('工单_印件资料')->fetchSql(true)->insert($param);
|
|
|
|
|
-// $priRes = \db()->query($priSql);
|
|
|
|
|
-// $proSql = \db('工单_工艺资料')->fetchSql(true)->insertAll($processDetail);
|
|
|
|
|
-// $proRes = \db()->query($proSql);
|
|
|
|
|
-// // 提交事务
|
|
|
|
|
-// db()->commit();
|
|
|
|
|
-// } catch (\Exception $e) {
|
|
|
|
|
-// // 回滚事务
|
|
|
|
|
-// db()->rollback();
|
|
|
|
|
-// $this->error($e->getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// if ($priRes !== false && $proRes !== false){
|
|
|
|
|
-// $this->success('成功');
|
|
|
|
|
-// }else{
|
|
|
|
|
-// $this->error('失败');
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ public function PrintDetailAdd()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = Request::instance()->post();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
+ $process = [
|
|
|
|
|
+ ['1','仓库出库'],['2','裁切'],['3','车缝'],['4','后道收样'],['5','大烫'],['6','总检'],['7','包装']
|
|
|
|
|
+ ];
|
|
|
|
|
+ $processDetail = [];
|
|
|
|
|
+ foreach ($process as $key=>$value){
|
|
|
|
|
+ $total = null;
|
|
|
|
|
+ if ($key !== 0){
|
|
|
|
|
+ $total = $param['zdtotal'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $processDetail[$key] = [
|
|
|
|
|
+ '订单编号' => $param['订单编号'],
|
|
|
|
|
+ '子订单编号' => $param['子订单编号'],
|
|
|
|
|
+ '款号' => $param['款号'],
|
|
|
|
|
+ '颜色' => $param['颜色'],
|
|
|
|
|
+ '工序编号' => $value[0],
|
|
|
|
|
+ '工序名称' => $value[1],
|
|
|
|
|
+ '计划产量' => $total,
|
|
|
|
|
+ 'Sys_id' => $param['Sys_id'],
|
|
|
|
|
+ 'Sys_rq' => $param['Sys_rq']
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ //开启事务
|
|
|
|
|
+ db()->startTrans();
|
|
|
|
|
+ try{
|
|
|
|
|
+ $priSql = \db('工单_印件资料')->fetchSql(true)->insert($param);
|
|
|
|
|
+ $priRes = \db()->query($priSql);
|
|
|
|
|
+ $proSql = \db('工单_工艺资料')->fetchSql(true)->insertAll($processDetail);
|
|
|
|
|
+ $proRes = \db()->query($proSql);
|
|
|
|
|
+ // 提交事务
|
|
|
|
|
+ db()->commit();
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ // 回滚事务
|
|
|
|
|
+ db()->rollback();
|
|
|
|
|
+ $this->error($e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($priRes !== false && $proRes !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 新增工艺资料->工艺资料添加
|
|
* 新增工艺资料->工艺资料添加
|