| | |
| | | poCode: "DO单号", |
| | | poId: "DO标识", |
| | | type: "类型", |
| | | checkType: '盘点类型', |
| | | wkType: "业务类型", |
| | | anfme: "数量", |
| | | workQty: '执行数', |
| | |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Toolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | useDataProvider, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useRefresh, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Button, |
| | | useRedirect, |
| | | useUnselectAll, |
| | | useRecordSelection, |
| | | } from 'react-admin'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <TextInput source="code" label="table.field.outStock.code" alwaysOn />, |
| | | <TextInput source="poCode" label="table.field.outStock.poCode" />, |
| | | <NumberInput source="poId" label="table.field.outStock.poId" />, |
| | | <ReferenceInput source="type" reference="dictData" filter={{ dictTypeCode: 'sys_order_type', group: '2' }} label="table.field.outStock.type" alwaysOn> |
| | | <AutocompleteInput label="table.field.outStock.type" optionValue="value" /> |
| | | <TextInput source="code" label="table.field.checkOrder.code" alwaysOn />, |
| | | <TextInput source="poCode" label="table.field.checkOrder.poCode" />, |
| | | <NumberInput source="poId" label="table.field.checkOrder.poId" />, |
| | | <ReferenceInput source="type" reference="dictData" filter={{ dictTypeCode: 'sys_order_type', group: '3' }} label="table.field.checkOrder.type" alwaysOn> |
| | | <AutocompleteInput label="table.field.checkOrder.type" optionValue="value" /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_business_type', group: '2' }} label="table.field.outStock.wkType" alwaysOn> |
| | | <AutocompleteInput label="table.field.outStock.wkType" optionValue="value" /> |
| | | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_check_order_type'}} label="table.field.checkOrder.wkType" alwaysOn> |
| | | <AutocompleteInput label="table.field.checkOrder.wkType" optionValue="value" /> |
| | | </ReferenceInput>, |
| | | <NumberInput source="anfme" label="table.field.outStock.anfme" />, |
| | | <NumberInput source="qty" label="table.field.outStock.qty" />, |
| | | <TextInput source="logisNo" label="table.field.outStock.logisNo" />, |
| | | <DateInput source="arrTime" label="table.field.outStock.arrTime" />, |
| | | <SelectInput source="rleStatus" label="table.field.outStock.rleStatus" |
| | | <NumberInput source="anfme" label="table.field.checkOrder.anfme" />, |
| | | <NumberInput source="qty" label="table.field.checkOrder.qty" />, |
| | | <TextInput source="logisNo" label="table.field.checkOrder.logisNo" />, |
| | | <DateInput source="arrTime" label="table.field.checkOrder.arrTime" />, |
| | | <SelectInput source="rleStatus" label="table.field.checkOrder.rleStatus" |
| | | choices={[ |
| | | { id: 0, name: ' 正常' }, |
| | | { id: 1, name: ' 已释放' }, |
| | |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <DictionarySelect |
| | | label='table.field.outStock.exceStatus' |
| | | label='table.field.checkOrder.exceStatus' |
| | | name="exceStatus" |
| | | dictTypeCode="sys_asn_exce_status" |
| | | alwaysOn |
| | |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [select, setSelect] = useState(0); |
| | | const billReload = useRef(); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_check_order_type')) || []; |
| | | |
| | | //获取波次规则 |
| | | // const closeDialog = async (value) => { |
| | |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> |
| | | <SelectColumnsButton preferenceKey='check' /> |
| | | <ImportButton value={'outStockItem'} /> |
| | | <ImportButton value={'checkItem'} /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | |
| | | <TextField source="code" label="table.field.checkOrder.code" /> |
| | | <TextField source="poCode" label="table.field.checkOrder.poCode" /> |
| | | <TextField source="type$" label="table.field.checkOrder.type" /> |
| | | <TextField cellClassName="wkType" source="wkType$" label="table.field.checkOrder.wkType" /> |
| | | <TextField cellClassName="wkType" source="checkType$" label="table.field.checkOrder.wkType" /> |
| | | <NumberField source="anfme" label="table.field.checkOrder.anfme" /> |
| | | <NumberField source="workQty" label="table.field.checkOrder.workQty" /> |
| | | <NumberField source="qty" label="table.field.checkOrder.qty" /> |
| | |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | 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.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private CheckOrderService checkOrderService; |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | @PostMapping("/check/page") |
| | |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrder.class), response); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 盘点单导入 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/check/import") |
| | | @ApiOperation("ASN导入接口") |
| | | @PreAuthorize("hasAuthority('manager:check:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | return R.error("文件不能为空!!"); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | return checkOrderService.excelImport(file, hashMap, getLoginUserId()); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.CheckOrderTemplate; |
| | | import com.vincent.rsf.server.manager.service.CheckOrderItemService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | 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.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/7/14 |
| | | * @description: 盘点明细 |
| | | * @version 1.0 |
| | | */ |
| | | @Api("盘点明细") |
| | | @RestController |
| | | public class CheckOrderItemController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CheckOrderItemService checkOrderItemService; |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @PostMapping("/checkItem/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<AsnOrderItem, BaseParam> pageParam = new PageParam<>(baseParam, AsnOrderItem.class); |
| | | QueryWrapper<AsnOrderItem> wrapper = pageParam.buildWrapper(true); |
| | | return R.ok().add(checkOrderItemService.page(pageParam, wrapper)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @PostMapping("/checkItem/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(checkOrderItemService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @PostMapping({"/checkItem/many/{ids}", "/checkItem/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(checkOrderItemService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @GetMapping("/checkItem/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(checkOrderItemService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:save')") |
| | | @OperationLog("Create 字典数据集") |
| | | @PostMapping("/checkItem/save") |
| | | public R save(@RequestBody AsnOrderItem order) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_CHECK_RULE_CODE, order); |
| | | if (Objects.isNull(ruleCode)) { |
| | | throw new RuntimeException("盘点单号生成失败!!"); |
| | | } |
| | | if (!checkOrderItemService.save(order)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(order); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:update')") |
| | | @OperationLog("Update 字典数据集") |
| | | @PostMapping("/checkItem/update") |
| | | public R update(@RequestBody AsnOrderItem order) { |
| | | order.setUpdateTime(null); |
| | | order.setUpdateBy(getLoginUserId()); |
| | | if (!checkOrderItemService.updateById(order)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(order); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:remove')") |
| | | @OperationLog("Delete 字典数据集") |
| | | @PostMapping("/checkItem/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!checkOrderItemService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @PostMapping("/checkItem/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<AsnOrderItem> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(AsnOrderItem::getAsnCode, condition); |
| | | } |
| | | checkOrderItemService.page(new Page<>(1, 20), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getAsnCode())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/7/14 |
| | | * @description: 盘点单导出 |
| | | * @version 1.0 |
| | | */ |
| | | @PreAuthorize("hasAuthority('manager:checkItem:list')") |
| | | @PostMapping("/checkItem/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | List<AsnOrderItem> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | orders = checkOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().in(AsnOrderItem::getId, map.get("ids"))); |
| | | } else { |
| | | orders = checkOrderItemService.list(); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrderItem.class), response); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/checkItem/template/download") |
| | | @ApiOperation("下载盘点单模板") |
| | | @PreAuthorize("hasAuthority('manager:checkItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | CheckOrderTemplate template = ExcelUtil.mockData(CheckOrderTemplate.class); |
| | | List<CheckOrderTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, CheckOrderTemplate.class, true), response); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.Companys; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.OutStockTemplate; |
| | | import com.vincent.rsf.server.manager.enums.CompanysType; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.OutStockItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/outStock/template/download") |
| | | @PostMapping("/outStockItem/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public String getCheckType$(){ |
| | | if (Cools.isEmpty(this.wkType)){ |
| | | return ""; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.SYS_CHECK_ORDER_TYPE).eq(DictData::getValue, this.wkType)); |
| | | if (Objects.isNull(dictData)) { |
| | | return null; |
| | | } |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | |
| | | public String getArrTime$(){ |
| | | if (Cools.isEmpty(this.arrTime)){ |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity.excel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelAutoColumnSize; |
| | | import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelComment; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ExcelAutoColumnSize |
| | | @Accessors(chain = true) |
| | | public class CheckOrderTemplate implements Serializable { |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @Excel(name = "*盘点单号") |
| | | @ApiModelProperty(value = "*盘点单号") |
| | | @ExcelComment(value = "code", example = "CK5945272236") |
| | | private String code; |
| | | |
| | | @Excel(name = "行号") |
| | | @ApiModelProperty("行号") |
| | | @ExcelComment(value = "platItemId", example = "1357564255478") |
| | | private String platItemId; |
| | | |
| | | @Excel(name = "客户订单号") |
| | | @ApiModelProperty("客户订单号") |
| | | @ExcelComment(value = "platOrderCode", example = "PT202564713301") |
| | | private String platOrderCode; |
| | | |
| | | @Excel(name = "工单号") |
| | | @ApiModelProperty("工单号") |
| | | @ExcelComment(value = "platWorkCode", example = "PWC2354894211") |
| | | private String platWorkCode; |
| | | |
| | | @Excel(name = "项目号") |
| | | @ApiModelProperty("项目号") |
| | | @ExcelComment(value = "projectCode", example = "PC2365845636001") |
| | | private String projectCode; |
| | | |
| | | /** |
| | | * 单据类型 |
| | | */ |
| | | @Excel(name = "*单据类型") |
| | | @ApiModelProperty(value = "*单据类型") |
| | | @ExcelComment(value = "type", example = "盘点单") |
| | | private String type; |
| | | |
| | | /** |
| | | * 业务类型 |
| | | */ |
| | | @Excel(name = "*业务类型") |
| | | @ApiModelProperty(value = "*业务类型") |
| | | @ExcelComment(value = "wkType", example = "定期盘点") |
| | | private String wkType; |
| | | |
| | | |
| | | @Excel(name = "*物料编码") |
| | | @ApiModelProperty("*物料编码") |
| | | @ExcelComment(value = "matnrCode", example = "102010101545") |
| | | private String matnrCode; |
| | | |
| | | |
| | | @Excel(name = "物料名称") |
| | | @ApiModelProperty("物料名称") |
| | | @ExcelComment(value = "maktx", example = "天瑞019-大A型支架-55飞机轮黑色,三角轮盖喷漆银色 (带攻丝钉)右") |
| | | private String maktx; |
| | | |
| | | |
| | | @Excel(name = "物料规格") |
| | | @ApiModelProperty("物料规格") |
| | | @ExcelComment(value = "maktx", example = "2*3*6") |
| | | private String spec; |
| | | |
| | | |
| | | @Excel(name = "物料型号") |
| | | @ApiModelProperty("物料型号") |
| | | @ExcelComment(value = "maktx", example = "abc") |
| | | private String model; |
| | | |
| | | |
| | | @Excel(name = "供应商编码") |
| | | @ApiModelProperty("供应商编码") |
| | | @ExcelComment(value = "splrCode", example = "685947") |
| | | private String splrCode; |
| | | |
| | | @Excel(name = "供应商名称") |
| | | @ApiModelProperty("供应商名称") |
| | | @ExcelComment(value = "splrName", example = "浙江中扬立库技术有限公司") |
| | | private String splrName; |
| | | |
| | | |
| | | @Excel(name = "已完成数量") |
| | | @ApiModelProperty("已完成数量") |
| | | @ExcelComment(value = "qty", example = "0") |
| | | private String qty; |
| | | |
| | | |
| | | @Excel(name = "供应商批次") |
| | | @ApiModelProperty("供应商批次") |
| | | @ExcelComment(value = "splrBatch", example = "25251212") |
| | | private String splrBatch; |
| | | |
| | | @Excel(name = "*数量") |
| | | @ApiModelProperty("*数量") |
| | | @ExcelComment(value = "anfme", example = "75") |
| | | private String anfme; |
| | | |
| | | |
| | | @Excel(name = "物流单号") |
| | | @ApiModelProperty("物流单号") |
| | | @ExcelComment(value = "logicNo", example = "SF100064851") |
| | | private String logicNo; |
| | | |
| | | |
| | | @Excel(name = "预计送达时间") |
| | | @ApiModelProperty("预计送达时间") |
| | | @ExcelComment(value = "arrTime", example = "2025-05-21") |
| | | private String arrTime; |
| | | |
| | | @Excel(name = "包装名称") |
| | | @ApiModelProperty("包装名称") |
| | | @ExcelComment(value = "packName", example = "个") |
| | | private String packName; |
| | | |
| | | @Excel(name = "备注") |
| | | @ApiModelProperty("备注") |
| | | @ExcelComment(value = "memo", example = "注:易碎品,轻拿放") |
| | | private String memo; |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.enums; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/7/14 |
| | | * @description: 盘点单类型 |
| | | * @version 1.0 |
| | | */ |
| | | public enum CheckOrderType { |
| | | |
| | | CHECK_ORDER_TYPE_TEMP("1", "临时盘点"), |
| | | CHECK_ORDER_TYPE_ROUND("2", "抽样盘点"), |
| | | CHECK_ORDER_TYPE_AREAS("3", "区域盘点"), |
| | | CHECK_ORDER_TYPE_DIFF("4", "差异盘点"), |
| | | CHECK_ORDER_TYPE_CIRCLE("5", "循环盘点"), |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | return OrderType.ORDER_IN.type; |
| | | } else if (desc.equals(OrderType.ORDER_OUT.desc)) { |
| | | return OrderType.ORDER_OUT.type; |
| | | } else if (desc.equals(OrderType.ORDER_CHECK.desc)) { |
| | | return OrderType.ORDER_CHECK.type; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | return OrderType.ORDER_IN.desc; |
| | | } else if (type.equals(OrderType.ORDER_OUT.type)) { |
| | | return OrderType.ORDER_OUT.desc; |
| | | // } else if (type.equals(OrderType.ORDER_PLAT_IN.type)) { |
| | | // return OrderType.ORDER_PLAT_IN.desc; |
| | | // } else if (type.equals(OrderType.ORDER_RECEIPT.type)) { |
| | | // return OrderType.ORDER_RECEIPT.desc; |
| | | // } else if (type.equals(OrderType.ORDER_PURCHASE_IN.type)) { |
| | | // return OrderType.ORDER_PURCHASE_IN.desc; |
| | | } else if (type.equals(OrderType.ORDER_CHECK.type)) { |
| | | return OrderType.ORDER_CHECK.desc; |
| | | } |
| | | return null; |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CheckOrderItemMapper extends BaseMapper<AsnOrderItem> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | |
| | | public interface CheckOrderItemService extends IService<AsnOrderItem> { |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | public interface CheckOrderService extends IService<AsnOrder> { |
| | | |
| | | R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId); |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.mapper.CheckOrderItemMapper; |
| | | import com.vincent.rsf.server.manager.service.CheckOrderItemService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("checkOrderItemService") |
| | | public class CheckOrderItemServiceImpl extends ServiceImpl<CheckOrderItemMapper, AsnOrderItem> implements CheckOrderItemService { |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.CheckOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.mapper.CheckOrderMapper; |
| | | import com.vincent.rsf.server.manager.service.CheckOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.CheckOrderService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("checkOrderService") |
| | | public class CheckOrderServiceImpl extends ServiceImpl<CheckOrderMapper, AsnOrder> implements CheckOrderService { |
| | | |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | |
| | | @Autowired |
| | | private CheckOrderItemService checkOrderItemService; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/7/14 |
| | | * @description: 盘点单导入 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) { |
| | | ExcelImportResult result = null; |
| | | try { |
| | | result = ExcelImportUtil.importExcelMore(file.getInputStream(), CheckOrderTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | List<CheckOrderTemplate> resultList = result.getList(); |
| | | Map<String, List<CheckOrderTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(CheckOrderTemplate::getCode)); |
| | | for (String key : listMap.keySet()) { |
| | | CheckOrderTemplate template = listMap.get(key).stream().findFirst().get(); |
| | | AsnOrder asnOrder = this.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, template.getCode())); |
| | | if (!Objects.isNull(asnOrder)) { |
| | | continue; |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | order.setCode(template.getCode()) |
| | | .setMemo(template.getMemo()) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setType(OrderType.getTypeVal(template.getType())) |
| | | .setWkType(OrderWorkType.getWorkType(template.getWkType())); |
| | | if (!this.save(order)) { |
| | | throw new CoolException("单据保存失败!!"); |
| | | } |
| | | List<AsnOrderItem> items = new ArrayList<>(); |
| | | for (CheckOrderTemplate orderTemplate : listMap.get(key)) { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | Matnr matnr = null; |
| | | if (StringUtils.isNotBlank(orderTemplate.getMatnrCode())) { |
| | | matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>() |
| | | .eq(Matnr::getCode, orderTemplate.getMatnrCode())); |
| | | } |
| | | orderItem.setAsnId(order.getId()) |
| | | .setAsnCode(order.getCode()) |
| | | .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | .setAnfme(Double.parseDouble(orderTemplate.getAnfme())) |
| | | .setSplrName(orderTemplate.getSplrName()) |
| | | .setSplrCode(orderTemplate.getSplrCode()) |
| | | .setMaktx(orderTemplate.getMaktx()) |
| | | .setMatnrCode(orderTemplate.getMatnrCode()); |
| | | if (!Objects.isNull(matnr)) { |
| | | orderItem.setMaktx(matnr.getName()).setMatnrCode(matnr.getCode()).setMatnrId(matnr.getId()); |
| | | } |
| | | items.add(orderItem); |
| | | if (!checkOrderItemService.saveBatch(items)) { |
| | | throw new CoolException("单据明细保存失败!!"); |
| | | } |
| | | } |
| | | if (!items.isEmpty()) { |
| | | double purQty = items.stream().mapToDouble(AsnOrderItem::getAnfme).sum(); |
| | | if (!this.update(new LambdaUpdateWrapper<AsnOrder>() |
| | | .set(AsnOrder::getExceStatus, AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val) |
| | | .set(AsnOrder::getAnfme, purQty).eq(AsnOrder::getId, order.getId()))) { |
| | | throw new CoolException("单据数量修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok("操作成功!!"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public final static String DICT_SYS_BUSINESS_TYPE = "sys_business_type"; |
| | | |
| | | /**盘点类型*/ |
| | | public final static String SYS_CHECK_ORDER_TYPE = "sys_check_order_type"; |
| | | |
| | | /** |
| | | * 单据类型 |
| | | */ |
| | |
| | | # url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: rsf |
| | | username: root |
| | | url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://192.168.4.151:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | password: 34821015 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vincent.rsf.server.manager.mapper.CheckOrderItemMapper"> |
| | | |
| | | </mapper> |