| | |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.ReportToThirdService; |
| | | import com.zy.common.utils.Synchro; |
| | | import com.zy.nc.SendUtil; |
| | | import com.zy.nc.entity.NccSaleXsfhmxWms; |
| | | import com.zy.nc.util.NcResultMessage; |
| | | import com.zy.nc.vo.SaleOutBodyVO; |
| | | import com.zy.nc.vo.SaleOutHeadVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | NcResultMessage response = null; |
| | | try { |
| | | switch (order.getDocType().toString()) { |
| | | case "销售发货": |
| | | case "35": |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO(); |
| | | saleOutHeadVO.setPk_org("FYT"); |
| | | saleOutHeadVO.setCwarehouseid("6101"); |
| | | SaleOutBodyVO saleOutBodyVO = null; |
| | | List<SaleOutBodyVO> saleOutBodyVOList = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | saleOutBodyVO = new SaleOutBodyVO(); |
| | | saleOutBodyVO.setCsourcebillhid("1001A1100000027XNSH2"); |
| | | saleOutBodyVO.setCsourcebillbid("1001A1100000027YFC8U"); |
| | | saleOutBodyVO.setCsourcetype("4331-01"); |
| | | String remark = orderDetl.getRemark(); |
| | | if (!Cools.isEmpty(remark)) { |
| | | NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); |
| | | saleOutBodyVO.setCsourcetype("4331"); |
| | | saleOutBodyVO.setClocationid("610101"); |
| | | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); |
| | | saleOutHeadVO.setVdef2(nccSaleXsfhmxWms.getVdef2()); |
| | | saleOutHeadVO.setVdef3(nccSaleXsfhmxWms.getVdef3()); |
| | | saleOutHeadVO.setVdef4(nccSaleXsfhmxWms.getVdef4()); |
| | | saleOutHeadVO.setVdef7(nccSaleXsfhmxWms.getVdef7()); |
| | | saleOutHeadVO.setVdef8(nccSaleXsfhmxWms.getVdef8()); |
| | | saleOutHeadVO.setVdef13(nccSaleXsfhmxWms.getVdef13()); |
| | | saleOutHeadVO.setVdef14(nccSaleXsfhmxWms.getVdef14()); |
| | | } |
| | | saleOutBodyVO.setVbatchcode(orderDetl.getBatch()); |
| | | saleOutBodyVO.setNshouldnum(orderDetl.getAnfme()); |
| | | saleOutBodyVO.setNnum(orderDetl.getQty()); |
| | | saleOutBodyVOList.add(saleOutBodyVO); |
| | | } |
| | | data.put("saleOutHeadVO", saleOutHeadVO); |
| | | data.put("saleOutBodyVO", saleOutBodyVO); |
| | | data.put("SaleOutHeadVO", saleOutHeadVO); |
| | | data.put("SaleOutBodyVO", saleOutBodyVOList); |
| | | //发送请求 |
| | | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + port, saveRefDelivery, JSONObject.toJSONString(data)); |
| | | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(data)); |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("response:{}", response); |
| | | http = true; |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new CoolException("调用接口报错,请联系管理员"); |
| | | } finally { |
| | | reportApiLog(response, order.getDocType$(), nyncIp, saveRefDelivery); |