no message
parent
a10f08b432
commit
385522812a
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.domain;
|
||||||
|
|
||||||
|
import com.youchain.base.BaseEntity;
|
||||||
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import lombok.Data;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="data_pick")
|
||||||
|
public class Pick extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "`id`")
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`dept_id`",nullable = false)
|
||||||
|
@NotNull
|
||||||
|
@ApiModelProperty(value = "仓库")
|
||||||
|
private Dept dept;
|
||||||
|
@Column(name = "`code`")
|
||||||
|
@ApiModelProperty(value = "出库单头")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Column(name = "`line_no`")
|
||||||
|
@ApiModelProperty(value = "序号")
|
||||||
|
private int lineNo;
|
||||||
|
|
||||||
|
@Column(name = "`status`")
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`gd_detail_id`",nullable = false)
|
||||||
|
@NotNull
|
||||||
|
@ApiModelProperty(value = "关联工单明细")
|
||||||
|
private GdDetail gdDetail;
|
||||||
|
|
||||||
|
public void copy(Pick source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,4 +32,6 @@ public interface GdDetailRepository extends JpaRepository<GdDetail, Long>, JpaSp
|
||||||
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 " +
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 " +
|
||||||
" and (?2=null or g.bigItem.id=?2) and g.item.id=?3 and g.orderType=?4", nativeQuery = false)
|
" and (?2=null or g.bigItem.id=?2) and g.item.id=?3 and g.orderType=?4", nativeQuery = false)
|
||||||
List<GdDetail> findRepeat(Long gdId, Long bigItemId, Long itemId,String orderType);
|
List<GdDetail> findRepeat(Long gdId, Long bigItemId, Long itemId,String orderType);
|
||||||
|
@Query(value = "SELECT g FROM GdDetail g WHERE g.gd.id=?1 ", nativeQuery = false)
|
||||||
|
List<GdDetail> findByGd(Long gdId);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.repository;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificationExecutor<Pick> {
|
||||||
|
}
|
||||||
|
|
@ -81,7 +81,7 @@ public class MesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 生成 出库明细*/
|
/* 生成 出库明细*/
|
||||||
addPickDetail(gd);
|
gdService.addPickDetail(gd);
|
||||||
ApiResult apiResult=ApiResult.result(200,"成功",null);
|
ApiResult apiResult=ApiResult.result(200,"成功",null);
|
||||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
@ -161,8 +161,4 @@ public class MesController {
|
||||||
return bigBom;
|
return bigBom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** 拆分工单*/
|
|
||||||
private void splitGd(Gd gd) {
|
|
||||||
List<GdDetail> gdDetailList=gdDetailService.fingByDg(gd.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
|
import com.youchain.annotation.Log;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.businessdata.service.PickService;
|
||||||
|
import com.youchain.businessdata.service.dto.PickQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "pick管理")
|
||||||
|
@RequestMapping("/api/pick")
|
||||||
|
public class PickController {
|
||||||
|
|
||||||
|
private final PickService pickService;
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
@PreAuthorize("@el.check('pick:list')")
|
||||||
|
public void exportPick(HttpServletResponse response, PickQueryCriteria criteria) throws IOException {
|
||||||
|
pickService.download(pickService.queryAll(criteria), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询pick")
|
||||||
|
@ApiOperation("查询pick")
|
||||||
|
@PreAuthorize("@el.check('pick:list')")
|
||||||
|
public ResponseEntity<Object> queryPick(PickQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity<>(pickService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增pick")
|
||||||
|
@ApiOperation("新增pick")
|
||||||
|
@PreAuthorize("@el.check('pick:add')")
|
||||||
|
public ResponseEntity<Object> createPick(@Validated @RequestBody Pick resources){
|
||||||
|
return new ResponseEntity<>(pickService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改pick")
|
||||||
|
@ApiOperation("修改pick")
|
||||||
|
@PreAuthorize("@el.check('pick:edit')")
|
||||||
|
public ResponseEntity<Object> updatePick(@Validated @RequestBody Pick resources){
|
||||||
|
pickService.update(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Log("删除pick")
|
||||||
|
@ApiOperation("删除pick")
|
||||||
|
@PreAuthorize("@el.check('pick:del')")
|
||||||
|
public ResponseEntity<Object> deletePick(@RequestBody Long[] ids) {
|
||||||
|
pickService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -82,4 +82,7 @@ public interface GdService {
|
||||||
void download(List<GdDto> all, HttpServletResponse response) throws IOException;
|
void download(List<GdDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
Gd save(String orderNo, String taskCode, String station);
|
Gd save(String orderNo, String taskCode, String station);
|
||||||
|
|
||||||
|
/** 根据工单,申城出库明细*/
|
||||||
|
void addPickDetail(Gd gd);
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import com.youchain.basicdata.domain.Box;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.service.dto.BoxDto;
|
import com.youchain.basicdata.service.dto.BoxDto;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
import com.youchain.businessdata.domain.PickDetail;
|
import com.youchain.businessdata.domain.PickDetail;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||||
|
|
@ -114,4 +115,6 @@ public interface PickDetailService {
|
||||||
PickDetail toEntity(PickDetailDto pickDetailDto);
|
PickDetail toEntity(PickDetailDto pickDetailDto);
|
||||||
|
|
||||||
PickDetail createPickDetail(Item item,String po);
|
PickDetail createPickDetail(Item item,String po);
|
||||||
|
|
||||||
|
void save(Pick pick);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.businessdata.service.dto.PickDto;
|
||||||
|
import com.youchain.businessdata.service.dto.PickQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description 服务接口
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
public interface PickService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
Map<String,Object> queryAll(PickQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<PickDto>
|
||||||
|
*/
|
||||||
|
List<PickDto> queryAll(PickQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param id ID
|
||||||
|
* @return PickDto
|
||||||
|
*/
|
||||||
|
PickDto findById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param resources /
|
||||||
|
* @return PickDto
|
||||||
|
*/
|
||||||
|
PickDto create(Pick resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param resources /
|
||||||
|
*/
|
||||||
|
void update(Pick resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<PickDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
Pick save(GdDetail gdDetail, int no);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PickDto implements Serializable {
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 创建人 */
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 修改人 */
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
/** 修改时间 */
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
/** 仓库ID */
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/** 出库单头 */
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/** 序号 */
|
||||||
|
private String lineNo;
|
||||||
|
|
||||||
|
/** 状态 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 关联工单明细 */
|
||||||
|
private String gdDetaiId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
import com.youchain.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PickQueryCriteria{
|
||||||
|
|
||||||
|
/** 模糊 */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/** 模糊 */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String gdDetaiId;
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,11 @@
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.businessdata.domain.Gd;
|
import com.youchain.businessdata.domain.Gd;
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.businessdata.repository.GdDetailRepository;
|
||||||
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
|
import com.youchain.businessdata.service.PickService;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.modules.system.service.DeptService;
|
import com.youchain.modules.system.service.DeptService;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
|
|
@ -47,6 +52,9 @@ import java.util.LinkedHashMap;
|
||||||
public class GdServiceImpl implements GdService {
|
public class GdServiceImpl implements GdService {
|
||||||
|
|
||||||
private final GdRepository gdRepository;
|
private final GdRepository gdRepository;
|
||||||
|
private final GdDetailRepository gdDetailRepository;
|
||||||
|
private final PickService pickService;
|
||||||
|
private final PickDetailService pickDetailService;
|
||||||
private final DeptService deptService;
|
private final DeptService deptService;
|
||||||
private final GdMapper gdMapper;
|
private final GdMapper gdMapper;
|
||||||
|
|
||||||
|
|
@ -125,4 +133,17 @@ public class GdServiceImpl implements GdService {
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPickDetail(Gd gd) {
|
||||||
|
int no=1;// 序号
|
||||||
|
List<GdDetail> gdDetailList=gdDetailRepository.findByGd(gd.getId());
|
||||||
|
for(GdDetail gdDetail : gdDetailList) {
|
||||||
|
/*生成出库单*/
|
||||||
|
Pick pick = pickService.save(gdDetail,no);
|
||||||
|
no=no+1;
|
||||||
|
/*生成出库明细*/
|
||||||
|
pickDetailService.save(pick);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,10 +24,7 @@ import com.youchain.basicdata.repository.StockRepository;
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.domain.Inventory;
|
|
||||||
import com.youchain.businessdata.domain.PickDetail;
|
|
||||||
import com.youchain.businessdata.domain.Task;
|
|
||||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||||
import com.youchain.businessdata.repository.InventoryRepository;
|
import com.youchain.businessdata.repository.InventoryRepository;
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
import com.youchain.businessdata.repository.TaskRepository;
|
||||||
|
|
@ -335,4 +332,9 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(Pick pick) {
|
||||||
|
GdDetail gdDetail=pick.getGdDetail();
|
||||||
|
gdDetail.getItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.GdDetail;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.utils.*;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import com.youchain.businessdata.repository.PickRepository;
|
||||||
|
import com.youchain.businessdata.service.PickService;
|
||||||
|
import com.youchain.businessdata.service.dto.PickDto;
|
||||||
|
import com.youchain.businessdata.service.dto.PickQueryCriteria;
|
||||||
|
import com.youchain.businessdata.service.mapstruct.PickMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description 服务实现
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PickServiceImpl implements PickService {
|
||||||
|
|
||||||
|
private final PickRepository pickRepository;
|
||||||
|
private final PickMapper pickMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryAll(PickQueryCriteria criteria, Pageable pageable){
|
||||||
|
Page<Pick> page = pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
return PageUtil.toPage(page.map(pickMapper::toDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PickDto> queryAll(PickQueryCriteria criteria){
|
||||||
|
return pickMapper.toDto(pickRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PickDto findById(Long id) {
|
||||||
|
Pick pick = pickRepository.findById(id).orElseGet(Pick::new);
|
||||||
|
ValidationUtil.isNull(pick.getId(),"Pick","id",id);
|
||||||
|
return pickMapper.toDto(pick);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public PickDto create(Pick resources) {
|
||||||
|
return pickMapper.toDto(pickRepository.save(resources));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(Pick resources) {
|
||||||
|
Pick pick = pickRepository.findById(resources.getId()).orElseGet(Pick::new);
|
||||||
|
ValidationUtil.isNull( pick.getId(),"Pick","id",resources.getId());
|
||||||
|
pick.copy(resources);
|
||||||
|
pickRepository.save(pick);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Long[] ids) {
|
||||||
|
for (Long id : ids) {
|
||||||
|
pickRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<PickDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (PickDto pick : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("创建人", pick.getCreateBy());
|
||||||
|
map.put("修改人", pick.getUpdateBy());
|
||||||
|
map.put("创建时间", pick.getCreateTime());
|
||||||
|
map.put("修改时间", pick.getUpdateTime());
|
||||||
|
map.put("仓库ID", pick.getDeptId());
|
||||||
|
map.put("出库单头", pick.getCode());
|
||||||
|
map.put("序号", pick.getLineNo());
|
||||||
|
map.put("状态", pick.getStatus());
|
||||||
|
map.put("关联工单明细", pick.getGdDetaiId());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Pick save(GdDetail gdDetail, int no) {
|
||||||
|
Pick pick=new Pick();
|
||||||
|
pick.setGdDetail(gdDetail);
|
||||||
|
pick.setLineNo(no);
|
||||||
|
pick.setCode(gdDetail.getGd().getName()+"_"+no);
|
||||||
|
pick.setDept(UserUtils.getDept());
|
||||||
|
pickRepository.save(pick);
|
||||||
|
return pick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service.mapstruct;
|
||||||
|
|
||||||
|
import com.youchain.base.BaseMapper;
|
||||||
|
import com.youchain.businessdata.domain.Pick;
|
||||||
|
import com.youchain.businessdata.service.dto.PickDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author huojin
|
||||||
|
* @date 2024-06-11
|
||||||
|
**/
|
||||||
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface PickMapper extends BaseMapper<PickDto, Pick> {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue