jsk
This commit is contained in:
parent
018f23c782
commit
2556628c21
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.canteen.core.cook.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
|
@ -101,7 +103,18 @@ public class CookDishesController extends BaseController {
|
|||
@SysLog(title = "菜品信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除菜品信息")
|
||||
@PostMapping("/del/{dishesIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dishesIds) {
|
||||
return toAjax(cookDishesService.deleteCookDishesByDishesIds(dishesIds));
|
||||
try{
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map=cookDishesService.deleteCookDishesByDishesIds(dishesIds);
|
||||
String res=(String) map.get("msg");
|
||||
int data=(int) map.get("data");
|
||||
if(data==0){
|
||||
return AjaxResult.error(res);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping({"/import/check"})
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public interface CookDishesMapper {
|
|||
* @return 菜品计划详情id列表
|
||||
*/
|
||||
List<Long> selectDishPlanDetailIdByDishId(@Param("dishesIds") Long[] dishesIds,@Param("applyDate") String applyDate);
|
||||
|
||||
List<CookDishes> selectRecipeDishesByDishId(@Param("dishesId") Long dishesId);
|
||||
/**
|
||||
* 批量删除菜品信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.canteen.core.cook.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.canteen.core.cook.domain.CookDishes;
|
||||
import com.bonus.canteen.core.cook.dto.AppletDishesDetailDTO;
|
||||
import com.bonus.canteen.core.cook.dto.DishesConvertDTO;
|
||||
|
|
@ -56,7 +58,7 @@ public interface ICookDishesService {
|
|||
* @param dishesIds 需要删除的菜品信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCookDishesByDishesIds(Long[] dishesIds);
|
||||
public Map<String,Object> deleteCookDishesByDishesIds(Long[] dishesIds);
|
||||
|
||||
/**
|
||||
* 删除菜品信息信息
|
||||
|
|
|
|||
|
|
@ -205,14 +205,31 @@ public class CookDishesServiceImpl implements ICookDishesService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCookDishesByDishesIds(Long[] dishesIds) {
|
||||
//查询所有当天及之后的菜品计划detailId
|
||||
List<Long> detailIdList = cookDishesMapper.selectDishPlanDetailIdByDishId(dishesIds, DateUtils.getDate());
|
||||
//删除菜品计划cook_recipe_dishes 菜品计划菜品关联表
|
||||
if (detailIdList != null && !detailIdList.isEmpty()) {
|
||||
cookDishesMapper.deleteCookDishesByDishPlanDetailIds(detailIdList, dishesIds);
|
||||
public Map<String,Object> deleteCookDishesByDishesIds(Long[] dishesIds) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
String res="";
|
||||
for(Long lg:dishesIds){
|
||||
List<CookDishes> cookDishes=cookDishesMapper.selectRecipeDishesByDishId(lg);
|
||||
if(cookDishes!=null&&cookDishes.size()>0){
|
||||
res=res+cookDishes.get(0).getDishesName()+" ";
|
||||
}
|
||||
}
|
||||
return cookDishesMapper.deleteCookDishesByDishesIds(dishesIds);
|
||||
if(!"".equals(res)){
|
||||
res=res+"已加入菜谱!";
|
||||
map.put("msg",res);
|
||||
map.put("data",0);
|
||||
}else{
|
||||
//查询所有当天及之后的菜品计划detailId
|
||||
List<Long> detailIdList = cookDishesMapper.selectDishPlanDetailIdByDishId(dishesIds, DateUtils.getDate());
|
||||
//删除菜品计划cook_recipe_dishes 菜品计划菜品关联表
|
||||
if (detailIdList != null && !detailIdList.isEmpty()) {
|
||||
cookDishesMapper.deleteCookDishesByDishPlanDetailIds(detailIdList, dishesIds);
|
||||
}
|
||||
cookDishesMapper.deleteCookDishesByDishesIds(dishesIds);
|
||||
map.put("msg",res);
|
||||
map.put("data",1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.ims.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.ims.domain.CheckInventory;
|
||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||
import com.bonus.canteen.core.ims.dto.CheckInventoryMaterialDTO;
|
||||
import com.bonus.canteen.core.ims.dto.CheckInventoryPageDTO;
|
||||
import com.bonus.canteen.core.ims.vo.CheckInventoryMaterialVO;
|
||||
|
|
@ -69,4 +70,6 @@ public interface CheckInventoryMapper {
|
|||
|
||||
List<CheckInventoryPageVO> getDrpCheckInventoryPage(@Param("content") CheckInventoryPageDTO content);
|
||||
|
||||
void setData(String sqld);
|
||||
List<ImsIntoInventoryDetail> getData(String sqld);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,4 +95,6 @@ public interface ImsIntoInventoryMapper {
|
|||
public ImsIntoInventoryDetailVO selectImsIntoInventoryDetailListByIntoDetailId(@Param("intoDetailId") Long intoDetailId);
|
||||
|
||||
public List<ImsIntoInventoryDetailVO> selectDetailListByWarehouseIdAndMaterialId(ImsIntoInventory imsIntoInventory);
|
||||
|
||||
public List<ImsIntoInventoryDetailVO> selectImsIntoInventoryDetailListByInventoryIdD(Long inventoryId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.ims.service.impl;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -12,6 +13,12 @@ import cn.hutool.core.date.DateTime;
|
|||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.ims.domain.CheckInventoryDetail;
|
||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||
import com.bonus.canteen.core.ims.domain.param.ImsIntoInventoryAdd;
|
||||
import com.bonus.canteen.core.ims.domain.param.ImsIntoInventoryDetailAdd;
|
||||
import com.bonus.canteen.core.ims.domain.param.ImsOutInventoryAdd;
|
||||
import com.bonus.canteen.core.ims.domain.param.ImsOutInventoryDetailAdd;
|
||||
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryDetailVO;
|
||||
import com.bonus.canteen.core.ims.dto.CheckDetailDraftAddDTO;
|
||||
import com.bonus.canteen.core.ims.dto.CheckInventoryDraftAddDTO;
|
||||
import com.bonus.canteen.core.ims.dto.CheckInventoryMaterialDTO;
|
||||
|
|
@ -21,6 +28,9 @@ import com.bonus.canteen.core.ims.enums.CheckWayEnum;
|
|||
import com.bonus.canteen.core.ims.enums.DealWithStatusEnum;
|
||||
import com.bonus.canteen.core.ims.enums.IntoInventoryStatusEnum;
|
||||
import com.bonus.canteen.core.ims.mapper.CheckInventoryDetailMapper;
|
||||
import com.bonus.canteen.core.ims.mapper.ImsIntoInventoryMapper;
|
||||
import com.bonus.canteen.core.ims.service.IImsIntoInventoryService;
|
||||
import com.bonus.canteen.core.ims.service.IImsOutInventoryService;
|
||||
import com.bonus.canteen.core.ims.utils.NoGenerateUtils;
|
||||
import com.bonus.canteen.core.ims.vo.CheckInventoryAddVO;
|
||||
import com.bonus.canteen.core.ims.vo.CheckInventoryMaterialVO;
|
||||
|
|
@ -52,6 +62,14 @@ public class CheckInventoryServiceImpl implements ICheckInventoryService {
|
|||
@Resource
|
||||
private CheckInventoryDetailMapper checkDetailMapper;
|
||||
|
||||
@Resource
|
||||
private ImsIntoInventoryMapper imsintoInventoryMapper;
|
||||
|
||||
@Autowired
|
||||
private IImsOutInventoryService iimsOutInventoryService;
|
||||
|
||||
@Autowired
|
||||
private IImsIntoInventoryService iimsIntoInventoryService;
|
||||
/**
|
||||
* 查询库存盘点
|
||||
*
|
||||
|
|
@ -200,7 +218,73 @@ public class CheckInventoryServiceImpl implements ICheckInventoryService {
|
|||
checkInventory.setTotalProfitLoss(totalProfitLoss.toString());
|
||||
checkInventory.setCreateTime(DateUtils.getNowDate());
|
||||
checkInventory.setCreateBy(SecurityUtils.getUsername());
|
||||
checkInventoryMapper.insertCheckInventory(checkInventory);
|
||||
int dd=checkInventoryMapper.insertCheckInventory(checkInventory);
|
||||
|
||||
if(dd>0){
|
||||
for(CheckDetailDraftAddDTO vo:detailList){
|
||||
//盘点后实时修改库存数量
|
||||
|
||||
BigDecimal diffnum=vo.getDifferNum();
|
||||
if(diffnum.compareTo(new BigDecimal("0"))>0){
|
||||
//增加库存
|
||||
BigDecimal purNum=new BigDecimal("0");
|
||||
Long inventoryId=0L;
|
||||
|
||||
ImsIntoInventoryAdd imsIntoInventoryAdd =new ImsIntoInventoryAdd();
|
||||
imsIntoInventoryAdd.setWarehouseId(checkInventory.getWarehouseId());
|
||||
imsIntoInventoryAdd.setIntoDate(LocalDateTime.now());
|
||||
imsIntoInventoryAdd.setTotalNum(vo.getActualNum());
|
||||
imsIntoInventoryAdd.setIntoType(1L);
|
||||
imsIntoInventoryAdd.setStatus(2L);
|
||||
imsIntoInventoryAdd.setTotalAmount((long)vo.getActualAmount());
|
||||
|
||||
List<ImsIntoInventoryDetailAdd> imsintoInventoryDetailAddList=new ArrayList<>();
|
||||
ImsIntoInventoryDetailAdd imsintoInventoryDetailAdd=new ImsIntoInventoryDetailAdd();
|
||||
List<ImsIntoInventoryDetailVO> imsintoInventoryDetails= imsintoInventoryMapper.selectImsIntoInventoryDetailListByInventoryIdD(vo.getInventoryId());
|
||||
if(imsintoInventoryDetails!=null&&imsintoInventoryDetails.size()>0){
|
||||
imsintoInventoryDetailAdd.setMaterialId(imsintoInventoryDetails.get(0).getMaterialId());
|
||||
imsintoInventoryDetailAdd.setSupplierId(imsintoInventoryDetails.get(0).getSupplierId());
|
||||
imsintoInventoryDetailAdd.setUnitId(imsintoInventoryDetails.get(0).getUnitId());
|
||||
imsintoInventoryDetailAdd.setUnitPrice((long)vo.getPrice());
|
||||
imsintoInventoryDetailAdd.setTotalPrice((long)vo.getActualAmount());
|
||||
imsintoInventoryDetailAdd.setPurNum(vo.getDifferNum());
|
||||
imsintoInventoryDetailAdd.setProductDate(imsintoInventoryDetails.get(0).getProductDate());
|
||||
imsintoInventoryDetailAdd.setExpireTime(imsintoInventoryDetails.get(0).getExpireTime());
|
||||
imsintoInventoryDetailAddList.add(imsintoInventoryDetailAdd);
|
||||
imsIntoInventoryAdd.setImsIntoInventoryDetailAddList(imsintoInventoryDetailAddList);
|
||||
try{
|
||||
iimsIntoInventoryService.insertImsIntoInventory(imsIntoInventoryAdd);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else if(diffnum.compareTo(new BigDecimal("0"))<0){
|
||||
//减少库存
|
||||
ImsOutInventoryAdd imsOutInventoryAdd=new ImsOutInventoryAdd();
|
||||
imsOutInventoryAdd.setWarehouseId(checkInventory.getWarehouseId());
|
||||
imsOutInventoryAdd.setOutDate(LocalDateTime.now());
|
||||
imsOutInventoryAdd.setTotalNum(vo.getActualNum());
|
||||
imsOutInventoryAdd.setOutType(2L);
|
||||
imsOutInventoryAdd.setStatus(2L);
|
||||
imsOutInventoryAdd.setTotalAmount((long)vo.getActualAmount());
|
||||
|
||||
List<ImsOutInventoryDetailAdd> imsoutInventoryDetailAddList=new ArrayList<>();
|
||||
ImsOutInventoryDetailAdd imsoutInventoryDetailAdd=new ImsOutInventoryDetailAdd();
|
||||
imsoutInventoryDetailAdd.setInventoryId(vo.getInventoryId());
|
||||
imsoutInventoryDetailAdd.setFetchNum(vo.getDifferNum().abs());
|
||||
imsoutInventoryDetailAdd.setTotalPrice((long)vo.getActualAmount());
|
||||
imsoutInventoryDetailAddList.add(imsoutInventoryDetailAdd);
|
||||
imsOutInventoryAdd.setImsOutInventoryDetailAddList(imsoutInventoryDetailAddList);
|
||||
try{
|
||||
iimsOutInventoryService.insertImsOutInventory(imsOutInventoryAdd);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckDetailDraftAddDTO temp;
|
||||
for(Iterator var9 = detailList.iterator(); var9.hasNext(); totalProfitLoss = totalProfitLoss.add(new BigDecimal(temp.getDifferAmount()))) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
|
|||
@Override
|
||||
public ImsIntoInventoryVO selectImsIntoInventoryByIntoId(Long intoId)
|
||||
{
|
||||
return imsIntoInventoryMapper.selectImsIntoInventoryByIntoId(intoId);
|
||||
ImsIntoInventoryVO vo=new ImsIntoInventoryVO();
|
||||
vo=imsIntoInventoryMapper.selectImsIntoInventoryByIntoId(intoId);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public class CheckInventoryPageVO {
|
|||
|
||||
@ApiModelProperty("差异数")
|
||||
private String differNum;
|
||||
@ApiModelProperty("差异总额")
|
||||
private String differAmount;
|
||||
@ApiModelProperty("当前用户是否可以审批")
|
||||
private Boolean curUserApprove;
|
||||
@ApiModelProperty("签名")
|
||||
|
|
@ -314,4 +316,12 @@ public class CheckInventoryPageVO {
|
|||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getDifferAmount() {
|
||||
return differAmount;
|
||||
}
|
||||
|
||||
public void setDifferAmount(String differAmount) {
|
||||
this.differAmount = differAmount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,6 +327,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectDishPlanDetailIdByDishId" resultType="java.lang.Long">
|
||||
select recipe_detail_id from cook_recipe_detail where apply_date <![CDATA[ >= ]]> #{applyDate} and detail_type = '2'
|
||||
</select>
|
||||
<select id="selectRecipeDishesByDishId" resultType="com.bonus.canteen.core.cook.domain.CookDishes">
|
||||
select distinct a.dishes_id as dishesid,b.dishes_name as dishesname from cook_recipe_dishes a left join cook_dishes b on a.dishes_id=b.dishes_id where a.dishes_id = #{dishesId}
|
||||
</select>
|
||||
<select id="selectCookDishesMaterialList"
|
||||
resultType="com.bonus.canteen.core.cook.domain.CookDishesMaterial">
|
||||
select
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getDrpCheckInventoryPage" resultType="com.bonus.canteen.core.ims.vo.CheckInventoryPageVO">
|
||||
SELECT dci.check_id,
|
||||
select * from (
|
||||
SELECT dci.check_id,
|
||||
dci.check_code,
|
||||
dci.warehouse_id,
|
||||
dw.warehouse_name,
|
||||
|
|
@ -238,7 +239,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
dci.update_time,
|
||||
dci.deal_with_status,
|
||||
dci.total_profit_loss,
|
||||
dicd.differ_num,
|
||||
sum(replace(dicd.differ_num,'-','')) as differ_num,
|
||||
sum(replace(dicd.differ_amount,'-','')) as differamount,
|
||||
dci.process_instance_id,
|
||||
dw.area_id,
|
||||
aa.area_name,
|
||||
|
|
@ -288,6 +290,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</if>
|
||||
</where>
|
||||
order by dci.create_time desc
|
||||
group by dci.check_code
|
||||
) a
|
||||
order by create_time desc
|
||||
</select>
|
||||
<update id="setData" parameterType="java.lang.String">
|
||||
${sqld}
|
||||
</update>
|
||||
<select id="getData" parameterType="java.lang.String" resultType="com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail">
|
||||
${sqld}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -375,4 +375,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND inventory_num >= #{fetchNum}
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
<select id="selectImsIntoInventoryDetailListByInventoryIdD" resultMap="ImsIntoInventoryDetailResult">
|
||||
select into_detail_id,
|
||||
iiid.into_id,
|
||||
iiid.into_code,
|
||||
inventory_id,
|
||||
material_id,
|
||||
iiid.supplier_id,
|
||||
unit_id,
|
||||
size,
|
||||
unit_price,
|
||||
total_price,
|
||||
delivery_num,
|
||||
pur_num,
|
||||
unqualified_num,
|
||||
inventory_num,
|
||||
product_date,
|
||||
expire_time,
|
||||
img_url,
|
||||
if_fill_inventory,
|
||||
relate_order_goods_detail_id,
|
||||
relate_delivery_goods_detail_id,
|
||||
iiid.del_flag,
|
||||
iiid.create_by,
|
||||
iiid.create_time,
|
||||
iiid.update_by,
|
||||
iiid.update_time
|
||||
from ims_into_inventory_detail iiid
|
||||
left join ims_into_inventory iii on iii.into_id = iiid.into_id
|
||||
where iiid.inventory_id = #{inventoryId}
|
||||
and iii.status = '2'
|
||||
and iiid.inventory_num > 0
|
||||
and iiid.del_flag = '0'
|
||||
order by iii.into_date
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue