Zzququeu9.php 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  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. }
  14. public function _remap($arg,$arg_array)
  15. {
  16. if($arg == 'dc')//调出单
  17. {
  18. $this->_dc($arg_array);
  19. }
  20. elseif($arg == 'cg')//采购
  21. {
  22. $this->_cg($arg_array);
  23. }
  24. elseif($arg == 'xs')//销售单
  25. {
  26. $this->_xs($arg_array);
  27. }
  28. elseif($arg == 'bzch')//标准出货
  29. {
  30. $this->_bzch($arg_array);
  31. }
  32. elseif($arg == 'bzsh')//标准收货
  33. {
  34. $this->_bzsh($arg_array);
  35. }
  36. elseif($arg == 'dr')//调入单
  37. {
  38. $this->_dr($arg_array);
  39. }
  40. elseif($arg == 'xs_two')//调入单
  41. {
  42. $this->_xs_two($arg_array);
  43. }
  44. elseif($arg == 'dczt')//在途的调出单
  45. {
  46. $this->_dczt($arg_array);
  47. }
  48. elseif($arg == 'add'){
  49. $this->_add();
  50. }
  51. elseif($arg == 'excel'){
  52. $this->_excel();
  53. }
  54. elseif($arg == 'mcindex')
  55. {
  56. $this->_mcindex();
  57. }
  58. elseif($arg == 'scdel')//删除
  59. {
  60. $this->_del($arg_array);
  61. }
  62. elseif($arg == 'waixiao')//编辑
  63. {
  64. $this->_waixiao($arg_array);
  65. }
  66. elseif($arg == 'wxcprk')//外销成品入库
  67. {
  68. $this->_wxcprk($arg_array);
  69. }
  70. elseif($arg == 'wxcprksh'){
  71. $this->_wxcprksh($arg_array);
  72. }
  73. elseif($arg == 'wxxs'){
  74. $this->_wxxs($arg_array);
  75. }
  76. else
  77. {
  78. $this->_index();
  79. }
  80. }
  81. public function _index(){
  82. $post = $this->input->post(NULL, TRUE);
  83. if(isset($post['page']))
  84. {
  85. $page = $this->input->post('page',true);
  86. $perpage = $this->input->post('perpage',true);
  87. $timetk = $this->input->post('timetk',true);//订单开始时间
  88. $timetj = $this->input->post('timetj',true);//订单结束时间
  89. $timetk = strtotime($timetk);
  90. $timetj = strtotime($timetj);
  91. $status = $this->input->post('status',true);
  92. $order_no = $this->input->post('order_no',true);
  93. $where='type = 10 ';
  94. if($order_no){
  95. $where .= " and order_no = '".$order_no."' ";
  96. }
  97. if($status){
  98. if($status == 1){
  99. $where .= " and dc_status = 0 ";
  100. }elseif($status == 2){
  101. $where .= " and dc_status = -1 ";
  102. }elseif($status == 3){
  103. $where .= " and dc_status = -2 ";
  104. }elseif($status == 4){
  105. $where .= " and dc_status = -3 ";
  106. }elseif($status == 5){
  107. $where .= " and dc_status < 3 ";
  108. }
  109. }
  110. if($timetk && $timetj){
  111. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  112. }
  113. if(empty($page))
  114. {
  115. $start = 0;
  116. $perpage = 10;
  117. }
  118. else
  119. {
  120. $start = ($page - 1)*$perpage;
  121. }
  122. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  123. $type_list = $this->zzquque_u9->getType();
  124. $list = [];
  125. foreach($info_list as $k=>$v){
  126. $dc_no = "";
  127. if($v['dc_status'] == 0){
  128. $dc_no = "<span data-action='dc' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
  129. }elseif($v['dc_status'] == -1){
  130. $tmp_str = "异常信息";
  131. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  132. if(isset($error[0])){
  133. if($error[0]['apply_api']=='lpck'){
  134. $ret_data = json_decode($error[0]['ret_data'],true);
  135. $apply_data = json_decode($error[0]['apply_data'],true);
  136. if(isset($ret_data["ResMsg"])){
  137. if(empty($apply_data['0'])){
  138. $tmp_str = $ret_data["ResMsg"];
  139. }else{
  140. $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  141. }
  142. }else{
  143. $tmp_str = "料品同步失败";
  144. }
  145. }else{
  146. $ret_data = json_decode($error[0]['ret_data'],true);
  147. if(isset($ret_data[0]["ResMsg"])){
  148. $tmp_str = $ret_data[0]["ResMsg"];
  149. }elseif(isset($ret_data['msg'])){
  150. $tmp_str = $ret_data['msg'];
  151. }else{
  152. $tmp_str = "料品同步失败";
  153. }
  154. }
  155. }
  156. $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>';
  157. }
  158. if(!empty($v['dc_no'])){
  159. $dc_no = $v['dc_no']."<br/>".$dc_no;
  160. }
  161. $cg_no = "";
  162. if($v['cg_status'] == 0){
  163. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建采购单</span>";
  164. }elseif($v['cg_status'] == 1){
  165. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交采购单</span>";
  166. }elseif($v['cg_status'] == -1){
  167. $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>';
  168. }elseif($v['cg_status'] == 2){
  169. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核采购单</span>";
  170. }elseif($v['cg_status'] == -2){
  171. $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>';
  172. }elseif($v['cg_status'] == -3){
  173. $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>';
  174. }
  175. if(!empty($v['cg_no'])){
  176. $cg_no = $v['cg_no']."<br/>".$cg_no;
  177. }
  178. $xs_no = "";
  179. if($v['xs_status'] == 0){
  180. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  181. }elseif($v['xs_status'] == 1){
  182. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  183. }elseif($v['xs_status'] == -1){
  184. $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>';
  185. }elseif($v['xs_status'] == 2){
  186. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  187. }elseif($v['xs_status'] == -2){
  188. $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>';
  189. }elseif($v['xs_status'] == -3){
  190. $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>';
  191. }
  192. if(!empty($v['xs_no'])){
  193. $xs_no = $v['xs_no']."<br/>".$xs_no;
  194. }
  195. $xs_two_no ='';
  196. if($v['xs_two_status'] == 0){
  197. $xs_two_no .= "<span data-action='xs_two' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建销售单</span>";
  198. }elseif($v['xs_two_status'] == 1){
  199. $xs_two_no .= "<span data-action='xs_two' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交销售单</span>";
  200. }elseif($v['xs_two_status'] == -1){
  201. $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>';
  202. }elseif($v['xs_two_status'] == 2){
  203. $xs_two_no .= "<span data-action='xs_two' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核销售单</span>";
  204. }elseif($v['xs_two_status'] == -2){
  205. $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>';
  206. }elseif($v['xs_two_status'] == -3){
  207. $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>';
  208. }
  209. if(!empty($v['xs_two_no'])){
  210. $xs_two_no = $v['xs_two_no']."<br/>".$xs_two_no;
  211. }
  212. $bzch_no ="";
  213. if($v['bzch_status'] == 0){
  214. $bzch_no .= "<span data-action='bzch' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建出货单</span>";
  215. }elseif($v['bzch_status'] == 1){
  216. $bzch_no .= "<span data-action='bzch' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交出货单</span>";
  217. }elseif($v['bzch_status'] == -1){
  218. $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>';
  219. }elseif($v['bzch_status'] == 2){
  220. $bzch_no .= "<span data-action='bzch' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核出货单</span>";
  221. }elseif($v['bzch_status'] == -2){
  222. $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>';
  223. }elseif($v['bzch_status'] == -3){
  224. $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>';
  225. }
  226. //$bzsh_no =empty($v['bzsh_no'])?"":$v['bzsh_no'];
  227. if(!empty($v['bzch_no'])){
  228. $bzch_no = $v['bzch_no']."<br/>".$bzch_no;
  229. }
  230. $dr_no = "";
  231. if($v['dr_status'] == 0){
  232. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调入单</span>";
  233. }elseif($v['dr_status'] == 1){
  234. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' onclick='doAction(this)'>提交调入单</span>";
  235. }elseif($v['dr_status'] == -1){
  236. $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>';
  237. }elseif($v['dr_status'] == 2){
  238. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' onclick='doAction(this)'>审核调入单</span>";
  239. }elseif($v['dr_status'] == -2){
  240. $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>';
  241. }elseif($v['dr_status'] == -3){
  242. $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>';
  243. }
  244. if(!empty($v['dr_no'])){
  245. $dr_no = $v['dr_no']."<br/>".$dr_no;
  246. }
  247. $list[] = [
  248. 'id'=>$v['id'],
  249. 'order_no'=>$v['order_no'],
  250. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  251. 'dc_no'=> $dc_no,
  252. 'cg_no'=>$cg_no,
  253. 'xs_no'=>$xs_no,
  254. 'dr_no'=>$dr_no,
  255. 'xs_two_no'=>$xs_two_no,
  256. 'bzch_no'=>$bzch_no,
  257. //'bzsh_no'=>$bzsh_no,
  258. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  259. 'update_time'=>date("Y-m-d H:i:s",$v['update_time']),
  260. 'operate'=>($v['dc_status'] == 3)?"": "<span data-action='dr' data-id='".$v['id']."' onclick='doDel(this)' style='background-color:red'>删除</span>"
  261. ];
  262. }
  263. $total = $this->zzquque_u9->find_count($where);
  264. $pagenum = ceil($total/$perpage);
  265. $over = $total-($start+$perpage);
  266. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  267. echo json_encode($rows);exit;
  268. }
  269. $this->_Template('zzququeu9',$this->data);
  270. }
  271. public function _dc($arg_array){
  272. $process= $arg_array[0];
  273. $id = $arg_array[1];
  274. $info = $this->zzquque_u9->read($id);
  275. if($process == 1){
  276. if(!in_array($info['dc_status'],[0,-1])){
  277. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  278. exit;
  279. }
  280. $r = $this->logic_u9xgsd->createDc($info);
  281. if($r['code'] == 1){
  282. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  283. exit;
  284. }else{
  285. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  286. exit;
  287. }
  288. }else if($process == 2){
  289. if(!in_array($info['dc_status'],[1,-2])){
  290. echo json_encode(array('msg'=>'当前状态不符合提交调出单的条件','success'=>false));
  291. exit;
  292. }
  293. $r = $this->logic_u9xgsd->subDc($info);
  294. if($r['code'] == 1){
  295. echo json_encode(array('msg'=>'提交调出单成功','success'=>true));
  296. exit;
  297. }else{
  298. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  299. exit;
  300. }
  301. }else if($process == 3){
  302. if(!in_array($info['dc_status'],[2,-3])){
  303. echo json_encode(array('msg'=>'当前状态不符合审核调出单的条件','success'=>false));
  304. exit;
  305. }
  306. $r = $this->logic_u9xgsd->shDc($info);
  307. if($r['code'] == 1){
  308. echo json_encode(array('msg'=>'审核调出单成功','success'=>true));
  309. exit;
  310. }else{
  311. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  312. exit;
  313. }
  314. }else{
  315. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  316. exit;
  317. }
  318. }
  319. public function _cg($arg_array){
  320. $process= $arg_array[0];
  321. $id = $arg_array[1];
  322. $info = $this->zzquque_u9->read($id);
  323. if($info['dc_status'] != 3){
  324. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  325. exit;
  326. }
  327. if($process == 1){
  328. if(!in_array($info['cg_status'],[0,-1])){
  329. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  330. exit;
  331. }
  332. $r = $this->logic_u9xgsd->createCg($info);
  333. if($r['code'] == 1){
  334. echo json_encode(array('msg'=>'创建采购单成功','success'=>true));
  335. exit;
  336. }else{
  337. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  338. exit;
  339. }
  340. }else if($process == 2){
  341. if(!in_array($info['cg_status'],[1,-2])){
  342. echo json_encode(array('msg'=>'当前状态不符合提交采购单的条件','success'=>false));
  343. exit;
  344. }
  345. $r = $this->logic_u9xgsd->subCg($info);
  346. if($r['code'] == 1){
  347. echo json_encode(array('msg'=>'提交采购单成功','success'=>true));
  348. exit;
  349. }else{
  350. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  351. exit;
  352. }
  353. }else if($process == 3){
  354. if(!in_array($info['cg_status'],[2,-3])){
  355. echo json_encode(array('msg'=>'当前状态不符合审核采购单的条件','success'=>false));
  356. exit;
  357. }
  358. $r = $this->logic_u9xgsd->shCg($info);
  359. if($r['code'] == 1){
  360. echo json_encode(array('msg'=>'审核采购单成功','success'=>true));
  361. exit;
  362. }else{
  363. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  364. exit;
  365. }
  366. }else{
  367. echo json_encode(array('msg'=>'当前状态不符合创建采购单的条件','success'=>false));
  368. exit;
  369. }
  370. }
  371. public function _xs($arg_array){
  372. $process= $arg_array[0];
  373. $id = $arg_array[1];
  374. $info = $this->zzquque_u9->read($id);
  375. if($info['dc_status'] != 3){
  376. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  377. exit;
  378. }
  379. if($process == 1){
  380. if(!in_array($info['xs_status'],[0,-1])){
  381. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  382. exit;
  383. }
  384. $r = $this->logic_u9xgsd->createXs($info);
  385. if($r['code'] == 1){
  386. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  387. exit;
  388. }else{
  389. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  390. exit;
  391. }
  392. }else if($process == 2){
  393. if(!in_array($info['xs_status'],[1,-2])){
  394. echo json_encode(array('msg'=>'当前状态不符合提交销售单的条件','success'=>false));
  395. exit;
  396. }
  397. $r = $this->logic_u9xgsd->subXs($info);
  398. if($r['code'] == 1){
  399. echo json_encode(array('msg'=>'提交销售单成功','success'=>true));
  400. exit;
  401. }else{
  402. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  403. exit;
  404. }
  405. }else if($process == 3){
  406. if(!in_array($info['xs_status'],[2,-3])){
  407. echo json_encode(array('msg'=>'当前状态不符合审核销售单的条件','success'=>false));
  408. exit;
  409. }
  410. $r = $this->logic_u9xgsd->shXs($info);
  411. if($r['code'] == 1){
  412. echo json_encode(array('msg'=>'审核销售单成功','success'=>true));
  413. exit;
  414. }else{
  415. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  416. exit;
  417. }
  418. }else{
  419. echo json_encode(array('msg'=>'当前状态不符合创建销售单的条件','success'=>false));
  420. exit;
  421. }
  422. }
  423. public function _dr($arg_array){
  424. $process= $arg_array[0];
  425. $id = $arg_array[1];
  426. $info = $this->zzquque_u9->read($id);
  427. if($info['dc_status'] != 3){
  428. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  429. exit;
  430. }
  431. if($process == 1){
  432. if(!in_array($info['dr_status'],[0,-1])){
  433. echo json_encode(array('msg'=>'当前状态不符合查询调入单的条件','success'=>false));
  434. exit;
  435. }
  436. $r = $this->logic_u9xgsd->createDr($info);
  437. if($r['code'] == 1){
  438. echo json_encode(array('msg'=>'查询调入单成功','success'=>true));
  439. exit;
  440. }else{
  441. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  442. exit;
  443. }
  444. }else if($process == 2){
  445. if(!in_array($info['dr_status'],[1,-2])){
  446. echo json_encode(array('msg'=>'当前状态不符合提交调入单的条件','success'=>false));
  447. exit;
  448. }
  449. $r = $this->logic_u9xgsd->subDr($info);
  450. if($r['code'] == 1){
  451. echo json_encode(array('msg'=>'提交调入单成功','success'=>true));
  452. exit;
  453. }else{
  454. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  455. exit;
  456. }
  457. }else if($process == 3){
  458. if(!in_array($info['dr_status'],[2,-3])){
  459. echo json_encode(array('msg'=>'当前状态不符合审核调入单的条件','success'=>false));
  460. exit;
  461. }
  462. $r = $this->logic_u9xgsd->shDr($info);
  463. if($r['code'] == 1){
  464. echo json_encode(array('msg'=>'审核调入单成功','success'=>true));
  465. exit;
  466. }else{
  467. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  468. exit;
  469. }
  470. }else{
  471. echo json_encode(array('msg'=>'当前状态不符合创建调入单的条件','success'=>false));
  472. exit;
  473. }
  474. }
  475. public function _xs_two($arg_array){
  476. $process= $arg_array[0];
  477. $id = $arg_array[1];
  478. $info = $this->zzquque_u9->read($id);
  479. if($info['dc_status'] != 3){
  480. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  481. exit;
  482. }
  483. if($process == 1){
  484. if(!in_array($info['xs_two_status'],[0,-1])){
  485. echo json_encode(array('msg'=>'当前状态不符合查询香港销售单的条件','success'=>false));
  486. exit;
  487. }
  488. $r = $this->logic_u9xgsd->createXsTwo($info);
  489. if($r['code'] == 1){
  490. echo json_encode(array('msg'=>'创建香港销售单成功','success'=>true));
  491. exit;
  492. }else{
  493. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  494. exit;
  495. }
  496. }else if($process == 2){
  497. if(!in_array($info['xs_two_status'],[1,-2])){
  498. echo json_encode(array('msg'=>'当前状态不符合提交香港销售单的条件','success'=>false));
  499. exit;
  500. }
  501. $r = $this->logic_u9xgsd->subXsTwo($info);
  502. if($r['code'] == 1){
  503. echo json_encode(array('msg'=>'提交香港销售单成功','success'=>true));
  504. exit;
  505. }else{
  506. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  507. exit;
  508. }
  509. }else if($process == 3){
  510. if(!in_array($info['xs_two_status'],[2,-3])){
  511. echo json_encode(array('msg'=>'当前状态不符合审核香港销售单的条件','success'=>false));
  512. exit;
  513. }
  514. $r = $this->logic_u9xgsd->shXsTwo($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{
  523. echo json_encode(array('msg'=>'当前状态不符合创建香港销售单的条件','success'=>false));
  524. exit;
  525. }
  526. }
  527. public function _bzch($arg_array){
  528. $process= $arg_array[0];
  529. $id = $arg_array[1];
  530. $info = $this->zzquque_u9->read($id);
  531. if($info['dc_status'] != 3){
  532. echo json_encode(array('msg'=>'调出单未审核不能执行后续操作','success'=>false));
  533. exit;
  534. }
  535. if($info['xs_two_status'] != 3){
  536. echo json_encode(array('msg'=>'香港销售单未审核不能执行后续操作','success'=>false));
  537. exit;
  538. }
  539. if($process == 1){
  540. if(!in_array($info['bzsh_status'],[0,-1])){
  541. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  542. exit;
  543. }
  544. $r = $this->logic_u9xgsd->createCh($info);
  545. if($r['code'] == 1){
  546. echo json_encode(array('msg'=>'创建标准收货单成功','success'=>true));
  547. exit;
  548. }else{
  549. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  550. exit;
  551. }
  552. }else if($process == 2){
  553. $r = $this->logic_u9xgsd->subAndShCh($info);
  554. if($r['code'] == 1){
  555. echo json_encode(array('msg'=>'审核标准收货单成功','success'=>true));
  556. exit;
  557. }else{
  558. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  559. exit;
  560. }
  561. }else{
  562. echo json_encode(array('msg'=>'当前状态不符合创建标准收货单的条件','success'=>false));
  563. exit;
  564. }
  565. }
  566. public function _bzsh($arg_array){
  567. }
  568. public function _add(){
  569. $order_no = $this->input->post('order_no',true);
  570. if(empty($order_no)){
  571. echo json_encode(['msg'=>'请输入要添加的订单编码!','success'=>false]);exit;
  572. }
  573. $info = $this->logic_order->getInfo("number = '" .$order_no."'");
  574. if(empty($info)){
  575. echo json_encode(['msg'=>'订单不存在!请仔细核对单号','success'=>false]);exit;
  576. }
  577. $num = $this->zzquque_u9->find_all("order_no = '".$info['number']."'");
  578. if(empty($num)){
  579. $this->zzquque_u9->insert([
  580. 'platform'=>$info['lv_platform'],
  581. 'warehouse'=>$info['type'],
  582. 'type'=>10,
  583. 'order_no'=>$info['number'],
  584. 'create_time'=>time(),
  585. 'update_time'=>time(),
  586. ]);
  587. echo json_encode(['msg'=>'添加成功','success'=>true]);exit;
  588. }else{
  589. echo json_encode(['msg'=>'订单不允许重复添加','success'=>false]);exit;
  590. }
  591. }
  592. public function _excel(){
  593. $params = $this->input->get();
  594. $where = " type = 10 ";
  595. if(!empty($params['order_no'])){
  596. $where .= " and order_no = '".$params['order_no']."' ";
  597. }
  598. if(!empty($params['timetk'])){
  599. $where .= " and create_time > ".strtotime($params['timetk'])." ";
  600. }
  601. if(!empty($params['timetj'])){
  602. $where .= "and create_time < ".strtotime($params['timetj'])." ";
  603. }
  604. if(!empty($params['status'])){
  605. $status = $params['status'];
  606. if($status == 1){
  607. $where .= " and dc_status = 0 ";
  608. }elseif($status == 2){
  609. $where .= " and dc_status = -1 ";
  610. }elseif($status == 3){
  611. $where .= " and dc_status = -2 ";
  612. }elseif($status == 4){
  613. $where .= " and dc_status = -3 ";
  614. }elseif($status == 5){
  615. $where .= " and dc_status < 3 ";
  616. }
  617. }
  618. $info_list = $this->zzquque_u9->find_all($where,'*','id desc');
  619. $type_list = $this->zzquque_u9->getType();
  620. $list = [];
  621. foreach($info_list as $k=>$v){
  622. $dc_no = $v['dc_no'];
  623. $error_str = "";
  624. $error_json ="";
  625. if($v['dc_status'] == -1){
  626. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  627. $error_json = $error[0]['ret_data'];
  628. if($error[0]['apply_api']=='lpck'){
  629. $ret_data = json_decode($error[0]['ret_data'],true);
  630. $apply_data = json_decode($error[0]['apply_data'],true);
  631. if(isset($ret_data["ResMsg"])){
  632. if(empty($apply_data['0'])){
  633. $error_str = $ret_data["ResMsg"];
  634. }else{
  635. $error_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  636. }
  637. }else{
  638. $error_str = "料品同步失败";
  639. }
  640. }else{
  641. $ret_data = json_decode($error[0]['ret_data'],true);
  642. if(isset($ret_data[0]["ResMsg"])){
  643. $error_str = $ret_data[0]["ResMsg"];
  644. }elseif(isset($ret_data['msg'])){
  645. $error_str = $ret_data['msg'];
  646. }else{
  647. $error_str = "料品同步失败";
  648. }
  649. }
  650. }
  651. $list[] = [
  652. 'id'=>$v['id'],
  653. 'order_no'=>$v['order_no'],
  654. 'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
  655. 'dc_no'=> $dc_no,
  656. 'error'=>$error_str,
  657. 'error_json'=>$error_json,
  658. //'bzsh_no'=>$bzsh_no,
  659. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  660. ];
  661. }
  662. $filename = date("Y-m-d")."u9小单导出.xls";
  663. $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
  664. <head>
  665. <!--[if gte mso 9]><xml>
  666. <x:ExcelWorkbook>
  667. <x:ExcelWorksheets>
  668. <x:ExcelWorksheet>
  669. <x:Name>EXCEL</x:Name>
  670. <x:WorksheetOptions>
  671. <x:Print>
  672. <x:ValidPrinterInfo />
  673. </x:Print>
  674. </x:WorksheetOptions>
  675. </x:ExcelWorksheet>
  676. </x:ExcelWorksheets>
  677. </x:ExcelWorkbook>
  678. </xml>
  679. <![endif]-->
  680. </head><body>";
  681. $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
  682. $str .= "<tr><td>id</td><td>订单号</td><td>类型</td><td>调出单号</td><td>创建时间</td><td>错误信息</td><td>错误json</td></tr>";
  683. foreach ($list as $key=>$value)
  684. {
  685. $str .= "<tr>";
  686. $str .= "<td>". $value['id']. "</td>";
  687. $str .= "<td>". $value['order_no']. "</td>";
  688. $str .= "<td>". $value['type']. "</td>";
  689. $str .= "<td>". $value['dc_no']. "</td>";
  690. $str .= "<td>". $value['create_time']. "</td>";
  691. $str .= "<td>". $value['error']. "</td>";
  692. $str .= "<td>". $value['error_json']. "</td>";
  693. $str .= "</tr>";
  694. }
  695. $str .= "</table></body></html>";
  696. header( "Content-Type: application/vnd.ms-excel; name='excel'" );
  697. header( "Content-type: application/octet-stream" );
  698. header( "Content-Disposition: attachment; filename=".$filename );
  699. header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
  700. header( "Pragma: no-cache" );
  701. header( "Expires: 0" );
  702. exit($str);
  703. }
  704. public function _mcindex(){
  705. $post = $this->input->post(NULL, TRUE);
  706. if(isset($post['page']))
  707. {
  708. $page = $this->input->post('page',true);
  709. $perpage = $this->input->post('perpage',true);
  710. $timetk = $this->input->post('timetk',true);//订单开始时间
  711. $timetj = $this->input->post('timetj',true);//订单结束时间
  712. $timetk = strtotime($timetk);
  713. $timetj = strtotime($timetj);
  714. $order_no = $this->input->post('order_no',true);
  715. $type = $this->input->post('type',true);
  716. if($type == 1){
  717. $where=' ( type = 1)';
  718. }elseif($type == 2){
  719. $where=' ( type = 2)';
  720. }else{
  721. $where=' ( type = 1 or type = 2)';
  722. }
  723. if($order_no){
  724. $where .= " and order_no = '".$order_no."' ";
  725. }
  726. if($timetk && $timetj){
  727. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  728. }
  729. if(empty($page))
  730. {
  731. $start = 0;
  732. $perpage = 1;
  733. }
  734. else
  735. {
  736. $start = ($page - 1)*$perpage;
  737. }
  738. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  739. $type_list = $this->zzquque_u9->getType();
  740. $list = [];
  741. foreach($info_list as $k=>$v){
  742. $dc_no = "";
  743. if($v['dc_status'] == 0){
  744. if($v['type'] == 1){
  745. $dc_no = "<span data-action='dczt' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建调出单</span>";
  746. }
  747. }elseif($v['dc_status'] == -1){
  748. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
  749. if($error[0]['apply_api']=='lpck'){
  750. $ret_data = json_decode($error[0]['ret_data'],true);
  751. $apply_data = json_decode($error[0]['apply_data'],true);
  752. if(isset($ret_data["ResMsg"])){
  753. if(empty($apply_data['0'])){
  754. $tmp_str = $ret_data["ResMsg"];
  755. }else{
  756. $tmp_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
  757. }
  758. }else{
  759. $tmp_str = "料品同步失败";
  760. }
  761. }else{
  762. $tmp_str= "";
  763. $ret_data = json_decode($error[0]['ret_data'],true);
  764. if(isset($ret_data[0]["ResMsg"])){
  765. $tmp_str = $ret_data[0]["ResMsg"];
  766. }elseif(isset($ret_data['msg'])){
  767. $tmp_str = $ret_data['msg'];
  768. }elseif(isset($ret_data['Data'])){
  769. foreach($ret_data['Data'] as $iit){
  770. if(!$iit['IsSucess']){
  771. $tmp_str .= $iit['ErrorMsg']."<br>";
  772. }
  773. }
  774. }else{
  775. $tmp_str = "料品同步失败";
  776. }
  777. }
  778. $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>';
  779. }
  780. if(!empty($v['dc_no'])){
  781. if($v['type'] == 1){
  782. $dc_no = $v['dc_no']."【销售组织】"."<br/>".$dc_no;
  783. }else{
  784. $dc_no = $v['dc_no']."【香港组织】"."<br/>".$dc_no;
  785. }
  786. }
  787. $cg_no = "";
  788. if($v['type'] == 1){
  789. if($v['cg_status'] == 1){
  790. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."'>采购单提交异常</span>";
  791. }elseif($v['cg_status'] == -1){
  792. $cg_no .= "<span data-action='cg' data-process='1' data-id='".$v['id']."' >创建采购单失败</span>";
  793. }elseif($v['cg_status'] == 2){
  794. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' >采购单未审核</span>";
  795. }elseif($v['cg_status'] == -2){
  796. $cg_no .= "<span data-action='cg' data-process='2' data-id='".$v['id']."' >采购单提交失败</span>";
  797. }elseif($v['cg_status'] == -3){
  798. $cg_no .= "<span data-action='cg' data-process='3' data-id='".$v['id']."' >采购单审核失败</span>";
  799. }
  800. if(!empty($v['cg_no'])){
  801. $cg_no = $v['cg_no']."【香港组织】<br/>".$cg_no;
  802. }
  803. }
  804. $xs_no = "";
  805. if($v['type'] == 1){
  806. if($v['xs_status'] == 1){
  807. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' >销售单未提交</span>";
  808. }elseif($v['xs_status'] == -1){
  809. $xs_no .= "<span data-action='xs' data-process='1' data-id='".$v['id']."' >销售单创建失败</span>";
  810. }elseif($v['xs_status'] == 2){
  811. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' >销售单未审核</span>";
  812. }elseif($v['xs_status'] == -2){
  813. $xs_no .= "<span data-action='xs' data-process='2' data-id='".$v['id']."' >销售单提交失败</span>";
  814. }elseif($v['xs_status'] == -3){
  815. $xs_no .= "<span data-action='xs' data-process='3' data-id='".$v['id']."' >销售单审核失败</span>";
  816. }
  817. if(!empty($v['xs_no'])){
  818. $xs_no = $v['xs_no']."【销售组织】<br/>".$xs_no;
  819. }
  820. }
  821. $dr_no = "";
  822. if($v['dr_status'] == 1){
  823. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' >调入单未提交</span>";
  824. }elseif($v['dr_status'] == -1){
  825. $dr_no .= "<span data-action='dr' data-process='1' data-id='".$v['id']."' >创建调入单失败</span>";
  826. }elseif($v['dr_status'] == 2){
  827. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' >调入单未审核</span>";
  828. }elseif($v['dr_status'] == -2){
  829. $dr_no .= "<span data-action='dr' data-process='2' data-id='".$v['id']."' >调入单提交失败</span>";
  830. }elseif($v['dr_status'] == -3){
  831. $dr_no .= "<span data-action='dr' data-process='3' data-id='".$v['id']."' >调入单审核失败</span>";
  832. }
  833. if(!empty($v['dr_no'])){
  834. $dr_no = $v['dr_no']."【香港组织】<br/>".$dr_no;
  835. }
  836. $type = "";
  837. if(isset($type_list[$v['type']])){
  838. if($v['type'] == 2){
  839. $type = "<i style='color:#70B'>".$type_list[$v['type']]."</i>";
  840. }else{
  841. $type = "<i>".$type_list[$v['type']]."</i>";
  842. }
  843. }else{
  844. $type = "<b style='color:red'>异常</b>";
  845. }
  846. $list[] = [
  847. 'id'=>$v['id'],
  848. 'order_no'=>$v['order_no'],
  849. 'type'=>$type,
  850. 'dc_no'=> $dc_no,
  851. 'cg_no'=>$cg_no,
  852. 'xs_no'=>$xs_no,
  853. 'dr_no'=>$dr_no,
  854. // 'xs_two_no'=>"",
  855. // 'bzch_no'=>"",
  856. //'bzsh_no'=>$bzsh_no,
  857. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  858. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  859. ];
  860. }
  861. $total = $this->zzquque_u9->find_count($where);
  862. $pagenum = ceil($total/$perpage);
  863. $over = $total-($start+$perpage);
  864. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  865. echo json_encode($rows);exit;
  866. }
  867. $this->_Template('zzququeu9zt',$this->data);
  868. }
  869. public function _dczt($arg_array){
  870. $process= $arg_array[0];
  871. $id = $arg_array[1];
  872. $info = $this->zzquque_u9->read($id);
  873. if($process == 1){
  874. if(!in_array($info['dc_status'],[0,-1])){
  875. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  876. exit;
  877. }
  878. $r = $this->logic_u9ztsd->createdDc($info);
  879. if($r['code'] == 1){
  880. echo json_encode(array('msg'=>'创建调出单成功','success'=>true));
  881. exit;
  882. }else{
  883. echo json_encode(array('msg'=>$r['msg'],'success'=>false));
  884. exit;
  885. }
  886. }else{
  887. echo json_encode(array('msg'=>'当前状态不符合创建调出单的条件','success'=>false));
  888. exit;
  889. }
  890. }
  891. private function _del($arg_array){
  892. $id = $arg_array[0];
  893. $user = $this->user->get_api($_SESSION['api']);
  894. if(!in_array($user['userid'],['ceshi','admin'])){
  895. echo json_encode(array('msg'=>'权限不足,禁止删除!','success'=>false));
  896. }
  897. $info = $this->zzquque_u9->read($id);
  898. //目前只删除小单的 在途的单子 不管对错都不处理留痕
  899. if(($info['dc_status'] < 3) && ($info['type'] == 10)){
  900. $this->zzquque_u9->remove($id);
  901. echo json_encode(array('msg'=>'删除成功','success'=>true));
  902. }else{
  903. echo json_encode(array('msg'=>'不满足删除条件','success'=>true));
  904. }
  905. }
  906. public function _waixiao(){
  907. $post = $this->input->post(NULL, TRUE);
  908. if(isset($post['page']))
  909. {
  910. $page = $this->input->post('page',true);
  911. $perpage = $this->input->post('perpage',true);
  912. $timetk = $this->input->post('timetk',true);//订单开始时间
  913. $timetj = $this->input->post('timetj',true);//订单结束时间
  914. $timetk = strtotime($timetk);
  915. $timetj = strtotime($timetj);
  916. $order_no = $this->input->post('order_no',true);
  917. $type = $this->input->post('type',true);
  918. $where = " ( type = 20) ";
  919. if($order_no){
  920. $where .= " and order_no like '%".$order_no."%' ";
  921. }
  922. if($timetk && $timetj){
  923. $where .= " and create_time > ".$timetk." and create_time < ".$timetj." ";
  924. }
  925. if(empty($page))
  926. {
  927. $start = 0;
  928. $perpage = 1;
  929. }
  930. else
  931. {
  932. $start = ($page - 1)*$perpage;
  933. }
  934. $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
  935. $type_list = $this->zzquque_u9->getType();
  936. $list = [];
  937. foreach($info_list as $k=>$v){
  938. $bzsh_no = $v['bzsh_no'];
  939. if($v['bzsh_status'] == 0){
  940. $bzsh_no = "<span data-action='wxcprk' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  941. }elseif($v['bzsh_status'] == -1){
  942. $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
  943. $tmp_str= "";
  944. if(isset($error[0]['ret_data'])){
  945. $ret_data = json_decode($error[0]['ret_data'],true);
  946. if(isset($ret_data[0]["ResMsg"])){
  947. $tmp_str = $ret_data[0]["ResMsg"];
  948. }elseif(isset($ret_data['msg'])){
  949. $tmp_str = $ret_data['msg'];
  950. }elseif(isset($ret_data['Data'])){
  951. foreach($ret_data['Data'] as $iit){
  952. if(!$iit['m_isSucess']){
  953. $tmp_str .= $iit['m_errorMsg']."<br>";
  954. }
  955. }
  956. }else{
  957. $tmp_str = "系统执行失败,请重试";
  958. }
  959. }else{
  960. $tmp_str = "";
  961. }
  962. $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>';
  963. }elseif($v['bzsh_status'] == 1){
  964. $bzsh_no = $v['bzsh_no']."<br/><span data-action='wxcprksh' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  965. }
  966. $xs_no = " ";
  967. if($v['xs_status'] == -1){
  968. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  969. }elseif($v['xs_status'] == 0){
  970. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  971. }
  972. if(!empty($v['xs_no'])){
  973. $xs_no = $v['xs_no']."<br/>".$xs_no;
  974. }
  975. $bzch_no = empty($v['bzch_no'])?"":$v['bzch_no'];
  976. $list[] = [
  977. 'id'=>$v['id'],
  978. 'order_no'=>$v['order_no'],
  979. 'type'=>"工厂外销单",
  980. 'bzsh_no'=> $bzsh_no,
  981. 'xs_no'=>$xs_no,
  982. 'bzch_no'=>$bzch_no,
  983. // 'xs_two_no'=>"",
  984. // 'bzch_no'=>"",
  985. //'bzsh_no'=>$bzsh_no,
  986. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  987. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  988. ];
  989. }
  990. $total = $this->zzquque_u9->find_count($where);
  991. $pagenum = ceil($total/$perpage);
  992. $over = $total-($start+$perpage);
  993. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  994. echo json_encode($rows);exit;
  995. }
  996. $this->_Template('zzququeu9wx',$this->data);
  997. }
  998. public function _wxcprk($arg_array){
  999. $id = $arg_array[0];
  1000. $info = $this->zzquque_u9->read($id);
  1001. if(empty($info)){
  1002. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1003. exit;
  1004. }
  1005. if($info['bzsh_status'] != 0){
  1006. echo json_encode(array('msg'=>"当前状态不符合创建成品入库单的条件",'success'=>false));
  1007. exit;
  1008. }
  1009. $res = $this->logic_u9action->doRkd($info);
  1010. if($res['code'] == 1){
  1011. echo json_encode(array('msg'=>'创建成品入库单成功','success'=>true));
  1012. exit;
  1013. }else{
  1014. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1015. exit;
  1016. }
  1017. }
  1018. public function _wxcprksh($arg_array){
  1019. $id = $arg_array[0];
  1020. $info = $this->zzquque_u9->read($id);
  1021. if(empty($info)){
  1022. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1023. exit;
  1024. }
  1025. if($info['bzsh_status'] != 0){
  1026. echo json_encode(array('msg'=>"当前状态不符合审核成品入库单的条件",'success'=>false));
  1027. exit;
  1028. }
  1029. $res = $this->logic_u9action->checkRkd($info);
  1030. if($res['code'] == 1){
  1031. echo json_encode(array('msg'=>'审核成品入库单成功','success'=>true));
  1032. exit;
  1033. }else{
  1034. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1035. exit;
  1036. }
  1037. }
  1038. public function _wxxs($arg_array){
  1039. $id = $arg_array[0];
  1040. $info = $this->zzquque_u9->read($id);
  1041. if(empty($info)){
  1042. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1043. exit;
  1044. }
  1045. if($info['xs_status'] != 0){
  1046. echo json_encode(array('msg'=>"当前状态不符合创建销售单的条件",'success'=>false));
  1047. exit;
  1048. }
  1049. $res = $this->logic_u9action->createXsd($info);
  1050. if($res['code'] == 1){
  1051. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  1052. exit;
  1053. }else{
  1054. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1055. exit;
  1056. }
  1057. }
  1058. }