diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagecheck/StorageCheckController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagecheck/StorageCheckController.java index 80dafe22..b2cab75e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagecheck/StorageCheckController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagecheck/StorageCheckController.java @@ -1,95 +1,129 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.storagecheck; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; -import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; - -import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; - -import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; -import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; - -import com.chanko.yunxi.mes.module.heli.controller.admin.storagecheck.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagecheck.StorageCheckDO; -import com.chanko.yunxi.mes.module.heli.service.storagecheck.StorageCheckService; - -@Tag(name = "管理后台 - 入/出库盘点") -@RestController -@RequestMapping("/heli/storage-check") -@Validated -public class StorageCheckController { - - @Resource - private StorageCheckService storageCheckService; - - @PostMapping("/create") - @Operation(summary = "创建入/出库盘点") - @PreAuthorize("@ss.hasPermission('heli:storage-check:create')") - public CommonResult createStorageCheck(@Valid @RequestBody StorageCheckSaveReqVO createReqVO) { - return success(storageCheckService.createStorageCheck(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新入/出库盘点") - @PreAuthorize("@ss.hasPermission('heli:storage-check:update')") - public CommonResult updateStorageCheck(@Valid @RequestBody StorageCheckSaveReqVO updateReqVO) { - storageCheckService.updateStorageCheck(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除入/出库盘点") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:storage-check:delete')") - public CommonResult deleteStorageCheck(@RequestParam("id") Long id) { - storageCheckService.deleteStorageCheck(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得入/出库盘点") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:storage-check:query')") - public CommonResult getStorageCheck(@RequestParam("id") Long id) { - StorageCheckDO storageCheck = storageCheckService.getStorageCheck(id); - return success(BeanUtils.toBean(storageCheck, StorageCheckRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得入/出库盘点分页") - @PreAuthorize("@ss.hasPermission('heli:storage-check:query')") - public CommonResult> getStorageCheckPage(@Valid StorageCheckPageReqVO pageReqVO) { - PageResult pageResult = storageCheckService.getStorageCheckPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, StorageCheckRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出入/出库盘点 Excel") - @PreAuthorize("@ss.hasPermission('heli:storage-check:export')") - @OperateLog(type = EXPORT) - public void exportStorageCheckExcel(@Valid StorageCheckPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = storageCheckService.getStorageCheckPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "入/出库盘点.xls", "数据", StorageCheckRespVO.class, - BeanUtils.toBean(list, StorageCheckRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.storagecheck; + +import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.StorageSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog.StorageLogDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import com.chanko.yunxi.mes.module.heli.service.storagecheckmat.StorageCheckMatService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.time.LocalDateTime; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.storagecheck.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagecheck.StorageCheckDO; +import com.chanko.yunxi.mes.module.heli.service.storagecheck.StorageCheckService; + +@Tag(name = "管理后台 - 入/出库盘点") +@RestController +@RequestMapping("/heli/storage-check") +@Validated +public class StorageCheckController { + + @Resource + private StorageCheckService storageCheckService; + + @Resource + private StorageCheckMatService storageCheckMatService; + + @PostMapping("/create") + @Operation(summary = "创建入/出库盘点") + @PreAuthorize("@ss.hasPermission('heli:storage-check:create')") + public CommonResult createStorageCheck(@Valid @RequestBody StorageCheckSaveReqVO createReqVO) { + return success(storageCheckService.createStorageCheck(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新入/出库盘点") + @PreAuthorize("@ss.hasPermission('heli:storage-check:update')") + public CommonResult updateStorageCheck(@Valid @RequestBody StorageCheckSaveReqVO updateReqVO) { + storageCheckService.updateStorageCheck(updateReqVO); + return success(true); + } + + @PutMapping("/update-status") + @Operation(summary = "更新盘点状态") + @PreAuthorize("@ss.hasPermission('heli:storage:update')") + public CommonResult updateStorageCheckStatus(@Valid @RequestBody StorageCheckSaveReqVO updateReqVO) { + + // 提交或者删除时记录相关操作人 + LocalDateTime currTime = LocalDateTime.now(); + if(updateReqVO.getStatus().equals(2)){ + // 已提交时间更新 + updateReqVO.setKeeperTime(currTime); + } else if(updateReqVO.getStatus().equals(3)){ + // 已删除时间更新 + updateReqVO.setCancelTime(currTime); + } + // 盘点信息保存 + storageCheckService.updateStorageCheck(updateReqVO); + + // TODO保存物料列表信息 + + // TODO生成入库/出库单据 + + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除入/出库盘点") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:storage-check:delete')") + public CommonResult deleteStorageCheck(@RequestParam("id") Long id) { + storageCheckService.deleteStorageCheck(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得入/出库盘点") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:storage-check:query')") + public CommonResult getStorageCheck(@RequestParam("id") Long id) { + StorageCheckDO storageCheck = storageCheckService.getStorageCheck(id); + return success(BeanUtils.toBean(storageCheck, StorageCheckRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得入/出库盘点分页") + @PreAuthorize("@ss.hasPermission('heli:storage-check:query')") + public CommonResult> getStorageCheckPage(@Valid StorageCheckPageReqVO pageReqVO) { + PageResult pageResult = storageCheckService.getStorageCheckPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, StorageCheckRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出入/出库盘点 Excel") + @PreAuthorize("@ss.hasPermission('heli:storage-check:export')") + @OperateLog(type = EXPORT) + public void exportStorageCheckExcel(@Valid StorageCheckPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = storageCheckService.getStorageCheckPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "入/出库盘点.xls", "数据", StorageCheckRespVO.class, + BeanUtils.toBean(list, StorageCheckRespVO.class)); + } + +} diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/PnForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/PnForm.vue index ad9e6b88..ea4ef7a8 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/PnForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/pn/PnForm.vue @@ -1,18 +1,6 @@ --> - + @@ -404,30 +279,12 @@ @@ -471,7 +328,7 @@ const formData = ref({ status: 1, whId: undefined, creator: undefined, - createTime: formatDate(new Date(), 'YYYY-MM-DD HH:mm'), + createTime: undefined, keeper: undefined, keeperTime: undefined, outbound: undefined, @@ -498,6 +355,17 @@ const subFormRules = reactive({ pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }], storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }] }) +const enableHeadNo = ref(false) +const handleStockType = async (typeid) => { + formData.value.headerNo = '' + if (typeid == 1) { + enableHeadNo.value = false + } else { + + enableHeadNo.value = true + } + +} const handleStatus = async (num) => { // 校验表单 await formRef.value.validate() @@ -526,36 +394,7 @@ const handleStatus = async (num) => { message.success(t('common.updateSuccess')) - switch (num) { - case 1: - isShowBtnGroup.value = true - isShowBtnCancel.value = false - isShowBtnOther.value = true - isShowBtnDelete.value = true - break - case 2: - isShowBtnGroup.value = false - isShowBtnCancel.value = true - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - case 3: - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - default: - break - } - //查看页面不可以编辑 - if (query.type === 'review') { - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - } - query.id = storageid.value + query.id = formData.value.id query.type = 'update' reload() } @@ -614,7 +453,6 @@ const downloadAttachment = async (name, url) => { } // ====================附件信息 结束======================================= -const storageid = ref() var commonResult = '' /** 提交表单 */ @@ -647,27 +485,27 @@ const saveFormData = async () => { const data = formData.value as unknown as StorageApi.StorageVO if (query.type === 'create') { //库存信息保存 - storageid.value = await StorageApi.createStorage(data) + formData.value.id = await StorageApi.createStorage(data) commonResult = 'common.createSuccess' } else { - storageid.value = data.id + await StorageApi.updateStorage(data) commonResult = 'common.updateSuccess' } //物料信息保存 formData.value.matItemDOList.forEach((item) => { - item.stockId = storageid.value + item.stockId = formData.value.id item.whId = formData.value.whId }) const dataMats = formData.value.matItemDOList as unknown as StorageMatApi.StorageMatVO[] - await StorageMatApi.createStorageMatBatch(dataMats, storageid.value) + await StorageMatApi.createStorageMatBatch(dataMats, formData.value.id) - if (formData.value.attachments!=undefined && formData.value.attachments.length > 0) { + if (formData.value.attachments != undefined && formData.value.attachments.length > 0) { //附件信息保存 - matUploadData.value.businessId = storageid + matUploadData.value.businessId = formData.value.id matUploadRef.value!.submit() } - formData.value = await StorageApi.getStorage(storageid.value) + await initStatus(formData.value.status) message.success(t(commonResult)) } finally { formLoading.value = false @@ -689,7 +527,7 @@ const submitForm = async () => { //保存表单数据 await saveFormData() // 成功后刷新 - query.id = storageid.value + query.id = formData.value.id query.type = 'update' reload() } @@ -850,15 +688,49 @@ const handleMatCode = async (scope, matid) => { } } -const isShowBtnGroup = ref(true) -const isShowBtnCancel = ref(false) -const isShowBtnOther = ref(false) -const isShowBtnDelete = ref(true) -const btnWhClickable = ref(false) + const matLastData = ref([]) +// 按钮控制 +const btnView = ref(false) +const btnSave = ref(false) +const btnCancel = ref(true) +const btnDelete = ref(false) + + +// 根据页面动作和数据状态控制按钮输入框信息 +const initStatus = async (status) => { + switch (status) { + case 1: + btnView.value = false + btnSave.value = false + btnCancel.value = true + btnDelete.value = false + break + case 2: + btnView.value = false + btnSave.value = true + btnCancel.value = false + btnDelete.value = true + break + case 3: + btnView.value = true + btnSave.value = true + btnCancel.value = true + btnDelete.value = true + break + default: + break + } + // 查看页面时可操作控件禁用 + if (query.type === 'review') { + btnView.value = true + btnSave.value = true + btnCancel.value = true + btnDelete.value = true + } +} /** 初始化 **/ onMounted(async () => { - btnWhClickable.value = query.type === 'update' ? true : false matLastData.value = await StorageMatApi.getStorageMatList() @@ -882,36 +754,7 @@ onMounted(async () => { if (query.id) { //获取库存信息 formData.value = await StorageApi.getStorage(query.id) - - switch (formData.value.status) { - case 1: - isShowBtnGroup.value = true - isShowBtnCancel.value = false - isShowBtnDelete.value = true - break - case 2: - isShowBtnGroup.value = false - isShowBtnCancel.value = true - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - case 3: - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - break - default: - break - } - //查看页面不可以编辑 - if (query.type === 'review') { - isShowBtnGroup.value = false - isShowBtnCancel.value = false - isShowBtnOther.value = false - isShowBtnDelete.value = false - } - + await initStatus(formData.value.status) //获得库区列表 const queryParamsRg = reactive({ pageNo: 1, diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/index.vue index fd82a0ab..74aab6cf 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/index.vue @@ -108,7 +108,7 @@ - +