| | |
| | | List<GetOrderResult0> list = JSON.parseArray(result.getData(), GetOrderResult0.class); |
| | | if (!Cools.isEmpty(list)) { |
| | | boolean complete = true; |
| | | Set<String> existNumbers = new HashSet<>(); |
| | | for (GetOrderResult0 data : list) { |
| | | if (custOrderService.selectCount(new EntityWrapper<CustOrder>() |
| | | .eq("number", data.getNumber()) |
| | |
| | | ) > 0) { |
| | | // log.error("{}单号已存在", data.getNumber()); |
| | | // complete = false; |
| | | existNumbers.add(data.getNumber()); |
| | | continue; |
| | | } |
| | | for (GetOrderResultDetl0 detl0 : data.getDetail()) { |
| | |
| | | data.getBillDate(), // 单据日期[非空] |
| | | data.getBTypeID(), // 客户编号 |
| | | data.getETypeID(), // 经手人编号[非空] |
| | | data.getVchcode(), // 单据自增ID |
| | | detl0.getUserCode(), // 商品编号 |
| | | detl0.getQty(), // 商品数量 |
| | | detl0.getQty(), // 总数量 |
| | |
| | | now, // 修改时间 |
| | | data.getSummary() // 备注 |
| | | ); |
| | | boolean insert = custOrderService.insert(custOrder); |
| | | if (!insert) { |
| | | if (!custOrderService.insert(custOrder)) { |
| | | complete = false; |
| | | log.error("保存销售订单失败!"); |
| | | } |
| | |
| | | if (complete) { |
| | | List<String> collect = list.stream().map(GetOrderResult0::getNumber).distinct().collect(Collectors.toList()); |
| | | for (String number : collect) { |
| | | custOrderService.updateStatus(number, 1); |
| | | if (!existNumbers.contains(number)) { |
| | | custOrderService.updateStatus(number, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * 完成销售订单 |
| | | */ |
| | | // @Scheduled(cron = "0/10 * * * * ? ") |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | @Transactional |
| | | // @PostConstruct |
| | | public void finishOrdersExecute(){ |
| | | try { |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>().eq("status", 4)); |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>().eq("status", 4).isNotNull("vch_code")); |
| | | if (!Cools.isEmpty(custOrders)) { |
| | | List<String> numbers = custOrders.stream().map(CustOrder::getNumber).distinct().collect(Collectors.toList()); |
| | | for (String number : numbers) { |
| | |
| | | getOrderResult0.setBillDate(custOrder.getBillDate()); |
| | | getOrderResult0.setBTypeID(custOrder.getBTypeId()); |
| | | getOrderResult0.setKTypeID("宏挺仓库"); |
| | | getOrderResult0.setVchcode(custOrder.getVchcode()); |
| | | } |
| | | // 表体 |
| | | GetOrderResultDetl0 detl0 = new GetOrderResultDetl0(); |
| | |
| | | detl0.setQty(custOrder.getTotal()); |
| | | detl0.setPrice(custOrder.getPrice()); |
| | | detl0.setComment(custOrder.getComment()); |
| | | detl0.setRowNo(custOrder.getRowNo()); |
| | | list.add(detl0); |
| | | iterator.remove(); |
| | | } |
| | |
| | | private String number; |
| | | |
| | | // 自增 |
| | | private String Vchcode; |
| | | private Double Vchcode; |
| | | |
| | | private Integer vchType; |
| | | |
| | |
| | | |
| | | private String summary; |
| | | |
| | | // 自增 |
| | | private Double Vchcode; |
| | | |
| | | private List<UploadBillDetail> detail; |
| | | |
| | | } |
| | |
| | | |
| | | private String comment; |
| | | |
| | | // 商品明细行号 |
| | | private Double RowNo; |
| | | |
| | | } |
| | |
| | | private String eTypeId; |
| | | |
| | | /** |
| | | * 单据自增ID |
| | | */ |
| | | @ApiModelProperty(value= "单据自增ID") |
| | | @TableField("vch_code") |
| | | private Double vchcode; |
| | | |
| | | /** |
| | | * 商品编号 |
| | | */ |
| | | @ApiModelProperty(value= "商品编号") |
| | |
| | | |
| | | public CustOrder() {} |
| | | |
| | | public CustOrder(String number,String billDate,String bTypeId,String eTypeId,String userCode,Double qty,Double total,Double price, Double rowNo, String comment,Integer status,Date createTime,Date updateTime,String memo) { |
| | | public CustOrder(String number,String billDate,String bTypeId,String eTypeId,Double vchcode,String userCode,Double qty,Double total,Double price, Double rowNo, String comment,Integer status,Date createTime,Date updateTime,String memo) { |
| | | this.number = number; |
| | | this.billDate = billDate; |
| | | this.bTypeId = bTypeId; |
| | | this.eTypeId = eTypeId; |
| | | this.vchcode = vchcode; |
| | | this.userCode = userCode; |
| | | this.qty = qty; |
| | | this.total = total; |
| | |
| | | this.memo = memo; |
| | | } |
| | | |
| | | public Double getVchcode() { |
| | | return vchcode; |
| | | } |
| | | |
| | | public void setVchcode(Double vchcode) { |
| | | this.vchcode = vchcode; |
| | | } |
| | | } |
| | |
| | | } |
| | | // 采购退货单 |
| | | // if (param.getNumber().startsWith("PR-")) { |
| | | // erp单据上传 |
| | | Long docId = pakouts.get(0).getDocId(); |
| | | if (null != docId) { |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | for (Pakout pakout : pakouts) { |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(pakout.getMatnr()); |
| | | billDto.setQty(pakout.getAnfme()); |
| | | dtos.add(billDto); |
| | | } |
| | | if (!erpService.uploadBill(dtos, docId.intValue() , pakouts.get(0).getDocNum())) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | } |
| | | // erp单据上传 todo |
| | | // Long docId = pakouts.get(0).getDocId(); |
| | | // if (null != docId) { |
| | | // List<BillDto> dtos = new ArrayList<>(); |
| | | // for (Pakout pakout : pakouts) { |
| | | // BillDto billDto = new BillDto(); |
| | | // billDto.setMatnr(pakout.getMatnr()); |
| | | // billDto.setQty(pakout.getAnfme()); |
| | | // dtos.add(billDto); |
| | | // } |
| | | // if (!erpService.uploadBill(dtos, docId.intValue() , pakouts.get(0).getDocNum())) { |
| | | // throw new CoolException("无法上报至erp"); |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | return R.ok(); |
| | |
| | | DateUtils.convert(now), // 单据日期[非空] |
| | | param.getCustomerTypeId(), // 客户编号 |
| | | null, // 经手人编号[空] |
| | | null, |
| | | dto.getMatnr(), // 商品编号 |
| | | dto.getCount(), // 商品数量 |
| | | dto.getCount(), // 总数量 |
| | |
| | | # password: xltys1995 |
| | | # sql-server |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://192.168.2.250:1433;databasename=htasrs |
| | | url: jdbc:sqlserver://192.168.110.56:1433;databasename=htasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | endpoint: http://oss-cn-hangzhou.aliyuncs.com |
| | | |
| | | asrs: |
| | | baseUrl: http://localhost:8081/htwms |
| | | baseUrl: http://192.168.110.56:8080/htwms |
| | |
| | | <result column="bill_date" property="billDate" /> |
| | | <result column="bType_id" property="bTypeId" /> |
| | | <result column="eType_id" property="eTypeId" /> |
| | | <result column="vch_code" property="vchcode" /> |
| | | <result column="user_code" property="userCode" /> |
| | | <result column="qty" property="qty" /> |
| | | <result column="total" property="total" /> |