Resign.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <?php
  2. /**
  3. * 备库申请
  4. */
  5. namespace app\admin\controller;
  6. use app\BaseController;
  7. use think\facade\Db;
  8. use think\App;
  9. class Resign extends BaseController
  10. {
  11. public $post="";
  12. public function __construct(App $app)
  13. {
  14. parent::__construct($app);
  15. $this->post = $this->request->post();
  16. // $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  17. // if($token==""){
  18. // return error_show(101,'token不能为空');
  19. // }
  20. // $effetc = VerifyTokens($token);
  21. // if(!empty($effetc) && $effetc['code']!=0) {
  22. // return error_show($effetc['code'], $effetc['message']);
  23. // }
  24. }
  25. public function list(){
  26. $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
  27. $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
  28. $where =[['is_del',"=",0]];
  29. $bkcode = isset($this->post['bk_code']) && $this->post['bk_code']!="" ? trim($this->post['bk_code']):"";
  30. if($bkcode!=""){
  31. //$where['bk_code'] = $bk_code;
  32. $where[]=['bk_code',"like","%{$bkcode}%"];
  33. }
  34. $good_code = isset($this->post['good_code']) && $this->post['good_code']!="" ? trim($this->post['good_code']):"";
  35. if($good_code!=""){
  36. // $where['good_code'] = $good_code;
  37. $where[]=['good_code',"like","%{$good_code}%"];
  38. }
  39. $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code']!="" ? trim($this->post['good_type_code']):"";
  40. if($good_type_code!=""){
  41. // $where['good_type_code'] = $good_type_code;
  42. $where[]=['good_type_code',"like","%{$good_type_code}%"];
  43. }
  44. $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
  45. if($wsm_code!=""){
  46. //$where['wsm_code'] = $wsm_code;
  47. $where[]=['wsm_code',"=",$wsm_code];
  48. }
  49. $good_name = isset($this->post['good_name']) && $this->post['good_name']!="" ? trim($this->post['good_name']):"";
  50. if($good_name!=""){
  51. // $where['good_name'] = Db::raw(" like '%{$good_name}%'");
  52. $where[]=['good_name',"like","%{$good_name}%"];
  53. }
  54. $apply_name = isset($this->post['apply_name']) && $this->post['apply_name']!="" ? trim($this->post['apply_name']):"";
  55. if($apply_name!=""){
  56. // $where['apply_name'] =Db::Raw("like '%{$apply_name}%'");
  57. $where[]=['apply_name',"like","%{$apply_name}%"];
  58. }
  59. $status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
  60. if($status!==""){
  61. // $where['status'] = $status;
  62. $where[]=['status',"=",$status];
  63. }
  64. $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
  65. if($start!==""){
  66. //$where['addtime'] = Db::Raw(">= '{$start}'");
  67. $where[]=['addtime',">=",$start];
  68. }
  69. $end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
  70. if($end!==""){
  71. // $where['addtime'] = Db::Raw("<= '{$end}'");
  72. $where[]=['addtime',"<=",$end];
  73. }
  74. $count=Db::name("purchease")->where($where)->count();
  75. $total = ceil($count/$size);
  76. $page = $page >= $total ? $total : $page;
  77. $list = Db::name("purchease")->where($where)->page($page,$size)->order("addtime desc")->select();
  78. $data=[];
  79. foreach ($list as $value){
  80. $value['wsm_name']="";
  81. if($value['wsm_code']!=""){
  82. $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
  83. ->where(["a.wsm_code"=>$value['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
  84. $value['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
  85. $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
  86. $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
  87. }
  88. $data[]=$value;
  89. }
  90. return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
  91. }
  92. public function add(){
  93. $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  94. if($token==""){
  95. return error_show(101,'token不能为空');
  96. }
  97. $good_code = isset($this->post['good_code'])&&$this->post['good_code']!="" ? trim($this->post['good_code']):"";
  98. if($good_code==""){
  99. return error_show(1002,'参数good_code 不能为空');
  100. }
  101. $good = Db::name("good")->where(['good_code'=>$good_code,'is_del'=>0])->find();
  102. if(empty($good)){
  103. return error_show(1002,'未找到商品数据');
  104. }
  105. $good_type_code = isset($this->post['good_type_code'])&&$this->post['good_type_code']!="" ? trim($this->post['good_type_code'])
  106. :"";
  107. if($good_type_code!==""){
  108. $good_type= Db::name("good_type")->where(['good_code'=>$good_code,'is_del'=>0,'type_code'=>$good_type_code])
  109. ->find();
  110. if(empty($good_type)){
  111. return error_show(1002,'未找到商品属性数据');
  112. }
  113. }
  114. $good_num = isset($this->post['good_num'])&&$this->post['good_num']!=="" ? intval($this->post['good_num']) :"";
  115. if($good_num==''){
  116. return error_show(1002,'参数good_num 不能为空或零');
  117. }
  118. $wsm_code = isset($this->post['wsm_code'])&&$this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
  119. if($wsm_code==""){
  120. return error_show(1002,'参数wsm_code 不能为空');
  121. }
  122. $wsminfo = Db::name("warehouse_info")->where(['wsm_code'=>$wsm_code,"is_del"=>0])->find();
  123. if(empty($wsminfo)){
  124. return error_show(1002,'未找到仓库数据');
  125. }
  126. $lastime = isset($this->post['lastime'])&&$this->post['lastime']!="" ? $this->post['lastime']:"";
  127. if($lastime==""){
  128. return error_show(1002,'参数lastime 不能为空');
  129. }
  130. $data = GetUserInfo($token);
  131. if((!empty($data) && $data['code']!=0) ||empty($data) ){
  132. return error_show($data['code'],$data['message']);
  133. }
  134. $userinfo = $data['data'];
  135. $bk_code=makeNo("BK");
  136. $info = [
  137. "good_code"=>$good_code,
  138. "good_name"=>$good['good_name'],
  139. "good_num"=>$good_num,
  140. "good_type_code"=>$good_type_code,
  141. "wsm_code"=>$wsm_code,
  142. "lasttime"=>$lastime,
  143. "addtime"=>date("Y-m-d H:i:s"),
  144. "updatetime"=>date("Y-m-d H:i:s"),
  145. "apply_id"=>$userinfo['id'],
  146. "apply_name"=>$userinfo['nickname'],
  147. "bk_code"=>$bk_code
  148. ];
  149. $in = Db::name("purchease")->insert($info);
  150. return $in ? app_show(0,"新建成功",['bk_code'=>$bk_code]):error_show(1005,"新建失败");
  151. }
  152. public function info(){
  153. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  154. if($id==""){
  155. return error_show(1001,'id不能为空');
  156. }
  157. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  158. if(empty($info)){
  159. return error_show(1002,'未找到数据');
  160. }
  161. $info['wsm_name']="";
  162. if($info['wsm_code']!=""){
  163. $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
  164. ->where(["a.wsm_code"=>$info['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
  165. $info['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
  166. $info['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
  167. $info['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
  168. }
  169. return app_show(0,"获取成功",$info);
  170. }
  171. public function edit(){
  172. $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  173. if($token==""){
  174. return error_show(101,'token不能为空');
  175. }
  176. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  177. if($id==""){
  178. return error_show(1001,'id不能为空');
  179. }
  180. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  181. if(empty($info)){
  182. return error_show(1002,'未找到数据');
  183. }
  184. $good_code = isset($this->post['good_code'])&&$this->post['good_code']!="" ? trim($this->post['good_code']):"";
  185. if($good_code==""){
  186. return error_show(1002,'参数good_code 不能为空');
  187. }
  188. $good = Db::name("good")->where(['good_code'=>$good_code,'is_del'=>0])->find();
  189. if(empty($good)){
  190. return error_show(1002,'未找到商品数据');
  191. }
  192. $good_type_code = isset($this->post['good_type_code'])&&$this->post['good_type_code']!="" ? trim($this->post['good_type_code'])
  193. :"";
  194. if($good_type_code!=''){
  195. $good_type= Db::name("good_type")->where(['good_code'=>$good_code,'is_del'=>0,'type_code'=>$good_type_code])
  196. ->find();
  197. if(empty($good_type)){
  198. return error_show(1002,'未找到商品属性数据');
  199. }
  200. }
  201. $good_num = isset($this->post['good_num'])&&$this->post['good_num']!=="" ? intval($this->post['good_num']) :"";
  202. if($good_num==''){
  203. return error_show(1002,'参数good_num 不能为空或零');
  204. }
  205. $wsm_code = isset($this->post['wsm_code'])&&$this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
  206. if($wsm_code==""){
  207. return error_show(1002,'参数wsm_code 不能为空');
  208. }
  209. $wsminfo = Db::name("warehouse_info")->where(['wsm_code'=>$wsm_code,"is_del"=>0])->find();
  210. if(empty($wsminfo)){
  211. return error_show(1002,'未找到仓库数据');
  212. }
  213. $lastime = isset($this->post['lastime'])&&$this->post['lastime']!="" ? $this->post['lastime']:"";
  214. if($lastime==""){
  215. return error_show(1002,'参数lastime 不能为空');
  216. }
  217. $data = GetUserInfo($token);
  218. if((!empty($data) && $data['code']!=0) ||empty($data) ){
  219. return error_show($data['code'],$data['message']);
  220. }
  221. $userinfo = $data['data'];
  222. $up = [
  223. "good_code"=>$good_code,
  224. "good_name"=>$good['good_name'],
  225. "good_num"=>$good_num,
  226. "good_type_code"=>$good_type_code,
  227. "wsm_code"=>$wsm_code,
  228. "lasttime"=>$lastime,
  229. "updatetime"=>date("Y-m-d H:i:s"),
  230. "apply_id"=>$userinfo['id'],
  231. "apply_name"=>$userinfo['nickname']
  232. ];
  233. $in = Db::name("purchease")->where($info)->save($up);
  234. return $in ? app_show(0,"更新成功"):error_show(1005,"更新失败");
  235. }
  236. public function delete(){
  237. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  238. if($id==""){
  239. return error_show(1001,'id不能为空');
  240. }
  241. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  242. if(empty($info)){
  243. return error_show(1002,'未找到数据');
  244. }
  245. $info['is_del']=1;
  246. $info['updatetime']=date("Y-m-d H:i:s");
  247. $up = Db::name("purchease")->update($info);
  248. return $up ? app_show(0,"删除成功"):error_show(1005,"删除失败");
  249. }
  250. public function status(){
  251. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  252. if($id==""){
  253. return error_show(1001,'id不能为空');
  254. }
  255. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  256. if(empty($info)){
  257. return error_show(1002,'未找到数据');
  258. }
  259. $status = isset($this->post['status'])&&$this->post['status']!=='' ? intval($this->post['status']) : "";
  260. if($status===""){
  261. return error_show(1001,'status不能为空');
  262. }
  263. $info['status']= $status;
  264. $info['updatetime']=date("Y-m-d H:i:s");
  265. $up = Db::name("purchease")->update($info);
  266. return $up ? app_show(0,"更新成功"):error_show(1005,"更新失败");
  267. }
  268. public function addFeed(){
  269. $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  270. if($token==""){
  271. return error_show(101,'token不能为空');
  272. }
  273. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  274. if($id==""){
  275. return error_show(1001,'id不能为空');
  276. }
  277. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  278. if(empty($info)){
  279. return error_show(1002,'未找到备库数据');
  280. }
  281. if($info['status']!=1){
  282. return error_show(1002,'备库数据状态有误');
  283. }
  284. $num = isset($this->post['num']) && $this->post['num']!=="" ? intval($this->post['num']):"";
  285. if($num==''){
  286. return error_show(1002,'参数num 不能为空或零');
  287. }
  288. $expecttime = isset($this->post['expecttime'])&&$this->post['expecttime']!=''?$this->post['expecttime'] :"";
  289. if($expecttime==''){
  290. return error_show(1002,'参数expecttime 不能为空');
  291. }
  292. $wsm_code = isset($this->post['wsm_code'])&&$this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
  293. if($wsm_code==""){
  294. return error_show(1002,'参数wsm_code 不能为空');
  295. }
  296. $wsminfo = Db::name("warehouse_info")->where(['wsm_code'=>$wsm_code,"is_del"=>0])->find();
  297. if(empty($wsminfo)){
  298. return error_show(1002,'未找到仓库数据');
  299. }
  300. $supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!="" ? trim($this->post['supplierNo']):"";
  301. if($supplierNo==""){
  302. return error_show(1002,'参数supplierNo 不能为空');
  303. }
  304. $supplie = Db::name("supplier")->where(['code'=>$supplierNo,"is_del"=>0])->find();
  305. if(empty($supplie)){
  306. return error_show(1002,'未找到供应商');
  307. }
  308. $good_price = isset($this->post['good_price'])&&$this->post['good_price']!=="" ? $this->post['good_price']:"";
  309. if($good_price===""){
  310. return error_show(1002,'参数good_price 不能为空');
  311. }
  312. $pakge_fee = isset($this->post['pakge_fee'])&&$this->post['pakge_fee']!=="" ? $this->post['pakge_fee']:0;
  313. $cert_fee = isset($this->post['cert_fee'])&&$this->post['cert_fee']!=="" ? $this->post['cert_fee']:0;
  314. $open_fee = isset($this->post['open_fee'])&&$this->post['open_fee']!=="" ? $this->post['open_fee']:0;
  315. $delivery_fee = isset($this->post['delivery_fee'])&&$this->post['delivery_fee']!=="" ? $this->post['delivery_fee']:0;
  316. $mark_fee = isset($this->post['mark_fee'])&&$this->post['mark_fee']!=="" ? $this->post['mark_fee']:0;
  317. $teach_fee = isset($this->post['teach_fee'])&&$this->post['teach_fee']!=="" ? $this->post['teach_fee']:0;
  318. $nake_fee = isset($this->post['nake_fee'])&&$this->post['nake_fee']!=="" ? $this->post['nake_fee']:0;
  319. $weight = isset($this->post['weight'])&&$this->post['weight']!=="" ? $this->post['weight']:0;
  320. $diff_weight =isset($this->post['diff_weight'])&&$this->post['diff_weight']!=="" ? $this->post['diff_weight']:0;
  321. $diff_price =isset($this->post['diff_price'])&&$this->post['diff_price']!=="" ? $this->post['diff_price']:0;
  322. $remark =isset($this->post['remark'])&&$this->post['remark']!=="" ? $this->post['remark']:'';
  323. $data = GetUserInfo($token);
  324. if((!empty($data) && $data['code']!=0) ||empty($data) ){
  325. return error_show($data['code'],$data['message']);
  326. }
  327. $userinfo = $data['data'];
  328. $data=[
  329. "bkcode"=>$info['bk_code'],
  330. "warehouse"=>$wsm_code,
  331. "num"=>$num,
  332. 'expecttime'=>$expecttime,
  333. 'supplier'=>isset($supplie) && $supplie['name']!=''? $supplie['name']:'',
  334. 'good_price'=>$good_price,
  335. 'pakge_fee'=>$pakge_fee,
  336. 'cert_fee'=>$cert_fee,
  337. 'open_fee'=>$open_fee,
  338. 'mark_fee'=>$mark_fee,
  339. 'teach_fee'=>$teach_fee,
  340. 'nake_fee'=>$nake_fee,
  341. 'delivery_fee'=>$delivery_fee,
  342. 'weight'=>$weight,
  343. 'remark'=>$remark,
  344. 'diff_weight'=>$diff_weight,
  345. 'diff_price'=>$diff_price,
  346. 'purchaser'=>$userinfo['nickname'],
  347. 'purchaser_id'=>$userinfo['id'],
  348. "addtime"=>date("Y-m-d H:i:s"),
  349. "updatetime"=>date("Y-m-d H:i:s")
  350. ];
  351. $in = Db::name('purchease_feedback')->insert($data);
  352. return $in ? app_show(0,"新建成功"):error_show(1005,"新建失败");
  353. }
  354. public function delFeed(){
  355. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  356. if($id==""){
  357. return error_show(1001,'id不能为空');
  358. }
  359. $feed = Db::name("purchease_feedback")->where(['id'=>$id,'is_del'=>0])->find();
  360. if(empty($feed)){
  361. return error_show(1004,'未找到数据');
  362. }
  363. if($feed['status']==1){
  364. return error_show(1004,'反馈数据已采用无法删除');
  365. }
  366. $feed['is_del']= 1;
  367. $feed['updatetime']=date("Y-m-d H:i:s");
  368. $up = Db::name("purchease_feedback")->update($feed);
  369. return $up ? app_show(0,"删除成功"):error_show(1005,"删除失败");
  370. }
  371. public function infoFeed(){
  372. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  373. if($id==""){
  374. return error_show(1001,'id不能为空');
  375. }
  376. $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
  377. if(empty($info)){
  378. return error_show(1002,'未找到备库数据');
  379. }
  380. $feed = Db::name("purchease_feedback")->where(['bkcode'=>$info['bk_code'],'is_del'=>0])->find();
  381. if(empty($feed)){
  382. return error_show(1004,'未找到数据');
  383. }
  384. $feed['wsm_name']="";
  385. if($feed['warehouse']!=""){
  386. $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
  387. ->where(["a.wsm_code"=>$feed['warehouse']])->field("a.name as wsm_name,b.name,b.code")->find();
  388. $feed['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
  389. $feed['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
  390. $feed['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
  391. }
  392. return app_show(0,"获取成功",$feed);
  393. }
  394. public function changeFeed(){
  395. $id = isset($this->post['id']) ? intval($this->post['id']) : "";
  396. if($id==""){
  397. return error_show(1001,'id不能为空');
  398. }
  399. $feed = Db::name("purchease_feedback")->where(['id'=>$id,'is_del'=>0])->find();
  400. if(empty($feed)){
  401. return error_show(1004,'未找到数据');
  402. }
  403. $status = isset($this->post['status'])&& $this->post['status']!=='' ? intval($this->post['status']) : "";
  404. if($status==""){
  405. return error_show(1001,'参数status 不能为空');
  406. }
  407. $remark = isset($this->post['remark'])&& $this->post['remark']!=='' ? trim($this->post['remark']) : "";
  408. Db::startTrans();
  409. try{
  410. $feed['remark']= $remark;
  411. $feed['status']= $status;
  412. $feed['updatetime']=date("Y-m-d H:i:s");
  413. $up = Db::name("purchease_feedback")->update($feed);
  414. if($up){
  415. if($status==1){
  416. // $ware = Db::name("warehouse_addr")->where(["wsm_code"=>$feed['warehouse'],"is_del"=>0])->find();
  417. $purse = Db::name("purchease")->where(['bk_code'=>$feed['bkcode'],"is_del"=>0])->find();
  418. if(empty($purse)){
  419. Db::rollback();
  420. return error_show(1001,'未找到备库申请数据');
  421. }
  422. $supplier = Db::name("supplier")->where(["code"=>$feed['supplier']])->find();
  423. $inw = makeNo("CG");
  424. $data=[
  425. "bkcode"=>$feed['bkcode'],
  426. 'cgdNo'=>$inw,
  427. "wsm_code"=>$feed['warehouse'],
  428. "good_code"=>$purse['good_code'],
  429. "good_name"=>$purse['good_name'],
  430. "good_type_code"=>$purse['good_type_code'],
  431. "good_num"=>$purse['good_num'],
  432. "send_num"=>0,
  433. "wsend_num"=>$purse['good_num'],
  434. 'good_price'=>$feed['good_price'],
  435. "total_fee"=>$feed['good_price'],
  436. 'pakge_fee'=>$feed['pakge_fee'],
  437. 'cert_fee'=>$feed['cert_fee'],
  438. 'open_fee'=>$feed['open_fee'],
  439. 'mark_fee'=>$feed['mark_fee'],
  440. 'teach_fee'=>$feed['teach_fee'],
  441. 'nake_fee'=>$feed['nake_fee'],
  442. 'delivery_fee'=>$feed['delivery_fee'],
  443. 'weight'=>$feed['weight'],
  444. 'diff_weight'=>$feed['diff_weight'],
  445. 'diff_price'=>$feed['diff_price'],
  446. 'cgder_id'=>$feed['purchaser_id'],
  447. 'cgder'=>$feed['purchaser'],
  448. 'supplierNo'=>$feed['supplier'],
  449. 'supplier_name'=>isset($supplier['name']) ? $supplier['name']:"",
  450. 'lasttime'=>$feed['expecttime'],
  451. "addtime"=>date("Y-m-d H:i:s"),
  452. "updatetime"=>date("Y-m-d H:i:s")
  453. ];
  454. $in= Db::name("purchease_order")->insert($data);
  455. if($in){
  456. Db::commit();
  457. return app_show(0,"更新成功",['cgdNo'=>$inw]);
  458. }
  459. }else{
  460. Db::commit();
  461. return app_show(0,"更新成功");
  462. }
  463. }
  464. Db::rollback();
  465. return error_show(1004,"更新失败");
  466. }catch (\Exception $e){
  467. Db::rollback();
  468. return error_show(1005,$e->getMessage());
  469. }
  470. }
  471. }