Zzququeu9.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  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. $apply_data = json_decode($error[0]['apply_data']);
  108. if(isset($ret_data["ResMsg"])){
  109. if(empty($apply_data['0'])){
  110. $tmp_str = $ret_data["ResMsg"];
  111. }else{
  112. $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  113. }
  114. }else{
  115. $tmp_str = "料品同步失败";
  116. }
  117. }else{
  118. $ret_data = json_decode($error[0]['ret_data'],true);
  119. if(isset($ret_data[0]["ResMsg"])){
  120. $tmp_str = $ret_data[0]["ResMsg"];
  121. }elseif(isset($ret_data['msg'])){
  122. $tmp_str = $ret_data['msg'];
  123. }else{
  124. $tmp_str = "料品同步失败";
  125. }
  126. }
  127. $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>';
  128. }
  129. if(!empty($v['dc_no'])){
  130. $dc_no = $v['dc_no']."<br/>".$dc_no;
  131. }
  132. $cg_no = "";
  133. if($v['cg_status'] == 0){
  134. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建采购单</span>";
  135. }elseif($v['cg_status'] == 1){
  136. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交采购单</span>";
  137. }elseif($v['cg_status'] == -1){
  138. $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>';
  139. }elseif($v['cg_status'] == 2){
  140. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核采购单</span>";
  141. }elseif($v['cg_status'] == -2){
  142. $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>';
  143. }elseif($v['cg_status'] == -3){
  144. $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>';
  145. }
  146. if(!empty($v['cg_no'])){
  147. $cg_no = $v['cg_no']."<br/>".$cg_no;
  148. }
  149. $xs_no = "";
  150. if($v['xs_status'] == 0){
  151. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  152. }elseif($v['xs_status'] == 1){
  153. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  154. }elseif($v['xs_status'] == -1){
  155. $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>';
  156. }elseif($v['xs_status'] == 2){
  157. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  158. }elseif($v['xs_status'] == -2){
  159. $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>';
  160. }elseif($v['xs_status'] == -3){
  161. $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>';
  162. }
  163. if(!empty($v['xs_no'])){
  164. $xs_no = $v['xs_no']."<br/>".$xs_no;
  165. }
  166. $xs_two_no ='';
  167. if($v['xs_two_status'] == 0){
  168. $xs_two_no .= "<span data-action='xs_two' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  169. }elseif($v['xs_two_status'] == 1){
  170. $xs_two_no .= "<span data-action='xs_two' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  171. }elseif($v['xs_two_status'] == -1){
  172. $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>';
  173. }elseif($v['xs_two_status'] == 2){
  174. $xs_two_no .= "<span data-action='xs_two' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  175. }elseif($v['xs_two_status'] == -2){
  176. $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>';
  177. }elseif($v['xs_two_status'] == -3){
  178. $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>';
  179. }
  180. if(!empty($v['xs_two_no'])){
  181. $xs_two_no = $v['xs_two_no']."<br/>".$xs_two_no;
  182. }
  183. $bzch_no ="";
  184. if($v['bzch_status'] == 0){
  185. $bzch_no .= "<span data-action='bzch' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建出货单</span>";
  186. }elseif($v['bzch_status'] == 1){
  187. $bzch_no .= "<span data-action='bzch' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交出货单</span>";
  188. }elseif($v['bzch_status'] == -1){
  189. $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>';
  190. }elseif($v['bzch_status'] == 2){
  191. $bzch_no .= "<span data-action='bzch' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核出货单</span>";
  192. }elseif($v['bzch_status'] == -2){
  193. $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>';
  194. }elseif($v['bzch_status'] == -3){
  195. $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>';
  196. }
  197. //$bzsh_no =empty($v['bzsh_no'])?"":$v['bzsh_no'];
  198. if(!empty($v['bzch_no'])){
  199. $bzch_no = $v['bzch_no']."<br/>".$bzch_no;
  200. }
  201. $dr_no = "";
  202. if($v['dr_status'] == 0){
  203. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调入单</span>";
  204. }elseif($v['dr_status'] == 1){
  205. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交调入单</span>";
  206. }elseif($v['dr_status'] == -1){
  207. $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>';
  208. }elseif($v['dr_status'] == 2){
  209. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核调入单</span>";
  210. }elseif($v['dr_status'] == -2){
  211. $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>';
  212. }elseif($v['dr_status'] == -3){
  213. $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>';
  214. }
  215. if(!empty($v['dr_no'])){
  216. $dr_no = $v['dr_no']."<br/>".$dr_no;
  217. }
  218. $list[] = [
  219. 'id'=>$v['id'],
  220. 'order_no'=>$v['order_no'],
  221. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  222. 'dc_no'=> $dc_no,
  223. 'cg_no'=>$cg_no,
  224. 'xs_no'=>$xs_no,
  225. 'dr_no'=>$dr_no,
  226. 'xs_two_no'=>$xs_two_no,
  227. 'bzch_no'=>$bzch_no,
  228. //'bzsh_no'=>$bzsh_no,
  229. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  230. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  231. ];
  232. }
  233. $total = $this->zzquque_u9->find_count($where);
  234. $pagenum = ceil($total/$perpage);
  235. $over = $total-($start+$perpage);
  236. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  237. echo json_encode($rows);exit;
  238. }
  239. $this->_Template('zzququeu9',$this->data);
  240. }
  241. public function _dc($arg_array){
  242. $process= $arg_array[0];
  243. $id = $arg_array[1];
  244. $info = $this->zzquque_u9->read($id);
  245. if($process == 1){
  246. if(!in_array($info['dc_status'],[0,-1])){
  247. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  248. exit;
  249. }
  250. $r = $this->logic_u9xgsd->createDc($info);
  251. if($r['code'] == 1){
  252. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  253. exit;
  254. }else{
  255. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  256. exit;
  257. }
  258. }else if($process == 2){
  259. if(!in_array($info['dc_status'],[1,-2])){
  260. echo json_encode(array('msg'=>'当前状态不符合提交调出单的条件','success'=>false));
  261. exit;
  262. }
  263. $r = $this->logic_u9xgsd->subDc($info);
  264. if($r['code'] == 1){
  265. echo json_encode(array('msg'=>'提交调出单成功','success'=>true));
  266. exit;
  267. }else{
  268. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  269. exit;
  270. }
  271. }else if($process == 3){
  272. if(!in_array($info['dc_status'],[2,-3])){
  273. echo json_encode(array('msg'=>'当前状态不符合审核调出单的条件','success'=>false));
  274. exit;
  275. }
  276. $r = $this->logic_u9xgsd->shDc($info);
  277. if($r['code'] == 1){
  278. echo json_encode(array('msg'=>'审核调出单成功','success'=>true));
  279. exit;
  280. }else{
  281. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  282. exit;
  283. }
  284. }else{
  285. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  286. exit;
  287. }
  288. }
  289. public function _cg($arg_array){
  290. $process= $arg_array[0];
  291. $id = $arg_array[1];
  292. $info = $this->zzquque_u9->read($id);
  293. if($info['dc_status'] != 3){
  294. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  295. exit;
  296. }
  297. if($process == 1){
  298. if(!in_array($info['cg_status'],[0,-1])){
  299. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  300. exit;
  301. }
  302. $r = $this->logic_u9xgsd->createCg($info);
  303. if($r['code'] == 1){
  304. echo json_encode(array('msg'=>'创建采购单成功','success'=>true));
  305. exit;
  306. }else{
  307. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  308. exit;
  309. }
  310. }else if($process == 2){
  311. if(!in_array($info['cg_status'],[1,-2])){
  312. echo json_encode(array('msg'=>'当前状态不符合提交采购单的条件','success'=>false));
  313. exit;
  314. }
  315. $r = $this->logic_u9xgsd->subCg($info);
  316. if($r['code'] == 1){
  317. echo json_encode(array('msg'=>'提交采购单成功','success'=>true));
  318. exit;
  319. }else{
  320. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  321. exit;
  322. }
  323. }else if($process == 3){
  324. if(!in_array($info['cg_status'],[2,-3])){
  325. echo json_encode(array('msg'=>'当前状态不符合审核采购单的条件','success'=>false));
  326. exit;
  327. }
  328. $r = $this->logic_u9xgsd->shCg($info);
  329. if($r['code'] == 1){
  330. echo json_encode(array('msg'=>'审核采购单成功','success'=>true));
  331. exit;
  332. }else{
  333. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  334. exit;
  335. }
  336. }else{
  337. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  338. exit;
  339. }
  340. }
  341. public function _xs($arg_array){
  342. $process= $arg_array[0];
  343. $id = $arg_array[1];
  344. $info = $this->zzquque_u9->read($id);
  345. if($info['dc_status'] != 3){
  346. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  347. exit;
  348. }
  349. if($process == 1){
  350. if(!in_array($info['xs_status'],[0,-1])){
  351. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  352. exit;
  353. }
  354. $r = $this->logic_u9xgsd->createXs($info);
  355. if($r['code'] == 1){
  356. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  357. exit;
  358. }else{
  359. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  360. exit;
  361. }
  362. }else if($process == 2){
  363. if(!in_array($info['xs_status'],[1,-2])){
  364. echo json_encode(array('msg'=>'当前状态不符合提交销售单的条件','success'=>false));
  365. exit;
  366. }
  367. $r = $this->logic_u9xgsd->subXs($info);
  368. if($r['code'] == 1){
  369. echo json_encode(array('msg'=>'提交销售单成功','success'=>true));
  370. exit;
  371. }else{
  372. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  373. exit;
  374. }
  375. }else if($process == 3){
  376. if(!in_array($info['xs_status'],[2,-3])){
  377. echo json_encode(array('msg'=>'当前状态不符合审核销售单的条件','success'=>false));
  378. exit;
  379. }
  380. $r = $this->logic_u9xgsd->shXs($info);
  381. if($r['code'] == 1){
  382. echo json_encode(array('msg'=>'审核销售单成功','success'=>true));
  383. exit;
  384. }else{
  385. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  386. exit;
  387. }
  388. }else{
  389. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  390. exit;
  391. }
  392. }
  393. public function _dr($arg_array){
  394. $process= $arg_array[0];
  395. $id = $arg_array[1];
  396. $info = $this->zzquque_u9->read($id);
  397. if($info['dc_status'] != 3){
  398. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  399. exit;
  400. }
  401. if($process == 1){
  402. if(!in_array($info['dr_status'],[0,-1])){
  403. echo json_encode(array('msg'=>'当前状态不符合查询调入单的条件','success'=>false));
  404. exit;
  405. }
  406. $r = $this->logic_u9xgsd->createDr($info);
  407. if($r['code'] == 1){
  408. echo json_encode(array('msg'=>'查询调入单成功','success'=>true));
  409. exit;
  410. }else{
  411. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  412. exit;
  413. }
  414. }else if($process == 2){
  415. if(!in_array($info['dr_status'],[1,-2])){
  416. echo json_encode(array('msg'=>'当前状态不符合提交调入单的条件','success'=>false));
  417. exit;
  418. }
  419. $r = $this->logic_u9xgsd->subDr($info);
  420. if($r['code'] == 1){
  421. echo json_encode(array('msg'=>'提交调入单成功','success'=>true));
  422. exit;
  423. }else{
  424. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  425. exit;
  426. }
  427. }else if($process == 3){
  428. if(!in_array($info['dr_status'],[2,-3])){
  429. echo json_encode(array('msg'=>'当前状态不符合审核调入单的条件','success'=>false));
  430. exit;
  431. }
  432. $r = $this->logic_u9xgsd->shDr($info);
  433. if($r['code'] == 1){
  434. echo json_encode(array('msg'=>'审核调入单成功','success'=>true));
  435. exit;
  436. }else{
  437. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  438. exit;
  439. }
  440. }else{
  441. echo json_encode(array('msg'=>'当前状态不符合创建调入单的条件','success'=>false));
  442. exit;
  443. }
  444. }
  445. public function _xs_two($arg_array){
  446. $process= $arg_array[0];
  447. $id = $arg_array[1];
  448. $info = $this->zzquque_u9->read($id);
  449. if($info['dc_status'] != 3){
  450. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  451. exit;
  452. }
  453. if($process == 1){
  454. if(!in_array($info['xs_two_status'],[0,-1])){
  455. echo json_encode(array('msg'=>'当前状态不符合查询香港销售单的条件','success'=>false));
  456. exit;
  457. }
  458. $r = $this->logic_u9xgsd->createXsTwo($info);
  459. if($r['code'] == 1){
  460. echo json_encode(array('msg'=>'创建香港销售单成功','success'=>true));
  461. exit;
  462. }else{
  463. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  464. exit;
  465. }
  466. }else if($process == 2){
  467. if(!in_array($info['xs_two_status'],[1,-2])){
  468. echo json_encode(array('msg'=>'当前状态不符合提交香港销售单的条件','success'=>false));
  469. exit;
  470. }
  471. $r = $this->logic_u9xgsd->subXsTwo($info);
  472. if($r['code'] == 1){
  473. echo json_encode(array('msg'=>'提交香港销售单成功','success'=>true));
  474. exit;
  475. }else{
  476. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  477. exit;
  478. }
  479. }else if($process == 3){
  480. if(!in_array($info['xs_two_status'],[2,-3])){
  481. echo json_encode(array('msg'=>'当前状态不符合审核香港销售单的条件','success'=>false));
  482. exit;
  483. }
  484. $r = $this->logic_u9xgsd->shXsTwo($info);
  485. if($r['code'] == 1){
  486. echo json_encode(array('msg'=>'审核香港销售单成功','success'=>true));
  487. exit;
  488. }else{
  489. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  490. exit;
  491. }
  492. }else{
  493. echo json_encode(array('msg'=>'当前状态不符合创建香港销售单的条件','success'=>false));
  494. exit;
  495. }
  496. }
  497. public function _bzch($arg_array){
  498. $process= $arg_array[0];
  499. $id = $arg_array[1];
  500. $info = $this->zzquque_u9->read($id);
  501. if($info['dc_status'] != 3){
  502. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  503. exit;
  504. }
  505. if($info['xs_two_status'] != 3){
  506. echo json_encode(array('msg'=>'香港销售单未审核不能执行后续操作','success'=>false));
  507. exit;
  508. }
  509. if($process == 1){
  510. if(!in_array($info['bzsh_status'],[0,-1])){
  511. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  512. exit;
  513. }
  514. $r = $this->logic_u9xgsd->createCh($info);
  515. if($r['code'] == 1){
  516. echo json_encode(array('msg'=>'创建标准收货单成功','success'=>true));
  517. exit;
  518. }else{
  519. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  520. exit;
  521. }
  522. }else if($process == 2){
  523. $r = $this->logic_u9xgsd->subAndShCh($info);
  524. if($r['code'] == 1){
  525. echo json_encode(array('msg'=>'审核标准收货单成功','success'=>true));
  526. exit;
  527. }else{
  528. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  529. exit;
  530. }
  531. }else{
  532. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  533. exit;
  534. }
  535. }
  536. public function _bzsh($arg_array){
  537. }
  538. public function _add(){
  539. $order_no = $this->input->post('order_no',true);
  540. if(empty($order_no)){
  541. echo json_encode(['msg'=>'请输入要添加的订单编码!','success'=>false]);exit;
  542. }
  543. $info = $this->logic_order->getInfo("number = '" .$order_no."'");
  544. if(empty($info)){
  545. echo json_encode(['msg'=>'订单不存在!请仔细核对单号','success'=>false]);exit;
  546. }
  547. $num = $this->zzquque_u9->find_all("order_no = '".$info['number']."'");
  548. if(empty($num)){
  549. $this->zzquque_u9->insert([
  550. 'platform'=>$info['lv_platform'],
  551. 'warehouse'=>$info['type'],
  552. 'type'=>10,
  553. 'order_no'=>$info['number'],
  554. 'create_time'=>time(),
  555. 'update_time'=>time(),
  556. ]);
  557. echo json_encode(['msg'=>'添加成功','success'=>true]);exit;
  558. }else{
  559. echo json_encode(['msg'=>'订单不允许重复添加','success'=>false]);exit;
  560. }
  561. }
  562. public function _excel(){
  563. $params = $this->input->get();
  564. $where = "1 = 1";
  565. if(!empty($params['order_no'])){
  566. $where .= " order_no = '".$params['order_no']."' ";
  567. }
  568. if(!empty($params['timetk'])){
  569. $where .= " create_time > ".strtotime($params['timetk'])." ";
  570. }
  571. if(!empty($params['timetj'])){
  572. $where .= " create_time < ".strtotime($params['timetj'])." ";
  573. }
  574. if(!empty($params['status'])){
  575. $where .= " status = ".$params['status'];
  576. }
  577. var_dump($where);
  578. }
  579. public function mcindex(){
  580. }
  581. }