ade06649f804b1380b6e1bcedd453d7e7f974b81.svn-base 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. package xin.glue.ui.H.H05;
  2. import java.io.ByteArrayOutputStream;
  3. import java.io.PrintStream;
  4. import java.math.BigDecimal;
  5. import java.sql.CallableStatement;
  6. import java.sql.Connection;
  7. import java.sql.Types;
  8. import java.util.List;
  9. import xin.glue.ui.common.PosGridSave;
  10. import xin.glue.ui.common.ProduceFactory;
  11. import xin.glue.ui.common.component.PosSiteLog;
  12. import xin.glue.user.common.UIJ030052;
  13. import com.posdata.glue.biz.activity.PosActivity;
  14. import com.posdata.glue.biz.constants.PosBizControlConstants;
  15. import com.posdata.glue.context.PosContext;
  16. import com.posdata.glue.dao.vo.PosParameter;
  17. import com.posdata.glue.dao.vo.PosRow;
  18. import com.posdata.glue.dao.vo.PosRowSet;
  19. /*
  20. * 发货明细回退业务处理,为方便成品发货操作添加
  21. * @author TangLiang 唐亮
  22. * @data 2009.12.15
  23. */
  24. public class returnDlivDirno extends PosActivity{
  25. public String runActivity(PosContext context)
  26. {
  27. //发运指示号
  28. String[] DLIV_DIRNO = (String[]) context.get("DLIV_DIRNO");
  29. //录入人
  30. String[] REG_ID = (String[]) context.get("REG_ID");
  31. //退回原因
  32. String[] RETURN_REASON = (String[]) context.get("RETURN_REASON");
  33. String sqlOut = "select DLIV_DIRNO from tbj01_dliv_dir where DLIV_DIRNO = ? AND LAST_MAN IS NULL";
  34. PosParameter paramg = new PosParameter();
  35. paramg.setWhereClauseParameter(0,DLIV_DIRNO[0]);
  36. PosRowSet ischeck = this.getDao("mesdao").findByQueryStatement(sqlOut, paramg);
  37. UIJ030052 uij030052 = new UIJ030052();
  38. String url="http://172.16.0.18:9090/TieQianinterface/services/MaterialOutInfo/materialoutinfo/"+DLIV_DIRNO[0];
  39. String retr=uij030052.jsonPost(url, DLIV_DIRNO[0]);
  40. if(retr.contains("false")&&ischeck.hasNext())
  41. {
  42. logger.logDebug("returnDlivDirno 车辆已出厂,需要审核!! ");
  43. String vtemp="ISOUT";
  44. context.put("rs", vtemp);
  45. }
  46. else
  47. {
  48. //在做明细回退之前,必须要删除结算数据。如果结算没有接收则直接退到排车界面
  49. PosParameter param11 = new PosParameter();
  50. param11.setWhereClauseParameter(0,DLIV_DIRNO[0]);
  51. PosRowSet DIRNOVO = this.getDao("mesdao").find("UIH052200_02.select", param11);
  52. String strValue = null;
  53. Connection conn = null;
  54. if(DIRNOVO.hasNext()){
  55. CallableStatement cstm= null;
  56. conn = this.getDao("mesdao").getDBConnection();
  57. //存在值的情况下要判断销售是否进行结算退回操作
  58. PosRow DIRNORow = DIRNOVO.next();
  59. try{
  60. CallableStatement cstmt = conn.prepareCall("{?=call SqListNumbRollBack(?)}");
  61. cstmt.registerOutParameter(1, Types.VARCHAR);
  62. cstmt.setString(2, DLIV_DIRNO[0]);
  63. //cstmt.registerOutParameter(3, Types.INTEGER);
  64. cstmt.execute();
  65. strValue = cstmt.getString(1);
  66. cstmt.close();
  67. }
  68. catch(Exception ex)
  69. {
  70. //System.out.println(pDlivDirNo[i] + "明细数据发送到铁前数据库执行失败UIJ010060_01.CALL**********");
  71. ByteArrayOutputStream baos = new ByteArrayOutputStream();
  72. ex.printStackTrace(new PrintStream(baos));
  73. String exception = baos.toString();
  74. String errStr = "\n异常原因:" + exception;
  75. logger.logInfo(DLIV_DIRNO[0] + "明细退回执行失败SqListNumbRollBack;" + errStr);
  76. }
  77. if (cstm != null) {
  78. try {
  79. cstm.close();
  80. conn.close();
  81. } catch (Exception e) {
  82. }
  83. }
  84. //String ISCHANGEWGT = (String) DIRNORow.getAttribute("ISCHANGEWGT");
  85. //if(ISCHANGEWGT != null && ISCHANGEWGT.equals("1")){
  86. if(strValue != null && strValue.equals("1")){
  87. //这里把发货指示号从发货明细完成退回到销售下车完成界面
  88. //更新钢卷公共表
  89. PosParameter param1 = new PosParameter();
  90. param1.setWhereClauseParameter(0, REG_ID[0]);
  91. param1.setWhereClauseParameter(1, DLIV_DIRNO[0]);
  92. getDao("mesdao").update("UIH052200_COIL_COMM.UPDATE", param1);
  93. //删除货运中国
  94. PosParameter paramdt = new PosParameter();
  95. paramdt = new PosParameter();
  96. paramdt.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  97. this.getDao("mesdao").delete("UIJ010060_cargocn_02.update", paramdt);
  98. //更新发运表TBJ01_DLIV_DIR
  99. PosParameter param2 = new PosParameter();
  100. param2.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  101. getDao("mesdao").update("UIH052200_DLIV_DIR.UPDATE", param2);
  102. try{
  103. cstm=getDao("mesdao").getCallableStatement("UIJ010060_01.CALL");
  104. cstm.setString(1, "3");
  105. cstm.setString(2, DLIV_DIRNO[0]);
  106. cstm.setString(3, "");
  107. cstm.setString(4, "");
  108. cstm.setString(5, "");
  109. cstm.setString(6, "1");
  110. cstm.setString(7, "");
  111. cstm.setString(8, "");
  112. cstm.setString(9, "4001RZ1");
  113. cstm.setString(10, "热轧线");
  114. cstm.execute();
  115. }
  116. catch (Exception ex) {
  117. //System.out.println(pDlivDirNo[i] + "明细数据发送到铁前数据库执行失败UIJ010060_01.CALL**********");
  118. ByteArrayOutputStream baos = new ByteArrayOutputStream();
  119. ex.printStackTrace(new PrintStream(baos));
  120. String exception = baos.toString();
  121. String errStr = "\n异常原因:" + exception;
  122. logger.logInfo(DLIV_DIRNO[0] + "明细数据发送到铁前数据库执行失败UIJ010060_01.CALL;" + errStr);
  123. //ex.printStackTrace();
  124. }
  125. if (cstm != null) {
  126. try {
  127. cstm.close();
  128. } catch (Exception e) {
  129. }
  130. }
  131. //更新运送表
  132. PosParameter param4 = new PosParameter();
  133. param4.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  134. getDao("mesdao").update("UIH052200_SHIP_DIR.UPDATE", param4);
  135. //删除结算接口表
  136. PosParameter param3 = new PosParameter();
  137. param3.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  138. getDao("mesdao").update("UIH052200_J02_COMM.UPDATE", param3);
  139. //调用returndlivhis存储过程
  140. CallableStatement cstm1= null;
  141. cstm1=getDao("mesdao").getCallableStatement("UIJ010060_05.CALL");
  142. try {
  143. cstm1.setString(1, "3");
  144. cstm1.setString(2, "");
  145. cstm1.setString(3, DLIV_DIRNO[0]);
  146. cstm1.setString(4, "");
  147. cstm1.setString(5, "");
  148. cstm1.setString(6, "");
  149. cstm1.setString(7, "");
  150. cstm1.setString(8, "");
  151. cstm1.setString(9, RETURN_REASON[0]);
  152. cstm1.setString(10, "H");
  153. cstm1.setString(11, REG_ID[0]);
  154. cstm1.execute();
  155. } catch (Exception e) {
  156. e.printStackTrace();
  157. }finally{
  158. try {
  159. if(cstm1!=null)
  160. cstm1.close();
  161. } catch (Exception e) {
  162. e.printStackTrace();
  163. }
  164. }
  165. //调用存货异动点存储过程 20210927暂时屏蔽
  166. ProduceFactory PD= new ProduceFactory();
  167. PD.ErpDataCover("HDLIVNO",DLIV_DIRNO[0],"69A","1","N",REG_ID[0],"热轧退货");
  168. // PD.ErpDataCover("HDLIVNO",DLIV_DIRNO[0],"11AC","0","N",REG_ID[0],"热轧退货取消判定");
  169. }else{
  170. logger.logDebug("returnDlivDirno 销售已经进行结算接收操作,请退结算后再进行退明细操作!!! ");
  171. String vtemp="ISCHANGEWGT";
  172. context.put("rs", vtemp);
  173. }
  174. }else{
  175. //结算接口表内没有数据,说明销售还没有接收。可以直接进行发货明细退回操作
  176. //这里把发货指示号从发货明细完成退回到销售下车完成界面
  177. //更新钢卷公共表
  178. PosParameter param1 = new PosParameter();
  179. param1.setWhereClauseParameter(0, REG_ID[0]);
  180. param1.setWhereClauseParameter(1, DLIV_DIRNO[0]);
  181. getDao("mesdao").update("UIH052200_COIL_COMM.UPDATE", param1);
  182. //删除货运中国
  183. PosParameter paramdt = new PosParameter();
  184. paramdt = new PosParameter();
  185. paramdt.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  186. this.getDao("mesdao").delete("UIJ010060_cargocn_02.update", paramdt);
  187. //更新发运表TBJ01_DLIV_DIR
  188. PosParameter param2 = new PosParameter();
  189. param2.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  190. getDao("mesdao").update("UIH052200_DLIV_DIR.UPDATE", param2);
  191. //更新运送表
  192. PosParameter param4 = new PosParameter();
  193. param4.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  194. getDao("mesdao").update("UIH052200_SHIP_DIR.UPDATE", param4);
  195. //删除结算接口表
  196. PosParameter param3 = new PosParameter();
  197. param3.setWhereClauseParameter(0, DLIV_DIRNO[0]);
  198. getDao("mesdao").update("UIH052200_J02_COMM.UPDATE", param3);
  199. //调用returndlivhis存储过程
  200. CallableStatement cstm= null;
  201. cstm=getDao("mesdao").getCallableStatement("UIJ010060_05.CALL");
  202. try {
  203. cstm.setString(1, "3");
  204. cstm.setString(2, "");
  205. cstm.setString(3, DLIV_DIRNO[0]);
  206. cstm.setString(4, "");
  207. cstm.setString(5, "");
  208. cstm.setString(6, "");
  209. cstm.setString(7, "");
  210. cstm.setString(8, "");
  211. cstm.setString(9, RETURN_REASON[0]);
  212. cstm.setString(10, "H");
  213. cstm.setString(11, REG_ID[0]);
  214. cstm.execute();
  215. } catch (Exception e) {
  216. e.printStackTrace();
  217. }finally{
  218. try {
  219. if(cstm!=null)
  220. cstm.close();
  221. } catch (Exception e) {
  222. e.printStackTrace();
  223. }
  224. }
  225. //调用存货异动点存储过程 20210927暂时屏蔽
  226. ProduceFactory PD= new ProduceFactory();
  227. PD.ErpDataCover("HDLIVNO",DLIV_DIRNO[0],"69A","1","N",REG_ID[0],"热轧退货");
  228. PD.ErpDataCover("HDLIVNO",DLIV_DIRNO[0],"11AC","0","N",REG_ID[0],"热轧退货取消判定");
  229. }
  230. }
  231. return PosBizControlConstants.SUCCESS;
  232. }
  233. }