| | |
| | | package com.consum.base.controller; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.consum.base.pojo.*; |
| | | import com.consum.base.pojo.excel.ImportProcureOrderTemplate; |
| | | import com.consum.base.pojo.excel.LWhFormTransferTemplate; |
| | | import com.consum.base.pojo.query.WarehouseQry; |
| | | import com.consum.base.service.*; |
| | | import com.consum.base.util.DateUtil; |
| | | import com.consum.base.util.ExcelStyleUtil; |
| | | import com.consum.model.po.*; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pc/l/wh/form/transfer") |
| | | @Api(value = "调拨分发管理", tags = "调拨分发管理") |
| | | // @Api(value = "调拨分发管理", tags = "调拨分发管理") |
| | | public class LWhFormTransferController extends BaseController { |
| | | |
| | | @Autowired |
| | |
| | | /** |
| | | * @Description 新增 |
| | | */ |
| | | @ApiOperation(value = "单据新增", notes = "单据新增") |
| | | @ApiImplicitParam(name = "param", value = "单据新增", required = true, dataType = "LWhFormTransferParam") |
| | | // @ApiOperation(value = "单据新增", notes = "单据新增") |
| | | // @ApiImplicitParam(name = "param", value = "单据新增", required = true, dataType = "LWhFormTransferParam") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResponseValue add() throws Exception { |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("import") |
| | | public ResponseValue upload(@RequestBody String idStr) throws Exception { |
| | |
| | | * <p> |
| | | * 2.查询物品型号 |
| | | */ |
| | | @ApiOperation(value = "单据列表查询", notes = "单据列表查询") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "param", value = "条件参数", required = true, dataType = "TransferQry"),}) |
| | | // @ApiOperation(value = "单据列表查询", notes = "单据列表查询") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "int"), |
| | | // @ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "int"), |
| | | // @ApiImplicitParam(name = "param", value = "条件参数", required = true, dataType = "TransferQry"),}) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormTransferList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | // @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id) { |
| | | if (id == null) { |
| | |
| | | return ResponseValue.success(vo); |
| | | } |
| | | |
| | | @ApiOperation(value = "调拨明细列表", notes = "调拨明细列表") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "条件", required = true, dataType = "TransferQry"),}) |
| | | // @ApiOperation(value = "调拨明细列表", notes = "调拨明细列表") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "条件", required = true, dataType = "TransferQry"),}) |
| | | @GetMapping("/detail/list") |
| | | public ResponseValue queryFormTransferDetailList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "撤销", notes = "撤销") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | // @ApiOperation(value = "撤销", notes = "撤销") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/updStatus") |
| | | public ResponseValue updateStatus(Long id) { |
| | | if (id == null) { |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨入库", notes = "调拨入库") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | // @ApiOperation(value = "调拨入库", notes = "调拨入库") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/income") |
| | | public ResponseValue income(Long id) throws Exception { |
| | | lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser(), null); |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨出库", notes = "调拨出库") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | // @ApiOperation(value = "调拨出库", notes = "调拨出库") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/output") |
| | | public ResponseValue output(Long id) throws Exception { |
| | | |
| | |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "调拨单导出", notes = "调拨单导出") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "type", value = "导出类型 1 入库 2 出库", required = true, dataType = "Integer"),}) |
| | | // @ApiOperation(value = "调拨单导出", notes = "调拨单导出") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | // @ApiImplicitParam(name = "type", value = "导出类型 1 入库 2 出库", required = true, dataType = "Integer"),}) |
| | | @GetMapping("/list/export") |
| | | public ResponseValue<String> export(Long id, Integer type, HttpServletResponse response) throws Exception { |
| | | |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "部门物品分发列表明细", notes = "部门物品分发列表明细") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "transferQryDto", value = "调拨单查询条件", required = true)}) |
| | | // @ApiOperation(value = "部门物品分发列表明细", notes = "部门物品分发列表明细") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "transferQryDto", value = "调拨单查询条件", required = true)}) |
| | | @GetMapping("/department/list") |
| | | public ResponseValue departmentTransferList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | return ResponseValue.success(transferInfoDetailsVoGenericPager); |
| | | } |
| | | |
| | | @ApiOperation(value = "使用人修改", notes = "使用人修改") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "procureModelInfoDto", value = "使用信息", required = true)}) |
| | | // @ApiOperation(value = "使用人修改", notes = "使用人修改") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "procureModelInfoDto", value = "使用信息", required = true)}) |
| | | @PostMapping("/useInfo/update") |
| | | public ResponseValue infoUpdate() { |
| | | |
| | |
| | | * @param transferOrderId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "部门物品使用人记录", notes = "部门物品使用人记录") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "transferOrderId", value = "调拨单id", required = true)}) |
| | | // @ApiOperation(value = "部门物品使用人记录", notes = "部门物品使用人记录") |
| | | // @ApiImplicitParams({@ApiImplicitParam(name = "transferOrderId", value = "调拨单id", required = true)}) |
| | | @GetMapping("/use/record") |
| | | public ResponseValue useRecord(Long transferOrderId) { |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | |
| | | return ResponseValue.success(goodsUseRecordList); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询部门下的分发单", notes = "查询部门下的分发单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query")}) |
| | | // @ApiOperation(value = "查询部门下的分发单", notes = "查询部门下的分发单") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/query/transfList") |
| | | public ResponseValue queryDepartmentTransferOrderList() { |
| | | |
| | |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "分发单导入", notes = "分发单导入") |
| | | // @ApiOperation(value = "分发单导入", notes = "分发单导入") |
| | | @PostMapping("/import2") |
| | | public ResponseValue import2(MultipartFile file) { |
| | | String originalFilename = file.getOriginalFilename(); |
| | |
| | | LWhProcureModelUserParam lWhProcureModelUserParam = new LWhProcureModelUserParam(); |
| | | lWhProcureModelUserParam.setGoodsNum(Integer.valueOf(num)); |
| | | lWhProcureModelUserParam.setNowUserName(user); |
| | | lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); |
| | | lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); |
| | | Integer counts1 = optional3.get().getCounts(); |
| | | Integer num1 = optional3.get().getNum(); |
| | | optional3.get().setCounts(Integer.valueOf(num) + counts1); |
| | |
| | | |
| | | // 查询库存数量 |
| | | Integer nowNum = selectAllNumber(lWhFormTransferParam.getOutAgencyId(), selByModelNameAndGoodsTemplatesId.getId()); |
| | | if(nowNum<new Integer(num)){ |
| | | if(nowNum< Convert.toInt(num)){ |
| | | throw new ExcelAnalysisException("第" + index + "条数据" + "品名:[" + goodsName + "] 规格型号:[" + goodModelName + "] 库存数量不足:["+nowNum+"]"); |
| | | } |
| | | lWhProcureModelUserParam.setNowUserName(user); |
| | | lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); |
| | | lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); |
| | | addLWhProcureModelUserParam.add(lWhProcureModelUserParam); |
| | | lWhTransferModelParam.setProcureModelUserList(addLWhProcureModelUserParam); |
| | | optional.get().getModels().add(lWhTransferModelParam); |
| | |
| | | // 规格id |
| | | lWhTransferModelParam.setBaseGoodsModelsId(selByModelNameAndGoodsTemplatesId.getId()); |
| | | // 新增的时候默认一条 |
| | | lWhTransferModelParam.setCounts(new Integer(num)); |
| | | lWhTransferModelParam.setNum(new Integer(num)); |
| | | lWhTransferModelParam.setCounts(Convert.toInt(num)); |
| | | lWhTransferModelParam.setNum(Convert.toInt(num)); |
| | | List<LWhProcureModelUserParam> lWhFormProcureGoodsInfoParam = new ArrayList<>(); |
| | | LWhProcureModelUserParam lWhProcureModelUserParam = new LWhProcureModelUserParam(); |
| | | lWhProcureModelUserParam.setGoodsNum(Integer.valueOf(num)); |
| | | |
| | | // 查询库存数量 |
| | | Integer nowNum = selectAllNumber(lWhFormTransferParam.getOutAgencyId(), selByModelNameAndGoodsTemplatesId.getId()); |
| | | if(nowNum<new Integer(num)){ |
| | | if(nowNum<Convert.toInt(num)){ |
| | | throw new ExcelAnalysisException("第" + index + "条数据 " + "品名:[" + goodsName + "] 规格型号:[" + goodModelName + "] 库存数量不足:["+nowNum+"]"); |
| | | } |
| | | |
| | | lWhProcureModelUserParam.setNowUserName(user); |
| | | lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); |
| | | lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); |
| | | lWhFormProcureGoodsInfoParam.add(lWhProcureModelUserParam); |
| | | lWhTransferModelParam.setProcureModelUserList(lWhFormProcureGoodsInfoParam); |
| | | lWhTransferModelParam.setBaseGoodsModelsName(goodModelName); |