| | |
| | | <el-button @click="getTableRow(row,'edit')" |
| | | v-if="userStore.user.permissions.indexOf('materialOutbound.edit') > -1" |
| | | link type="primary" size="small">{{$t('basicData.edit')}}</el-button> |
| | | <!-- <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>--> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button :disabled="row.reviewedState===1" link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | |
| | | router.push({path: '/main/ingredientsStock/ReturnToStorageCreate', query: { returningId: row.returningId }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | let flowData = ref({ |
| | | returningId:row.returningId, |
| | | userName:userStore.user.userName, |
| | | userId:userStore.user.userId |
| | | }) |
| | | request.post("/materialInventory/deleteReturnToStorage",flowData.value).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('searchOrder.msgDeleteSuccess')) |
| | | router.push({path:'/main/ingredientsStock/ReturnToStorage', query:{random:Math.random()}}) |
| | | }else{ |
| | | ElMessage.warning(t('basicData.msg.deleteSuccess')) |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | | router.push("/login") |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | <el-button @click="getTableRow(row,'edit')" |
| | | v-if="userStore.user.permissions.indexOf('returnToStorage.edit') > -1" |
| | | link type="primary" size="small">{{$t('basicData.edit')}}</el-button> |
| | | <!-- <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>--> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button :disabled="row.reviewedState===1" link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | |
| | | import { useI18n } from 'vue-i18n' |
| | | import {toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import {divideAuto, multiply} from "@/utils/decimal"; |
| | | |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | |
| | | |
| | | |
| | | let flowData = ref({ |
| | | totalArea: selectRecords.height*selectRecords.width/1000000*titleUploadData.value.inventoryQuantity, |
| | | singlePieceArea: selectRecords.height*selectRecords.width/1000000, |
| | | totalArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2))*titleUploadData.value.inventoryQuantity, |
| | | singlePieceArea: parseFloat(divideAuto(multiply(selectRecords.height,selectRecords.width),1000000,2)), |
| | | title: titleUploadData.value, |
| | | materialCode: selectRecords.id, |
| | | userName:userStore.user.userName, |
| | | userId:userStore.user.userId |
| | | |
| | | }) |
| | | console.log(flowData.value) |
| | | |
| | | request.post("/materialInventory/saveMaterialInventory", flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | console.log(res) |
| | | if(res.code==200 && res.data==="true"){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path: '/main/ingredientsStock/SelectIngredientsStock', query:{random:Math.random()}}) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | }else if(res.data==="false1") { |
| | | ElMessage.warning("库存存在多条") |
| | | }else { |
| | | ElMessage.warning(t('basicData.msg.ServerConnectionError')) |
| | | } |
| | | }) |
| | | break |
| | |
| | | @SaCheckPermission("selectIngredientsStock.add") |
| | | @PostMapping("/saveMaterialInventory") |
| | | public Result saveMaterialInventory( @RequestBody Map<String,Object> object){ |
| | | if(materialInventoryService.saveMaterialInventory(object)){ |
| | | return Result.seccess(); |
| | | }else { |
| | | throw new ServiceException(Constants.Code_500,"保存失败"); |
| | | |
| | | } |
| | | return Result.seccess(materialInventoryService.saveMaterialInventory(object)); |
| | | } |
| | | |
| | | @ApiOperation("物料库存加时间查询接口") |
| | |
| | | return Result.seccess(materialInventoryService.getSelectReturningWarehouse(pageNum,pageSize,returningWarehouseDetail)); |
| | | } |
| | | |
| | | @ApiOperation("物料返库删除接口") |
| | | @SaCheckPermission("returnToStorageCreate.delete") |
| | | @PostMapping("/deleteReturnToStorage") |
| | | public Result deleteReturnToStorage( @RequestBody Map<String,Object> object){ |
| | | return Result.seccess(materialInventoryService.deleteReturnToStorage(object)); |
| | | } |
| | | |
| | | @ApiOperation("物料返库审核接口") |
| | | @SaCheckPermission("returnToStorageCreate.review") |
| | | @PostMapping("/updateReturningWarehouseToExamine") |
| | |
| | | |
| | | Boolean deleteMaterialOutbound(@Param("materialOutboundId") String materialOutboundId); |
| | | |
| | | Boolean deleteMaterialLog(@Param("materialOutboundId") String materialOutboundId); |
| | | |
| | | Integer getMaximum(@Param("type") String type); |
| | | |
| | | Integer getMaximums(@Param("type") String type); |
| | |
| | | |
| | | Boolean deleteReturningWarehouseDetail(@Param("returningId") String returningId); |
| | | |
| | | Boolean deleteReturningWarehouse(@Param("returningId") String returningId); |
| | | |
| | | List<MaterialOutbound> getSelectMaterialOutboundDate(@Param("offset") Integer offset, |
| | | @Param("pageSize") Integer pageSize,String startDate, String endDate, |
| | | @Param("materialOutbound") MaterialOutbound materialOutbound); |
| | |
| | | @Param("totalArea") Double totalArea, |
| | | @Param("materialInventory") MaterialInventory materialInventory); |
| | | |
| | | Boolean updateMaterialInventoryNull(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea, |
| | | @Param("totalArea") Double totalArea, |
| | | @Param("materialInventory") MaterialInventory materialInventory); |
| | | |
| | | Boolean insertMaterialInventory(@Param("materialCode") Long materialCode,@Param("singlePieceArea") Double singlePieceArea, |
| | | @Param("totalArea") Double totalArea, |
| | | @Param("materialInventory") MaterialInventory materialInventory); |
| | |
| | | |
| | | } |
| | | |
| | | public Boolean saveMaterialInventory(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | public String saveMaterialInventory(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | |
| | | |
| | | MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class); |
| | | |
| | | //查询物料是否存在 |
| | | Integer MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); |
| | | |
| | | if(MaterialInventoryCount>0){ |
| | | materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | //查询物料是否存在 |
| | | Integer MaterialInventoryCount=0; |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); |
| | | }else{ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode); |
| | | } |
| | | |
| | | if(MaterialInventoryCount==1){ |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | }else{ |
| | | materialInventoryMapper.updateMaterialInventoryNull(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | } |
| | | log.setFunction("saveMaterialInventory修改"); |
| | | }else { |
| | | }else if(MaterialInventoryCount==0) { |
| | | materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | log.setFunction("saveMaterialInventory新增"); |
| | | }else { |
| | | return "false1"; |
| | | } |
| | | |
| | | String json=""; |
| | |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveMaterialInventory"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |
| | |
| | | if(materialOutboundId!=null){ |
| | | materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId); |
| | | materialInventoryMapper.deleteMaterialOutbound(materialOutboundId); |
| | | materialInventoryMapper.deleteMaterialLog(materialOutboundId); |
| | | } |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | |
| | | |
| | | } |
| | | |
| | | public Boolean deleteReturnToStorage(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String returningId = ""; |
| | | if (object.get("returningId") != null) { |
| | | returningId = object.get("returningId").toString(); |
| | | } |
| | | if(returningId!=null){ |
| | | materialInventoryMapper.deleteReturningWarehouseDetail(returningId); |
| | | materialInventoryMapper.deleteReturningWarehouse(returningId); |
| | | materialInventoryMapper.deleteMaterialLog(returningId); |
| | | } |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | | log.setOperatorId(object.get("userId").toString()); |
| | | log.setOperator(object.get("userName").toString()); |
| | | log.setFunction("deleteReturnToStorage:"+returningId); |
| | | logService.saveLog(log); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("deleteMaterialOutbound"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getSelectMaterialOutboundDate(Integer pageNum, Integer pageSize, List<String> selectDate, MaterialOutbound materialOutbound) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | String endDate = LocalDate.now().toString(); |
| | |
| | | delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId} |
| | | </delete> |
| | | |
| | | <delete id="deleteMaterialLog" > |
| | | delete from mm.material_log where operation_order_number=#{materialOutboundId} |
| | | </delete> |
| | | |
| | | <delete id="deleteReturningWarehouseDetail" > |
| | | delete from mm.returning_warehouse_detail where returning_id=#{returningId} |
| | | </delete> |
| | | |
| | | <delete id="deleteReturningWarehouse" > |
| | | delete from mm.returning_warehouse where returning_id=#{returningId} |
| | | </delete> |
| | | |
| | | <select id="getMaximum" > |
| | |
| | | <update id="updateMaterialInventory" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity}, |
| | | available_quantity=available_quantity+#{materialInventory.inventoryQuantity}, |
| | | total_area=total_area+#{totalArea} |
| | | total_area=single_piece_area*inventory_quantity |
| | | where material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryNull" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity}, |
| | | available_quantity=available_quantity+#{materialInventory.inventoryQuantity}, |
| | | total_area=single_piece_area*inventory_quantity |
| | | where material_code=#{materialCode} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryReturning" > |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | total_area=total_area+#{totalArea} |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity} |
| | | where material_code=#{materialCode} and |
| | | date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture} |
| | | |
| | |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryReturningNull" > |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | total_area=total_area+#{totalArea} |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity} |
| | | where material_code=#{materialCode} and |
| | | date_of_manufacture is null |
| | | |