|
|
@@ -646,7 +646,194 @@ public class WarehouseServiceImpl implements IWarehouseService {
|
|
|
result.setThjspotgoodsdeposits(thjspotgoodsdeposits);
|
|
|
}
|
|
|
|
|
|
- return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"),result);
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageResult<WarehouseExpressResult> queryexpress(WarehouseExpressParam param, HttpServletRequest request) {
|
|
|
+ IPage<WarehouseExpressResult> page = new Page<>(param.getPageNum(), param.getPageSize());
|
|
|
+ IPage<WarehouseExpressResult> express = iWroutinapplyMapper.queryexpress(page, param);
|
|
|
+ PageResult<WarehouseExpressResult> pageResult = new PageResult<>();
|
|
|
+ pageResult.setCode(Constants.Success_Code_Design);
|
|
|
+ pageResult.setMessage(AjaxResult.dealMsg(MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language")));
|
|
|
+ pageResult.setPages(express.getPages());
|
|
|
+ pageResult.setCurrent(express.getCurrent());
|
|
|
+ pageResult.setTotal(express.getTotal());
|
|
|
+ pageResult.setPageSize(express.getSize());
|
|
|
+ pageResult.setData(express.getRecords());
|
|
|
+ return pageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult checkWROutInApply(WarehouseOutInApplyParam param, HttpServletRequest request) {
|
|
|
+ Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
|
|
|
+
|
|
|
+ Wroutinapply wrOutInApply = iWroutinapplyMapper.selectOne(new QueryWrapper<Wroutinapply>()
|
|
|
+ .eq("applyid", param.getApplyid()));
|
|
|
+ //申请类型 - 1:入库 2:出库
|
|
|
+ Integer applytype = wrOutInApply.getApplytype();
|
|
|
+ //type 1:预约初审2:预约复审3:注册初审4:注册复审
|
|
|
+ if (param.getType() == 1) {
|
|
|
+ if ((param.getApplystatus() == 2 || param.getApplystatus() == 3) && wrOutInApply.getApplystatus() == 1) {
|
|
|
+ wrOutInApply.setApplyid(Long.parseLong(param.getApplyid()));
|
|
|
+ wrOutInApply.setApplystatus(param.getApplystatus());
|
|
|
+ wrOutInApply.setFirstauditid(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setFirstaudittime(new Date());
|
|
|
+ wrOutInApply.setFirstremark(param.getRemark());
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM037.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ } else if (param.getType() == 2) {
|
|
|
+ if ((param.getApplystatus() == 5 || param.getApplystatus() == 6) && wrOutInApply.getApplystatus() == 2) {
|
|
|
+ wrOutInApply.setApplyid(Long.parseLong(param.getApplyid()));
|
|
|
+ wrOutInApply.setApplystatus(param.getApplystatus());
|
|
|
+ if (param.getApplystatus() == 5) {
|
|
|
+ if (applytype == 1) {
|
|
|
+ wrOutInApply.setApplytype(3);
|
|
|
+ } else if (applytype == 2) {
|
|
|
+ wrOutInApply.setApplytype(4);
|
|
|
+ }
|
|
|
+
|
|
|
+ wrOutInApply.setApplystatus2(0);
|
|
|
+ }
|
|
|
+ wrOutInApply.setSecondauditid(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setSecondaudittime(new Date());
|
|
|
+ wrOutInApply.setSecondremark(param.getRemark());
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM037.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ } else if (param.getType().equals(3)) {
|
|
|
+ if ((param.getApplystatus() == 2 || param.getApplystatus() == 3) && wrOutInApply.getApplystatus2() == 1) {
|
|
|
+ wrOutInApply.setApplyid(Long.parseLong(param.getApplyid()));
|
|
|
+ wrOutInApply.setApplystatus2(param.getApplystatus());
|
|
|
+ wrOutInApply.setFirstauditid2(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setFirstaudittime2(new Date());
|
|
|
+ wrOutInApply.setFirstremark2(param.getRemark());
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM037.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ } else if (param.getType().equals(4)) {
|
|
|
+ if ((param.getApplystatus() == 5 || param.getApplystatus() == 6) && wrOutInApply.getApplystatus2() == 2) {
|
|
|
+ if (applytype == 3 && param.getApplystatus() == 5) {
|
|
|
+ //调用仓单入库注册复审通过
|
|
|
+ wrOutInApply.setSecondauditid2(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setSecondremark2(param.getRemark());
|
|
|
+ wrOutInApply.setSecondaudittime2(new Date());
|
|
|
+ return rkzccheck(wrOutInApply, request);
|
|
|
+ }
|
|
|
+ if (applytype == 4) {
|
|
|
+ if (param.getApplystatus() == 5) {
|
|
|
+ //调用仓单出库注销复审通过
|
|
|
+ wrOutInApply.setSecondauditid2(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setSecondremark2(param.getRemark());
|
|
|
+ wrOutInApply.setSecondaudittime2(new Date());
|
|
|
+ return ckzxcheck(wrOutInApply, request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wrOutInApply.setApplyid(Long.parseLong(param.getApplyid()));
|
|
|
+ wrOutInApply.setApplystatus2(param.getApplystatus());
|
|
|
+ wrOutInApply.setSecondauditid2(systemmanager.getAutoid());
|
|
|
+ wrOutInApply.setSecondaudittime2(new Date());
|
|
|
+ wrOutInApply.setSecondremark2(param.getRemark());
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM037.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ iWroutinapplyMapper.update(wrOutInApply, new QueryWrapper<Wroutinapply>().eq("applyid", param.getApplyid()));
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private AjaxResult ckzxcheck(Wroutinapply param, HttpServletRequest request) {
|
|
|
+ WarehouseReceiptMI1.ReceiptOutApplyLogoutReq.Builder builder = WarehouseReceiptMI1.ReceiptOutApplyLogoutReq.newBuilder();
|
|
|
+ WarehouseReceiptMI1.WRCommon.Builder common = WarehouseReceiptMI1.WRCommon.newBuilder();
|
|
|
+ Long uuid = SerialNumberUtils.getNewSerialNumber(SerialNumberUtils.prefix_warehouse);
|
|
|
+ common.setUserID(param.getUserid());
|
|
|
+ common.setAccountID(param.getAccountid());
|
|
|
+ common.setRelatedOrderID(uuid);
|
|
|
+ common.setTradeID(param.getApplyid());
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_ReceiptOutApplyLogoutReq);
|
|
|
+ hd.setClientTime(System.currentTimeMillis());
|
|
|
+ hd.setResponseTopic(SysConstants.RabbitWRRegisterRspKey);
|
|
|
+ hd.setMarketID(Constants.SPEICAL_MARKET_WR);
|
|
|
+ hd.setUUID(uuid.toString());
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setApplyID(param.getApplyid());
|
|
|
+ builder.setSecondAuditID2(param.getSecondauditid2());
|
|
|
+ builder.setSecondRemark2(param.getSecondremark2());
|
|
|
+ builder.setCommon(common);
|
|
|
+
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_ReceiptOutApplyLogoutReq);
|
|
|
+ Calculator ca = SerialNumberUtils.createCalculator(uuid);
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitWRKey,new Message(body, new MessageProperties()));
|
|
|
+ log.debug("ReceiptOutApplyLogoutReq出库注销复审通过请求={}",builder.build());
|
|
|
+
|
|
|
+ synchronized (ca) {
|
|
|
+ try {
|
|
|
+ ca.wait(10000);
|
|
|
+ Object rsp_ = ca.obj;
|
|
|
+ if (rsp_ != null) {
|
|
|
+ WarehouseReceiptMI1.ReceiptOutApplyLogoutRsp rsp = (WarehouseReceiptMI1.ReceiptOutApplyLogoutRsp) rsp_;
|
|
|
+ if (rsp.getRetCode() != 0) {
|
|
|
+ String errDesc = ProtoErrorCodes.resultMsg(rsp.getRetCode());
|
|
|
+ log.error("出库注销复审通过失败,失败原因:" + errDesc);
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM002.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ log.error("消息发送失败,失败原因:" + Arrays.toString(e.getStackTrace()));
|
|
|
+ } finally {
|
|
|
+ SerialNumberUtils.lockMap.remove(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private AjaxResult rkzccheck(Wroutinapply param, HttpServletRequest request) {
|
|
|
+ WarehouseReceiptMI1.ReceiptOutApplyLogoutReq.Builder builder = WarehouseReceiptMI1.ReceiptOutApplyLogoutReq.newBuilder();
|
|
|
+ WarehouseReceiptMI1.WRCommon.Builder common = WarehouseReceiptMI1.WRCommon.newBuilder();
|
|
|
+ Long uuid = SerialNumberUtils.getNewSerialNumber(SerialNumberUtils.prefix_warehouse);
|
|
|
+ common.setUserID(param.getUserid());
|
|
|
+ common.setAccountID(param.getAccountid());
|
|
|
+ common.setRelatedOrderID(uuid);
|
|
|
+ common.setTradeID(param.getApplyid());
|
|
|
+ Common.MessageHead.Builder hd = Common.MessageHead.newBuilder();
|
|
|
+ hd.setFunCode(FunCodeConstants.FunCode_Trade_ReceiptInApplyRegisterReq);
|
|
|
+ hd.setClientTime(System.currentTimeMillis());
|
|
|
+ hd.setResponseTopic(SysConstants.RabbitWRRegisterRspKey);
|
|
|
+ hd.setMarketID(Constants.SPEICAL_MARKET_WR);
|
|
|
+ hd.setUUID(uuid.toString());
|
|
|
+ builder.setHeader(hd);
|
|
|
+ builder.setApplyID(param.getApplyid());
|
|
|
+ builder.setSecondAuditID2(param.getSecondauditid2());
|
|
|
+ builder.setSecondRemark2(param.getSecondremark2());
|
|
|
+ builder.setCommon(common);
|
|
|
+
|
|
|
+ byte[] body = ProtoHelper.getNTAS(builder.build().toByteArray(), FunCodeConstants.FunCode_Trade_ReceiptInApplyRegisterReq);
|
|
|
+ Calculator ca = SerialNumberUtils.createCalculator(uuid);
|
|
|
+ rabbitTemplate.send(SysConstants.RabbitWRKey, new Message(body, new MessageProperties()));
|
|
|
+ log.debug("ReceiptOutApplyLogoutReq仓单入库注册复审通过请求={}", builder.build());
|
|
|
+
|
|
|
+ synchronized (ca) {
|
|
|
+ try {
|
|
|
+ ca.wait(10000);
|
|
|
+ Object rsp_ = ca.obj;
|
|
|
+ if (rsp_ != null) {
|
|
|
+ WarehouseReceiptMI1.ReceiptInApplyRegisterRsp rsp = (WarehouseReceiptMI1.ReceiptInApplyRegisterRsp) rsp_;
|
|
|
+ if (rsp.getRetCode() != 0) {
|
|
|
+ String errDesc = ProtoErrorCodes.resultMsg(rsp.getRetCode());
|
|
|
+ log.error("仓单入库注册复审通过失败,失败原因:" + errDesc);
|
|
|
+ return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM002.getCode(), request.getHeader("Accept-Language"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ log.error("消息发送失败,失败原因:" + Arrays.toString(e.getStackTrace()));
|
|
|
+ } finally {
|
|
|
+ SerialNumberUtils.lockMap.remove(uuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"));
|
|
|
}
|
|
|
|
|
|
private void sendWRFactorTypeNameUpdateReqMsg(Warehouseinfo wh, Systemmanager systemmanager) {
|