Zzququeu9.php 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  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. $ret_data = json_decode($error[0]['ret_data'],true);
  945. if(isset($ret_data[0]["ResMsg"])){
  946. $tmp_str = $ret_data[0]["ResMsg"];
  947. }elseif(isset($ret_data['msg'])){
  948. $tmp_str = $ret_data['msg'];
  949. }elseif(isset($ret_data['Data'])){
  950. foreach($ret_data['Data'] as $iit){
  951. if(!$iit['m_isSucess']){
  952. $tmp_str .= $iit['m_errorMsg']."<br>";
  953. }
  954. }
  955. }else{
  956. $tmp_str = "系统执行失败,请重试";
  957. }
  958. $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>';
  959. }elseif($v['bzsh_status'] == 1){
  960. $bzsh_no = $v['bzsh_no']."<br/><span data-action='wxcprksh' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
  961. }
  962. $xs_no = " ";
  963. if($v['xs_status'] == -1){
  964. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  965. }elseif($v['xs_status'] == 0){
  966. $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
  967. }
  968. if(!empty($v['xs_no'])){
  969. $xs_no = $v['xs_no']."<br/>".$xs_no;
  970. }
  971. $bzch_no = $v['bzch_no'];
  972. $list[] = [
  973. 'id'=>$v['id'],
  974. 'order_no'=>$v['order_no'],
  975. 'type'=>"工厂外销单",
  976. 'bzsh_no'=> $bzsh_no,
  977. 'xs_no'=>$xs_no,
  978. 'bzch_no'=>$bzch_no,
  979. // 'xs_two_no'=>"",
  980. // 'bzch_no'=>"",
  981. //'bzsh_no'=>$bzsh_no,
  982. 'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
  983. 'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
  984. ];
  985. }
  986. $total = $this->zzquque_u9->find_count($where);
  987. $pagenum = ceil($total/$perpage);
  988. $over = $total-($start+$perpage);
  989. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
  990. echo json_encode($rows);exit;
  991. }
  992. $this->_Template('zzququeu9wx',$this->data);
  993. }
  994. public function _wxcprk($arg_array){
  995. $id = $arg_array[0];
  996. $info = $this->zzquque_u9->read($id);
  997. if(empty($info)){
  998. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  999. exit;
  1000. }
  1001. if($info['bzsh_status'] != 0){
  1002. echo json_encode(array('msg'=>"当前状态不符合创建成品入库单的条件",'success'=>false));
  1003. exit;
  1004. }
  1005. $res = $this->logic_u9action->doRkd($info);
  1006. if($res['code'] == 1){
  1007. echo json_encode(array('msg'=>'创建成品入库单成功','success'=>true));
  1008. exit;
  1009. }else{
  1010. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1011. exit;
  1012. }
  1013. }
  1014. public function _wxcprksh($arg_array){
  1015. $id = $arg_array[0];
  1016. $info = $this->zzquque_u9->read($id);
  1017. if(empty($info)){
  1018. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1019. exit;
  1020. }
  1021. if($info['bzsh_status'] != 0){
  1022. echo json_encode(array('msg'=>"当前状态不符合审核成品入库单的条件",'success'=>false));
  1023. exit;
  1024. }
  1025. $res = $this->logic_u9action->checkRkd($info);
  1026. if($res['code'] == 1){
  1027. echo json_encode(array('msg'=>'审核成品入库单成功','success'=>true));
  1028. exit;
  1029. }else{
  1030. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1031. exit;
  1032. }
  1033. }
  1034. public function _wxxs($arg_array){
  1035. $id = $arg_array[0];
  1036. $info = $this->zzquque_u9->read($id);
  1037. if(empty($info)){
  1038. echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
  1039. exit;
  1040. }
  1041. if($info['xs_status'] != 0){
  1042. echo json_encode(array('msg'=>"当前状态不符合创建销售单的条件",'success'=>false));
  1043. exit;
  1044. }
  1045. $res = $this->logic_u9action->createXsd($info);
  1046. if($res['code'] == 1){
  1047. echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
  1048. exit;
  1049. }else{
  1050. echo json_encode(array('msg'=>$res['msg'],'success'=>false));
  1051. exit;
  1052. }
  1053. }
  1054. }