Zzququeu9.php 28 KB

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