diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 6291f9c..dd28b01 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.exception.BadRequestException; +import org.nl.modules.system.service.DictService; import org.nl.modules.system.util.CodeUtil; import org.nl.utils.SecurityUtils; import org.nl.utils.SpringContextHolder; @@ -21,6 +22,7 @@ import org.nl.wms.sch.service.TaskService; import org.nl.wms.sch.service.dto.TaskDto; import org.nl.wms.sch.tasks.*; import org.nl.wql.core.bean.WQLObject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,6 +36,8 @@ import java.util.Map; @Slf4j public class AcsToWmsServiceImpl implements AcsToWmsService { private final TaskService taskService; + @Autowired + private DictService dictService; /** * task_uuid:任务标识 @@ -427,10 +431,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String deliveryNo = json.getString("deliveryno"); String deliveryLineNo = json.getString("deliverylineno"); String sku = json.getString("sku"); - String lkCode = json.getString("lkCode"); - String pickDetailKey = json.getString("pickdetailkey"); + String lk_code = json.getString("lk_code"); + String pickdetailkey = json.getString("pickdetailkey"); String qty = json.getString("qty"); String outboundTime = json.getString("outboundtime"); + String skudesc = json.getString("skudesc"); WQLObject noteTab = WQLObject.getWQLObject("ext_delivery_note");//上游系统出库单表 JSONObject orderJson = new JSONObject(); JSONObject res = new JSONObject(); @@ -442,12 +447,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { orderJson.put("deliveryno", deliveryNo); orderJson.put("deliverylineno", deliveryLineNo); orderJson.put("sku", sku); - orderJson.put("lkCode", lkCode); - orderJson.put("pickdetailkey", pickDetailKey); + orderJson.put("skudesc",skudesc); + orderJson.put("lk_code", lk_code); + orderJson.put("pickdetailkey", pickdetailkey); orderJson.put("qty", qty); orderJson.put("outboundtime", outboundTime); orderJson.put("request_param", json); orderJson.put("create_time", DateUtil.now()); + orderJson.put("status", "0"); + JSONArray jsonArray=dictService.queryDetailByName("sku"); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jo = (JSONObject) jsonArray.get(i); + if(sku.equals(jo.getString("value"))){ + orderJson.put("status", "1"); + } + } res.put("statusCode", HttpStatus.OK.value()); res.put("isSuccess", true); res.put("errCode", 0); diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls b/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls index 2f53446..11a6ebd 100644 Binary files a/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls and b/lms/hd/nladmin-system/src/main/java/org/nl/wms/ext/wql/ext.xls differ diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/rest/PadController.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/rest/PadController.java index 1171705..ab8e248 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/rest/PadController.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/rest/PadController.java @@ -323,7 +323,7 @@ public class PadController { @PostMapping("/getOrderList") @Log("查询出库单") @ApiOperation("查询出库单") - public ResponseEntity getOrderList() { - return new ResponseEntity<>(padService.getOrderList(), HttpStatus.OK); + public ResponseEntity getOrderList(@RequestBody JSONObject param) { + return new ResponseEntity<>(padService.getOrderList(param), HttpStatus.OK); } } diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/PadService.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/PadService.java index 048d61a..9b4b1e9 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/PadService.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/PadService.java @@ -101,6 +101,6 @@ public interface PadService { */ JSONObject p2p(String startPointCode, String nextPointCode); - JSONObject getOrderList(); + JSONObject getOrderList(JSONObject param); } diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/impl/PadServiceImpl.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/impl/PadServiceImpl.java index 1c4b63b..f701e56 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/impl/PadServiceImpl.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pad/service/impl/PadServiceImpl.java @@ -460,10 +460,23 @@ public class PadServiceImpl implements PadService { } @Override - public JSONObject getOrderList() { + public JSONObject getOrderList(JSONObject param) { JSONObject res = new JSONObject(); + String where = "status=1"; + String sku=param.getString("sku"); + String startTime=param.getString("startTime"); + String endTime=param.getString("endTime"); + if(ObjectUtil.isNotEmpty(sku)){ + where += " AND sku like ('%" + sku + "%')"; + } + if(ObjectUtil.isNotEmpty(startTime)){ + where += " AND DATE_FORMAT(outboundtime, '%Y/%m/%d %H:%i:%s')>=DATE_FORMAT('" + startTime+"', '%Y/%m/%d %H:%i:%s')"; + } + if(ObjectUtil.isNotEmpty(endTime)){ + where += " AND DATE_FORMAT(outboundtime, '%Y/%m/%d %H:%i:%s')<=DATE_FORMAT('" + endTime+"', '%Y/%m/%d %H:%i:%s')"; + } JSONArray arrayList = WQLObject.getWQLObject("ext_delivery_note") - .query("", "create_time desc") + .query(where, "create_time desc") .getResultJSONArray(0); res.put("code", "1"); res.put("desc", "查询成功"); diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/ExtDeliveryNoteController.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/ExtDeliveryNoteController.java new file mode 100644 index 0000000..202b5bd --- /dev/null +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/ExtDeliveryNoteController.java @@ -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 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 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 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 delete(@RequestBody String[] ids) { + extDeliveryNoteService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/ExtDeliveryNoteService.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/ExtDeliveryNoteService.java new file mode 100644 index 0000000..6ac7457 --- /dev/null +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/ExtDeliveryNoteService.java @@ -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 + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * @param whereJson 条件参数 + * @return List + */ + List 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); + +} diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/ExtDeliveryNoteDto.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/ExtDeliveryNoteDto.java new file mode 100644 index 0000000..28af705 --- /dev/null +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/ExtDeliveryNoteDto.java @@ -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; +} diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/ExtDeliveryNoteServiceImpl.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/ExtDeliveryNoteServiceImpl.java new file mode 100644 index 0000000..378b2ef --- /dev/null +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/ExtDeliveryNoteServiceImpl.java @@ -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 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 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); + } + } + +}