psh
8 months ago
9 changed files with 339 additions and 9 deletions
Binary file not shown.
@ -0,0 +1,69 @@ |
|||
|
|||
package org.nl.wms.sch.rest; |
|||
|
|||
|
|||
import org.nl.wms.sch.service.ExtDeliveryNoteService; |
|||
import org.nl.wms.sch.service.dto.ExtDeliveryNoteDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.nl.annotation.Log; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import io.swagger.annotations.*; |
|||
import java.io.IOException; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Map; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
/** |
|||
* @author psh |
|||
* @date 2024-05-13 |
|||
**/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "delivery管理") |
|||
@RequestMapping("/api/extDeliveryNote") |
|||
@Slf4j |
|||
public class ExtDeliveryNoteController { |
|||
|
|||
private final ExtDeliveryNoteService extDeliveryNoteService; |
|||
|
|||
@GetMapping |
|||
@Log("查询delivery") |
|||
@ApiOperation("查询delivery") |
|||
//@PreAuthorize("@el.check('extDeliveryNote:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){ |
|||
return new ResponseEntity<>(extDeliveryNoteService.queryAll(whereJson,page),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增delivery") |
|||
@ApiOperation("新增delivery") |
|||
//@PreAuthorize("@el.check('extDeliveryNote:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody ExtDeliveryNoteDto dto){ |
|||
extDeliveryNoteService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改delivery") |
|||
@ApiOperation("修改delivery") |
|||
//@PreAuthorize("@el.check('extDeliveryNote:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody ExtDeliveryNoteDto dto){ |
|||
extDeliveryNoteService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除delivery") |
|||
@ApiOperation("删除delivery") |
|||
//@PreAuthorize("@el.check('extDeliveryNote:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
|||
extDeliveryNoteService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
|
|||
package org.nl.wms.sch.service; |
|||
|
|||
import org.nl.wms.sch.service.dto.ExtDeliveryNoteDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import java.util.Map; |
|||
import java.util.List; |
|||
import java.io.IOException; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
/** |
|||
* @description 服务接口 |
|||
* @author psh |
|||
* @date 2024-05-13 |
|||
**/ |
|||
public interface ExtDeliveryNoteService { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String,Object> |
|||
*/ |
|||
Map<String,Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* @param whereJson 条件参数 |
|||
* @return List<ExtDeliveryNoteDto> |
|||
*/ |
|||
List<ExtDeliveryNoteDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param note_id ID |
|||
* @return ExtDeliveryNote |
|||
*/ |
|||
ExtDeliveryNoteDto findById(String note_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* @param code code |
|||
* @return ExtDeliveryNote |
|||
*/ |
|||
ExtDeliveryNoteDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* @param dto / |
|||
*/ |
|||
void create(ExtDeliveryNoteDto dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* @param dto / |
|||
*/ |
|||
void update(ExtDeliveryNoteDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(String[] ids); |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package org.nl.wms.sch.service.dto; |
|||
|
|||
import lombok.Data; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description / |
|||
* @author psh |
|||
* @date 2024-05-13 |
|||
**/ |
|||
@Data |
|||
public class ExtDeliveryNoteDto implements Serializable { |
|||
|
|||
/** 主键ID */ |
|||
private String note_id; |
|||
|
|||
/** 任务号 */ |
|||
private String req_code; |
|||
|
|||
/** 出库单号 */ |
|||
private String deliveryno; |
|||
|
|||
/** 出库单行号 */ |
|||
private String deliverylineno; |
|||
|
|||
/** 物料 */ |
|||
private String sku; |
|||
|
|||
/** 立库代码 */ |
|||
private String lk_code; |
|||
|
|||
/** 拣货单号 */ |
|||
private String pickdetailkey; |
|||
|
|||
/** 出库数量 */ |
|||
private String qty; |
|||
|
|||
/** 出库时间 */ |
|||
private String outboundtime; |
|||
|
|||
/** 请求参数 */ |
|||
private String request_param; |
|||
|
|||
/** 响应结果 */ |
|||
private String response_param; |
|||
|
|||
/** 创建时间 */ |
|||
private String create_time; |
|||
|
|||
private String skudesc; |
|||
|
|||
private Integer status; |
|||
} |
@ -0,0 +1,115 @@ |
|||
|
|||
package org.nl.wms.sch.service.impl; |
|||
|
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.nl.exception.BadRequestException; |
|||
import org.nl.wms.sch.service.ExtDeliveryNoteService; |
|||
import org.nl.wms.sch.service.dto.ExtDeliveryNoteDto; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import org.springframework.data.domain.Pageable; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.alibaba.fastjson.JSON; |
|||
import org.nl.utils.SecurityUtils; |
|||
import org.nl.wql.core.bean.ResultBean; |
|||
import org.nl.wql.core.bean.WQLObject; |
|||
import org.nl.wql.util.WqlUtil; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
|
|||
/** |
|||
* @description 服务实现 |
|||
* @author psh |
|||
* @date 2024-05-13 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class ExtDeliveryNoteServiceImpl implements ExtDeliveryNoteService { |
|||
|
|||
@Override |
|||
public Map<String,Object> queryAll(Map form, Pageable page){ |
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
String where="1=1"; |
|||
JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(form)); |
|||
if (StrUtil.isNotEmpty(whereJson.getString("sku"))) { |
|||
where += " AND sku like ('%" + whereJson.get("sku") + "%')"; |
|||
} |
|||
if (StrUtil.isNotEmpty(whereJson.getString("status"))) { |
|||
where += " AND status = '" + whereJson.getString("status") + "'"; |
|||
} |
|||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page),where, "create_time desc"); |
|||
final JSONObject json = rb.pageResult(); |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<ExtDeliveryNoteDto> queryAll(Map whereJson){ |
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(ExtDeliveryNoteDto.class); |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ExtDeliveryNoteDto findById(String note_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
JSONObject json = wo.query("note_id = '" + note_id + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)){ |
|||
return json.toJavaObject( ExtDeliveryNoteDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ExtDeliveryNoteDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)){ |
|||
return json.toJavaObject( ExtDeliveryNoteDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(ExtDeliveryNoteDto dto) { |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ExtDeliveryNoteDto dto) { |
|||
ExtDeliveryNoteDto entity = this.findById(dto.getNote_id()); |
|||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(String[] ids) { |
|||
WQLObject wo = WQLObject.getWQLObject("ext_delivery_note"); |
|||
for (String note_id: ids) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("note_id", String.valueOf(note_id)); |
|||
param.put("status", "0"); |
|||
wo.update(param); |
|||
} |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue