Ck.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Ck extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->_model('Model_ck','ck');
  6. $this->load->_model('Model_warehouse','warehouse');
  7. $this->load->_model('Model_specialstock','specialstock');
  8. $this->load->_model('Model_whlabel','whlabel');
  9. $this->load->_model('Model_typeclass','typeclass');
  10. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  11. $this->load->_model("Model_logic_goods_replace","logic_goods_replace");
  12. $this->load->_model("Model_logic_tools","logic_tools");
  13. }
  14. //定义方法的调用规则 获取URI第二段值
  15. public function _remap($arg,$arg_array)
  16. {
  17. if($arg == 'kcyz')//添加
  18. {
  19. $this->_kcyz();
  20. }
  21. elseif($arg == 'mcth'){
  22. $this->_mcth();
  23. }
  24. else
  25. {
  26. $this->_index();
  27. }
  28. }
  29. private function _index(){
  30. exit('No direct script access allowed');
  31. }
  32. private function _mcth(){
  33. $post = $this->input->post(NULL, TRUE);
  34. if(empty($post['number'])){
  35. exit($this->logic_tools->ret_json(-1,'订单编码不能为空'));
  36. }
  37. if(empty($post['fpdata'])){
  38. exit($this->logic_tools->ret_json(-1,'订单产品信息为传递'));
  39. }
  40. $res = $this->logic_goods_replace->do_replace($post['number'],$post['fpdata']);
  41. exit(json_encode($res));
  42. }
  43. public function _kcyz()
  44. {
  45. $post = $this->input->post(NULL, TRUE);
  46. if(isset($post['warehouse']))
  47. {
  48. $warehouse = $this->input->post('warehouse',true);
  49. $whlabel = $this->input->post('whlabel',true);
  50. $id = $this->input->post('id',true);
  51. $shop = $this->input->post('shop',true);
  52. $number = $this->input->post('number',true);
  53. $state = $this->input->post('state',true);
  54. $warehouse = $this->warehouse->read($warehouse);
  55. if(!$state)
  56. {
  57. $state = 207;
  58. }
  59. if(!$number)
  60. {
  61. $number = '001';
  62. }
  63. if(!$whlabel || $whlabel == '|')
  64. {
  65. echo json_encode(array('msg'=>'请先添加产品信息!','success'=>false));exit;
  66. }
  67. $z = $this->ck->get_kcyz($state,$warehouse,$shop,$number,$whlabel,'');
  68. if($z['t'] > '0')
  69. {
  70. echo $z['m'];
  71. }
  72. else
  73. {
  74. echo json_encode(array('success'=>true));exit;
  75. }
  76. }
  77. }
  78. }