Zzququeu9.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Zzququeu9 extends Start_Controller {
  4. public function __construct(){
  5. parent::__construct();
  6. $this->load->library('session');
  7. $this->load->_model('Model_zzquque_u9','zzquque_u9');
  8. $this->load->_model("Model_logic_order","logic_order");
  9. $this->load->_model("Model_logic_u9xgsd","logic_u9xgsd");
  10. $this->load->_model('Model_zzququeu9_logs','zzququeu9_logs');
  11. }
  12. public function _remap($arg,$arg_array)
  13. {
  14. if($arg == 'dc')//调出单
  15. {
  16. $this->_dc($arg_array);
  17. }
  18. elseif($arg == 'cg')//采购
  19. {
  20. $this->_cg($arg_array);
  21. }
  22. elseif($arg == 'xs')//销售单
  23. {
  24. $this->_xs($arg_array);
  25. }
  26. elseif($arg == 'bzch')//标准出货
  27. {
  28. $this->_bzch($arg_array);
  29. }
  30. elseif($arg == 'bzsh')//标准收货
  31. {
  32. $this->_bzsh($arg_array);
  33. }
  34. elseif($arg == 'dr')//调入单
  35. {
  36. $this->_dr($arg_array);
  37. }
  38. elseif($arg == 'xs_two')//调入单
  39. {
  40. $this->_xs_two($arg_array);
  41. }
  42. elseif($arg == 'add'){
  43. $this->_add();
  44. }
  45. elseif($arg == 'excel'){
  46. $this->_excel();
  47. }
  48. else
  49. {
  50. $this->_index();
  51. }
  52. }
  53. public function _index(){
  54. $post = $this->input->post(NULL, TRUE);
  55. if(isset($post['page']))
  56. {
  57. $page = $this->input->post('page',true);
  58. $perpage = $this->input->post('perpage',true);
  59. $timetk = $this->input->post('timetk',true);//订单开始时间
  60. $timetj = $this->input->post('timetj',true);//订单结束时间
  61. $timetk = strtotime($timetk);
  62. $timetj = strtotime($timetj);
  63. $status = $this->input->post('status',true);
  64. $order_no = $this->input->post('order_no',true);
  65. $where='type = 10 ';
  66. if($order_no){
  67. $where .= " and order_no = '".$order_no."' ";
  68. }
  69. if($timetk && $timetj){
  70. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  71. }
  72. if($status){
  73. if($status = 1){
  74. $where .= " and dc_status < 0 ";
  75. }elseif($status = 2){
  76. $where .= " and cg_status < 0 ";
  77. }elseif($status = 3){
  78. $where .= " and xs_status < 0 ";
  79. }elseif($status = 4){
  80. $where .= " and dr_status < 0 ";
  81. }elseif($status = 5){
  82. $where .= " and xs_two_status < 0 ";
  83. }elseif($status = 6){
  84. $where .= " and bzsh_status <0 ";
  85. }
  86. }
  87. if(empty($page))
  88. {
  89. $start = 0;
  90. $perpage = 1;
  91. }
  92. else
  93. {
  94. $start = ($page - 1)*$perpage;
  95. }
  96. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  97. $type_list = $this->zzquque_u9->getType();
  98. $list = [];
  99. foreach($info_list as $k=>$v){
  100. $dc_no = "";
  101. if($v['dc_status'] == 0){
  102. $dc_no = "<span data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
  103. }elseif($v['dc_status'] == -1){
  104. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  105. if($error[0]['apply_api']=='lpck'){
  106. $ret_data = json_decode($error[0]['ret_data'],true);
  107. if(isset($ret_data[0]["ResMsg"])){
  108. $tmp_str = $ret_data[0]["ResMsg"];
  109. }else{
  110. $tmp_str = "料品同步失败";
  111. }
  112. }else{
  113. $tmp_str = "创建调出单失败";
  114. }
  115. $dc_no = "<span data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="'.$tmp_str.'"></i><p>';
  116. }
  117. if(!empty($v['dc_no'])){
  118. $dc_no = $v['dc_no']."<br/>".$dc_no;
  119. }
  120. $cg_no = "";
  121. if($v['cg_status'] == 0){
  122. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建采购单</span>";
  123. }elseif($v['cg_status'] == 1){
  124. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交采购单</span>";
  125. }elseif($v['cg_status'] == -1){
  126. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建采购单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="采购单创建失败"></i><p>';
  127. }elseif($v['cg_status'] == 2){
  128. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核采购单</span>";
  129. }elseif($v['cg_status'] == -2){
  130. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交采购单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="采购单提交失败"></i><p>';
  131. }elseif($v['cg_status'] == -3){
  132. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核采购单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="采购单审核失败"></i><p>';
  133. }
  134. if(!empty($v['cg_no'])){
  135. $cg_no = $v['cg_no']."<br/>".$cg_no;
  136. }
  137. $xs_no = "";
  138. if($v['xs_status'] == 0){
  139. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  140. }elseif($v['xs_status'] == 1){
  141. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  142. }elseif($v['xs_status'] == -1){
  143. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="销售单创建失败"></i><p>';
  144. }elseif($v['xs_status'] == 2){
  145. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  146. }elseif($v['xs_status'] == -2){
  147. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="销售单提交失败"></i><p>';
  148. }elseif($v['xs_status'] == -3){
  149. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="销售单审核失败"></i><p>';
  150. }
  151. if(!empty($v['xs_no'])){
  152. $xs_no = $v['xs_no']."<br/>".$xs_no;
  153. }
  154. $xs_two_no ='';
  155. if($v['xs_two_status'] == 0){
  156. $xs_two_no .= "<span data-action='xs_two' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  157. }elseif($v['xs_two_status'] == 1){
  158. $xs_two_no .= "<span data-action='xs_two' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  159. }elseif($v['xs_two_status'] == -1){
  160. $xs_two_no .= "<span data-action='xs_two' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  161. }elseif($v['xs_two_status'] == 2){
  162. $xs_two_no .= "<span data-action='xs_two' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  163. }elseif($v['xs_two_status'] == -2){
  164. $xs_two_no .= "<span data-action='xs_two' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  165. }elseif($v['xs_two_status'] == -3){
  166. $xs_two_no .= "<span data-action='xs_two' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  167. }
  168. if(!empty($v['xs_two_no'])){
  169. $xs_two_no = $v['xs_two_no']."<br/>".$xs_two_no;
  170. }
  171. $bzch_no ="";
  172. if($v['bzch_status'] == 0){
  173. $bzch_no .= "<span data-action='bzch' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建出货单</span>";
  174. }elseif($v['bzch_status'] == 1){
  175. $bzch_no .= "<span data-action='bzch' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交出货单</span>";
  176. }elseif($v['bzch_status'] == -1){
  177. $bzch_no .= "<span data-action='bzch' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建出货单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  178. }elseif($v['bzch_status'] == 2){
  179. $bzch_no .= "<span data-action='bzch' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核出货单</span>";
  180. }elseif($v['bzch_status'] == -2){
  181. $bzch_no .= "<span data-action='bzch' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交出货单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  182. }elseif($v['bzch_status'] == -3){
  183. $bzch_no .= "<span data-action='bzch' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核出货单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  184. }
  185. //$bzsh_no =empty($v['bzsh_no'])?"":$v['bzsh_no'];
  186. if(!empty($v['bzch_no'])){
  187. $bzch_no = $v['bzch_no']."<br/>".$bzch_no;
  188. }
  189. $dr_no = "";
  190. if($v['dr_status'] == 0){
  191. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调入单</span>";
  192. }elseif($v['dr_status'] == 1){
  193. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交调入单</span>";
  194. }elseif($v['dr_status'] == -1){
  195. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调入单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  196. }elseif($v['dr_status'] == 2){
  197. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核调入单</span>";
  198. }elseif($v['dr_status'] == -2){
  199. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交调入单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  200. }elseif($v['dr_status'] == -3){
  201. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核调入单</span>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="123"></i><p>';
  202. }
  203. if(!empty($v['dr_no'])){
  204. $dr_no = $v['dr_no']."<br/>".$dr_no;
  205. }
  206. $list[] = [
  207. 'id'=>$v['id'],
  208. 'order_no'=>$v['order_no'],
  209. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  210. 'dc_no'=> $dc_no,
  211. 'cg_no'=>$cg_no,
  212. 'xs_no'=>$xs_no,
  213. 'dr_no'=>$dr_no,
  214. 'xs_two_no'=>$xs_two_no,
  215. 'bzch_no'=>$bzch_no,
  216. //'bzsh_no'=>$bzsh_no,
  217. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  218. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  219. ];
  220. }
  221. $total = $this->zzquque_u9->find_count($where);
  222. $pagenum = ceil($total/$perpage);
  223. $over = $total-($start+$perpage);
  224. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  225. echo json_encode($rows);exit;
  226. }
  227. $this->_Template('zzququeu9',$this->data);
  228. }
  229. public function _dc($arg_array){
  230. $process= $arg_array[0];
  231. $id = $arg_array[1];
  232. $info = $this->zzquque_u9->read($id);
  233. if($process == 1){
  234. if(!in_array($info['dc_status'],[0,-1])){
  235. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  236. exit;
  237. }
  238. $r = $this->logic_u9xgsd->createDc($info);
  239. if($r['code'] == 1){
  240. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  241. exit;
  242. }else{
  243. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  244. exit;
  245. }
  246. }else if($process == 2){
  247. if(!in_array($info['dc_status'],[1,-2])){
  248. echo json_encode(array('msg'=>'当前状态不符合提交调出单的条件','success'=>false));
  249. exit;
  250. }
  251. $r = $this->logic_u9xgsd->subDc($info);
  252. if($r['code'] == 1){
  253. echo json_encode(array('msg'=>'提交调出单成功','success'=>true));
  254. exit;
  255. }else{
  256. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  257. exit;
  258. }
  259. }else if($process == 3){
  260. if(!in_array($info['dc_status'],[2,-3])){
  261. echo json_encode(array('msg'=>'当前状态不符合审核调出单的条件','success'=>false));
  262. exit;
  263. }
  264. $r = $this->logic_u9xgsd->shDc($info);
  265. if($r['code'] == 1){
  266. echo json_encode(array('msg'=>'审核调出单成功','success'=>true));
  267. exit;
  268. }else{
  269. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  270. exit;
  271. }
  272. }else{
  273. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  274. exit;
  275. }
  276. }
  277. public function _cg($arg_array){
  278. $process= $arg_array[0];
  279. $id = $arg_array[1];
  280. $info = $this->zzquque_u9->read($id);
  281. if($info['dc_status'] != 3){
  282. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  283. exit;
  284. }
  285. if($process == 1){
  286. if(!in_array($info['cg_status'],[0,-1])){
  287. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  288. exit;
  289. }
  290. $r = $this->logic_u9xgsd->createCg($info);
  291. if($r['code'] == 1){
  292. echo json_encode(array('msg'=>'创建采购单成功','success'=>true));
  293. exit;
  294. }else{
  295. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  296. exit;
  297. }
  298. }else if($process == 2){
  299. if(!in_array($info['cg_status'],[1,-2])){
  300. echo json_encode(array('msg'=>'当前状态不符合提交采购单的条件','success'=>false));
  301. exit;
  302. }
  303. $r = $this->logic_u9xgsd->subCg($info);
  304. if($r['code'] == 1){
  305. echo json_encode(array('msg'=>'提交采购单成功','success'=>true));
  306. exit;
  307. }else{
  308. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  309. exit;
  310. }
  311. }else if($process == 3){
  312. if(!in_array($info['cg_status'],[2,-3])){
  313. echo json_encode(array('msg'=>'当前状态不符合审核采购单的条件','success'=>false));
  314. exit;
  315. }
  316. $r = $this->logic_u9xgsd->shCg($info);
  317. if($r['code'] == 1){
  318. echo json_encode(array('msg'=>'审核采购单成功','success'=>true));
  319. exit;
  320. }else{
  321. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  322. exit;
  323. }
  324. }else{
  325. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  326. exit;
  327. }
  328. }
  329. public function _xs($arg_array){
  330. $process= $arg_array[0];
  331. $id = $arg_array[1];
  332. $info = $this->zzquque_u9->read($id);
  333. if($info['dc_status'] != 3){
  334. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  335. exit;
  336. }
  337. if($process == 1){
  338. if(!in_array($info['xs_status'],[0,-1])){
  339. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  340. exit;
  341. }
  342. $r = $this->logic_u9xgsd->createXs($info);
  343. if($r['code'] == 1){
  344. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  345. exit;
  346. }else{
  347. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  348. exit;
  349. }
  350. }else if($process == 2){
  351. if(!in_array($info['xs_status'],[1,-2])){
  352. echo json_encode(array('msg'=>'当前状态不符合提交销售单的条件','success'=>false));
  353. exit;
  354. }
  355. $r = $this->logic_u9xgsd->subXs($info);
  356. if($r['code'] == 1){
  357. echo json_encode(array('msg'=>'提交销售单成功','success'=>true));
  358. exit;
  359. }else{
  360. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  361. exit;
  362. }
  363. }else if($process == 3){
  364. if(!in_array($info['xs_status'],[2,-3])){
  365. echo json_encode(array('msg'=>'当前状态不符合审核销售单的条件','success'=>false));
  366. exit;
  367. }
  368. $r = $this->logic_u9xgsd->shXs($info);
  369. if($r['code'] == 1){
  370. echo json_encode(array('msg'=>'审核销售单成功','success'=>true));
  371. exit;
  372. }else{
  373. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  374. exit;
  375. }
  376. }else{
  377. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  378. exit;
  379. }
  380. }
  381. public function _dr($arg_array){
  382. $process= $arg_array[0];
  383. $id = $arg_array[1];
  384. $info = $this->zzquque_u9->read($id);
  385. if($info['dc_status'] != 3){
  386. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  387. exit;
  388. }
  389. if($process == 1){
  390. if(!in_array($info['dr_status'],[0,-1])){
  391. echo json_encode(array('msg'=>'当前状态不符合查询调入单的条件','success'=>false));
  392. exit;
  393. }
  394. $r = $this->logic_u9xgsd->createDr($info);
  395. if($r['code'] == 1){
  396. echo json_encode(array('msg'=>'查询调入单成功','success'=>true));
  397. exit;
  398. }else{
  399. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  400. exit;
  401. }
  402. }else if($process == 2){
  403. if(!in_array($info['dr_status'],[1,-2])){
  404. echo json_encode(array('msg'=>'当前状态不符合提交调入单的条件','success'=>false));
  405. exit;
  406. }
  407. $r = $this->logic_u9xgsd->subDr($info);
  408. if($r['code'] == 1){
  409. echo json_encode(array('msg'=>'提交调入单成功','success'=>true));
  410. exit;
  411. }else{
  412. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  413. exit;
  414. }
  415. }else if($process == 3){
  416. if(!in_array($info['dr_status'],[2,-3])){
  417. echo json_encode(array('msg'=>'当前状态不符合审核调入单的条件','success'=>false));
  418. exit;
  419. }
  420. $r = $this->logic_u9xgsd->shDr($info);
  421. if($r['code'] == 1){
  422. echo json_encode(array('msg'=>'审核调入单成功','success'=>true));
  423. exit;
  424. }else{
  425. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  426. exit;
  427. }
  428. }else{
  429. echo json_encode(array('msg'=>'当前状态不符合创建调入单的条件','success'=>false));
  430. exit;
  431. }
  432. }
  433. public function _xs_two($arg_array){
  434. $process= $arg_array[0];
  435. $id = $arg_array[1];
  436. $info = $this->zzquque_u9->read($id);
  437. if($info['dc_status'] != 3){
  438. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  439. exit;
  440. }
  441. if($process == 1){
  442. if(!in_array($info['xs_two_status'],[0,-1])){
  443. echo json_encode(array('msg'=>'当前状态不符合查询香港销售单的条件','success'=>false));
  444. exit;
  445. }
  446. $r = $this->logic_u9xgsd->createXsTwo($info);
  447. if($r['code'] == 1){
  448. echo json_encode(array('msg'=>'创建香港销售单成功','success'=>true));
  449. exit;
  450. }else{
  451. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  452. exit;
  453. }
  454. }else if($process == 2){
  455. if(!in_array($info['xs_two_status'],[1,-2])){
  456. echo json_encode(array('msg'=>'当前状态不符合提交香港销售单的条件','success'=>false));
  457. exit;
  458. }
  459. $r = $this->logic_u9xgsd->subXsTwo($info);
  460. if($r['code'] == 1){
  461. echo json_encode(array('msg'=>'提交香港销售单成功','success'=>true));
  462. exit;
  463. }else{
  464. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  465. exit;
  466. }
  467. }else if($process == 3){
  468. if(!in_array($info['xs_two_status'],[2,-3])){
  469. echo json_encode(array('msg'=>'当前状态不符合审核香港销售单的条件','success'=>false));
  470. exit;
  471. }
  472. $r = $this->logic_u9xgsd->shXsTwo($info);
  473. if($r['code'] == 1){
  474. echo json_encode(array('msg'=>'审核香港销售单成功','success'=>true));
  475. exit;
  476. }else{
  477. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  478. exit;
  479. }
  480. }else{
  481. echo json_encode(array('msg'=>'当前状态不符合创建香港销售单的条件','success'=>false));
  482. exit;
  483. }
  484. }
  485. public function _bzch($arg_array){
  486. $process= $arg_array[0];
  487. $id = $arg_array[1];
  488. $info = $this->zzquque_u9->read($id);
  489. if($info['dc_status'] != 3){
  490. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  491. exit;
  492. }
  493. if($info['xs_two_status'] != 3){
  494. echo json_encode(array('msg'=>'香港销售单未审核不能执行后续操作','success'=>false));
  495. exit;
  496. }
  497. if($process == 1){
  498. if(!in_array($info['bzsh_status'],[0,-1])){
  499. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  500. exit;
  501. }
  502. $r = $this->logic_u9xgsd->createCh($info);
  503. if($r['code'] == 1){
  504. echo json_encode(array('msg'=>'创建标准收货单成功','success'=>true));
  505. exit;
  506. }else{
  507. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  508. exit;
  509. }
  510. }else if($process == 2){
  511. $r = $this->logic_u9xgsd->subAndShCh($info);
  512. if($r['code'] == 1){
  513. echo json_encode(array('msg'=>'审核标准收货单成功','success'=>true));
  514. exit;
  515. }else{
  516. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  517. exit;
  518. }
  519. }else{
  520. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  521. exit;
  522. }
  523. }
  524. public function _bzsh($arg_array){
  525. }
  526. public function _add(){
  527. $order_no = $this->input->post('order_no',true);
  528. if(empty($order_no)){
  529. echo json_encode(['msg'=>'请输入要添加的订单编码!','success'=>false]);exit;
  530. }
  531. $info = $this->logic_order->getInfo("number = '" .$order_no."'");
  532. if(empty($info)){
  533. echo json_encode(['msg'=>'订单不存在!请仔细核对单号','success'=>false]);exit;
  534. }
  535. $num = $this->zzquque_u9->find_all("order_no = '".$info['number']."'");
  536. if(empty($num)){
  537. $this->zzquque_u9->insert([
  538. 'platform'=>$info['lv_platform'],
  539. 'warehouse'=>$info['type'],
  540. 'type'=>10,
  541. 'order_no'=>$info['number'],
  542. 'create_time'=>time(),
  543. 'update_time'=>time(),
  544. ]);
  545. echo json_encode(['msg'=>'添加成功','success'=>true]);exit;
  546. }else{
  547. echo json_encode(['msg'=>'订单不允许重复添加','success'=>false]);exit;
  548. }
  549. }
  550. public function _excel(){
  551. $params = $this->input->get();
  552. $where = "1 = 1";
  553. if(!empty($params['order_no'])){
  554. $where .= " order_no = '".$params['order_no']."' ";
  555. }
  556. if(!empty($params['timetk'])){
  557. $where .= " create_time > ".strtotime($params['timetk'])." ";
  558. }
  559. if(!empty($params['timetj'])){
  560. $where .= " create_time < ".strtotime($params['timetj'])." ";
  561. }
  562. if(!empty($params['status'])){
  563. $where .= " status = ".$params['status'];
  564. }
  565. var_dump($where);
  566. }
  567. }