食材进销
This commit is contained in:
1 parent
01095ce445
commit
4d4dfaf7e9
6 files changed
+78
-19
No files matched your search
+1
-1
@@ -70,7 +70,7 @@ public class CanteenInventoryRecordsEntity extends Model<CanteenInventoryRecords
|
||||
* 审批人id
|
||||
*/
|
||||
@Schema(description="审批人id")
|
||||
private String checkUserId;
|
||||
private Long checkUserId;
|
||||
|
||||
/**
|
||||
* 审核日期
|
||||
|
||||
+10
@@ -82,6 +82,16 @@ public class CanteenInventoryRecordsController {
|
||||
return R.ok(canteenInventoryRecordsService.saveCanteenInventoryRecordsdDTO(canteenInventoryRecordsdDTO));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "采购验收" , description = "采购验收" )
|
||||
@SysLog("采购验收" )
|
||||
@PostMapping("/ys")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenInventoryRecords_ys')" )
|
||||
public R ys(@RequestParam Long id) {
|
||||
canteenInventoryRecordsService.ys(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购记录表
|
||||
* @param canteenInventoryRecordEditDTO 采购记录表
|
||||
|
||||
+2
@@ -42,4 +42,6 @@ public interface CanteenInventoryRecordsService extends IService<CanteenInventor
|
||||
|
||||
|
||||
Object removeBatch(List<Long> list);
|
||||
|
||||
void ys(Long id);
|
||||
}
|
||||
+62
-16
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -54,7 +55,8 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
Long deptId = SecurityUtils.getUser().getDeptId();
|
||||
CanteenInventoryRecordsEntity canteenInventoryRecordsEntity= BeanUtils.toBean(canteenInventoryRecordsdDTO, CanteenInventoryRecordsEntity.class);
|
||||
canteenInventoryRecordsEntity.setDeptId(deptId);
|
||||
canteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
canteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
// canteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
baseMapper.insert(canteenInventoryRecordsEntity);
|
||||
Long id = canteenInventoryRecordsEntity.getId();
|
||||
|
||||
@@ -62,32 +64,32 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
List<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityList = BeanUtils.toBean(canteenInventoryRecordsItemDTOS, CanteenInventoryRecordsItemEntity.class);
|
||||
|
||||
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
// List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
for (CanteenInventoryRecordsItemEntity canteenInventoryRecordsItemEntity : canteenInventoryRecordsItemEntityList){
|
||||
canteenInventoryRecordsItemEntity.setInventoryId(id);
|
||||
canteenInventoryRecordsItemEntity.setDeptId(deptId);
|
||||
String orderType = canteenInventoryRecordsEntity.getOrderType();
|
||||
canteenInventoryRecordsItemEntity.setOrderType(orderType);
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(canteenInventoryRecordsItemEntity.getErpMaterialId());
|
||||
// UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
// updateStockDTO.setId(canteenInventoryRecordsItemEntity.getErpMaterialId());
|
||||
Double quantity = canteenInventoryRecordsItemEntity.getQuantity();
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.No.getType())){
|
||||
// if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
// updateStockDTO.setIncrCount(quantity);
|
||||
// }else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
// updateStockDTO.setIncrCount(-quantity);
|
||||
// }else if (orderType.equals(OrderTypeEnum.No.getType())){
|
||||
//无需更新库存
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
// }else {
|
||||
// throw new RuntimeException("订单类型错误");
|
||||
// }
|
||||
// updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
|
||||
canteenInventoryRecordsItemMapper.insert(canteenInventoryRecordsItemEntityList);
|
||||
|
||||
if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
canteenStockService.updateStock(updateStockDTOS);
|
||||
}
|
||||
// if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
// canteenStockService.updateStock(updateStockDTOS);
|
||||
// }
|
||||
|
||||
return id;
|
||||
}
|
||||
@@ -238,4 +240,48 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
canteenStockService.updateStock(updateStockDTOS);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 采购验收
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void ys(Long id) {
|
||||
CanteenInventoryRecordsEntity canteenInventoryRecordsEntity = baseMapper.selectById(id);
|
||||
LambdaQueryWrapper<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenInventoryRecordsItemEntityLambdaQueryWrapper.eq(CanteenInventoryRecordsItemEntity::getInventoryId, id);
|
||||
List<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityList = canteenInventoryRecordsItemMapper.selectList(canteenInventoryRecordsItemEntityLambdaQueryWrapper);
|
||||
|
||||
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
for (CanteenInventoryRecordsItemEntity canteenInventoryRecordsItemEntity : canteenInventoryRecordsItemEntityList){
|
||||
String orderType = canteenInventoryRecordsEntity.getOrderType();
|
||||
canteenInventoryRecordsItemEntity.setOrderType(orderType);
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(canteenInventoryRecordsItemEntity.getErpMaterialId());
|
||||
Double quantity = canteenInventoryRecordsItemEntity.getQuantity();
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.No.getType())){
|
||||
//无需更新库存
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
canteenStockService.updateStock(updateStockDTOS);
|
||||
CanteenInventoryRecordsEntity updateCanteenInventoryRecordsEntity = new CanteenInventoryRecordsEntity();
|
||||
updateCanteenInventoryRecordsEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
updateCanteenInventoryRecordsEntity.setId(id);
|
||||
updateCanteenInventoryRecordsEntity.setCheckTime(LocalDateTime.now());
|
||||
updateCanteenInventoryRecordsEntity.setCheckUserId(SecurityUtils.getUser().getId());
|
||||
baseMapper.updateById(canteenInventoryRecordsEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -22,6 +22,7 @@
|
||||
m.id,
|
||||
m.name,
|
||||
m.unit,
|
||||
m.category_id,
|
||||
m.purchase_price,
|
||||
s.base_stock AS baseStock,
|
||||
s.inventory_upper_limit AS inventoryUpperLimit,
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@
|
||||
</resultMap>
|
||||
<select id="selectPageDataByScope"
|
||||
resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO">
|
||||
SELECT r.id, r.inventory_code,r.inventory_date, COALESCE(GROUP_CONCAT(m.name ORDER BY m.name SEPARATOR ','), '') AS product_name,r.remark,r.total_amount,s.supplier_name
|
||||
FROM `canteen_inventory_records` r
|
||||
SELECT r.id, r.inventory_code,r.inventory_date, COALESCE(GROUP_CONCAT(m.name ORDER BY m.name SEPARATOR ','), '') AS product_name,r.remark,r.total_amount,s.supplier_name,
|
||||
r.check_status FROM `canteen_inventory_records` r
|
||||
LEFT JOIN canteen_inventory_records_item i
|
||||
on r.id=i.inventory_id
|
||||
LEFT JOIN canteen_erp_material m
|
||||
|
||||
Reference in new issue
Block a user