| package doumeemes.api.ext; | 
|   | 
| import com.alibaba.fastjson.JSONObject; | 
| import doumeemes.api.BaseController; | 
| import doumeemes.config.rocketmq.RocketMessageProducer; | 
| import doumeemes.core.annotation.pr.PreventRepeat; | 
| import doumeemes.core.model.ApiResponse; | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.core.utils.Constants; | 
| import doumeemes.dao.business.dto.AutoWorkReportDTO; | 
| import doumeemes.dao.business.dto.CreateMaterialDTO; | 
| import doumeemes.dao.business.dto.DealWorkorderRecordDTO; | 
| import doumeemes.dao.business.model.Workorder; | 
| import doumeemes.dao.business.model.WorkorderRecord; | 
| import doumeemes.dao.ext.bean.EndCheckApBean; | 
| import doumeemes.dao.ext.beanDto.QueryWStockDto; | 
| import doumeemes.dao.ext.dto.QuerySalaryStatisticDTO; | 
| import doumeemes.dao.ext.dto.QueryUserSalaryListDTO; | 
| import doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO; | 
| import doumeemes.dao.ext.vo.*; | 
| import doumeemes.service.business.WorkorderRecordService; | 
| import doumeemes.service.ext.WorkorderExtService; | 
| import doumeemes.service.ext.WorkorderRecordExtService; | 
| import doumeemes.service.ext.WorkorderRecordStandardService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import javax.servlet.http.HttpServletResponse; | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 工单生产过程记录接口 | 
|  * @author 江蹄蹄 | 
|  * @date 2022/04/20 10:56 | 
|  */ | 
| @RestController | 
| @RequestMapping("/ext/workorderRecordExt") | 
| @Api(tags = "工单生产过程记录接口") | 
| public class   WorkorderRecordExtController extends BaseController { | 
|   | 
|     @Autowired | 
|     private WorkorderRecordExtService workorderRecordExtService; | 
|     @Autowired | 
|     private WorkorderExtService workorderExtService; | 
|     @Autowired | 
|     private WorkorderRecordService workorderRecordService; | 
|     @Autowired | 
|     private WorkorderRecordStandardService workorderRecordStandardService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建投料") | 
|     @PostMapping("/createMaterial") | 
|     @RequiresPermissions("ext:workorderrecordext:create") | 
|     public ApiResponse createMaterial(@RequestBody CreateMaterialDTO param) { | 
|         return ApiResponse.success(workorderRecordExtService.createMaterial(param)); | 
|     } | 
|   | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建投料 - 标准版") | 
|     @PostMapping("/createMaterialStandard") | 
|     @RequiresPermissions("ext:workorderrecordext:create") | 
|     public ApiResponse createMaterialStandard(@RequestBody CreateMaterialDTO param) { | 
|         return ApiResponse.success(workorderRecordStandardService.createMaterialStandard(param)); | 
|     } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("确认报工") | 
|     @PostMapping("/comfirmDone") | 
|     @RequiresPermissions("ext:workorderrecordext:create") | 
|     public ApiResponse comfirmDone(@RequestBody Workorder param) { | 
|         Integer id =workorderRecordExtService.comfirmDone(param); | 
|         //发送消息队列处理分享操作 | 
|         workorderExtService.statisticNum(param); | 
| //        RocketMessageProducer.producerMsg(Constants.MQ_TAG.statistics,null, JSONObject.toJSONString(param)); | 
| //        rabbitTemplate.convertAndSend(Constants.MqTopicKeys.TOPIC_STATISTIC_NUM, Constants.MqTopicKeys.TOPIC_STATISTIC_NUM, JSONObject.toJSONString(param)); | 
|         return ApiResponse.success(id); | 
|     } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation(value = "确认报工" ,notes = "1.0.2更新") | 
|     @PostMapping("/comfirmDoneStandard") | 
|     @RequiresPermissions("ext:workorderrecordext:create") | 
|     public ApiResponse comfirmDoneStandard(@RequestBody AutoWorkReportDTO autoWorkReportDTO) { | 
|         Workorder workorder =workorderRecordStandardService.comfirmDoneNew(autoWorkReportDTO,true); | 
|         //发送消息队列处理分享操作 | 
|         workorderExtService.statisticNumAsync(workorder); | 
|         return ApiResponse.success("操作成功"); | 
|     } | 
|   | 
|   | 
| //    @PreventRepeat | 
| //    @ApiOperation("确认报工(弃用)") | 
| //    @PostMapping("/comfirmDoneStandard") | 
| //    @RequiresPermissions("ext:workorderrecordext:create") | 
| //    public ApiResponse comfirmDoneStandard(@RequestBody Workorder param) { | 
| //        Integer id =workorderRecordStandardService.comfirmDone(param,true); | 
| //        //发送消息队列处理分享操作 | 
| //        workorderExtService.statisticNum(param); | 
| //        RocketMessageProducer.producerMsg(Constants.MQ_TAG.statistics,null, JSONObject.toJSONString(param)); | 
| //        rabbitTemplate.convertAndSend(Constants.MqTopicKeys.TOPIC_STATISTIC_NUM, Constants.MqTopicKeys.TOPIC_STATISTIC_NUM, JSONObject.toJSONString(param)); | 
| //        return ApiResponse.success(""); | 
| //    } | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建产出") | 
|     @PostMapping("/createProduce") | 
|     @RequiresPermissions("ext:workorderrecordext:create") | 
|     public ApiResponse createProduce(@RequestBody CreateMaterialDTO param) { | 
|         return ApiResponse.success(workorderRecordExtService.createProduce(param)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除产出/投料") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("ext:workorderrecordext:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         workorderRecordExtService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除产出/投料") | 
|     @GetMapping("/delete/batch") | 
|     @RequiresPermissions("ext:workorderrecordext:delete") | 
|     public ApiResponse deleteByIds(@RequestParam String ids) { | 
|         String [] idArray = ids.split(","); | 
|         List<Integer> idList = new ArrayList<>(); | 
|         for (String id : idArray) { | 
|             idList.add(Integer.valueOf(id)); | 
|         } | 
|         workorderRecordExtService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("根据ID修改产出/投料数量") | 
|     @PostMapping("/updateById") | 
|     @RequiresPermissions("ext:workorderrecordext:update") | 
|     public ApiResponse updateById(@RequestBody WorkorderRecord workorderRecord) { | 
|         workorderRecordExtService.updateById(workorderRecord); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse<PageData<WorkorderRecordExtListVO>> findPage (@RequestBody PageWrap<QueryWorkorderRecordExtDTO> pageWrap) { | 
|         return ApiResponse.success(workorderRecordExtService.findPage(pageWrap)); | 
|     } | 
|     @ApiOperation("员工绩效分页查询") | 
|     @PostMapping("/userSalary") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse<PageData<UserSalaryListVO>> userSalaryPage (@RequestBody PageWrap<QueryUserSalaryListDTO> pageWrap) { | 
|         return ApiResponse.success(workorderRecordExtService.userSalaryPage(pageWrap)); | 
|     } | 
|     @ApiOperation("工资报表统计分页查询") | 
|     @PostMapping("/salaryStatistic") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse<PageData<SalaryStatisticsListVO>> salaryStatistic (@RequestBody PageWrap<QuerySalaryStatisticDTO> pageWrap) { | 
|         return ApiResponse.success(workorderRecordExtService.salaryStatistic(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("查询全部") | 
|     @PostMapping("/all") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse<List<WorkorderRecordExtListVO>> findAll (@RequestBody QueryWorkorderRecordExtDTO pageWrap) { | 
|         return ApiResponse.success(workorderRecordExtService.findAll(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("查询全部 - 标准") | 
|     @PostMapping("/allForStandard") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse<List<WStockExtListForWorkorderVO>> findAllForStandard (@RequestBody QueryWorkorderRecordExtDTO pageWrap) { | 
|         return ApiResponse.success(workorderRecordStandardService.findAllForStandard(pageWrap)); | 
|     } | 
|   | 
|   | 
|   | 
|     @ApiOperation("生产产出导出Excel") | 
|     @PostMapping("/exportExcel") | 
|    // @RequiresPermissions("ext:workorderrecordext:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<QueryWorkorderRecordExtDTO> pageWrap, HttpServletResponse response) { | 
|         workorderRecordExtService.exportExcel(pageWrap,response); | 
|     } | 
|   | 
|     @ApiOperation("生产投料导出Excel") | 
|     @PostMapping("/exportExcelFeeding") | 
|     public void exportExcelFeeding(@RequestBody PageWrap<QueryWorkorderRecordExtDTO> pageWrap ,HttpServletResponse response){ | 
|         workorderRecordExtService.exportExcel2(pageWrap,response); | 
|     } | 
|     @ApiOperation("导出员工绩效明细") | 
|     @PostMapping("/exportUserSalary") | 
|     public void exportUserSalary (@RequestBody PageWrap<QueryUserSalaryListDTO> pageWrap, HttpServletResponse response) { | 
|         workorderRecordExtService.exportUserSalary(pageWrap,response); | 
|     } | 
|     @ApiOperation("导出工资报表") | 
|     @PostMapping("/exportSalaryStatistics") | 
|     public void exportSalaryStatistics (@RequestBody PageWrap<QuerySalaryStatisticDTO> pageWrap, HttpServletResponse response) { | 
|         workorderRecordExtService.exportSalaryStatistics(pageWrap,response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @RequiresPermissions("ext:workorderrecordext:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(workorderRecordService.findById(id)); | 
|     } | 
|   | 
|   | 
|   | 
|     @ApiOperation("终检工装扫描") | 
|     @GetMapping("/getEndCheckAP") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "workOrderId", value = "工单主键" , required = true), | 
|             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "appliancesId", value = "工装器具主键" , required = true), | 
|     }) | 
|     public ApiResponse<EndCheckApBean> getEndCheckAP(@RequestParam String workOrderId, @RequestParam String appliancesId) { | 
|         return ApiResponse.success(workorderRecordExtService.getWOutboundRecordAp(workOrderId,appliancesId)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("生成产出记录 - standard") | 
|     @PostMapping("/dealWorkorderRecordStandard") | 
|     public ApiResponse<WorkorderRecord> dealWorkorderRecordStandard (@RequestBody DealWorkorderRecordDTO dealWorkorderRecordDTO) { | 
|         return ApiResponse.success(workorderRecordStandardService.dealWorkorderRecord(dealWorkorderRecordDTO,getLoginUser())); | 
|     } | 
|   | 
|     @ApiOperation("查询产出记录列表") | 
|     @GetMapping("/getWorkorderRecordListStandard") | 
|     public ApiResponse<List<WorkorderRecord>> getWorkorderRecordListStandard(@RequestParam Integer workorderId) { | 
|         return ApiResponse.success(workorderRecordStandardService.getWorkorderRecordList(workorderId)); | 
|     } | 
|   | 
|     @ApiOperation("根据工单查询可用库存") | 
|     @PostMapping("/choiceStockPageForStandard") | 
|     public ApiResponse<PageData<WStockExtListVO>> choiceStockPageForStandard (@RequestBody PageWrap<QueryWStockDto> pageWrap) { | 
|         return ApiResponse.success(workorderRecordStandardService.choiceStockPageForWorkorder(pageWrap,getLoginUser())); | 
|     } | 
|   | 
|     @ApiOperation("根据供需计划查询可用库存") | 
|     @PostMapping("/getStockByPlansForStandard") | 
|     public ApiResponse<PageData<WStockExtListVO>> getStockByPlansForStandard (@RequestBody PageWrap<QueryWStockDto> pageWrap) { | 
|         return ApiResponse.success(workorderRecordStandardService.choiceStockPageForPlans(pageWrap,getLoginUser())); | 
|     } | 
|   | 
| } |