Zzququeu9.php 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  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_logic_u9ztsd","logic_u9ztsd");
  11. $this->load->_model('Model_zzququeu9_logs','zzququeu9_logs');
  12. $this->load->_model("Model_logic_u9action","logic_u9action");
  13. $this->load->_model("Model_whlabel_bh_transfer","whlabel_bh_transfer");
  14. $this->load->_model('Model_systemtransfer','systemtransfer');
  15. }
  16. public function _remap($arg,$arg_array)
  17. {
  18. if($arg == 'dc')//调出单
  19. {
  20. $this->_dc($arg_array);
  21. }
  22. elseif($arg == 'cg')//采购
  23. {
  24. $this->_cg($arg_array);
  25. }
  26. elseif($arg == 'xs')//销售单
  27. {
  28. $this->_xs($arg_array);
  29. }
  30. elseif($arg == 'bzch')//标准出货
  31. {
  32. $this->_bzch($arg_array);
  33. }
  34. elseif($arg == 'bzsh')//标准收货
  35. {
  36. $this->_bzsh($arg_array);
  37. }
  38. elseif($arg == 'dr')//调入单
  39. {
  40. $this->_dr($arg_array);
  41. }
  42. elseif($arg == 'xs_two')//调入单
  43. {
  44. $this->_xs_two($arg_array);
  45. }
  46. elseif($arg == 'dczt')//在途的调出单
  47. {
  48. $this->_dczt($arg_array);
  49. }
  50. elseif($arg == 'add'){
  51. $this->_add();
  52. }
  53. elseif($arg == 'excel'){
  54. $this->_excel();
  55. }
  56. elseif($arg == 'mcindex')
  57. {
  58. $this->_mcindex();
  59. }
  60. elseif($arg == 'scdel')//删除
  61. {
  62. $this->_del($arg_array);
  63. }
  64. elseif($arg == 'waixiao')//编辑
  65. {
  66. $this->_waixiao($arg_array);
  67. }
  68. elseif($arg == 'wxcprk')//外销成品入库
  69. {
  70. $this->_wxcprk($arg_array);
  71. }
  72. elseif($arg == 'wxcprksh'){
  73. $this->_wxcprksh($arg_array);
  74. }
  75. elseif($arg == 'wxxs'){
  76. $this->_wxxs($arg_array);
  77. }elseif($arg == 'gcbh_index'){
  78. $this->_gcbh_index();
  79. }elseif($arg == 'gcbhexcel'){
  80. $this->_gcbhexcel();
  81. }elseif($arg == 'bhcprk'){
  82. $this->_bhcprk($arg_array);
  83. }elseif($arg == 'cpkbh_index'){
  84. $this->_cpkbh_index();
  85. }
  86. elseif($arg == 'excelwx'){
  87. $this->_excelwx();
  88. }
  89. elseif($arg == 'checkProduct'){
  90. $this->_checkProduct();
  91. }
  92. else
  93. {
  94. $this->_index();
  95. }
  96. }
  97. public function _index(){
  98. $post = $this->input->post(NULL, TRUE);
  99. if(isset($post['page']))
  100. {
  101. $page = $this->input->post('page',true);
  102. $perpage = $this->input->post('perpage',true);
  103. $timetk = $this->input->post('timetk',true);//订单开始时间
  104. $timetj = $this->input->post('timetj',true);//订单结束时间
  105. $timetk = strtotime($timetk);
  106. $timetj = strtotime($timetj);
  107. $status = $this->input->post('status',true);
  108. $order_no = $this->input->post('order_no',true);
  109. $where='type = 10 ';
  110. if($order_no){
  111. $where .= " and order_no = '".$order_no."' ";
  112. }
  113. if($status){
  114. if($status == 1){
  115. $where .= " and dc_status = 0 ";
  116. }elseif($status == 2){
  117. $where .= " and dc_status = -1 ";
  118. }elseif($status == 3){
  119. $where .= " and dc_status = -2 ";
  120. }elseif($status == 4){
  121. $where .= " and dc_status = -3 ";
  122. }elseif($status == 5){
  123. $where .= " and dc_status < 3 ";
  124. }
  125. }
  126. if($timetk && $timetj){
  127. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  128. }
  129. if(empty($page))
  130. {
  131. $start = 0;
  132. $perpage = 10;
  133. }
  134. else
  135. {
  136. $start = ($page - 1)*$perpage;
  137. }
  138. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  139. $type_list = $this->zzquque_u9->getType();
  140. $list = [];
  141. foreach($info_list as $k=>$v){
  142. $dc_no = "";
  143. if($v['dc_status'] == 0){
  144. $dc_no = "<span data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
  145. }elseif($v['dc_status'] == -1){
  146. $tmp_str = "异常信息";
  147. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  148. if(isset($error[0])){
  149. if($error[0]['apply_api']=='lpck'){
  150. $ret_data = json_decode($error[0]['ret_data'],true);
  151. $apply_data = json_decode($error[0]['apply_data'],true);
  152. if(isset($ret_data["ResMsg"])){
  153. if(empty($apply_data['0'])){
  154. $tmp_str = $ret_data["ResMsg"];
  155. }else{
  156. $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  157. }
  158. }else{
  159. $tmp_str = "料品同步失败";
  160. }
  161. }else{
  162. $ret_data = json_decode($error[0]['ret_data'],true);
  163. if(isset($ret_data[0]["ResMsg"])){
  164. $tmp_str = $ret_data[0]["ResMsg"];
  165. }elseif(isset($ret_data['msg'])){
  166. $tmp_str = $ret_data['msg'];
  167. }else{
  168. $tmp_str = "料品同步失败";
  169. }
  170. }
  171. }
  172. $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>';
  173. }
  174. if(!empty($v['dc_no'])){
  175. $dc_no = $v['dc_no']."<br/>".$dc_no;
  176. }
  177. $cg_no = "";
  178. if($v['cg_status'] == 0){
  179. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建采购单</span>";
  180. }elseif($v['cg_status'] == 1){
  181. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交采购单</span>";
  182. }elseif($v['cg_status'] == -1){
  183. $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>';
  184. }elseif($v['cg_status'] == 2){
  185. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核采购单</span>";
  186. }elseif($v['cg_status'] == -2){
  187. $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>';
  188. }elseif($v['cg_status'] == -3){
  189. $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>';
  190. }
  191. if(!empty($v['cg_no'])){
  192. $cg_no = $v['cg_no']."<br/>".$cg_no;
  193. }
  194. $xs_no = "";
  195. if($v['xs_status'] == 0){
  196. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  197. }elseif($v['xs_status'] == 1){
  198. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  199. }elseif($v['xs_status'] == -1){
  200. $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>';
  201. }elseif($v['xs_status'] == 2){
  202. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  203. }elseif($v['xs_status'] == -2){
  204. $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>';
  205. }elseif($v['xs_status'] == -3){
  206. $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>';
  207. }
  208. if(!empty($v['xs_no'])){
  209. $xs_no = $v['xs_no']."<br/>".$xs_no;
  210. }
  211. $xs_two_no ='';
  212. if($v['xs_two_status'] == 0){
  213. $xs_two_no .= "<span data-action='xs_two' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  214. }elseif($v['xs_two_status'] == 1){
  215. $xs_two_no .= "<span data-action='xs_two' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  216. }elseif($v['xs_two_status'] == -1){
  217. $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>';
  218. }elseif($v['xs_two_status'] == 2){
  219. $xs_two_no .= "<span data-action='xs_two' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  220. }elseif($v['xs_two_status'] == -2){
  221. $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>';
  222. }elseif($v['xs_two_status'] == -3){
  223. $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>';
  224. }
  225. if(!empty($v['xs_two_no'])){
  226. $xs_two_no = $v['xs_two_no']."<br/>".$xs_two_no;
  227. }
  228. $bzch_no ="";
  229. if($v['bzch_status'] == 0){
  230. $bzch_no .= "<span data-action='bzch' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建出货单</span>";
  231. }elseif($v['bzch_status'] == 1){
  232. $bzch_no .= "<span data-action='bzch' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交出货单</span>";
  233. }elseif($v['bzch_status'] == -1){
  234. $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>';
  235. }elseif($v['bzch_status'] == 2){
  236. $bzch_no .= "<span data-action='bzch' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核出货单</span>";
  237. }elseif($v['bzch_status'] == -2){
  238. $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>';
  239. }elseif($v['bzch_status'] == -3){
  240. $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>';
  241. }
  242. //$bzsh_no =empty($v['bzsh_no'])?"":$v['bzsh_no'];
  243. if(!empty($v['bzch_no'])){
  244. $bzch_no = $v['bzch_no']."<br/>".$bzch_no;
  245. }
  246. $dr_no = "";
  247. if($v['dr_status'] == 0){
  248. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调入单</span>";
  249. }elseif($v['dr_status'] == 1){
  250. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交调入单</span>";
  251. }elseif($v['dr_status'] == -1){
  252. $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>';
  253. }elseif($v['dr_status'] == 2){
  254. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核调入单</span>";
  255. }elseif($v['dr_status'] == -2){
  256. $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>';
  257. }elseif($v['dr_status'] == -3){
  258. $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>';
  259. }
  260. if(!empty($v['dr_no'])){
  261. $dr_no = $v['dr_no']."<br/>".$dr_no;
  262. }
  263. $list[] = [
  264. 'id'=>$v['id'],
  265. 'order_no'=>$v['order_no'],
  266. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  267. 'dc_no'=> $dc_no,
  268. 'cg_no'=>$cg_no,
  269. 'xs_no'=>$xs_no,
  270. 'dr_no'=>$dr_no,
  271. 'xs_two_no'=>$xs_two_no,
  272. 'bzch_no'=>$bzch_no,
  273. //'bzsh_no'=>$bzsh_no,
  274. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  275. 'update_time'=>date("Y-m-d H:i:s",$v['update_time']),
  276. 'operate'=>($v['dc_status'] == 3)?"": "<span data-action='dr' data-id='".$v['id']."' onclick='doDel(this)' style='background-color:red'>删除</span>"
  277. ];
  278. }
  279. $total = $this->zzquque_u9->find_count($where);
  280. $pagenum = ceil($total/$perpage);
  281. $over = $total-($start+$perpage);
  282. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  283. echo json_encode($rows);exit;
  284. }
  285. $this->_Template('zzququeu9',$this->data);
  286. }
  287. public function _dc($arg_array){
  288. $process= $arg_array[0];
  289. $id = $arg_array[1];
  290. $info = $this->zzquque_u9->read($id);
  291. if($process == 1){
  292. if(!in_array($info['dc_status'],[0,-1])){
  293. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  294. exit;
  295. }
  296. $r = $this->logic_u9xgsd->createDc($info);
  297. if($r['code'] == 1){
  298. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  299. exit;
  300. }else{
  301. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  302. exit;
  303. }
  304. }else if($process == 2){
  305. if(!in_array($info['dc_status'],[1,-2])){
  306. echo json_encode(array('msg'=>'当前状态不符合提交调出单的条件','success'=>false));
  307. exit;
  308. }
  309. $r = $this->logic_u9xgsd->subDc($info);
  310. if($r['code'] == 1){
  311. echo json_encode(array('msg'=>'提交调出单成功','success'=>true));
  312. exit;
  313. }else{
  314. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  315. exit;
  316. }
  317. }else if($process == 3){
  318. if(!in_array($info['dc_status'],[2,-3])){
  319. echo json_encode(array('msg'=>'当前状态不符合审核调出单的条件','success'=>false));
  320. exit;
  321. }
  322. $r = $this->logic_u9xgsd->shDc($info);
  323. if($r['code'] == 1){
  324. echo json_encode(array('msg'=>'审核调出单成功','success'=>true));
  325. exit;
  326. }else{
  327. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  328. exit;
  329. }
  330. }else{
  331. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  332. exit;
  333. }
  334. }
  335. public function _cg($arg_array){
  336. $process= $arg_array[0];
  337. $id = $arg_array[1];
  338. $info = $this->zzquque_u9->read($id);
  339. if($info['dc_status'] != 3){
  340. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  341. exit;
  342. }
  343. if($process == 1){
  344. if(!in_array($info['cg_status'],[0,-1])){
  345. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  346. exit;
  347. }
  348. $r = $this->logic_u9xgsd->createCg($info);
  349. if($r['code'] == 1){
  350. echo json_encode(array('msg'=>'创建采购单成功','success'=>true));
  351. exit;
  352. }else{
  353. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  354. exit;
  355. }
  356. }else if($process == 2){
  357. if(!in_array($info['cg_status'],[1,-2])){
  358. echo json_encode(array('msg'=>'当前状态不符合提交采购单的条件','success'=>false));
  359. exit;
  360. }
  361. $r = $this->logic_u9xgsd->subCg($info);
  362. if($r['code'] == 1){
  363. echo json_encode(array('msg'=>'提交采购单成功','success'=>true));
  364. exit;
  365. }else{
  366. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  367. exit;
  368. }
  369. }else if($process == 3){
  370. if(!in_array($info['cg_status'],[2,-3])){
  371. echo json_encode(array('msg'=>'当前状态不符合审核采购单的条件','success'=>false));
  372. exit;
  373. }
  374. $r = $this->logic_u9xgsd->shCg($info);
  375. if($r['code'] == 1){
  376. echo json_encode(array('msg'=>'审核采购单成功','success'=>true));
  377. exit;
  378. }else{
  379. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  380. exit;
  381. }
  382. }else{
  383. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  384. exit;
  385. }
  386. }
  387. public function _xs($arg_array){
  388. $process= $arg_array[0];
  389. $id = $arg_array[1];
  390. $info = $this->zzquque_u9->read($id);
  391. if($info['dc_status'] != 3){
  392. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  393. exit;
  394. }
  395. if($process == 1){
  396. if(!in_array($info['xs_status'],[0,-1])){
  397. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  398. exit;
  399. }
  400. $r = $this->logic_u9xgsd->createXs($info);
  401. if($r['code'] == 1){
  402. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  403. exit;
  404. }else{
  405. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  406. exit;
  407. }
  408. }else if($process == 2){
  409. if(!in_array($info['xs_status'],[1,-2])){
  410. echo json_encode(array('msg'=>'当前状态不符合提交销售单的条件','success'=>false));
  411. exit;
  412. }
  413. $r = $this->logic_u9xgsd->subXs($info);
  414. if($r['code'] == 1){
  415. echo json_encode(array('msg'=>'提交销售单成功','success'=>true));
  416. exit;
  417. }else{
  418. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  419. exit;
  420. }
  421. }else if($process == 3){
  422. if(!in_array($info['xs_status'],[2,-3])){
  423. echo json_encode(array('msg'=>'当前状态不符合审核销售单的条件','success'=>false));
  424. exit;
  425. }
  426. $r = $this->logic_u9xgsd->shXs($info);
  427. if($r['code'] == 1){
  428. echo json_encode(array('msg'=>'审核销售单成功','success'=>true));
  429. exit;
  430. }else{
  431. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  432. exit;
  433. }
  434. }else{
  435. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  436. exit;
  437. }
  438. }
  439. public function _dr($arg_array){
  440. $process= $arg_array[0];
  441. $id = $arg_array[1];
  442. $info = $this->zzquque_u9->read($id);
  443. if($info['dc_status'] != 3){
  444. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  445. exit;
  446. }
  447. if($process == 1){
  448. if(!in_array($info['dr_status'],[0,-1])){
  449. echo json_encode(array('msg'=>'当前状态不符合查询调入单的条件','success'=>false));
  450. exit;
  451. }
  452. $r = $this->logic_u9xgsd->createDr($info);
  453. if($r['code'] == 1){
  454. echo json_encode(array('msg'=>'查询调入单成功','success'=>true));
  455. exit;
  456. }else{
  457. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  458. exit;
  459. }
  460. }else if($process == 2){
  461. if(!in_array($info['dr_status'],[1,-2])){
  462. echo json_encode(array('msg'=>'当前状态不符合提交调入单的条件','success'=>false));
  463. exit;
  464. }
  465. $r = $this->logic_u9xgsd->subDr($info);
  466. if($r['code'] == 1){
  467. echo json_encode(array('msg'=>'提交调入单成功','success'=>true));
  468. exit;
  469. }else{
  470. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  471. exit;
  472. }
  473. }else if($process == 3){
  474. if(!in_array($info['dr_status'],[2,-3])){
  475. echo json_encode(array('msg'=>'当前状态不符合审核调入单的条件','success'=>false));
  476. exit;
  477. }
  478. $r = $this->logic_u9xgsd->shDr($info);
  479. if($r['code'] == 1){
  480. echo json_encode(array('msg'=>'审核调入单成功','success'=>true));
  481. exit;
  482. }else{
  483. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  484. exit;
  485. }
  486. }else{
  487. echo json_encode(array('msg'=>'当前状态不符合创建调入单的条件','success'=>false));
  488. exit;
  489. }
  490. }
  491. public function _xs_two($arg_array){
  492. $process= $arg_array[0];
  493. $id = $arg_array[1];
  494. $info = $this->zzquque_u9->read($id);
  495. if($info['dc_status'] != 3){
  496. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  497. exit;
  498. }
  499. if($process == 1){
  500. if(!in_array($info['xs_two_status'],[0,-1])){
  501. echo json_encode(array('msg'=>'当前状态不符合查询香港销售单的条件','success'=>false));
  502. exit;
  503. }
  504. $r = $this->logic_u9xgsd->createXsTwo($info);
  505. if($r['code'] == 1){
  506. echo json_encode(array('msg'=>'创建香港销售单成功','success'=>true));
  507. exit;
  508. }else{
  509. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  510. exit;
  511. }
  512. }else if($process == 2){
  513. if(!in_array($info['xs_two_status'],[1,-2])){
  514. echo json_encode(array('msg'=>'当前状态不符合提交香港销售单的条件','success'=>false));
  515. exit;
  516. }
  517. $r = $this->logic_u9xgsd->subXsTwo($info);
  518. if($r['code'] == 1){
  519. echo json_encode(array('msg'=>'提交香港销售单成功','success'=>true));
  520. exit;
  521. }else{
  522. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  523. exit;
  524. }
  525. }else if($process == 3){
  526. if(!in_array($info['xs_two_status'],[2,-3])){
  527. echo json_encode(array('msg'=>'当前状态不符合审核香港销售单的条件','success'=>false));
  528. exit;
  529. }
  530. $r = $this->logic_u9xgsd->shXsTwo($info);
  531. if($r['code'] == 1){
  532. echo json_encode(array('msg'=>'审核香港销售单成功','success'=>true));
  533. exit;
  534. }else{
  535. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  536. exit;
  537. }
  538. }else{
  539. echo json_encode(array('msg'=>'当前状态不符合创建香港销售单的条件','success'=>false));
  540. exit;
  541. }
  542. }
  543. public function _bzch($arg_array){
  544. $process= $arg_array[0];
  545. $id = $arg_array[1];
  546. $info = $this->zzquque_u9->read($id);
  547. if($info['dc_status'] != 3){
  548. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  549. exit;
  550. }
  551. if($info['xs_two_status'] != 3){
  552. echo json_encode(array('msg'=>'香港销售单未审核不能执行后续操作','success'=>false));
  553. exit;
  554. }
  555. if($process == 1){
  556. if(!in_array($info['bzsh_status'],[0,-1])){
  557. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  558. exit;
  559. }
  560. $r = $this->logic_u9xgsd->createCh($info);
  561. if($r['code'] == 1){
  562. echo json_encode(array('msg'=>'创建标准收货单成功','success'=>true));
  563. exit;
  564. }else{
  565. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  566. exit;
  567. }
  568. }else if($process == 2){
  569. $r = $this->logic_u9xgsd->subAndShCh($info);
  570. if($r['code'] == 1){
  571. echo json_encode(array('msg'=>'审核标准收货单成功','success'=>true));
  572. exit;
  573. }else{
  574. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  575. exit;
  576. }
  577. }else{
  578. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  579. exit;
  580. }
  581. }
  582. public function _bzsh($arg_array){
  583. }
  584. public function _add(){
  585. $order_no = $this->input->post('order_no',true);
  586. if(empty($order_no)){
  587. echo json_encode(['msg'=>'请输入要添加的订单编码!','success'=>false]);exit;
  588. }
  589. $info = $this->logic_order->getInfo("number = '" .$order_no."'");
  590. if(empty($info)){
  591. echo json_encode(['msg'=>'订单不存在!请仔细核对单号','success'=>false]);exit;
  592. }
  593. $num = $this->zzquque_u9->find_all("order_no = '".$info['number']."'");
  594. if(empty($num)){
  595. $this->zzquque_u9->insert([
  596. 'platform'=>$info['lv_platform'],
  597. 'warehouse'=>$info['type'],
  598. 'type'=>10,
  599. 'order_no'=>$info['number'],
  600. 'create_time'=>time(),
  601. 'update_time'=>time(),
  602. ]);
  603. echo json_encode(['msg'=>'添加成功','success'=>true]);exit;
  604. }else{
  605. echo json_encode(['msg'=>'订单不允许重复添加','success'=>false]);exit;
  606. }
  607. }
  608. public function _excel(){
  609. $params = $this->input->get();
  610. $where = " type = 10 ";
  611. if(!empty($params['order_no'])){
  612. $where .= " and order_no = '".$params['order_no']."' ";
  613. }
  614. if(!empty($params['timetk'])){
  615. $where .= " and create_time > ".strtotime($params['timetk'])." ";
  616. }
  617. if(!empty($params['timetj'])){
  618. $where .= "and create_time < ".strtotime($params['timetj'])." ";
  619. }
  620. if(!empty($params['status'])){
  621. $status = $params['status'];
  622. if($status == 1){
  623. $where .= " and dc_status = 0 ";
  624. }elseif($status == 2){
  625. $where .= " and dc_status = -1 ";
  626. }elseif($status == 3){
  627. $where .= " and dc_status = -2 ";
  628. }elseif($status == 4){
  629. $where .= " and dc_status = -3 ";
  630. }elseif($status == 5){
  631. $where .= " and dc_status < 3 ";
  632. }
  633. }
  634. $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
  635. $type_list = $this->zzquque_u9->getType();
  636. $list = [];
  637. foreach($info_list as $k=>$v){
  638. $dc_no = $v['dc_no'];
  639. $error_str = "";
  640. $error_json ="";
  641. if($v['dc_status'] == -1){
  642. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  643. $error_json = $error[0]['ret_data'];
  644. if($error[0]['apply_api']=='lpck'){
  645. $ret_data = json_decode($error[0]['ret_data'],true);
  646. $apply_data = json_decode($error[0]['apply_data'],true);
  647. if(isset($ret_data["ResMsg"])){
  648. if(empty($apply_data['0'])){
  649. $error_str = $ret_data["ResMsg"];
  650. }else{
  651. $error_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  652. }
  653. }else{
  654. $error_str = "料品同步失败";
  655. }
  656. }else{
  657. $ret_data = json_decode($error[0]['ret_data'],true);
  658. if(isset($ret_data[0]["ResMsg"])){
  659. $error_str = $ret_data[0]["ResMsg"];
  660. }elseif(isset($ret_data['msg'])){
  661. $error_str = $ret_data['msg'];
  662. }else{
  663. $error_str = "料品同步失败";
  664. }
  665. }
  666. }
  667. $list[] = [
  668. 'id'=>$v['id'],
  669. 'order_no'=>$v['order_no'],
  670. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  671. 'dc_no'=> $dc_no,
  672. 'error'=>$error_str,
  673. 'error_json'=>$error_json,
  674. //'bzsh_no'=>$bzsh_no,
  675. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  676. ];
  677. }
  678. $filename = date("Y-m-d")."u9小单导出.xls";
  679. $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
  680. <head>
  681. <!--[if gte mso 9]><xml>
  682. <x:ExcelWorkbook>
  683. <x:ExcelWorksheets>
  684. <x:ExcelWorksheet>
  685. <x:Name>EXCEL</x:Name>
  686. <x:WorksheetOptions>
  687. <x:Print>
  688. <x:ValidPrinterInfo />
  689. </x:Print>
  690. </x:WorksheetOptions>
  691. </x:ExcelWorksheet>
  692. </x:ExcelWorksheets>
  693. </x:ExcelWorkbook>
  694. </xml>
  695. <![endif]-->
  696. </head><body>";
  697. $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
  698. $str .= "<tr><td>id</td><td>订单号</td><td>类型</td><td>调出单号</td><td>创建时间</td><td>错误信息</td><td>错误json</td></tr>";
  699. foreach ($list as $key=>$value)
  700. {
  701. $str .= "<tr>";
  702. $str .= "<td>". $value['id']. "</td>";
  703. $str .= "<td>". $value['order_no']. "</td>";
  704. $str .= "<td>". $value['type']. "</td>";
  705. $str .= "<td>". $value['dc_no']. "</td>";
  706. $str .= "<td>". $value['create_time']. "</td>";
  707. $str .= "<td>". $value['error']. "</td>";
  708. $str .= "<td>". $value['error_json']. "</td>";
  709. $str .= "</tr>";
  710. }
  711. $str .= "</table></body></html>";
  712. header( "Content-Type: application/vnd.ms-excel; name='excel'" );
  713. header( "Content-type: application/octet-stream" );
  714. header( "Content-Disposition: attachment; filename=".$filename );
  715. header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
  716. header( "Pragma: no-cache" );
  717. header( "Expires: 0" );
  718. exit($str);
  719. }
  720. public function _mcindex(){
  721. $post = $this->input->post(NULL, TRUE);
  722. if(isset($post['page']))
  723. {
  724. $page = $this->input->post('page',true);
  725. $perpage = $this->input->post('perpage',true);
  726. $timetk = $this->input->post('timetk',true);//订单开始时间
  727. $timetj = $this->input->post('timetj',true);//订单结束时间
  728. $timetk = strtotime($timetk);
  729. $timetj = strtotime($timetj);
  730. $order_no = $this->input->post('order_no',true);
  731. $type = $this->input->post('type',true);
  732. if($type == 1){
  733. $where=' ( type = 1)';
  734. }elseif($type == 2){
  735. $where=' ( type = 2)';
  736. }else{
  737. $where=' ( type = 1 or type = 2)';
  738. }
  739. if($order_no){
  740. $where .= " and order_no = '".$order_no."' ";
  741. }
  742. if($timetk && $timetj){
  743. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  744. }
  745. if(empty($page))
  746. {
  747. $start = 0;
  748. $perpage = 1;
  749. }
  750. else
  751. {
  752. $start = ($page - 1)*$perpage;
  753. }
  754. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  755. $type_list = $this->zzquque_u9->getType();
  756. $list = [];
  757. foreach($info_list as $k=>$v){
  758. $dc_no = "";
  759. if($v['dc_status'] == 0){
  760. if($v['type'] == 1){
  761. $dc_no = "<span data-action='dczt' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
  762. }
  763. }elseif($v['dc_status'] == -1){
  764. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  765. if($error[0]['apply_api']=='lpck'){
  766. $ret_data = json_decode($error[0]['ret_data'],true);
  767. $apply_data = json_decode($error[0]['apply_data'],true);
  768. if(isset($ret_data["ResMsg"])){
  769. if(empty($apply_data['0'])){
  770. $tmp_str = $ret_data["ResMsg"];
  771. }else{
  772. $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  773. }
  774. }else{
  775. $tmp_str = "料品同步失败";
  776. }
  777. }else{
  778. $tmp_str= "";
  779. $ret_data = json_decode($error[0]['ret_data'],true);
  780. if(isset($ret_data[0]["ResMsg"])){
  781. $tmp_str = $ret_data[0]["ResMsg"];
  782. }elseif(isset($ret_data['msg'])){
  783. $tmp_str = $ret_data['msg'];
  784. }elseif(isset($ret_data['Data'])){
  785. foreach($ret_data['Data'] as $iit){
  786. if(!$iit['IsSucess']){
  787. $tmp_str .= $iit['ErrorMsg']."<br>";
  788. }
  789. }
  790. }else{
  791. $tmp_str = "料品同步失败";
  792. }
  793. }
  794. $dc_no = "<span data-action='dczt' 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>';
  795. }
  796. if(!empty($v['dc_no'])){
  797. if($v['type'] == 1){
  798. $dc_no = $v['dc_no']."【销售组织】"."<br/>".$dc_no;
  799. }else{
  800. $dc_no = $v['dc_no']."【香港组织】"."<br/>".$dc_no;
  801. }
  802. }
  803. $cg_no = "";
  804. if($v['type'] == 1){
  805. if($v['cg_status'] == 1){
  806. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."'>采购单提交异常</span>";
  807. }elseif($v['cg_status'] == -1){
  808. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' >创建采购单失败</span>";
  809. }elseif($v['cg_status'] == 2){
  810. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' >采购单未审核</span>";
  811. }elseif($v['cg_status'] == -2){
  812. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' >采购单提交失败</span>";
  813. }elseif($v['cg_status'] == -3){
  814. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' >采购单审核失败</span>";
  815. }
  816. if(!empty($v['cg_no'])){
  817. $cg_no = $v['cg_no']."【香港组织】<br/>".$cg_no;
  818. }
  819. }
  820. $xs_no = "";
  821. if($v['type'] == 1){
  822. if($v['xs_status'] == 1){
  823. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' >销售单未提交</span>";
  824. }elseif($v['xs_status'] == -1){
  825. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' >销售单创建失败</span>";
  826. }elseif($v['xs_status'] == 2){
  827. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' >销售单未审核</span>";
  828. }elseif($v['xs_status'] == -2){
  829. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' >销售单提交失败</span>";
  830. }elseif($v['xs_status'] == -3){
  831. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' >销售单审核失败</span>";
  832. }
  833. if(!empty($v['xs_no'])){
  834. $xs_no = $v['xs_no']."【销售组织】<br/>".$xs_no;
  835. }
  836. }
  837. $dr_no = "";
  838. if($v['dr_status'] == 1){
  839. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' >调入单未提交</span>";
  840. }elseif($v['dr_status'] == -1){
  841. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' >创建调入单失败</span>";
  842. }elseif($v['dr_status'] == 2){
  843. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' >调入单未审核</span>";
  844. }elseif($v['dr_status'] == -2){
  845. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' >调入单提交失败</span>";
  846. }elseif($v['dr_status'] == -3){
  847. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' >调入单审核失败</span>";
  848. }
  849. if(!empty($v['dr_no'])){
  850. $dr_no = $v['dr_no']."【香港组织】<br/>".$dr_no;
  851. }
  852. $type = "";
  853. if(isset($type_list[$v['type']])){
  854. if($v['type'] == 2){
  855. $type = "<i style='color:#70B'>".$type_list[$v['type']]."</i>";
  856. }else{
  857. $type = "<i>".$type_list[$v['type']]."</i>";
  858. }
  859. }else{
  860. $type = "<b style='color:red'>异常</b>";
  861. }
  862. $list[] = [
  863. 'id'=>$v['id'],
  864. 'order_no'=>$v['order_no'],
  865. 'type'=>$type,
  866. 'dc_no'=> $dc_no,
  867. 'cg_no'=>$cg_no,
  868. 'xs_no'=>$xs_no,
  869. 'dr_no'=>$dr_no,
  870. // 'xs_two_no'=>"",
  871. // 'bzch_no'=>"",
  872. //'bzsh_no'=>$bzsh_no,
  873. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  874. 'update_time'=>date("Y-m-d H:i:s",$v['update_time']),
  875. 'operate'=>"<span onclick='checkProduct(this)' style='background-color:#FF8C00' data-id='".$v['id']."' >物料核对</span>"
  876. ];
  877. }
  878. $total = $this->zzquque_u9->find_count($where);
  879. $pagenum = ceil($total/$perpage);
  880. $over = $total-($start+$perpage);
  881. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  882. echo json_encode($rows);exit;
  883. }
  884. $this->_Template('zzququeu9zt',$this->data);
  885. }
  886. public function _dczt($arg_array){
  887. $process= $arg_array[0];
  888. $id = $arg_array[1];
  889. $info = $this->zzquque_u9->read($id);
  890. if($process == 1){
  891. if(!in_array($info['dc_status'],[0,-1])){
  892. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  893. exit;
  894. }
  895. $r = $this->logic_u9ztsd->createdDc($info);
  896. if($r['code'] == 1){
  897. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  898. exit;
  899. }else{
  900. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  901. exit;
  902. }
  903. }else{
  904. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  905. exit;
  906. }
  907. }
  908. private function _del($arg_array){
  909. $id = $arg_array[0];
  910. $user = $this->user->get_api($_SESSION['api']);
  911. if(!in_array($user['userid'],['ceshi','admin'])){
  912. echo json_encode(array('msg'=>'权限不足,禁止删除!','success'=>false));
  913. }
  914. $info = $this->zzquque_u9->read($id);
  915. //目前只删除小单的 在途的单子 不管对错都不处理留痕
  916. if(($info['dc_status'] < 3) && ($info['type'] == 10)){
  917. $this->zzquque_u9->remove($id);
  918. echo json_encode(array('msg'=>'删除成功','success'=>true));
  919. }else{
  920. echo json_encode(array('msg'=>'不满足删除条件','success'=>true));
  921. }
  922. }
  923. public function _waixiao(){
  924. $post = $this->input->post(NULL, TRUE);
  925. if(isset($post['page']))
  926. {
  927. $page = $this->input->post('page',true);
  928. $perpage = $this->input->post('perpage',true);
  929. $timetk = $this->input->post('timetk',true);//订单开始时间
  930. $timetj = $this->input->post('timetj',true);//订单结束时间
  931. $timetk = strtotime($timetk);
  932. $timetj = strtotime($timetj);
  933. $order_no = $this->input->post('order_no',true);
  934. $type = $this->input->post('type',true);
  935. $where = " ( type = 20) ";
  936. if($order_no){
  937. $where .= " and order_no like '%".$order_no."%' ";
  938. }
  939. if($timetk && $timetj){
  940. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  941. }
  942. if(empty($page))
  943. {
  944. $start = 0;
  945. $perpage = 1;
  946. }
  947. else
  948. {
  949. $start = ($page - 1)*$perpage;
  950. }
  951. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  952. $type_list = $this->zzquque_u9->getType();
  953. $list = [];
  954. $lb_list= [];
  955. foreach($info_list as $k=>$v){
  956. $bzsh_no = $v['bzsh_no'];
  957. if($v['bzsh_status'] == 0){
  958. $bzsh_no = "<span data-action='wxcprk' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  959. }elseif($v['bzsh_status'] == -1){
  960. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
  961. $tmp_str= "";
  962. if(isset($error[0]['ret_data'])){
  963. $ret_data = json_decode($error[0]['ret_data'],true);
  964. if(isset($ret_data[0]["ResMsg"])){
  965. $tmp_str = $ret_data[0]["ResMsg"];
  966. }elseif(isset($ret_data['msg'])){
  967. $tmp_str = $ret_data['msg'];
  968. }elseif(isset($ret_data['Data'])){
  969. foreach($ret_data['Data'] as $iit){
  970. if(!$iit['m_isSucess']){
  971. $tmp_str .= $iit['m_errorMsg']."<br>";
  972. }
  973. }
  974. }else{
  975. $tmp_str = "系统执行失败,请重试";
  976. }
  977. }else{
  978. $tmp_str = "";
  979. }
  980. $bzsh_no = "<span data-action='wxcprk' 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>';
  981. }elseif($v['bzsh_status'] == 1){
  982. $bzsh_no = $v['bzsh_no']."<br/><span data-action='wxcprksh' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  983. }
  984. $xs_no = " ";
  985. if($v['xs_status'] == -1){
  986. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  987. }elseif($v['xs_status'] == 0){
  988. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  989. }
  990. if(!empty($v['xs_no'])){
  991. $xs_no = $v['xs_no']."<br/>".$xs_no;
  992. }
  993. $bzch_no = empty($v['bzch_no'])?"":$v['bzch_no'];
  994. $lb_list[] = $v['child_order_no'];
  995. $list[] = [
  996. 'id'=>$v['id'],
  997. 'order_no'=>$v['order_no'],
  998. 'type'=>"工厂外销单",
  999. 'child_order_no'=>$v['child_order_no'],
  1000. 'bzsh_no'=> $bzsh_no,
  1001. 'xs_no'=>$xs_no,
  1002. 'bzch_no'=>$bzch_no,
  1003. // 'xs_two_no'=>"",
  1004. // 'bzch_no'=>"",
  1005. //'bzsh_no'=>$bzsh_no,
  1006. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  1007. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  1008. ];
  1009. }
  1010. $lb_list = array_unique($lb_list);
  1011. $lb_arr = [];
  1012. if(!empty($lb_list)){
  1013. $lb_arr = $this->systemtransfer->find_all("id in (".implode(',',$lb_list).") ","id,jm,title,pm");
  1014. $lb_arr = array_column($lb_arr,null,'id');
  1015. }
  1016. foreach($list as $k=>$v){
  1017. $list[$k]['child_order_no'] = isset($lb_arr[$v['child_order_no']])?$lb_arr[$v['child_order_no']]['pm']:'';
  1018. }
  1019. $total = $this->zzquque_u9->find_count($where);
  1020. $pagenum = ceil($total/$perpage);
  1021. $over = $total-($start+$perpage);
  1022. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  1023. echo json_encode($rows);exit;
  1024. }
  1025. $this->_Template('zzququeu9wx',$this->data);
  1026. }
  1027. public function _wxcprk($arg_array){
  1028. $id = $arg_array[0];
  1029. $info = $this->zzquque_u9->read($id);
  1030. if(empty($info)){
  1031. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1032. exit;
  1033. }
  1034. if($info['bzsh_status'] != 0){
  1035. echo json_encode(array('msg'=>"当前状态不符合创建成品入库单的条件",'success'=>false));
  1036. exit;
  1037. }
  1038. $res = $this->logic_u9action->doRkd($info);
  1039. if($res['code'] == 1){
  1040. echo json_encode(array('msg'=>'创建成品入库单成功','success'=>true));
  1041. exit;
  1042. }else{
  1043. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1044. exit;
  1045. }
  1046. }
  1047. public function _wxcprksh($arg_array){
  1048. $id = $arg_array[0];
  1049. $info = $this->zzquque_u9->read($id);
  1050. if(empty($info)){
  1051. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1052. exit;
  1053. }
  1054. if($info['bzsh_status'] != 0){
  1055. echo json_encode(array('msg'=>"当前状态不符合审核成品入库单的条件",'success'=>false));
  1056. exit;
  1057. }
  1058. $res = $this->logic_u9action->checkRkd($info);
  1059. if($res['code'] == 1){
  1060. echo json_encode(array('msg'=>'审核成品入库单成功','success'=>true));
  1061. exit;
  1062. }else{
  1063. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1064. exit;
  1065. }
  1066. }
  1067. public function _wxxs($arg_array){
  1068. $id = $arg_array[0];
  1069. $info = $this->zzquque_u9->read($id);
  1070. if(empty($info)){
  1071. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1072. exit;
  1073. }
  1074. if($info['xs_status'] != 0){
  1075. echo json_encode(array('msg'=>"当前状态不符合创建销售单的条件",'success'=>false));
  1076. exit;
  1077. }
  1078. $res = $this->logic_u9action->createXsd($info);
  1079. if($res['code'] == 1){
  1080. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  1081. exit;
  1082. }else{
  1083. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1084. exit;
  1085. }
  1086. }
  1087. public function _gcbh_index(){
  1088. $post = $this->input->post(NULL, TRUE);
  1089. if(isset($post['page']))
  1090. {
  1091. $page = $this->input->post('page',true);
  1092. $perpage = $this->input->post('perpage',true);
  1093. $timetk = $this->input->post('timetk',true);//订单开始时间
  1094. $timetj = $this->input->post('timetj',true);//订单结束时间
  1095. $timetk = strtotime($timetk);
  1096. $timetj = strtotime($timetj);
  1097. $order_no = $this->input->post('order_no',true);
  1098. $type = $this->input->post('type',true);
  1099. $where = " ( type = 21) ";
  1100. if($order_no){
  1101. $where .= " and order_no like '%".$order_no."%' ";
  1102. }
  1103. if($timetk && $timetj){
  1104. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  1105. }
  1106. if(empty($page))
  1107. {
  1108. $start = 0;
  1109. $perpage = 1;
  1110. }
  1111. else
  1112. {
  1113. $start = ($page - 1)*$perpage;
  1114. }
  1115. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  1116. // $type_list = $this->zzquque_u9->getType();
  1117. $list = [];
  1118. foreach($info_list as $k=>$v){
  1119. $bzsh_no = empty($v['bzsh_no'])?"":$v['bzsh_no'];
  1120. if($v['bzsh_status'] == 0){
  1121. $bzsh_no = "<span data-action='bhcprk' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  1122. }elseif($v['bzsh_status'] == -1){
  1123. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
  1124. $tmp_str= "";
  1125. if(isset($error[0]['ret_data'])){
  1126. $ret_data = json_decode($error[0]['ret_data'],true);
  1127. if(isset($ret_data[0]["ResMsg"])){
  1128. $tmp_str = $ret_data[0]["ResMsg"];
  1129. }elseif(isset($ret_data['msg'])){
  1130. $tmp_str = $ret_data['msg'];
  1131. }elseif(isset($ret_data['Data'])){
  1132. foreach($ret_data['Data'] as $iit){
  1133. if(!$iit['m_isSucess']){
  1134. $tmp_str .= $iit['m_errorMsg']."<br>";
  1135. }
  1136. }
  1137. }else{
  1138. $tmp_str = "系统执行失败,请重试";
  1139. }
  1140. }else{
  1141. $tmp_str = "";
  1142. }
  1143. $bzsh_no = "<span data-action='bhcprk' 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>';
  1144. }elseif($v['bzsh_status'] == 1){
  1145. //$bzsh_no = $v['bzsh_no']."<br/><span data-action='wxcprksh' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  1146. $bzsh_no = $v['bzsh_no'];
  1147. }
  1148. $dc_no = empty($v['dc_no'])?" ":$v['dc_no'];
  1149. // if($v['xs_status'] == -1){
  1150. // $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  1151. // }elseif($v['xs_status'] == 0){
  1152. // $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  1153. // }
  1154. // if(!empty($v['xs_no'])){
  1155. // $xs_no = $v['xs_no']."<br/>".$xs_no;
  1156. // }
  1157. // $bzch_no = empty($v['bzch_no'])?"":$v['bzch_no'];
  1158. $list[] = [
  1159. 'id'=>$v['id'],
  1160. 'order_no'=>$v['order_no'],
  1161. 'type'=>"工厂备货单",
  1162. 'bzsh_no'=> $bzsh_no,
  1163. 'dc_no'=>$dc_no,
  1164. //'bzch_no'=>$bzch_no,
  1165. // 'xs_two_no'=>"",
  1166. // 'bzch_no'=>"",
  1167. //'bzsh_no'=>$bzsh_no,
  1168. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  1169. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  1170. ];
  1171. }
  1172. $total = $this->zzquque_u9->find_count($where);
  1173. $pagenum = ceil($total/$perpage);
  1174. $over = $total-($start+$perpage);
  1175. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  1176. echo json_encode($rows);exit;
  1177. }
  1178. $this->_Template('zzququeu9gcbh',$this->data);
  1179. }
  1180. public function _bhcprk($arg_array){
  1181. $id = $arg_array[0];
  1182. $info = $this->zzquque_u9->read($id);
  1183. if(empty($info)){
  1184. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1185. exit;
  1186. }
  1187. if($info['bzsh_status'] != 0){
  1188. echo json_encode(array('msg'=>"当前状态不符合创建成品入库单的条件",'success'=>false));
  1189. exit;
  1190. }
  1191. $res = $this->logic_u9bh->dpCprk($info);
  1192. if($res['code'] == 1){
  1193. echo json_encode(array('msg'=>'创建成品入库单成功','success'=>true));
  1194. exit;
  1195. }else{
  1196. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1197. exit;
  1198. }
  1199. }
  1200. public function _gcbhexcel(){
  1201. $params = $this->input->get();
  1202. $where = " type = 21 ";
  1203. if(!empty($params['order_no'])){
  1204. $where .= " and order_no = '".$params['order_no']."' ";
  1205. }
  1206. if(!empty($params['timetk'])){
  1207. $where .= " and create_time > ".strtotime($params['timetk'])." ";
  1208. }
  1209. if(!empty($params['timetj'])){
  1210. $where .= "and create_time < ".strtotime($params['timetj'])." ";
  1211. }
  1212. $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
  1213. $type_list = $this->zzquque_u9->getType();
  1214. $list = [];
  1215. foreach($info_list as $k=>$v){
  1216. $error_str = "";
  1217. $error_json ="";
  1218. if($v['bzsh_status'] == -1){
  1219. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
  1220. $error_json = $error[0]['ret_data'];
  1221. if($error[0]['apply_api']=='scrk_cj'){
  1222. $ret_data = json_decode($error[0]['ret_data'],true);
  1223. if(isset($ret_data["Data"])){
  1224. if(isset($ret_data['Data']['0'])){
  1225. $error_str = $ret_data['Data']['0']["m_errorMsg"];
  1226. }else{
  1227. $error_str = "数据异常请联系技术";
  1228. }
  1229. }else{
  1230. $error_str = "数据异常请联系技术";
  1231. }
  1232. }else{
  1233. $ret_data = json_decode($error[0]['ret_data'],true);
  1234. if(isset($ret_data[0]["ResMsg"])){
  1235. $error_str = $ret_data[0]["ResMsg"];
  1236. }elseif(isset($ret_data['msg'])){
  1237. $error_str = $ret_data['msg'];
  1238. }else{
  1239. $error_str = "数据异常请联系技术";
  1240. }
  1241. }
  1242. }
  1243. $transfer_info = $this->whlabel_bh_transfer->read($v['child_order_no']);
  1244. $pm = empty($transfer_info['pm'])?"异常":$transfer_info['pm'];
  1245. $list[] = [
  1246. 'id'=>$v['id'],
  1247. 'order_no'=>$v['order_no'],
  1248. 'pm'=>$pm,
  1249. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  1250. 'bzsh_no'=>empty($v['bzsh_no'])?"":$v['bzsh_no'],
  1251. 'dc_no'=>empty($v['dc_no'])?"":$v['dc_no'],
  1252. 'error_str'=>$error_str,
  1253. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  1254. ];
  1255. }
  1256. $filename = date("Y-m-d")."u9小单导出.xls";
  1257. $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
  1258. <head>
  1259. <!--[if gte mso 9]><xml>
  1260. <x:ExcelWorkbook>
  1261. <x:ExcelWorksheets>
  1262. <x:ExcelWorksheet>
  1263. <x:Name>EXCEL</x:Name>
  1264. <x:WorksheetOptions>
  1265. <x:Print>
  1266. <x:ValidPrinterInfo />
  1267. </x:Print>
  1268. </x:WorksheetOptions>
  1269. </x:ExcelWorksheet>
  1270. </x:ExcelWorksheets>
  1271. </x:ExcelWorkbook>
  1272. </xml>
  1273. <![endif]-->
  1274. </head><body>";
  1275. $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
  1276. $str .= "<tr><td>id</td><td>订单号</td><td>品名</td><td>类型</td><td>成品入库单</td><td>调出单</td><td>错误信息</td><td>时间</td></tr>";
  1277. foreach ($list as $key=>$value)
  1278. {
  1279. $str .= "<tr>";
  1280. $str .= "<td>". $value['id']. "</td>";
  1281. $str .= "<td>". $value['order_no']. "</td>";
  1282. $str .= "<td>". $value['pm']. "</td>";
  1283. $str .= "<td>". $value['type']. "</td>";
  1284. $str .= "<td>". $value['bzsh_no']. "</td>";
  1285. $str .= "<td>". $value['dc_no']. "</td>";
  1286. $str .= "<td>". $value['error_str']. "</td>";
  1287. $str .= "<td>". $value['create_time']. "</td>";
  1288. $str .= "</tr>";
  1289. }
  1290. $str .= "</table></body></html>";
  1291. header( "Content-Type: application/vnd.ms-excel; name='excel'" );
  1292. header( "Content-type: application/octet-stream" );
  1293. header( "Content-Disposition: attachment; filename=".$filename );
  1294. header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
  1295. header( "Pragma: no-cache" );
  1296. header( "Expires: 0" );
  1297. exit($str);
  1298. }
  1299. public function _cpkbh_index(){
  1300. $post = $this->input->post(NULL, TRUE);
  1301. if(isset($post['page']))
  1302. {
  1303. $page = $this->input->post('page',true);
  1304. $perpage = $this->input->post('perpage',true);
  1305. $timetk = $this->input->post('timetk',true);//订单开始时间
  1306. $timetj = $this->input->post('timetj',true);//订单结束时间
  1307. $timetk = strtotime($timetk);
  1308. $timetj = strtotime($timetj);
  1309. $order_no = $this->input->post('order_no',true);
  1310. $type = $this->input->post('type',true);
  1311. $where = " ( type = 22) ";
  1312. if($order_no){
  1313. $where .= " and order_no like '%".$order_no."%' ";
  1314. }
  1315. if($timetk && $timetj){
  1316. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  1317. }
  1318. if(empty($page))
  1319. {
  1320. $start = 0;
  1321. $perpage = 1;
  1322. }
  1323. else
  1324. {
  1325. $start = ($page - 1)*$perpage;
  1326. }
  1327. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  1328. $list = [];
  1329. foreach($info_list as $k=>$v){
  1330. $xs_no = "";
  1331. if($v['xs_status'] == 0){
  1332. $xs_no = "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  1333. }
  1334. if(!empty($v['xs_no'])){
  1335. $xs_no = $v['xs_no'];
  1336. }
  1337. $bzch_no = empty($v['bzch_no'])?"":$v['bzch_no'];
  1338. $list[] = [
  1339. 'id'=>$v['id'],
  1340. 'order_no'=>$v['order_no'],
  1341. 'type'=>"成品备货单",
  1342. 'xs_no'=>$xs_no,
  1343. 'bzch_no'=>$bzch_no,
  1344. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  1345. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  1346. ];
  1347. }
  1348. $total = $this->zzquque_u9->find_count($where);
  1349. $pagenum = ceil($total/$perpage);
  1350. $over = $total-($start+$perpage);
  1351. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  1352. echo json_encode($rows);exit;
  1353. }
  1354. $this->_Template('zzququeu9cpkbh',$this->data);
  1355. }
  1356. protected function _checkProduct(){
  1357. $post = $this->input->post(NULL, TRUE);
  1358. if(empty($post)){
  1359. echo json_encode(array('msg'=>'参数错误','success'=>false,'data'=>[]));
  1360. exit;
  1361. }
  1362. $info = $this->zzquque_u9->read($post['id']);
  1363. if(empty($info)){
  1364. echo json_encode(array('msg'=>'数据异常','success'=>false,'data'=>[]));
  1365. exit;
  1366. }
  1367. $res = $this->logic_u9ztsd->checkProduct($info);
  1368. if($res['code'] == 1){
  1369. $final_all = [];
  1370. foreach($res['data'] as $k=>$v){
  1371. $final_all[] = [
  1372. "U9料号"=>$v['jm'],
  1373. "中文品名"=>$v['zh'],
  1374. "调出条数"=>$v['dcsl'],
  1375. '是否在u9创建'=>($v['is_register'] == 1)?"是":"否",
  1376. ];
  1377. }
  1378. echo json_encode(array('msg'=>"核验完毕,是否导出excel?",'success'=>true,'data'=>$final_all));
  1379. exit;
  1380. }else{
  1381. echo json_encode(array('msg'=>$res['msg'],'success'=>false,'data'=>[]));
  1382. exit;
  1383. }
  1384. }
  1385. //导出excel
  1386. protected function _excelwx(){
  1387. $params = $this->input->post(null, TRUE);
  1388. if(empty($params)){
  1389. echo json_encode(array('msg'=>'参数错误','success'=>false));
  1390. exit;
  1391. }
  1392. $timetk = $this->input->post('timetk',true);//订单开始时间
  1393. $timetj = $this->input->post('timetj',true);//订单结束时间
  1394. $timetk = strtotime($timetk);
  1395. $timetj = strtotime($timetj);
  1396. $order_no = $this->input->post('order_no',true);
  1397. $where = " ( type = 20) ";
  1398. if($order_no){
  1399. $where .= " and order_no like '%".$order_no."%' ";
  1400. }
  1401. if($timetk && $timetj){
  1402. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  1403. }
  1404. $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
  1405. $list = [];
  1406. $lb_list= [];
  1407. foreach($info_list as $k=>$v){
  1408. $bzsh_no = $v['bzsh_no'];
  1409. $xs_no = empty($v['xs_no'])?"":$v['xs_no'];
  1410. $bzch_no = empty($v['bzch_no'])?"":$v['bzch_no'];
  1411. $lb_list[] = $v['child_order_no'];
  1412. $list[] = [
  1413. 'id'=>$v['id'],
  1414. 'order_no'=>$v['order_no'],
  1415. 'type'=>"工厂外销单",
  1416. 'child_order_no'=>$v['child_order_no'],
  1417. 'bzsh_no'=> $bzsh_no,
  1418. 'xs_no'=>$xs_no,
  1419. 'bzch_no'=>$bzch_no,
  1420. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  1421. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  1422. ];
  1423. }
  1424. $lb_list = array_unique($lb_list);
  1425. $lb_arr = [];
  1426. if(!empty($lb_list)){
  1427. $lb_arr = $this->systemtransfer->find_all("id in (".implode(',',$lb_list).") ","id,jm,title,pm");
  1428. $lb_arr = array_column($lb_arr,null,'id');
  1429. }
  1430. foreach($list as $k=>$v){
  1431. $list[$k]['child_order_no'] = isset($lb_arr[$v['child_order_no']])?$lb_arr[$v['child_order_no']]['pm']:'';
  1432. }
  1433. $final_list = [];
  1434. foreach($list as $k=>$v){
  1435. $final_list[] = [
  1436. "订单号"=>$v['order_no'],
  1437. "类型"=>$v['type'],
  1438. "成品入库单号"=>$v['bzsh_no'],
  1439. "销售单号"=>$v['xs_no'],
  1440. "标准出货单号"=>$v['bzch_no'],
  1441. "创建时间"=>$v['create_time'],
  1442. "更新时间"=>$v['update_time'],
  1443. "品名"=>$v['child_order_no'],
  1444. ];
  1445. }
  1446. if(empty($list)){
  1447. echo json_encode(array('msg'=>'没有数据','success'=>false));
  1448. exit;
  1449. }else{
  1450. echo json_encode(array('msg'=>'获取成功','success'=>true,'data'=>$final_list));
  1451. exit;
  1452. }
  1453. }
  1454. }