WorkOrder.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use Monolog\Handler\IFTTTHandler;
  5. use think\Db;
  6. use think\Request;
  7. /**
  8. * 工单资料管理
  9. */
  10. class WorkOrder extends Api
  11. {
  12. protected $noNeedLogin = ['*'];
  13. protected $noNeedRight = ['*'];
  14. /**
  15. * 工单资料菜单列表
  16. *
  17. * @ApiMethod (GET)
  18. * @return false|string
  19. * @throws \think\Exception
  20. */
  21. public function DataList()
  22. {
  23. if ($this->request->isGet() === false){
  24. $this->error('请求错误');
  25. }
  26. $where = [
  27. '行号' => '1',
  28. ];
  29. $ClientList = Db::table('erp_客户供应商')->where('类型','客户')->cache(true)->column('简称','编号');
  30. //获取总计划中数量和总生产中数量
  31. $productingAll = Db::table('工单_基本资料')->where('gd_statu','2-生产中')->cache(true)->count();
  32. $progressAll = Db::table('工单_基本资料')->where('gd_statu','3-计划中')->cache(true)->count();
  33. $data = [
  34. 'productingAll' => $productingAll,
  35. 'progressAll' => $progressAll
  36. ];
  37. //按客户编号查询生产中,计划中数量
  38. foreach ($ClientList as $key=>$value){
  39. $order = Db::table('工单_基本资料')->where('Gd_客户代号',$key)->cache(true)->count();
  40. if ($order !== 0){
  41. $productIng = Db::table('工单_基本资料')->where('Gd_客户代号',$key)->where($where)->where('gd_statu','2-生产中')->cache(true)->count();
  42. $proGress = Db::table('工单_基本资料')->where('Gd_客户代号',$key)->where($where)->where('gd_statu','3-计划中')->cache(true)->count();
  43. $code = Db::table('工单_基本资料')->where('Gd_客户代号',$key)->field('rtrim(成品代号) as 成品代号')->cache(true)->find();
  44. $Detail = [
  45. 'Gd_khdh' => substr($code['成品代号'],0,4),
  46. 'Gd_khmc' => rtrim($value),
  47. 'producting' => $productIng = 0?'':"生产中:".$productIng,
  48. 'progress' => $proGress=0?'':'计划中:'.$proGress,
  49. ];
  50. $menu = $Detail['Gd_khdh'].'【'.$Detail['producting'].$Detail['progress'].'】'.'【'.$Detail['Gd_khmc'].'】';
  51. array_push($data,$menu);
  52. }
  53. }
  54. $this->success('成功',$data);
  55. }
  56. /**
  57. * 工单基本资料列表
  58. * @ApiMethod (GET)
  59. * @param string $limit 查询长度
  60. * @param string $Gd_khdh 客户代号
  61. * @param string $startTime 接单日期开始时间
  62. * @param string $endTime 接单日期结束时间
  63. * @return \think\response\Json
  64. * @throws \think\exception\DbException
  65. */
  66. public function WorkList()
  67. {
  68. if ($this->request->isGet() === false){
  69. $this->error('请求错误');
  70. }
  71. $search = input('search');
  72. $limit = input('limit');
  73. $clientNumber = input('Gd_khdh');
  74. $startTime = input('start');
  75. $endTime = input('end');
  76. $workOrder = input('workOrder');
  77. $productCode = input('productCode');
  78. if (!empty($clientNumber)){
  79. $where['成品代号'] = ['like',$clientNumber.'%'];
  80. }
  81. if (!empty($workOrder)){
  82. $where['Gd_gdbh'] = $workOrder;
  83. }
  84. if (!empty($productCode)){
  85. $where['Gd_cpdh'] = $productCode;
  86. }
  87. if (!empty($search)){
  88. $where['Gd_lx|Gd_gdbh|Gd_客户代号|Gd_客户名称|Gd_khdh|Gd_khmc|Gd_cpdh|Gd_cpmc|成品代号|成品名称|产品版本号'] = ['like','%'.$search.'%'];
  89. }
  90. if (!empty($startTime) && !empty($endTime)){
  91. $where['接单日期'] = ['between',[$startTime,$endTime]];
  92. }
  93. $list = Db::table('工单_基本资料')
  94. ->where($where)
  95. ->order('接单日期 desc')
  96. ->paginate($limit);
  97. //工单基本资料数据整理
  98. $data = [];
  99. foreach ($list->items() as $key=>$value){
  100. $data[$key] = [
  101. '工单编号' => rtrim($value['Gd_gdbh']),
  102. '生产分类' => rtrim($value['Gd_生产分类']),
  103. '销售订单号' => rtrim($value['销售订单号']),
  104. '产品代号' => rtrim($value['Gd_cpdh']),
  105. '产品名称' => rtrim($value['Gd_cpmc']),
  106. '订单数量' => rtrim($value['订单数量']),
  107. '单位' => rtrim($value['计量单位']),
  108. '折合大箱' => rtrim((int)$value['投料大箱']),
  109. '投料率' => rtrim($value['投料率']),
  110. '平均合格率' => '',
  111. '开单日期' => date('Y-m-d',strtotime(rtrim($value['接单日期']))),
  112. '交货日期' => date('Y-m-d',strtotime(rtrim($value['交货日期']))),
  113. '工单类型' => rtrim($value['Gd_lx']),
  114. '工单状态' => rtrim($value['gd_statu']),
  115. '当前生产工序' => '',
  116. '产量提交时间' => '',
  117. '建档用户' => rtrim($value['Sys_id']),
  118. '建档时间' => rtrim($value['Sys_rq']),
  119. '更新时间' => rtrim($value['Mod_rq']),
  120. 'Uniqid' => rtrim($value['Uniqid'])
  121. ];
  122. }
  123. $this->success('成功',$data);
  124. }
  125. /**
  126. * 印件资料
  127. * @ApiMethod (GET)
  128. * @param string $Gd_gdbh 工单编号
  129. * @return \think\response\Json
  130. * @throws \think\db\exception\DataNotFoundException
  131. * @throws \think\db\exception\ModelNotFoundException
  132. * @throws \think\exception\DbException
  133. */
  134. public function Printed()
  135. {
  136. if ($this->request->isGet() === false){
  137. $this->error('请求错误');
  138. }
  139. $Gd_gdbh = input('Gd_gdbh');
  140. if (empty($Gd_gdbh)){
  141. $this->error('参数错误');
  142. }
  143. $list = Db::table('工单_印件资料')->where('Yj_Gdbh',$Gd_gdbh)->select();
  144. $data = [];
  145. if ($list){
  146. foreach ($list as $key=>$value){
  147. $data[$key] = [
  148. '印件号' => rtrim($value['yj_Yjno']),
  149. '印件代号' => rtrim($value['yj_Yjdh']),
  150. '印件名称' => rtrim($value['yj_yjmc']),
  151. '纸张代号' => rtrim($value['yj_zzdh']),
  152. '纸张名称' => rtrim($value['yj_zzmc']),
  153. '投料规格' => rtrim($value['yj_tlgg']),
  154. '平张投料' => rtrim($value['yj_平张投料']),
  155. '开料规格' => rtrim($value['yj_klgg']),
  156. '开数*联数' => rtrim($value['yj_ks']).'*'.rtrim($value['yj_ls']),
  157. '建档用户' => rtrim($value['Sys_id']),
  158. '建档时间' => rtrim($value['Sys_rq']),
  159. '更新时间' => rtrim($value['Mod_rq']),
  160. 'zzdh1' => rtrim($value['yj_zzdh1']),
  161. 'zzdh2' => rtrim($value['yj_zzdh2']),
  162. 'zzdh3' => rtrim($value['yj_zzdh3']),
  163. 'zzdh4' => rtrim($value['yj_zzdh4']),
  164. 'zzmc1' => rtrim($value['yj_zzmc1']),
  165. 'zzmc2' => rtrim($value['yj_zzmc2']),
  166. 'zzmc3' => rtrim($value['yj_zzmc3']),
  167. 'zzmc4' => rtrim($value['yj_zzmc4']),
  168. '订单数量' => rtrim($value['yj_成品数量']),
  169. '万小张' => rtrim($value['yj_实际投料']),
  170. '开数' => rtrim($value['yj_ks']),
  171. '联数' => rtrim($value['yj_ls']),
  172. '核算规格' => rtrim($value['Yj_核算规格']),
  173. '备注' => rtrim($value['yj_desc']),
  174. 'Uniqid' => rtrim($value['Uniqid'])
  175. ];
  176. }
  177. }
  178. $this->success('成功',$data);
  179. }
  180. /**
  181. * 工艺资料
  182. * @ApiMethod (GET)
  183. * @param string $Gd_gdbh 工单编号
  184. * @return \think\response\Json
  185. * @throws \think\db\exception\DataNotFoundException
  186. * @throws \think\db\exception\ModelNotFoundException
  187. * @throws \think\exception\DbException
  188. */
  189. public function Craft()
  190. {
  191. if ($this->request->isGet() === false){
  192. $this->error('请求错误');
  193. }
  194. $Gd_gdbh = input('Gd_gdbh');
  195. if (empty($Gd_gdbh)){
  196. $this->error('参数错误');
  197. }
  198. $list = Db::table('工单_工艺资料')
  199. ->where('Gy0_gdbh',$Gd_gdbh)
  200. ->select();
  201. $Gd_cpdh = Db::table('工单_基本资料')->where('Gd_gdbh',$Gd_gdbh)->field('Gd_cpdh')->find();
  202. $data = [];
  203. if ($list){
  204. foreach ($list as $key=>$value){
  205. if ($value['Gy0_yjno']<10){
  206. $value['Gy0_yjno'] = '0'.$value['Gy0_yjno'];
  207. }
  208. if ($value['Gy0_gxh']<10){
  209. $value['Gy0_gxh'] = '0'.$value['Gy0_gxh'];
  210. }
  211. $where = [
  212. 'Gy0_cpdh' => $Gd_cpdh['Gd_cpdh'],
  213. 'Gy0_yjno' => $value['Gy0_yjno'],
  214. 'Gy0_gxh' => $value['Gy0_gxh'],
  215. ];
  216. $product = Db::table('产品_工艺资料')->where($where)->field('工价系数,损耗系数')->find();
  217. $data[$key] = [
  218. '重点工序' => rtrim($value['重点工序']),
  219. '印件-工序' => rtrim($value['Gy0_yjno']).'-'.rtrim($value['Gy0_gxh']),
  220. '备选工序' => '',
  221. '工序名称' => rtrim($value['Gy0_gxmc']).'【'.rtrim($value['Add_gxmc']).'】',
  222. '计划产量' => rtrim($value['Gy0_计划接货数']),
  223. '基础损耗' => rtrim($value['Gy0_Rate0']),
  224. '损耗率' => rtrim($value['Gy0_Rate1']),
  225. '报废定额' => '',
  226. '允损比例' => '',
  227. '难度系数' => isset($product['工价系数'])?rtrim($product['工价系数']):'',
  228. '损耗系数' => isset($product['损耗系数'])?rtrim($product['损耗系数']):'',
  229. '人工检_次品板' => (int)$value['人工检_次品板']=0?'':$value['人工检_次品板'],
  230. '人工检_废检' => (int)$value['人工检_废检']=0?'':$value['人工检_废检'],
  231. '机检_正品板' => (int)$value['机检_正品板']=0?'':$value['机检_正品板'],
  232. '机检_次品板' => (int)$value['机检_次品板']=0?'':$value['机检_次品板'],
  233. '机检_废检' => (int)$value['机检_废检']=0?'':$value['机检_废检'],
  234. '开数*联数' => rtrim($value['Gy0_ks']).'*'.rtrim($value['Gy0_ls']),
  235. '备注' => isset($value['工序备注'])?rtrim($value['工序备注']):'',
  236. '印刷方式' => isset($value['印刷方式'])?rtrim($value['印刷方式']):'',
  237. '版距' => isset($value['版距'])?rtrim($value['版距']):'',
  238. '建档用户' => rtrim($value['Sys_id']),
  239. '建档日期' => isset($value['Sys_rq'])?rtrim($value['Sys_rq']):'',
  240. '更新时间' => isset($value['Mod_rq'])?rtrim($value['Mod_rq']):'',
  241. '车间名称' => rtrim($value['Gy0_SITE']),
  242. '质量要求' => rtrim($value['质量要求']),
  243. '质量隐患' => rtrim($value['质量隐患']),
  244. '开数' => rtrim($value['Gy0_ks']),
  245. '联数' => rtrim($value['Gy0_ls']),
  246. 'UniqId' => rtrim($value['UniqId'])
  247. ];
  248. }
  249. }
  250. $this->success('成功',$data);
  251. }
  252. /**
  253. * BOM资料
  254. * @ApiMethod (GET)
  255. * @param string $Gd_gdbh 工单编号
  256. * @return \think\response\Json
  257. * @throws \think\db\exception\DataNotFoundException
  258. * @throws \think\db\exception\ModelNotFoundException
  259. * @throws \think\exception\DbException
  260. */
  261. public function Bom()
  262. {
  263. if ($this->request->isGet() === false){
  264. $this->error('请求错误');
  265. }
  266. $Gd_gdbh = input('Gd_gdbh');
  267. if (empty($Gd_gdbh)){
  268. $this->error('参数错误');
  269. }
  270. $field = 'rtrim(BOM_方案) as 方案,rtrim(BOM_物料编码) as 物料编号,rtrim(BOM_物料名称) as 物料名称,BOM_投料单位,
  271. BOM_投入数,BOM_产出数,BOM_产出单位,rtrim(BOM_计划用量) as 计划用量,rtrim(Sys_ID) as 建档用户,rtrim(Sys_rq) as 建档时间,rtrim(Mod_rq) as 更新时间';
  272. $list = Db::table('工单_bom资料')
  273. ->where('BOM_工单编号',$Gd_gdbh)
  274. ->field($field)
  275. ->select();
  276. foreach ($list as $key=>$value){
  277. $list[$key]['消耗定量'] = rtrim($value['BOM_投入数']).rtrim($value['BOM_投料单位']).'/'.rtrim($value['BOM_产出数']).rtrim($value['BOM_产出单位']);
  278. unset($list[$key]['BOM_投料单位'],$list[$key]['BOM_投入数'],$list[$key]['BOM_产出数'],$list[$key]['BOM_产出单位']);
  279. $list[$key]['计划用量'] = rtrim((float)$value['计划用量']);
  280. }
  281. $this->success('成功',$list);
  282. }
  283. /**
  284. * 编辑页面展示
  285. * @ApiMethod (GET)
  286. * @param string $workOrder 工单编号
  287. * @return void
  288. * @throws \think\db\exception\DataNotFoundException
  289. * @throws \think\db\exception\ModelNotFoundException
  290. * @throws \think\exception\DbException
  291. */
  292. public function DataCorrection()
  293. {
  294. if ($this->request->isGet() === false){
  295. $this->error('请求错误');
  296. }
  297. $workOrder = input('Gd_gdbh');
  298. if (empty($workOrder)){
  299. $this->error('参数错误');
  300. }
  301. $field = 'rtrim(Gd_lx) as 重点工单,rtrim(Gd_gdbh) as 工单编号,rtrim(Gd_生产分类) as 生产类型,rtrim(Gd_khdh) as 客户代号,rtrim(Gd_客户名称) as 客户名称,
  302. rtrim(Gd_cpdh) as 产品代号,rtrim(Gd_cpmc) as 产品名称,rtrim(开单日期) as 开单日期,rtrim(订单数量) as 订单数量,rtrim(交货日期) as 交货日期,
  303. rtrim(投料率) as 投料率,rtrim(实际投料) as 万小张,rtrim(计量单位) as 单位,rtrim(投料大箱) as 投料大箱,rtrim(排产时库存) as 库存大箱,rtrim(警语版面) as 警语版面,
  304. rtrim(销售订单号) as 销售订单号,rtrim(产品版本号) as 版本号,rtrim(客户ERP编码) as 客户ERP编码,rtrim(码源数量) as 码源数量,rtrim(进程备注) as 进程备注,rtrim(Gd_desc) as 备注,rtrim(Uniqid) as Uniqid';
  305. $list = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->field($field)->find();
  306. if (empty($list)){
  307. $this->error('未找到该工单信息');
  308. }
  309. $printData = Db::table('工单_印件资料')
  310. ->where('Yj_Gdbh',$workOrder)
  311. ->field('rtrim(yj_yjmc) as 印件名称,rtrim(yj_Yjdh) as 印件代号,rtrim(yj_平张投料) as 平张投料')
  312. ->find();
  313. if (empty($printData)){
  314. $this->error('未找到该工单印件资料');
  315. }
  316. $list['印件名称'] = $printData['印件名称'];
  317. $list['印件代号'] = $printData['印件代号'];
  318. $list['平张投料'] = $printData['平张投料'];
  319. $this->success('成功',$list);
  320. }
  321. /**
  322. * 工单资料修改
  323. * @ApiMethod (POST)
  324. * @param void
  325. * @return void
  326. * @throws \think\Exception
  327. * @throws \think\exception\PDOException
  328. */
  329. public function WorkOrderEdit()
  330. {
  331. if ($this->request->isPost() === false){
  332. $this->error('请求错误');
  333. }
  334. $param = $this->request->param();
  335. if (empty($param) || isset($param['Uniqid']) === false){
  336. $this->error('参数错误');
  337. }
  338. $row = [
  339. 'Gd_lx' => isset($param['lx'])?$param['lx']:'',
  340. '开单日期' => isset($param['kdrq'])?$param['kdrq']:'',
  341. 'Gd_gdbh' => isset($param['gdbh'])?$param['gdbh']:'',
  342. 'Gd_生产分类' => isset($param['scfl'])?$param['scfl']:'',
  343. 'Gd_客户代号' => isset($param['khdh'])?$param['khdh']:'',
  344. 'Gd_客户名称' => isset($param['khmc'])?$param['khmc']:'',
  345. '成品代号' => isset($param['cpdh'])?$param['cpdh']:'',
  346. '成品名称' => isset($param['cpmc'])?$param['cpmc']:'',
  347. '订单数量' => isset($param['ddsl'])?$param['ddsl']:'',
  348. '交货日期' => isset($param['jhrq'])?$param['jhrq']:'',
  349. '投料率' => isset($param['tll'])?$param['tll']:'',
  350. '计划投料' => isset($param['jhtl'])?$param['jhtl']:'',
  351. '实际投料' => isset($param['sjtl'])?$param['sjtl']:'',
  352. '计量单位' => isset($param['jldw'])?$param['jldw']:'',
  353. '投料大箱' => isset($param['tldx'])?$param['tldx']:'',
  354. '销售订单号' => isset($param['xsddh'])?$param['xsddh']:'',
  355. '警语版面' => isset($param['jymb'])?$param['jymb']:'',
  356. '产品版本号' => isset($param['bbh'])?$param['bbh']:'',
  357. '客户ERP编码' => isset($param['erp'])?$param['erp']:'',
  358. '码源数量' => isset($param['ymsl'])?$param['ymsl']:'',
  359. '进程备注' => isset($param['jcbz'])?$param['jcbz']:'',
  360. 'Gd_desc' => isset($param['desc'])?$param['desc']:'',
  361. ];
  362. $sql = Db::table('工单_基本资料')->where('Uniqid',$param['Uniqid'])->fetchSql(true)->update($row);
  363. $res = Db::query($sql);
  364. if ($res !== false){
  365. $this->success('成功');
  366. }else{
  367. $this->error('失败');
  368. }
  369. }
  370. /**
  371. * U8投料试算
  372. * @ApiMethod (GET)
  373. * @param string $processCode 产品编号
  374. * @return void
  375. * @throws \think\db\exception\DataNotFoundException
  376. * @throws \think\db\exception\ModelNotFoundException
  377. * @throws \think\exception\DbException
  378. */
  379. public function U8Trial()
  380. {
  381. if ($this->request->isGet() === false)
  382. {
  383. $this->error('请求错误');
  384. }
  385. $productCode = input('productCode');
  386. if (empty($productCode)){
  387. $this->error('参数错误');
  388. }
  389. $field = 'rtrim(Gy0_cpdh) as 产品代号,rtrim(Gy0_yjno) as 印件号,rtrim(Gy0_gxh) as 工序号,rtrim(gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
  390. rtrim(Gy0_Ms) as 墨色数,rtrim(Gy0_shdh) as 损耗代号,rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as 加工联数';
  391. $list = Db::table('产品_工艺资料')->where('Gy0_cpdh',$productCode)->field($field)->select();
  392. if (empty($list)){
  393. $this->error('未找到该产品工序');
  394. }
  395. foreach ($list as $key=>$value){
  396. $data = Db::table('dic_lzsh')->where('sys_bh',$value['损耗代号'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->cache(true)->find();
  397. $list[$key]['调机损耗'] = isset($data['rate0'])?$data['rate0']:'';
  398. $list[$key]['运行损耗率'] = isset($data['rate1'])?$data['rate1']:'';
  399. if ($value['add_gxmc'] !== ''){
  400. $list[$key]['工序名称'] = $value['gxmc'].'【'.$value['add_gxmc'].'】';
  401. }else{
  402. $list[$key]['工序名称'] = $value['gxmc'];
  403. }
  404. unset($list[$key]['gxmc'],$list[$key]['add_gxmc']);
  405. }
  406. $this->success('成功',$list);
  407. }
  408. /**
  409. * 引用产品资料->获取产品资料
  410. * @ApiMethod (GET)
  411. * @param string $workOrder 工单编号
  412. * @return void
  413. * @throws \think\db\exception\DataNotFoundException
  414. * @throws \think\db\exception\ModelNotFoundException
  415. * @throws \think\exception\DbException
  416. */
  417. public function ProductInformation()
  418. {
  419. if ($this->request->isGet() === false)
  420. {
  421. $this->error('请求错误');
  422. }
  423. $workOrder = input('workOrder');
  424. if (empty($workOrder)){
  425. $this->error('参数错误');
  426. }
  427. $field = 'rtrim(Gd_gdbh) as 工单编号,rtrim(Gd_客户名称) as 客户名称,rtrim(成品代号) as 产品代号,rtrim(成品名称) as 产品名称';
  428. $Detail = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->field($field)->find();
  429. if (empty($Detail)){
  430. $this->error('未找到工单信息');
  431. }
  432. $Detail['客户代号'] = substr($Detail['产品代号'],0,4);
  433. $this->success('成功',$Detail);
  434. }
  435. /**
  436. * 引用产品资料->复制产品工艺资料
  437. * @ApiMethod (POST)
  438. * @param string $oldWorkOrder 被复制工单编号
  439. * @param string $newWorkOrder 复制工单编号
  440. * @return void
  441. * @throws \think\Exception
  442. * @throws \think\db\exception\DataNotFoundException
  443. * @throws \think\db\exception\ModelNotFoundException
  444. * @throws \think\exception\DbException
  445. * @throws \think\exception\PDOException
  446. */
  447. public function ProductInformationEdit()
  448. {
  449. if ($this->request->isPost() === false)
  450. {
  451. $this->error('请求错误');
  452. }
  453. $oldWorkOrder = input('oldWorkOrder');
  454. $newWorkOrder = input('newWorkOrder');
  455. if (empty($oldWorkOrder) || empty($newWorkOrder))
  456. {
  457. $this->error('参数错误');
  458. }
  459. //获取原工单工艺资料
  460. $oldProcessData = Db::table('工单_工艺资料')->where('Gy0_gdbh',$oldWorkOrder)->select();
  461. $ProsessUniqId = Db::table('工单_工艺资料')->field('UniqId')->order('UniqId desc')->find();
  462. foreach ($oldProcessData as $k=>$v){
  463. $oldProcessData[$k]['Gy0_gdbh'] = $newWorkOrder;
  464. $oldProcessData[$k]['Sys_id'] = '';
  465. $oldProcessData[$k]['UniqId'] = $ProsessUniqId['UniqId'] + $k + 1;
  466. }
  467. if (Db::table('工单_工艺资料')->where('Gy0_gdbh',$newWorkOrder)->find()){
  468. Db::table('工单_工艺资料')->where('Gy0_gdbh',$newWorkOrder)->delete();
  469. }
  470. //获取原工单印件资料
  471. $oldPrintData = Db::table('工单_印件资料')->where('Yj_Gdbh',$oldWorkOrder)->select();
  472. $PrintUniqId = Db::table('工单_印件资料')->field('Uniqid')->order('Uniqid desc')->find();
  473. foreach ($oldPrintData as $k=>$v){
  474. $oldPrintData[$k]['Yj_Gdbh'] = $newWorkOrder;
  475. $oldPrintData[$k]['Sys_id'] = '';
  476. $oldPrintData[$k]['Uniqid'] = $PrintUniqId['Uniqid'] +$k +1;
  477. }
  478. if (Db::table('工单_印件资料')->where('Yj_Gdbh',$newWorkOrder)->find()){
  479. Db::table('工单_印件资料')->where('Yj_Gdbh',$newWorkOrder)->delete();
  480. }
  481. //复制印件、工艺资料
  482. $ProcessSQL = Db::table('工单_工艺资料')->fetchSql(true)->insertAll($oldProcessData);
  483. $ProcessRes = Db::query($ProcessSQL);
  484. $PrintSQL = Db::table('工单_印件资料')->fetchSql(true)->insertAll($oldPrintData);
  485. $PrintRes = Db::query($PrintSQL);
  486. if ($ProcessRes !== false && $PrintRes !== false){
  487. $this->success('成功');
  488. }else{
  489. $this->error('失败');
  490. }
  491. }
  492. /**
  493. * 工艺流程调成->获取当前工单工艺资料
  494. * @ApiMethod (GET)
  495. * @param string $workorder 当前工单编号
  496. * @return void
  497. * @throws \think\db\exception\DataNotFoundException
  498. * @throws \think\db\exception\ModelNotFoundException
  499. * @throws \think\exception\DbException
  500. */
  501. public function ProcessFlow()
  502. {
  503. if ($this->request->isGet() === false){
  504. $this->error('请求错误');
  505. }
  506. $workOrder = input('workOrder');
  507. if (empty($workOrder)){
  508. $this->error('参数错误');
  509. }
  510. $list = Db::table('工单_基本资料')->where('Gd_gdbh',$workOrder)->field('rtrim(成品代号) as 成品编号,rtrim(成品名称) as 成品名称')->find();
  511. if (empty($list)){
  512. $this->error('未找到工单信息');
  513. }
  514. $filed = 'rtrim(Gy0_方案) as 方案,rtrim(Gy0_yjno) as 印件号,rtrim(Gy0_gxh) as 工序号,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
  515. rtrim(工价系数) as 工价系数,rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ks) as ks,rtrim(Gy0_ls) as ls,rtrim(工序备注) as 备注,rtrim(Gy0_SITE) as 车间,
  516. rtrim(Gy0_sbbh) as 设备编号,rtrim(Gy0_sbmc) as 设备名称,rtrim(Sys_id) as 建档用户,rtrim(Sys_rq) as 建档时间,rtrim(Mod_rq) as 更新时间';
  517. $process = Db::table('工单_工艺资料')->where('Gy0_gdbh',$workOrder)->field($filed)->select();
  518. if (empty($process)){
  519. $this->error('未找到该工单工艺资料');
  520. }
  521. foreach ($process as $key=>$value){
  522. if (isset($value['add_gxmc'])){
  523. $process[$key]['工序名称'] = $value['gxmc'] . '【'.$value['add_gxmc'].'】';
  524. }else{
  525. $process[$key]['工序名称'] = $value['gxmc'];
  526. }
  527. $process[$key]['工价系数'] = (float)$value['工价系数'];
  528. $process[$key]['损耗系数'] = (float)$value['损耗系数'];
  529. $process[$key]['开数*联数'] = $value['ks'].'*'.$value['ls'];
  530. }
  531. $list['process'] = $process;
  532. $this->success('成功',$list);
  533. }
  534. /**
  535. * 参照工单列表获取
  536. * @ApiMethod (GET)
  537. * @param string $workOrder 工单编号
  538. * @param string $productCode 产品代号
  539. * @return void
  540. */
  541. public function ReferenceWorkOrder()
  542. {
  543. if ($this->request->isGet() === false){
  544. $this->error('请求错误');
  545. }
  546. $productCode = input('productCode');
  547. $workOrder = input('workOrder');
  548. if (empty($productCode) || empty($workOrder)){
  549. $this->error('参数错误');
  550. }
  551. $list = Db::table('工单_基本资料')->where('成品代号',$productCode)->where('Gd_gdbh','<>',$workOrder)->column('Gd_gdbh');
  552. if (empty($list)){
  553. $this->error('未获取该产品其他工单信息');
  554. }
  555. $this->success('成功',$list);
  556. }
  557. /**
  558. * 工艺资料复制
  559. * @ApiMethod (POST)
  560. * @param string $oldWorkOrder 被复制工单编号
  561. * @param string $newWorkOrder 复制工单编号
  562. * @return void
  563. * @throws \think\Exception
  564. * @throws \think\db\exception\DataNotFoundException
  565. * @throws \think\db\exception\ModelNotFoundException
  566. * @throws \think\exception\DbException
  567. * @throws \think\exception\PDOException
  568. *
  569. */
  570. public function ProcessCopy()
  571. {
  572. if ($this->request->isPost() === false){
  573. $this->error('请求错误');
  574. }
  575. $oldWorkOrder = input('oldWorkOrder');
  576. $newWorkOrder = input('newWorkOrder');
  577. if (empty($oldWorkOrder) || empty($newWorkOrder))
  578. {
  579. $this->error('参数错误');
  580. }
  581. //获取原工单工艺资料
  582. $oldProcessData = Db::table('工单_工艺资料')->where('Gy0_gdbh',$oldWorkOrder)->select();
  583. $ProsessUniqId = Db::table('工单_工艺资料')->field('UniqId')->order('UniqId desc')->find();
  584. foreach ($oldProcessData as $k=>$v){
  585. $oldProcessData[$k]['Gy0_gdbh'] = $newWorkOrder;
  586. $oldProcessData[$k]['Sys_id'] = '';
  587. $oldProcessData[$k]['Mod_rq'] = date('Y-m-d H:i:s',time());
  588. $oldProcessData[$k]['UniqId'] = $ProsessUniqId['UniqId'] + $k + 1;
  589. }
  590. if (Db::table('工单_工艺资料')->where('Gy0_gdbh',$newWorkOrder)->find()){
  591. Db::table('工单_工艺资料')->where('Gy0_gdbh',$newWorkOrder)->delete();
  592. }
  593. //插入工艺资料
  594. $ProcessSQL = Db::table('工单_工艺资料')->fetchSql(true)->insertAll($oldProcessData);
  595. $ProcessRes = Db::query($ProcessSQL);
  596. if ($ProcessRes !== false){
  597. $this->success('成功');
  598. }else{
  599. $this->error('失败');
  600. }
  601. }
  602. /**
  603. * U8工单列表
  604. * @ApiMethod (GET)
  605. * @param void
  606. * @return void
  607. * @throws \think\db\exception\DataNotFoundException
  608. * @throws \think\db\exception\ModelNotFoundException
  609. * @throws \think\exception\DbException
  610. */
  611. public function U8workOrder()
  612. {
  613. if ($this->request->isGet() === false){
  614. $this->error('请求错误');
  615. }
  616. $param = $this->request->param();
  617. if (empty($param)){
  618. $this->error('参数错误');
  619. }
  620. $filed = 'rtrim(Gd_gdbh) as 工单编号,rtrim(行号) as 行号,rtrim(Gd_客户代号) as 客户代号,rtrim(Gd_客户名称) as 客户名称,
  621. rtrim(成品代号) as 成品代号,rtrim(成品名称) as 成品名称,rtrim(Mod_rq) as 获取日期,rtrim(Uniqid) as 序号';
  622. $list = Db::table('工单_基本资料')->where('Gd_gdbh',$param['workOrder'])->field($filed)->select();
  623. if (empty($list)){
  624. $this->error('未找到工单');
  625. }
  626. $this->success('成功',$list);
  627. }
  628. /**
  629. * U8工单资料删除
  630. * @param string $workOrder 工单编号
  631. * @return void
  632. * @throws \think\Exception
  633. * @throws \think\exception\PDOException
  634. */
  635. public function U8DataCorrection()
  636. {
  637. if($this->request->isGet() === false){
  638. $this->error('请求错误');
  639. }
  640. $workOrder = input('Uniqid');
  641. if (empty($workOrder)){
  642. $this->error('参数错误');
  643. }
  644. $data = [];
  645. if (strpos($workOrder,',')){
  646. $data = explode(',',$workOrder);
  647. }else{
  648. $data[0] = $workOrder;
  649. }
  650. $res = Db::table('工单_基本资料')->where('Uniqid','in',$data)->delete();
  651. if ($res !== false){
  652. $this->success('成功');
  653. }else{
  654. $this->error('失败');
  655. }
  656. }
  657. /**
  658. * 产品废检系数调整->质检工艺数据获取
  659. * @ApiMethod (GET)
  660. * @param string $workOrder 工单编号
  661. * @return void
  662. * @throws \think\db\exception\DataNotFoundException
  663. * @throws \think\db\exception\ModelNotFoundException
  664. * @throws \think\exception\DbException
  665. */
  666. public function TestCoefficient()
  667. {
  668. if ($this->request->isGet() === false){
  669. $this->error('请求错误');
  670. }
  671. $workOrder = input('workOrder');
  672. if (empty($workOrder)){
  673. $this->error('参数错误');
  674. }
  675. $where = [
  676. 'Gy0_gdbh' => $workOrder,
  677. 'Gy0_gxmc' => ['like','%检%']
  678. ];
  679. $filed = 'rtrim(Gy0_gdbh) as gdbh,rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(人工检_正品板) as 人工正品板,
  680. rtrim(人工检_次品板) as 人工次品板,rtrim(人工检_废检) as 人工废检,rtrim(机检_正品板) as 机检正品板,rtrim(机检_次品板) as 机检次品板,
  681. rtrim(机检_废检) as 机检废检,rtrim(Gy0_sbbh) as 设备编号,rtrim(Uniqid) as Uniqid';
  682. $list = Db::table('工单_工艺资料')->where($where)->field($filed)->select();
  683. if (empty($list)){
  684. $this->error('未找到该工单工艺');
  685. }
  686. $name = Db::table('工单_基本资料')
  687. ->where('Gd_gdbh',$workOrder)
  688. ->field('rtrim(Gd_cpdh) as 产品代号,rtrim(Gd_khmc) as 客户名称,rtrim(Gd_cpmc) as 产品名称')
  689. ->find();
  690. if (empty($name)){
  691. $this->error('未找到该工单');
  692. }
  693. foreach ($list as $key=>$value){
  694. if ($value['yjno']<10){
  695. $value['yjno'] = '0'.$value['yjno'];
  696. }
  697. if ($value['gxh']<10){
  698. $value['gxh'] = '0'.$value['gxh'];
  699. }
  700. $list[$key]['印件工序及工艺'] = $value['gdbh'].'-'.$value['yjno'].'-'.$value['gxh'].'-'.$value['gxmc'];
  701. unset($list[$key]['gdbh'],$list[$key]['yjno'],$list[$key]['gxmc']);
  702. $list[$key]['产品编号'] = $name['产品代号'];
  703. $list[$key]['产品名称'] = $name['产品名称'];
  704. $list[$key]['客户名称'] = $name['客户名称'];
  705. }
  706. $this->success('成功',$list);
  707. }
  708. /**
  709. * 产品质检系数调整->系数修改
  710. * @ApiMethod (GET)
  711. * @param string $workorder 工单编号
  712. * @param string $processCode 工序号
  713. * @param float $code1 人工正品板
  714. * @param float $code2 人工次品板
  715. * @param float $code3 人工废检
  716. * @param float $code4 机检正品板
  717. * @param float $code5 机检次品板
  718. * @param float $code6 机检废检
  719. * @return void
  720. * @throws \think\Exception
  721. * @throws \think\exception\PDOException
  722. */
  723. public function TestCoefficientEdit()
  724. {
  725. if ($this->request->isPost() === false){
  726. $this->error('请求错误');
  727. }
  728. $workOrder = input('workOrder');
  729. $processCode = input('processCode');
  730. $row = [
  731. '人工检_正品板' => input('code1'),
  732. '人工检_次品板' => input('code2'),
  733. '人工检_废检' => input('code3'),
  734. '机检_正品板' => input('code4'),
  735. '机检_次品板' => input('code5'),
  736. '机检_废检' => input('code6'),
  737. ];
  738. if (empty($workOrder) || empty($processCode)){
  739. $this->error('参数错误');
  740. }
  741. $where = [
  742. 'Gy0_gdbh' => $workOrder,
  743. 'Gy0_gxh' => $processCode
  744. ];
  745. $sql = Db::table('工单_工艺资料')->where($where)->fetchSql(true)->update($row);
  746. $res = Db::query($sql);
  747. if ($res !== false){
  748. $this->success('成功');
  749. }else{
  750. $this->error('失败');
  751. }
  752. }
  753. /**
  754. * 修正工单核算参数->数据获取
  755. * @ApiMethod (GET)
  756. * @param string $workOrder 工单编号
  757. * @return void
  758. * @throws \think\db\exception\DataNotFoundException
  759. * @throws \think\db\exception\ModelNotFoundException
  760. * @throws \think\exception\DbException
  761. */
  762. public function AccountingParameter()
  763. {
  764. if ($this->request->isGet() === false){
  765. $this->error('请求错误');
  766. }
  767. $workOrder = input('workOrder');
  768. if (empty($workOrder)){
  769. $this->error('参数错误');
  770. }
  771. $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,
  772. rtrim(Gy0_sbbh) as 参照设备,rtrim(工价系数) as 难度系数,rtrim(Gy0_shdh) as 损耗代号,rtrim(Gy0_Rate0) as 基础损耗,rtrim(Gy0_Rate1) as 损耗率,
  773. rtrim(印刷方式) as 印刷方式,rtrim(版距) as 版距,rtrim(Gy0_ms) as 计损色数,rtrim(损耗系数) as 损耗系数,rtrim(UniqId) as UniqId';
  774. $list = Db::table('工单_工艺资料')->where('Gy0_gdbh',$workOrder)->field($field)->select();
  775. if (empty($list)){
  776. $this->error('未找到该工单工艺资料');
  777. }
  778. foreach ($list as $key=>$value){
  779. if ($value['yjno']<10){
  780. $value['yjno'] = '0'.$value['yjno'];
  781. }
  782. if ($value['gxh']<10){
  783. $value['gxh'] = '0'.$value['gxh'];
  784. }
  785. $list[$key]['印件号及工序名称'] = $value['yjno'].'-'.$value['gxh'].$value['gxmc'].'('.$value['add_gxmc'].')';
  786. unset($list[$key]['yjno'],$list[$key]['gxmc'],$list[$key]['add_gxmc']);
  787. }
  788. $this->success('成功',$list);
  789. }
  790. /**
  791. * 修正工单核算参数->参数修改
  792. * @ApiMethod (POST)
  793. * @param void
  794. * @return void
  795. * @throws \think\Exception
  796. * @throws \think\db\exception\DataNotFoundException
  797. * @throws \think\db\exception\ModelNotFoundException
  798. * @throws \think\exception\DbException
  799. * @throws \think\exception\PDOException
  800. */
  801. public function AccountingParameterEdit()
  802. {
  803. if (Request::instance()->isPost() === false){
  804. $this->error('请求错误');
  805. }
  806. $param = Request::instance()->post();
  807. if (empty($param) || isset($param[0]['Uniqid']) === false){
  808. $this->error('参数错误');
  809. }
  810. $i = 0;
  811. foreach ($param as $key=>$value){
  812. $data = Db::table('dic_lzsh')->where('sys_bh',$value['loss'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->find();
  813. $row = [
  814. '工价系数' => $value['difficulty']?:'',
  815. 'Gy0_shdh' => $value['loss']?:'',
  816. '印刷方式' => $value['printMode']?:'',
  817. '版距' => $value['plate']?:'',
  818. 'Gy0_ms' => $value['chromatic']?:'',
  819. '损耗系数' => $value['wastage']?:'',
  820. 'Gy0_Rate0' => $data['rate0'],
  821. 'Gy0_Rate1' => $data['rate1']
  822. ];
  823. $sql = Db::table('工单_工艺资料')->where('Uniqid',$value['Uniqid'])->fetchSql(true)->update($row);
  824. $res = Db::query($sql);
  825. if ($res !== false){
  826. $i++;
  827. }
  828. }
  829. if ($i !== 0){
  830. $this->success('成功');
  831. }else{
  832. $this->error('失败');
  833. }
  834. }
  835. /**
  836. * 印件资料修改
  837. * @ApiMethod (POST)
  838. * @param void
  839. * @return void
  840. * @throws \think\Exception
  841. * @throws \think\exception\PDOException
  842. */
  843. public function PrintedEdit()
  844. {
  845. if ($this->request->isPost() === false){
  846. $this->error('请求错误');
  847. }
  848. $param = $this->request->param();
  849. if (empty($param) || isset($param['Uniqid']) === false){
  850. $this->error('参数错误');
  851. }
  852. $data = [
  853. 'yj_Yjno' => isset($param['yjno'])?$param['yjno']:'',
  854. 'yj_Yjdh' => isset($param['yjdh'])?$param['yjdh']:'',
  855. 'yj_yjmc' => isset($param['yjmc'])?$param['yjmc']:'',
  856. 'yj_zzdh' => isset($param['zzdh'])?$param['zzdh']:'',
  857. 'yj_zzdh1' => isset($param['zzdh1'])?$param['zzdh1']:'',
  858. 'yj_zzdh2' => isset($param['zzdh2'])?$param['zzdh2']:'',
  859. 'yj_zzdh3' => isset($param['zzdh3'])?$param['zzdh3']:'',
  860. 'yj_zzdh4' => isset($param['zzdh4'])?$param['zzdh4']:'',
  861. 'yj_zzmc' => isset($param['zzmc'])?$param['zzmc']:'',
  862. 'yj_zzmc1' => isset($param['zzmc1'])?$param['zzmc1']:'',
  863. 'yj_zzmc2' => isset($param['zzmc2'])?$param['zzmc2']:'',
  864. 'yj_zzmc3' => isset($param['zzmc3'])?$param['zzmc3']:'',
  865. 'yj_zzmc4' => isset($param['zzmc4'])?$param['zzmc4']:'',
  866. 'yj_成品数量' => isset($param['cpsl'])?$param['cpsl']:'',
  867. 'yj_实际投料' => isset($param['sjtl'])?$param['sjtl']:'',
  868. 'yj_平张投料' => isset($param['pztl'])?$param['pztl']:'',
  869. 'yj_tlgg' => isset($param['tlgg'])?$param['tlgg']:'',
  870. 'yj_klgg' => isset($param['klgg'])?$param['klgg']:'',
  871. 'Yj_核算规格' => isset($param['hsgg'])?$param['hsgg']:'',
  872. 'yj_ks' => isset($param['ks'])?$param['ks']:'',
  873. 'yj_ls' => isset($param['ls'])?$param['ls']:'',
  874. 'yj_desc' => isset($param['desc'])?$param['desc']:'',
  875. ];
  876. $sql = Db::table('工单_印件资料')->where('Uniqid',$param['Uniqid'])->fetchSql(true)->update($data);
  877. $res = Db::query($sql);
  878. if ($res !== false){
  879. $this->success('成功');
  880. }else{
  881. $this->error('失败');
  882. }
  883. }
  884. /**
  885. * 工艺资料修改
  886. * @ApiMethod (POST)
  887. * @param void
  888. * @return void
  889. * @throws \think\Exception
  890. * @throws \think\db\exception\DataNotFoundException
  891. * @throws \think\db\exception\ModelNotFoundException
  892. * @throws \think\exception\DbException
  893. * @throws \think\exception\PDOException
  894. */
  895. public function ProcessDetailEdit()
  896. {
  897. if ($this->request->isPost() === false){
  898. $this->error('请求错误');
  899. }
  900. $param = $this->request->param();
  901. if (empty($param) || isset($param['UniqId']) === false){
  902. $this->error('参数错误');
  903. }
  904. $rate = Db::table('dic_lzsh')->where('sys_bh',$param['shdh'])->field('rtrim(sys_rate0) as rate0,rtrim(sys_rate1) as rate1')->find();
  905. $data = [
  906. 'Gy0_yjno' => isset($param['yjno'])?$param['yjno']:'',
  907. 'Gy0_gxh' => isset($param['gxh'])?$param['gxh']:'',
  908. '重点工序' => isset($param['zdgx'])?$param['zdgx']:'',
  909. 'Gy0_ks' => isset($param['ks'])?$param['ks']:'',
  910. 'Gy0_ls' => isset($param['ls'])?$param['ls']:'',
  911. 'Gy0_SITE' => isset($param['site'])?$param['site']:'',
  912. 'Gy0_gxmc' => isset($param['gxmc'])?$param['gxmc']:'',
  913. 'Add_gxmc' => isset($param['add_gxmc'])?$param['add_gxmc']:'',
  914. 'Gy0_ms' => isset($param['ms'])?$param['ms']:'',
  915. 'Gy0_sbbh' => isset($param['sbbh'])?$param['sbbh']:'',
  916. 'Gy0_Rate0' => $rate['rate0'],
  917. 'Gy0_Rate1' => $rate['rate1'],
  918. 'Gy0_辅助工时' => isset($param['fzgs'])?$param['fzgs']:'',
  919. 'Gy0_小时产能' => isset($param['xscn'])?$param['xscn']:'',
  920. 'Gy0_shdh' => isset($param['shdh'])?$param['shdh']:'',
  921. '损耗系数' => isset($param['shxs'])?$param['shxs']:'',
  922. '工价系数' => isset($param['ndxs'])?$param['ndxs']:'',
  923. '印刷方式' => isset($param['ysfs'])?$param['ysfs']:'',
  924. '版距' => isset($param['bj'])?$param['bj']:'',
  925. '工序备注' => isset($param['gxbz'])?$param['gxbz']:'',
  926. '质量要求' => isset($param['zlyq'])?$param['zlyq']:'',
  927. '质量隐患' => isset($param['sbyh'])?$param['sbyh']:'',
  928. 'Mod_rq' => date('Y-m-d H:i:s',time()),
  929. ];
  930. $sql = Db::table('工单_工艺资料')->where('UniqId',$param['UniqId'])->fetchSql(true)->update($data);
  931. $res = Db::query($sql);
  932. if ($res !== false){
  933. $this->success('成功');
  934. }else{
  935. $this->error('失败');
  936. }
  937. }
  938. //
  939. }