|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.Cools; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.R; | 
|---|
|  |  |  | import com.vincent.rsf.framework.exception.CoolException; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.constant.Constants; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.domain.BaseParam; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.domain.PageParam; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.utils.FieldsUtils; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.entity.DeviceSite; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.entity.LocItem; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.enums.LocStsType; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.enums.TaskResouceType; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.service.DeviceSiteService; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.service.LocItemService; | 
|---|
|  |  |  | import com.vincent.rsf.server.system.controller.BaseController; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<LocItem> locItemQueryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | if (null != map.get("matnr") && !Cools.isEmpty(map.get("matnr"))){ | 
|---|
|  |  |  | locItemQueryWrapper.eq("matnr_code", map.get("matnr")); | 
|---|
|  |  |  | }else if(null != map.get("maktx") && !Cools.isEmpty(map.get("maktx"))){ | 
|---|
|  |  |  | locItemQueryWrapper.eq("maktx", map.get("maktx")); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | return R.error("物料编码为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | param.setType(Constants.TASK_TYPE_OUT_STOCK); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | locItemService.generateTask(param, getLoginUserId()); | 
|---|
|  |  |  | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | throw new RuntimeException(e); | 
|---|
|  |  |  | throw new CoolException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|